CiderClient
public struct CiderClient
A client for submitting requests to the Apple Music API.
-
Default
UrlFetcherA
URLSessionwith the defaultURLSessionConfigurationDeclaration
Swift
public static var defaultURLFetcher: UrlFetcher
-
Initialize a
CiderClientDeclaration
Swift
public init(storefront: Storefront, developerToken: String, urlFetcher: UrlFetcher = CiderClient.defaultURLFetcher)Parameters
storefrontThe
Storefrontto submit requests to.developerTokenThe Apple Music developer token to use in requests.
urlFetcherThe
UrlFetcherto use for processing requests. Defaults to aURLSessionwith the defaultURLSessionConfiguration.
-
Search the Apple Music catalog.
Declaration
Swift
public func search(term: String, limit: Int? = nil, offset: Int? = nil, types: [MediaType]? = nil, completion: ((SearchResults?, Error?) -> Void)?)Parameters
termThe term to search for.
limitThe amount of results to return.
offsetThe offset to use for paginating results.
typesThe
MediaTypes to limit the search to.completionThe completion handler to call with the results of the search.
-
Get hints for search terms to use searching the Apple Music catalog.
Declaration
Swift
public func searchHints(term: String, limit: Int? = nil, types: [MediaType]? = nil, completion: ((SearchHints?, Error?) -> Void)?)Parameters
termThe term to search for.
limitThe amount of results to return.
typesThe
MediaTypes to limit the search to.completionThe completion handler to call with the results of the search hints.
-
Lookup an artist by id.
Declaration
Swift
public func artist(id: String, include: [Include]? = nil, completion: ((Artist?, Error?) -> Void)?)Parameters
idThe id of the artist to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Lookup an album by id.
Declaration
Swift
public func album(id: String, include: [Include]? = nil, completion: ((Album?, Error?) -> Void)?)Parameters
idThe id of the album to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Lookup a song by id.
Declaration
Swift
public func song(id: String, include: [Include]? = nil, completion: ((Track?, Error?) -> Void)?)Parameters
idThe id of the song to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Lookup a playlist by id.
Declaration
Swift
public func playlist(id: String, include: [Include]? = nil, completion: ((Playlist?, Error?) -> Void)?)Parameters
idThe id of the playlist to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Lookup a music video by id.
Declaration
Swift
public func musicVideo(id: String, include: [Include]? = nil, completion: ((MusicVideo?, Error?) -> Void)?)Parameters
idThe id of the music video to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Lookup a curator by id.
Declaration
Swift
public func curator(id: String, include: [Include]? = nil, completion: ((Curator?, Error?) -> Void)?)Parameters
idThe id of the curator to lookup.
includeThe relationships to include in the lookup.
completionThe handler to call with the results.
-
Get the related resources for a
Relationship.Declaration
Swift
public func get<T>(related: Relationship<T>, limit: Int? = nil, offset: Int? = nil, completion: (([T]?, Error?) -> Void)?)Parameters
relatedThe relationship to get.
limitThe maximum amount of results to return.
offsetThe offset to use for pagination.
completionThe handler to call with the results.
CiderClient Struct Reference