SPTYourMusic Class Reference
Inherits from | NSObject |
Declared in | SPTYourMusic.h |
Overview
This class provides helpers for using the your music features in the Spotify API.
API Docs: https://developer.spotify.com/web-api/browse-endpoints/
API Console: https://developer.spotify.com/web-api/console/user%20library/
Tasks
API Request Factories
-
+ createRequestForCurrentUsersSavedTracksWithAccessToken:error:
-
+ createRequestForSavingTracks:forUserWithAccessToken:error:
-
+ createRequestForCheckingIfSavedTracksContains:forUserWithAccessToken:error:
-
+ createRequestForRemovingTracksFromSaved:forUserWithAccessToken:error:
Convenience Methods
Class Methods
createRequestForCheckingIfSavedTracksContains:forUserWithAccessToken:error:
Create a request for checking whether the authenticated user’s Your Music library contains a set of tracks.
+ (NSURLRequest *)createRequestForCheckingIfSavedTracksContains:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURL
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-read
scope.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTYourMusic.h
createRequestForCurrentUsersSavedTracksWithAccessToken:error:
Create a request for getting the authenticated user’s Your Music library tracks
+ (NSURLRequest *)createRequestForCurrentUsersSavedTracksWithAccessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-read
scope.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTYourMusic.h
createRequestForRemovingTracksFromSaved:forUserWithAccessToken:error:
Create a request for removing a set of tracks from the authenticated user’s Your Music library.
+ (NSURLRequest *)createRequestForRemovingTracksFromSaved:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURL
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-modify
scope.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTYourMusic.h
createRequestForSavingTracks:forUserWithAccessToken:error:
Create a request for adding a set of tracks to the authenticated user’s Your Music library.
+ (NSURLRequest *)createRequestForSavingTracks:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken error:(NSError **)error
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURI
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-modify
scope.
- error
An optional pointer to an
NSError
that will receive the error code if operation failed.
Declared In
SPTYourMusic.h
removeTracksFromSaved:forUserWithAccessToken:callback:
Removes a set of tracks from the authenticated user’s Your Music Library.
+ (void)removeTracksFromSaved:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURL
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-modify
scope.
- block
The block to be called when the operation is complete, with the data set if success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTYourMusic.h
saveTracks:forUserWithAccessToken:callback:
Adds a set of tracks to the authenticated user’s Your Music Library.
+ (void)saveTracks:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURI
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-modify
scope.
- block
The block to be called when the operation is complete, with the data set if success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTYourMusic.h
savedTracksContains:forUserWithAccessToken:callback:
Checks whether the authenticated user’s Your Music Library contains a set of tracks.
+ (void)savedTracksContains:(NSArray *)tracks forUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- tracks
An array of
SPTTrack
,SPTPartialTrack
orNSURI
objects.
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-read
scope.
- block
The block to be called when the operation is complete, with the data set if success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTYourMusic.h
savedTracksForUserWithAccessToken:callback:
Gets the authenticated user’s Your Music Library tracks
+ (void)savedTracksForUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block
Parameters
- accessToken
An authenticated access token. Must be valid and authorized with the
user-library-read
scope.
- block
The block to be called when the operation is complete, with the data set if success, otherwise an error.
Discussion
This is a convenience method around the createRequest equivalent and the current SPTRequestHandlerProtocol
Declared In
SPTYourMusic.h