SPTUser Class Reference
| Inherits from | SPTJSONObjectBase : NSObject |
| Declared in | SPTUser.h |
Overview
This class represents a user on the Spotify service.
API Model: https://developer.spotify.com/web-api/object-model/#user-object-private
API Console: https://developer.spotify.com/web-api/console/user%20profiles/
Tasks
Properties
-
displayNameproperty -
canonicalUserNameproperty -
territoryproperty -
emailAddressproperty -
uriproperty -
sharingURLproperty -
imagesproperty -
smallestImageproperty -
largestImageproperty -
productproperty -
followerCountproperty
Request creation methods
-
+ createRequestForCurrentUserWithAccessToken:error: -
+ requestCurrentUserWithAccessToken:callback: -
+ requestUser:withAccessToken:callback:
Response parsing methods
Properties
canonicalUserName
The canonical user name of the user. Not necessarily appropriate for UI use.
@property (nonatomic, readonly, copy) NSString *canonicalUserNameDeclared In
SPTUser.hdisplayName
The full display name of the user.
@property (nonatomic, readonly, copy) NSString *displayNameDiscussion
Will be nil unless your session has been granted the
user-read-private scope.
Declared In
SPTUser.hemailAddress
The user’s email address.
@property (nonatomic, readonly, copy) NSString *emailAddressDiscussion
Will be nil unless your session has been granted the
user-read-email scope.
Declared In
SPTUser.hfollowerCount
The number of followers this user has.
@property (nonatomic, readonly) long followerCountDeclared In
SPTUser.himages
Returns a list of user images in various sizes, as SPTImage objects.
@property (nonatomic, readonly, copy) NSArray *imagesDiscussion
Will be nil unless your session has been granted the
user-read-private scope.
Declared In
SPTUser.hlargestImage
Convenience method that returns the largest available user image.
@property (nonatomic, readonly) SPTImage *largestImageDiscussion
Will be nil unless your session has been granted the
user-read-private scope.
Declared In
SPTUser.hproduct
The product of the user. For example, only Premium users can stream audio.
@property (nonatomic, readonly) SPTProduct productDiscussion
Will be SPTProductUnknown unless your session has been granted the
user-read-private scope.
Declared In
SPTUser.hsharingURL
The HTTP open.spotify.com URL of the user.
@property (nonatomic, readonly, copy) NSURL *sharingURLDeclared In
SPTUser.hsmallestImage
Convenience method that returns the smallest available user image.
@property (nonatomic, readonly) SPTImage *smallestImageDiscussion
Will be nil unless your session has been granted the
user-read-private scope.
Declared In
SPTUser.hClass Methods
createRequestForCurrentUserWithAccessToken:error:
Create a NSURLRequest for requesting the current user
+ (NSURLRequest *)createRequestForCurrentUserWithAccessToken:(NSString *)accessToken error:(NSError **)errorParameters
- accessToken
An authenticated access token. Must be valid and authorized.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Discussion
See: https://developer.spotify.com/web-api/console/get-current-user/
Declared In
SPTUser.hrequestCurrentUserWithAccessToken:callback:
Request current user
+ (void)requestCurrentUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- accessToken
An authenticated access token. Must be valid and authorized.
- 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
See: https://developer.spotify.com/web-api/console/get-current-user/
Declared In
SPTUser.hrequestUser:withAccessToken:callback:
Request a user profile
+ (void)requestUser:(NSString *)username withAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)blockParameters
- username
The username of the user to request
- accessToken
An authenticated access token that must be valid and authorized.
- 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
See: https://developer.spotify.com/web-api/console/get-users-profile/
Declared In
SPTUser.huserFromData:withResponse:error:
Convert a HTTP response into a SPTUser object
+ (instancetype)userFromData:(NSData *)data withResponse:(NSURLResponse *)response error:(NSError **)errorParameters
- data
The response body
- response
The response headers
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Discussion
See: https://developer.spotify.com/web-api/object-model/#user-object-private and https://developer.spotify.com/web-api/object-model/#user-object-public
Declared In
SPTUser.huserFromDecodedJSON:error:
Convert a decoded response into a SPTUser object
+ (instancetype)userFromDecodedJSON:(id)decodedObject error:(NSError **)errorParameters
- decodedObject
The decoded JSON object structure.
- error
An optional pointer to an
NSErrorthat will receive the error code if operation failed.
Discussion
See: https://developer.spotify.com/web-api/object-model/#user-object-private and https://developer.spotify.com/web-api/object-model/#user-object-public
Declared In
SPTUser.h