SPTBrowse Class Reference
Inherits from | NSObject |
Declared in | SPTBrowse.h |
Overview
This class provides helpers for using the browse features in the Spotify API
API Docs: https://developer.spotify.com/web-api/browse-endpoints/
API Console: https://developer.spotify.com/web-api/console/browse/
Tasks
API Request Factories
-
+ createRequestForFeaturedPlaylistsInCountry:limit:offset:locale:timestamp:accessToken:error:
-
+ createRequestForNewReleasesInCountry:limit:offset:accessToken:error:
API Response Parsers
Convenience methods
Class Methods
createRequestForFeaturedPlaylistsInCountry:limit:offset:locale:timestamp:accessToken:error:
Get a list of featured playlists
+ (NSURLRequest *)createRequestForFeaturedPlaylistsInCountry:(NSString *)country limit:(NSInteger)limit offset:(NSInteger)offset locale:(NSString *)locale timestamp:(NSDate *)timestamp accessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- country
A ISO 3166-1 country code to get playlists for, or
nil
to get global recommendations.
- limit
The number of results to return, max 50.
- offset
The index at which to start returning results.
- locale
The locale of the user, for localized recommendations,
nil
will default to American English.
- timestamp
The time of day to get recommendations for (without timezone), or
nil
for current local time
- accessToken
An authenticated access token. Must be valid and authorized.
- error
An optional error value, will be set if the creation of the request failed.
Return Value
The request
Discussion
Parse the response into an SPTFeaturedPlaylistList
using SPTFeaturedPlaylistList
playlistListFromData:withResponse:error
See https://developer.spotify.com/web-api/get-list-featured-playlists/ for more information on parameters
Declared In
SPTBrowse.h
createRequestForNewReleasesInCountry:limit:offset:accessToken:error:
Get a list of new releases.
+ (NSURLRequest *)createRequestForNewReleasesInCountry:(NSString *)country limit:(NSInteger)limit offset:(NSInteger)offset accessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- country
A ISO 3166-1 country code to get releases for, or
nil
for global releases.
- limit
The number of results to return, max 50.
- offset
The index at which to start returning results.
- accessToken
An authenticated access token. Must be valid and authorized.
- error
An optional error value, will be set if the creation of the request failed.
Discussion
Parse the response into an SPTListPage
of SPTAlbum
’s using SPTListPage
listPageFromData:withResponse:error
See https://developer.spotify.com/web-api/get-list-new-releases/ for more information on parameters
Declared In
SPTBrowse.h
newReleasesFromData:withResponse:error:
Parse the response from createRequestForNewReleasesInCountry into a list of new releases
+ (SPTListPage *)newReleasesFromData:(NSData *)data withResponse:(NSURLResponse *)response error:(NSError **)error
Parameters
- data
The API response data
- response
The API response object
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Return Value
The list of new releases as an SPTListPage
object
Declared In
SPTBrowse.h
requestFeaturedPlaylistsForCountry:limit:offset:locale:timestamp:accessToken:accessTokenType:callback:
Get a list of featured playlists
+ (void)requestFeaturedPlaylistsForCountry:(NSString *)country limit:(NSInteger)limit offset:(NSInteger)offset locale:(NSString *)locale timestamp:(NSDate *)timestamp accessToken:(NSString *)accessToken accessTokenType:(NSString *)accessTokenType callback:(SPTRequestCallback)block
Parameters
- country
A ISO 3166-1 country code to get playlists for, or
nil
to get global recommendations.
- limit
The number of results to return, max 50.
- offset
The index at which to start returning results.
- locale
The locale of the user, for localized recommendations,
nil
will default to American English.
- timestamp
The time of day to get recommendations for (without timezone), or
nil
for current local time
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-modify
scope.
- accessTokenType
The string that describes how the access token may be used. Should always be equal to “Bearer”.
- block
The block to be called when the operation is complete, containing a
SPTFeaturedPlaylistList
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
See https://developer.spotify.com/web-api/get-list-featured-playlists/ for more information on parameters
Declared In
SPTBrowse.h
requestNewReleasesForCountry:limit:offset:accessToken:callback:
Get a list of new releases.
+ (void)requestNewReleasesForCountry:(NSString *)country limit:(NSInteger)limit offset:(NSInteger)offset accessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- country
A ISO 3166-1 country code to get releases for, or
nil
for global releases.
- limit
The number of results to return, max 50.
- offset
The index at which to start returning results.
- accessToken
An authenticated access token. Must be valid and authorized.
- block
The block to be called when the operation is complete, containing a
SPTListPage
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
See https://developer.spotify.com/web-api/get-list-new-releases/ for more information on parameters
Declared In
SPTBrowse.h