SPTArtist Class Reference
| Inherits from | SPTPartialArtist : SPTJSONObjectBase : NSObject |
| Conforms to | SPTJSONObject |
| Declared in | SPTArtist.h |
Overview
This class represents an artist on the Spotify service.
API Docs: https://developer.spotify.com/web-api/get-artist/
API Console: https://developer.spotify.com/web-api/console/get-artist
API Model: https://developer.spotify.com/web-api/object-model/#artist-object-full
Tasks
Properties
-
externalIdsproperty -
genresproperty -
imagesproperty -
smallestImageproperty -
largestImageproperty -
popularityproperty -
followerCountproperty
API Request Factories
-
+ createRequestForArtist:withAccessToken:error: -
+ createRequestForArtists:withAccessToken:error: -
+ createRequestForAlbumsByArtist:ofType:withAccessToken:market:error: -
+ createRequestForTopTracksForArtist:withAccessToken:market:error: -
+ createRequestForArtistsRelatedTo:withAccessToken:error:
API Response Parsers
-
+ artistFromData:withResponse:error: -
+ artistFromDecodedJSON:error: -
+ artistsFromData:withResponse:error: -
+ artistsFromDecodedJSON:error:
Convenience Methods
-
+ artistWithURI:accessToken:callback: -
+ artistsWithURIs:accessToken:callback: -
– requestAlbumsOfType:withAccessToken:availableInTerritory:callback: -
– requestTopTracksForTerritory:withAccessToken:callback: -
– requestRelatedArtistsWithAccessToken:callback:
Miscellaneous
Properties
externalIds
Any external IDs of the track, such as the ISRC code.
@property (nonatomic, readonly, copy) NSDictionary *externalIdsDeclared In
SPTArtist.hfollowerCount
The number of followers this artist has.
@property (nonatomic, readonly) long followerCountDeclared In
SPTArtist.hgenres
Returns a list of genre strings for the artist.
@property (nonatomic, readonly, copy) NSArray *genresDeclared In
SPTArtist.himages
Returns a list of artist images in various sizes, as SPTImage objects.
@property (nonatomic, readonly, copy) NSArray *imagesDeclared In
SPTArtist.hlargestImage
Convenience method that returns the largest available artist image.
@property (nonatomic, readonly) SPTImage *largestImageDeclared In
SPTArtist.hClass Methods
artistFromData:withResponse:error:
Parse an API response into an SPTArtist object.
+ (instancetype)artistFromData:(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
SPTArtist.hartistFromDecodedJSON:error:
Parse an JSON object structure into an array of SPTAlbum object.
+ (instancetype)artistFromDecodedJSON:(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
SPTArtist.hartistWithURI:accessToken:callback:
Request the artist at the given Spotify URI.
+ (void)artistWithURI:(NSURL *)uri accessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- uri
The Spotify URI of the artist to request.
- accessToken
An access token.
- block
The block to be called when the operation is complete. The block will pass a Spotify SDK metadata object on success, otherwise an error.
Discussion
This is a convenience method on top of the createRequestForArtist:withAccessToken:error: and SPTRequest performRequest:callback:
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTArtist.hartistsFromData:withResponse:error:
Parse an API response into an array of SPTArtist objects.
+ (NSArray *)artistsFromData:(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
SPTArtist.hartistsFromDecodedJSON:error:
Parse an JSON object structure into an array of SPTAlbum object.
+ (NSArray *)artistsFromDecodedJSON:(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
SPTArtist.hartistsWithURIs:accessToken:callback:
Request multiple artists given an array of Spotify URIs.
+ (void)artistsWithURIs:(NSArray *)uris accessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- uris
An array of Spotify URIs.
- accessToken
An access token.
- block
The block to be called when the operation is complete. The block will pass an array of
SPTArtistobjects on success, otherwise an error.
Discussion
This is a convenience method on top of the createRequestForArtists:withAccessToken:error: and SPTRequest performRequest:callback:
Note: This method takes an array Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTArtist.hcreateRequestForAlbumsByArtist:ofType:withAccessToken:market:error:
Request the artist’s albums.
+ (NSURLRequest *)createRequestForAlbumsByArtist:(NSURL *)artist ofType:(SPTAlbumType)type withAccessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)errorParameters
- artist
The Spotify URI of the artist.
- type
The type of albums to get.
- accessToken
An access token.
- market
An ISO 3166 country code of the territory to get albums for, or
nil.
- error
An optional
NSErrorthat will be set if an error occured.
Discussion
The territory parameter of this method can be nil to specify “any country”, but expect a lot of
duplicates as the Spotify catalog often has different albums for each country. Pair this with an
SPTUser’s territory property for best results.
Declared In
SPTArtist.hcreateRequestForArtist:withAccessToken:error:
Create a request for fetching an artist
+ (NSURLRequest *)createRequestForArtist:(NSURL *)uri withAccessToken:(NSString *)accessToken error:(NSError **)errorParameters
- uri
The Spotify URI of the artist to request.
- accessToken
An access token.
- error
An optional
NSErrorthat will be set if an error occured.
Return Value
A NSURLRequest for requesting the album
Discussion
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTArtist.hcreateRequestForArtists:withAccessToken:error:
Create a request for fetching a multiple artists
+ (NSURLRequest *)createRequestForArtists:(NSArray *)uris withAccessToken:(NSString *)accessToken error:(NSError **)errorParameters
- uris
An array of Spotify URIs.
- accessToken
An access token.
- error
An optional
NSErrorthat will be set if an error occured.
Return Value
A NSURLRequest for requesting the albums
Discussion
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTArtist.hcreateRequestForArtistsRelatedTo:withAccessToken:error:
Request the artist’s related artists.
+ (NSURLRequest *)createRequestForArtistsRelatedTo:(NSURL *)artist withAccessToken:(NSString *)accessToken error:(NSError **)errorParameters
- artist
The Spotify URI of the artist.
- accessToken
An access token.
- error
An optional
NSErrorthat will be set if an error occured.
Declared In
SPTArtist.hcreateRequestForTopTracksForArtist:withAccessToken:market:error:
Request the artist’s top tracks.
+ (NSURLRequest *)createRequestForTopTracksForArtist:(NSURL *)artist withAccessToken:(NSString *)accessToken market:(NSString *)market error:(NSError **)errorParameters
- artist
The Spotify URI of the artist.
- accessToken
An access token.
- market
An ISO 3166 country code of the territory to get top tracks for.
- error
An optional
NSErrorthat will be set if an error occured.
Discussion
The territory parameter of this method is required. Pair this with an
SPTUser’s territory property for best results.
Declared In
SPTArtist.hidentifierFromURI:
Get the identifier part of an Spotify Artist URI.
+ (NSString *)identifierFromURI:(NSURL *)uriParameters
- uri
The Spotify URI to check.
Return Value
The identifier part of the artist URI.
Discussion
Note: This method takes Spotify URIs in the form spotify:*, NOT HTTP URLs.
Declared In
SPTArtist.hInstance Methods
requestAlbumsOfType:withAccessToken:availableInTerritory:callback:
Request the artist’s albums.
- (void)requestAlbumsOfType:(SPTAlbumType)type withAccessToken:(NSString *)accessToken availableInTerritory:(NSString *)territory callback:(SPTRequestCallback)blockParameters
- type
The type of albums to get.
- accessToken
An access token.
- territory
An ISO 3166 country code of the territory to get albums for, or
nil.
- block
The block to be called when the operation is complete. The block will pass an
SPTListPageobject on success, otherwise an error.
Discussion
The territory parameter of this method can be nil to specify “any country”, but expect a lot of
duplicates as the Spotify catalog often has different albums for each country. Pair this with an
SPTUser’s territory property for best results.
Declared In
SPTArtist.hrequestRelatedArtistsWithAccessToken:callback:
Request the artist’s related artists.
- (void)requestRelatedArtistsWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- accessToken
An access token.
- block
The block to be called when the operation is complete. The block will pass an
NSArrayobject containingSPTArtists on success, otherwise an error.
Declared In
SPTArtist.hrequestTopTracksForTerritory:withAccessToken:callback:
Request the artist’s top tracks.
- (void)requestTopTracksForTerritory:(NSString *)territory withAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- territory
An ISO 3166 country code of the territory to get top tracks for.
- accessToken
An access token.
- block
The block to be called when the operation is complete. The block will pass an
NSArrayobject containingSPTTracks on success, otherwise an error.
Discussion
The territory parameter of this method is required. Pair this with an
SPTUser’s territory property for best results.
Declared In
SPTArtist.h