Skip to content

Commit

Permalink
Added remaining API methods
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Nicolae <nicolaeanatoli@gmail.com>
  • Loading branch information
anatolinicolae committed Feb 1, 2018
1 parent 7731235 commit 8582ea3
Showing 1 changed file with 143 additions and 1 deletion.
144 changes: 143 additions & 1 deletion src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,150 @@ protected function makeRequest($path = '', $args = null)
return $request->getBody();
}

public function getCategories($site)
/**
* Catalog endpoints
**/

public function getCollection($site, $args)
{
return $this->makeRequest('/v3/market/catalog/collection', $args);
}

public function getItem($site, $args)
{
return $this->makeRequest('/v3/market/catalog/item', $args);
}

public function searchItems($site, $args)
{
return $this->makeRequest('/v1/discovery/search/search/item', $args);
}

public function searchComments($site, $args)
{
return $this->makeRequest('/v1/discovery/search/search/comment', $args);
}

public function getPopularItems($site, $args)
{
return $this->makeRequest("/v1/market/popular:$site.json", $args);
}

public function getCategories($site, $args)
{
return $this->makeRequest("/v1/market/categories:$site.json");
}

public function getItemPrices($site, $args)
{
return $this->makeRequest("/v1/market/item-prices:$site.json");
}

public function getNewItems($site, $category, $args)
{
return $this->makeRequest("/v1/market/new-files:$site,$category.json");
}

public function getFeaturedItems($site, $args)
{
return $this->makeRequest("/v1/market/new-files:$site.json");
}

public function getRandomNewFiles($site, $args)
{
return $this->makeRequest("/v1/market/random-new-files:$site.json");
}

/**
* User details
**/

public function getUserCollections($args)
{
return $this->makeRequest('/v3/market/user/collections');
}

public function getPrivateCollection($args)
{
return $this->makeRequest('/v3/market/user/collection');
}

public function getUsersDetails($username, $args)
{
return $this->makeRequest("/v1/market/user:$username.json");
}

public function getUsersBadges($username, $args)
{
return $this->makeRequest("/v1/market/user-badges:$username.json");
}

public function getUsersItems($username, $args)
{
return $this->makeRequest("/v1/market/user-items-by-site:$username.json");
}

public function getUsersNewItems($username, $site, $args)
{
return $this->makeRequest("/v1/market/new-files-from-user:$username,$site.json");
}

/**
* Private user details
**/

public function getSales($args)
{
return $this->makeRequest('/v3/market/author/sales');
}

public function getSaleByCode($args)
{
return $this->makeRequest('/v3/market/author/sale');
}

public function getPurchases($args)
{
return $this->makeRequest('/v3/market/buyer/list-purchases');
}

public function getPurchaseByCode($args)
{
return $this->makeRequest('/v3/market/buyer/purchase');
}

public function getPrivateUserDetails($args)
{
return $this->makeRequest('/v1/market/private/user/account.json');
}

public function getUsername($args)
{
return $this->makeRequest('/v1/market/private/user/username.json');
}

public function getEmail($args)
{
return $this->makeRequest('/v1/market/private/user/email.json');
}

public function getSalesByMonth($args)
{
return $this->makeRequest('/v1/market/private/user/earnings-and-sales-by-month.json');
}

public function getTotalMarketUsers($args)
{
return $this->makeRequest('/v1/market/total-users.json');
}

public function getTotalMarketItems($args)
{
return $this->makeRequest('/v1/market/total-items.json');
}

public function getTotalFilesBySite($site, $args)
{
return $this->makeRequest("/v1/market/number-of-files:$site.json");
}
}

0 comments on commit 8582ea3

Please sign in to comment.