SPTAlbum Class Reference
| Inherits from | SPTPartialAlbum : SPTJSONObjectBase : NSObject |
| Conforms to | SPTJSONObject SPTTrackProvider |
| Declared in | SPTAlbum.h |
Overview
This class represents an album on the Spotify service.
API Docs: https://developer.spotify.com/web-api/get-album/
API Console: https://developer.spotify.com/web-api/console/albums/
API Model: https://developer.spotify.com/web-api/object-model/#album-object-full
Example usage:
[SPTAlbum albumWithURI:[NSURL URLWithString:@"spotify:album:58Dbqi6VBskSmnSsbXbgrs"]
accessToken:accessToken
market:@"UK"
callback:^(NSError *error, id object) {
if (error != nil) { handle error }
NSLog(@"Got album %@", object);
}];
Tasks
Properties
-
externalIdsproperty -
artistsproperty -
firstTrackPageproperty -
releaseYearproperty -
releaseDateproperty -
genresproperty -
popularityproperty
API Request Factories
-
+ createRequestForAlbum:withAccessToken:market:error: -
+ createRequestForAlbums:withAccessToken:market:error:
API Response Parsers
Convenience Methods
Miscellaneous
Properties
artists
An array of artists for this album, as SPTPartialArtist objects.
@property (nonatomic, readonly) NSArray *artistsDeclared In
SPTAlbum.hexternalIds
Any external IDs of the album, such as the UPC code.
@property (nonatomic, readonly, copy) NSDictionary *externalIdsDeclared In
SPTAlbum.hfirstTrackPage
The tracks contained by this album, as a page of SPTPartialTrack objects.
@property (nonatomic, readonly) SPTListPage *firstTrackPageDeclared In
SPTAlbum.hgenres
Returns a list of genre strings for the album.
@property (nonatomic, readonly, copy) NSArray *genresDeclared In
SPTAlbum.hpopularity
The popularity of the album as a value between 0.0 (least popular) to 100.0 (most popular).
@property (nonatomic, readonly) double popularityDeclared In
SPTAlbum.hClass Methods
albumFromData:withResponse:error:
Parse an API Response into an SPTAlbum object.
+ (instancetype)albumFromData:(NSData *)data withResponse:(NSURLResponse *)response error:(NSError **)errorParameters
- data
The API response data
- response
The API response object
- error
An optional
NSErrorthat will be set if an error occured when parsing the data.
Return Value
an SPTAlbum object, or nil if the parsing failed.
Declared In
SPTAlbum.halbumFromDecodedJSON:error:
Parse an JSON object structure into an SPTAlbum object.
+ (instancetype)albumFromDecodedJSON:(id)decodedObject error:(NSError **)errorParameters
- decodedObject
The decoded JSON structure to parse.
- error
An optional
NSErrorthat will be set if an error occured when parsing the data.
Return Value
an SPTAlbum object, or nil if the parsing failed.
Declared In
SPTAlbum.halbumWithURI:accessToken:market:callback:
Request the album at the given Spotify URI.
+ (void)albumWithURI:(NSURL *)uri accessToken:(NSString *)accessToken market:(NSString *)market callback:(SPTRequestCallback)blockParameters
- uri
The Spotify URI of the album to request.
- accessToken
An access token.
- market
An optional market parameter. Can be
nil.
- block
The block to be called when the operation is complete. The block will pass a SPTAlbum object on success, otherwise an error.
Discussion
This is a convenience method on top of the [SPTAlbum createRequestForAlbum:withAccessToken:market:error:] and the shared SPTRequest handler.
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTAlbum.halbumsFromDecodedJSON:error:
Parse an JSON object structure into an array of SPTAlbum object.
+ (NSArray *)albumsFromDecodedJSON:(id)decodedObject error:(NSError **)errorParameters
- decodedObject
The decoded JSON structure to parse.
- error
An optional
NSErrorthat will be set if an error occured when parsing the data.
Return Value
an SPTAlbum object, or nil if the parsing failed.
Declared In
SPTAlbum.halbumsWithURIs:accessToken:market:callback:
Request multiple albums given an array of Spotify URIs.
+ (void)albumsWithURIs:(NSArray *)uris accessToken:(NSString *)accessToken market:(NSString *)market callback:(SPTRequestCallback)blockParameters
- uris
An array of Spotify URIs.
- accessToken
An access token.
- market
An optional market parameter. Can be
nil.
- block
The block to be called when the operation is complete. The block will pass an array of SPTAlbum objects on success, otherwise an error.
Discussion
This is a convenience method on top of the [SPTAlbum createRequestForAlbums:withAccessToken:market:error:] and the shared SPTRequest handler.
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTAlbum.hcreateRequestForAlbum:withAccessToken:market:error:
Create a request for getting an album.
+ (NSURLRequest *)createRequestForAlbum:(NSURL *)uri withAccessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)errorParameters
- uri
The Spotify URI of the album to request.
- accessToken
An access token.
- market
An optional market parameter. Can be
nil.
- error
An optional
NSErrorthat will be set if an error occured.
Return Value
A NSURLRequest for requesting the album
Discussion
API Docs: https://developer.spotify.com/web-api/get-album/
Try it: https://developer.spotify.com/web-api/console/get-album/
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTAlbum.hcreateRequestForAlbums:withAccessToken:market:error:
Create a request for getting multiple albums.
+ (NSURLRequest *)createRequestForAlbums:(NSArray *)uris withAccessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)errorParameters
- uris
An array of Spotify URIs. A maxiumum of 20 URIs can be supplied per request.
- accessToken
An access token.
- market
An optional market parameter. Can be
nil.
- error
An optional
NSErrorthat will be set if an error occured.
Return Value
A NSURLRequest for requesting the albums
Discussion
API Docs: https://developer.spotify.com/web-api/get-several-albums/
Try it: https://developer.spotify.com/web-api/console/get-several-albums/
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTAlbum.h