Skip to content

Commit

Permalink
Add more API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Radt committed Dec 20, 2018
1 parent 1d88e00 commit bddc21e
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion src/AppleMusicAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,36 @@ public function setMusicUserToken($musicUserToken)
$this->client->setMusicUserToken($musicUserToken);
}

/**
* Fetch a single storefront by using its identifier.
* https://developer.apple.com/documentation/applemusicapi/get_a_storefront
*
* @param string $id The identifier (an ISO 3166 alpha-2 country code) for the storefront you want to fetch.
*
* @return object
*
* @throws AppleMusicAPIException
*/
public function getStorefront($id)
{
$requestUrl = sprintf('storefronts/%s', $id);

return $this->client->apiRequest('GET', $requestUrl);
}

/**
* Fetch all the storefronts in alphabetical order.
* https://developer.apple.com/documentation/applemusicapi/get_all_storefronts
*
* @return object
*
* @throws AppleMusicAPIException
*/
public function getAllStorefronts()
{
return $this->client->apiRequest('GET', 'storefronts');
}

/**
* Fetch one or more charts from the Apple Music Catalog.
* https://developer.apple.com/documentation/applemusicapi/get_catalog_charts
Expand Down Expand Up @@ -143,10 +173,28 @@ public function getCatalogArtist($storefront, $artistId)
return $this->client->apiRequest('GET', $requestUrl);
}

/**
* Fetch a curator by using the curator's identifier.
* https://developer.apple.com/documentation/applemusicapi/get_a_catalog_curator
*
* @param string $storefront An iTunes Store territory, specified by an ISO 3166 alpha-2 country code.
* @param string $curatorId The unique identifier for the curator.
*
* @return object
*
* @throws AppleMusicAPIException
*/
public function getCatalogCurator($storefront, $curatorId)
{
$requestUrl = sprintf('catalog/%s/curators/%s', $storefront, $curatorId);

return $this->client->apiRequest('GET', $requestUrl);
}

/**
* Fetch a user’s storefront.
* https://developer.apple.com/documentation/applemusicapi/get_a_user_s_storefront
* *
*
* @return object
*
* @throws AppleMusicAPIException
Expand Down

0 comments on commit bddc21e

Please sign in to comment.