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/

Properties

canonicalUserName

The canonical user name of the user. Not necessarily appropriate for UI use.

@property (nonatomic, readonly, copy) NSString *canonicalUserName

Declared In

SPTUser.h

displayName

The full display name of the user.

@property (nonatomic, readonly, copy) NSString *displayName

Discussion

Will be nil unless your session has been granted the user-read-private scope.

Declared In

SPTUser.h

emailAddress

The user’s email address.

@property (nonatomic, readonly, copy) NSString *emailAddress

Discussion

Will be nil unless your session has been granted the user-read-email scope.

Declared In

SPTUser.h

followerCount

The number of followers this user has.

@property (nonatomic, readonly) long followerCount

Declared In

SPTUser.h

images

Returns a list of user images in various sizes, as SPTImage objects.

@property (nonatomic, readonly, copy) NSArray *images

Discussion

Will be nil unless your session has been granted the user-read-private scope.

Declared In

SPTUser.h

largestImage

Convenience method that returns the largest available user image.

@property (nonatomic, readonly) SPTImage *largestImage

Discussion

Will be nil unless your session has been granted the user-read-private scope.

Declared In

SPTUser.h

product

The product of the user. For example, only Premium users can stream audio.

@property (nonatomic, readonly) SPTProduct product

Discussion

Will be SPTProductUnknown unless your session has been granted the user-read-private scope.

Declared In

SPTUser.h

sharingURL

The HTTP open.spotify.com URL of the user.

@property (nonatomic, readonly, copy) NSURL *sharingURL

Declared In

SPTUser.h

smallestImage

Convenience method that returns the smallest available user image.

@property (nonatomic, readonly) SPTImage *smallestImage

Discussion

Will be nil unless your session has been granted the user-read-private scope.

Declared In

SPTUser.h

territory

An ISO 3166 country code of the user’s account.

@property (nonatomic, readonly, copy) NSString *territory

Declared In

SPTUser.h

uri

The Spotify URI of the user.

@property (nonatomic, readonly, copy) NSURL *uri

Declared In

SPTUser.h

Class Methods

createRequestForCurrentUserWithAccessToken:error:

Create a NSURLRequest for requesting the current user

+ (NSURLRequest *)createRequestForCurrentUserWithAccessToken:(NSString *)accessToken error:(NSError **)error

Parameters

accessToken

An authenticated access token. Must be valid and authorized.

error

An optional pointer to an NSError that will receive the error code if operation failed.

Declared In

SPTUser.h

requestCurrentUserWithAccessToken:callback:

Request current user

+ (void)requestCurrentUserWithAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block

Parameters

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.

Declared In

SPTUser.h

requestUser:withAccessToken:callback:

Request a user profile

+ (void)requestUser:(NSString *)username withAccessToken:(NSString *)accessToken callback:(SPTRequestCallback)block

Parameters

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.

Declared In

SPTUser.h

userFromData:withResponse:error:

Convert a HTTP response into a SPTUser object

+ (instancetype)userFromData:(NSData *)data withResponse:(NSURLResponse *)response error:(NSError **)error

Parameters

data

The response body

response

The response headers

error

An optional pointer to an NSError that will receive the error code if operation failed.

Declared In

SPTUser.h

userFromDecodedJSON:error:

Convert a decoded response into a SPTUser object

+ (instancetype)userFromDecodedJSON:(id)decodedObject error:(NSError **)error

Parameters

decodedObject

The decoded JSON object structure.

error

An optional pointer to an NSError that will receive the error code if operation failed.

Declared In

SPTUser.h