HummingKit
public class HummingKit
Main entry class of HummingKit framework
-
Initializer of HummingKit()
Declaration
Swift
public init(developerToken: String, userToken: String)Parameters
developerTokenApple Music Developer Token fetched beforehand using developer key issued by developer.apple.com
userTokenApple Music User Token fetched on user-end device using Apple Music Developer Token
-
Function to customize maximum time of retrying an segmental fetching request within an expensive request.
Declaration
Swift
public func setMaximumRequestRetryCount(_ retryCount: Int)Parameters
retryCountThe upper limit of time of retrying.
-
Fetch user’s Apple Music account default storefront information.
Declaration
Swift
public func fetchUserStorefront(completion: @escaping (_ result: Swift.Result<Storefront, Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(Storefront) or .failure(Error)
-
Fetch a storefront from Apple Music server using its identifier.
Declaration
Swift
public func fetchAStorefront(storefrontID: String, completion: @escaping (_ result: Swift.Result<Storefront, Error>) -> Void)Parameters
storefrontIDThe identifier (an ISO 3166 alpha-2 country code) of the storefront to be fetched.
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(Storefront) or .failure(Error)
-
Fetch an array of storefronts from Apple Music server using their identifiers.
Declaration
Swift
public func fetchMultipleStorefronts(storefrontIDs: [String], completion: @escaping (_ result: Swift.Result<[Storefront], Error>) -> Void)Parameters
storefrontIDsAn array of the identifiers (ISO 3166 alpha-2 country codes) of the storefronts to be fetched.
completionCompletion handler of request result of type Swift.Result<[Storefront], Error>
resultResult of request, .success([Storefront]) or .failure(Error)
-
Fetch all storefronts available from Apple Music server all at once.
Declaration
Swift
public func fetchAllStorefronts(completion: @escaping (_ result: Swift.Result<[Storefront], Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<[Storefront], Error>
resultResult of request, .success([Storefront]) or .failure(Error)
-
Add resources (playlists, albums, songs, MVs) to user library.
Declaration
Swift
public func addResourcesToLibrary(playlistsIDs: [String], albumsIDs: [String], songsIDs: [String], musicVideosIDs: [String], completion: @escaping (_ result: Swift.Result<String, Error>) -> Void)Parameters
playlistsIDsAn array of unique catalog identifiers of playlists to be added to user library
albumsIDsAn array of unique catalog identifiers of albums to be added to user library
songsIDsAn array of unique catalog identifiers of songs to be added to user library
musicVideosIDsAn array of unique catalog identifiers of music videos to be added to user library
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(status) or .failure(Error)
-
Fetch a catalog album using its identifier.
Declaration
Swift
public func fetchACatalogAlbum(storefront: String, albumID: String, completion: @escaping (_ result: Swift.Result<CatalogAlbum, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
albumIDThe unique identifier of the album
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogAlbum) or .failure(Error)
-
Fetch multiple catalog albums using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogAlbums(storefront: String, albumIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogAlbum], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
albumIDsAn array of the identifiers of the albums. Maximum fetch limit is 100.
completionCompletion handler of request result of type Swift.Result<[CatalogAlbum], Error>
resultResult of request, .success([CatalogAlbum]) or .failure(Error)
-
Fetch the relationship of specified catalog album using its identifier and relationship tag.
Declaration
Swift
public func fetchACatalogAlbumRelationship(storefront: String, albumID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
albumIDThe unique identifier of the album
relationshipThe name tag of the relationship to fetch for this catalog album
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch a library album using its identifier.
Declaration
Swift
public func fetchALibraryAlbum(albumID: String, completion: @escaping (_ result: Swift.Result<LibraryAlbum, Error>) -> Void)Parameters
albumIDThe unique identifier of the album
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(LibraryAlbum) or .failure(Error)
-
Fetch the relationship of specified library album using its identifier and relationship tag.
Declaration
Swift
public func fetchALibraryAlbumRelationship(albumID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
albumIDThe unique identifier of the album
relationshipThe name tag of the relationship to fetch for this library album
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple library albums using their identifiers.
Declaration
Swift
public func fetchMultipleLibraryAlbums(albumIDs: [String], completion: @escaping (_ result: Swift.Result<[LibraryAlbum], Error>) -> Void)Parameters
albumIDsAn array of the identifiers of albums. Maximum fetch limit is 100.
completionCompletion handler of request result of type Swift.Result<[LibraryAlbum], Error>
resultResult of request, .success([LibraryAlbum]) or .failure(Error)
-
Fetch all library albums by segments.
Declaration
Swift
public func fetchAllLibraryAlbums(completion: @escaping (_ result: Swift.Result<([LibraryAlbum], FetchingStatus), Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<([LibraryAlbum], FetchingStatus), Error>
resultResult of request, .success([LibraryAlbum], FetchingStatus) or .failure(Error)
-
Fetch a catalog artist using their identifier.
Declaration
Swift
public func fetchACatalogArtist(storefront: String, artistID: String, completion: @escaping (_ result: Swift.Result<CatalogArtist, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
artistIDThe unique identifier of the artist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogArtist) or .failure(Error)
-
Fetch multiple catalog artists using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogArtists(storefront: String, artistIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogArtist], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
artistIDsThe unique identifiers of the artists. Maximum fetch limit is 25.
completionCompletion handler of request result of type Swift.Result<[CatalogArtist], Error>
resultResult of request, .success([CatalogArtist]) or .failure(Error)
-
Fetch the relationship of specified catalog artist using its identifier and relationship tag.
Declaration
Swift
public func fetchACatalogArtistRelationship(storefront: String, artistID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
artistIDThe unique identifier of the artist
relationshipThe name tag of the relationship to fetch for this catalog artist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch a library artist using their identifier.
Declaration
Swift
public func fetchALibraryArtist(artistID: String, completion: @escaping (_ result: Swift.Result<LibraryArtist, Error>) -> Void)Parameters
artistIDThe unique identifier of the artist.
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(LibraryArtist) or .failure(Error)
-
Fetch the relationship of specified library artist using its identifier and relationship tag.
Declaration
Swift
public func fetchALibraryArtistRelationship(artistID: String, relationship: String, completion: @escaping (Swift.Result<JSON, Error>) -> Void)Parameters
artistIDThe unique identifier of the artist.
relationshipThe name tag of the relationship to fetch for this library artist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple library artists using their identifiers.
Declaration
Swift
public func fetchMultipleLibraryArtists(artistIDs: [String], completion: @escaping (Swift.Result<[LibraryArtist], Error>) -> Void)Parameters
artistIDsThe unique identifiers of the artists. Maximum fetch limit is 25.
completionCompletion handler of request result of type Swift.Result<[LibraryArtist], Error>
resultResult of request, .success([LibraryArtist]) or .failure(Error)
-
Fetch all library artists by segments.
Declaration
Swift
public func fetchAllLibraryArtists(completion: @escaping (_ result: Swift.Result<([LibraryArtist], FetchingStatus), Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<([LibraryArtist], FetchingStatus), Error>
resultResult of request, .success([LibraryArtist], FetchingStatus) or .failure(Error)
-
Fetch a catalog song using its identifier
Declaration
Swift
public func fetchACatalogSong(storefront: String, songID: String, completion: @escaping (_ result: Swift.Result<CatalogSong, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
songIDThe unique identifier of the song.
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogSong) or .failure(Error)
-
Fetch multiple catalog songs using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogSongs(storefront: String, songIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogSong], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
songIDsAn array of the identifiers of the albums. Maximum fetch limit is 300.
completionCompletion handler of request result of type Swift.Result<[CatalogSong], Error>
resultResult of request, .success([CatalogSong]) or .failure(Error)
-
Fetch the relationship of specified catalog song using its identifier and relationship tag.
Declaration
Swift
public func fetchACatalogSongRelationship(storefront: String, songID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
songIDThe unique identifier of the song
relationshipThe name tag of the relationship to fetch for this catalog song
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch a library song using its identifier.
Declaration
Swift
public func fetchALibrarySong(songID: String, completion: @escaping (_ result: Swift.Result<LibrarySong, Error>) -> Void)Parameters
songIDThe unique identifier of the song
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(LibrarySong) or .failure(Error)
-
Fetch the relationship of specified library song using its identifier and relationship tag.
Declaration
Swift
public func fetchALibrarySongRelationship(songID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
songIDThe unique identifier of the song
relationshipThe name tag of the relationship to fetch for this library song
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple library songs using their identifiers.
Declaration
Swift
public func fetchMultipleLibrarySongs(songIDs: [String], completion: @escaping (_ result: Swift.Result<[LibrarySong], Error>) -> Void)Parameters
songIDsAn array of the identifiers of library songs. Maximum fetch limit is 300.
completionCompletion handler of request result of type Swift.Result<[LibrarySong], Error>
resultResult of request, .success([LibrarySong]) or .failure(Error)
-
Fetch all library songs by segments.
Declaration
Swift
public func fetchAllLibrarySongs(completion: @escaping (_ result: Swift.Result<([LibrarySong], FetchingStatus), Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<([LibrarySong], FetchingStatus), Error>
resultResult of request, .success([LibrarySong], FetchingStatus) or .failure(Error)
-
Fetch a catalog music video using its identifier.
Declaration
Swift
public func fetchACatalogMV(storefront: String, mvID: String, completion: @escaping (_ result: Swift.Result<CatalogMV, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
mvIDThe unique identifier of the music video
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogMV) or .failure(Error)
-
Fetch the relationship of specified catalog music video using its identifier and relationship tag.
Declaration
Swift
public func fetchACatalogMVRelationship(storefront: String, mvID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefrontwhich to perform request in
mvIDThe unique identifier of the music video
relationshipThe name tag of the relationship to fetch for this catalog music video
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple catalog music videos using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogMVs(storefront: String, mvIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogMV], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
mvIDsAn array of the identifiers of the music videos. Maximum fetch limit is 100.
completionCompletion handler of request result of type Swift.Result<[CatalogMV], Error>
resultResult of request, .success([CatalogMV]) or .failure(Error)
-
Fetch a library music video using its identifier.
Declaration
Swift
public func fetchALibraryMV(mvID: String, completion: @escaping (_ result: Swift.Result<LibraryMV, Error>) -> Void)Parameters
mvIDThe unique identifier of the music video
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(LibraryMV) or .failure(Error)
-
Fetch the relationship of specified library music video using its identifier and relationship tag.
Declaration
Swift
public func fetchALibraryMVRelationship(mvID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
mvIDThe unique identifier of the music video
relationshipThe name tag of the relationship to fetch for this library music video
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple library music videos using their identifiers.
Declaration
Swift
public func fetchMultipleLibraryMVs(mvIDs: [String], completion: @escaping (_ result: Swift.Result<[LibraryMV], Error>) -> Void)Parameters
mvIDsAn array of the identifiers of music videos. Maximum fetch limit is 100.
completionCompletion handler of request result of type Swift.Result<[LibraryMV], Error>
resultResult of request, .success([LibraryMV]) or .failure(Error)
-
Fetch all library music videos by segments.
Declaration
Swift
public func fetchAllLibraryMVs(completion: @escaping (_ result: Swift.Result<([LibraryMV], FetchingStatus), Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<([LibraryMV], FetchingStatus), Error>
resultResult of request, .success([LibraryMV], FetchingStatus) or .failure(Error)
-
Fetch a catalog playlist using its identifier
Declaration
Swift
public func fetchACatalogPlaylist(storefront: String, playlistID: String, completion: @escaping (_ result: Swift.Result<CatalogPlaylist, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
playlistIDThe unique identifier of the playlist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogPlaylist) or .failure(Error)
-
Fetch the relationship of specified catalog album using its identifier and relationship tag.
Declaration
Swift
public func fetchACatalogPlaylistRelationship(storefront: String, playlistID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
playlistIDThe unique identifier of the playlist
relationshipThe name tag of the relationship to fetch for this catalog playlist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple catalog playlists using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogPlaylists(storefront: String, playlistIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogPlaylist], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
playlistIDsAn array of the identifiers of playlists. Maximum fetch limit is 25.
completionCompletion handler of request result of type Swift.Result<[CatalogPlaylist], Error>
resultResult of request, .success([CatalogPlaylist]) or .failure(Error)
-
Fetch a library playlist using its identifier
Declaration
Swift
public func fetchALibraryPlaylist(playlistID: String, completion: @escaping (_ result: Swift.Result<LibraryPlaylist, Error>) -> Void)Parameters
playlistIDThe unique identifier of the playlist.
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(LibraryPlaylist) or .failure(Error)
-
Fetch the relationship of specified library playlist using its identifier and relationship tag.
Declaration
Swift
public func fetchALibraryPlaylistRelationship(playlistID: String, relationship: String, completion: @escaping (_ result: Swift.Result<JSON, Error>) -> Void)Parameters
playlistIDThe unique identifier of the playlist
relationshipThe name tag of the relationship to fetch for this library playlist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(JSON) or .failure(Error)
-
Fetch multiple library playlists using their identifiers.
Declaration
Swift
public func fetchMultipleLibraryPlaylists(storefront: String, playlistIDs: [String], completion: @escaping (_ result: Swift.Result<[LibraryPlaylist], Error>) -> Void)Parameters
playlistIDsAn array of the identifiers of playlists. Maximum fetch limit is 25.
completionCompletion handler of request result of type Swift.Result<[LibraryPlaylist], Error>
resultResult of request, .success([LibraryPlaylist]) or .failure(Error)
-
Fetch all library playlists by segments.
Declaration
Swift
public func fetchAllLibraryPlaylists(completion: @escaping (_ result: Swift.Result<([LibraryPlaylist], FetchingStatus), Error>) -> Void)Parameters
completionCompletion handler of request result of type Swift.Result<([LibraryPlaylist], FetchingStatus), Error>
resultResult of request, .success([LibraryPlaylist], FetchingStatus) or .failure(Error)
-
Create a new library playlist.
Declaration
Swift
public func createAPlaylist(name: String, description: String?, songsIDs: [String], completion: @escaping (_ result: Swift.Result<String, Error>) -> Void)Parameters
nameThe name of playlist to be created
descriptionOptional. The description of the playlist to be created
songsIDsAn array of identifiers of songs to be contained in the playlist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(status) or .failure(Error)
-
Add songs to a library playlist owned by the user, using their identifiers
Declaration
Swift
public func addTracksToAPlaylist(playlistID: String, songsIDs: [String], completion: @escaping (_ result: Swift.Result<String, Error>) -> Void)Parameters
playlistIDThe unique identifier of the playlist
songsIDsAn array of identifiers of songs to be added to the playlist
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(status) or .failure(Error)
-
Fetch a catalog station using its identifier.
Declaration
Swift
public func fetchACatalogStation(storefront: String, stationID: String, completion: @escaping (_ result: Swift.Result<CatalogStation, Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
stationIDThe unique identifier of the station
completionCompletion handler of request result of type Swift.Result
resultResult of request, .success(CatalogStation) or .failure(Error)
-
Fetch multiple catalog stations using their identifiers.
Declaration
Swift
public func fetchMultipleCatalogStations(storefront: String, stationIDs: [String], completion: @escaping (_ result: Swift.Result<[CatalogStation], Error>) -> Void)Parameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront which to perform request in
stationIDsAn array of the identifiers of the stations. Maximum fetch limit is 100.
completionCompletion handler of request result of type Swift.Result<[CatalogStation], Error>
resultResult of request, .success([CatalogStation]) or .failure(Error)
HummingKit Class Reference