HummingKitRequestFactory
public class HummingKitRequestFactory
Undocumented
-
Initilazation of HummingKitRequestFactory object.
Declaration
Swift
public init(developerToken: DeveloperToken, userToken: UserToken)Parameters
developerTokenDeveloper Token provided by the developer who use this package, required for authentication.
userTokenUser Token fetched by device when app runs for the first time, required for authentication
-
Generates “Fetch a User’s Storefront” URL request
Declaration
Swift
public func createGetUserStorefrontRequest() -> URLRequest
-
Generates “Fetch a single storefront by using its identifier” URL request
Declaration
Swift
public func createGetAStorefrontRequest(storefrontID: String) -> URLRequestParameters
storefrontIDThe identifier (an ISO 3166 alpha-2 country code) for the storefront you want to fetch.
-
Generates “Fetch one or more storefronts by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleStorefrontsRequest(storefrontIDs: [String]) -> URLRequestParameters
storefrontIDsAn array of the identifiers (ISO 3166 alpha-2 country codes) for the storefronts you want to fetch.
-
Generates “Fetch all the storefronts in alphabetical order” URL request
Declaration
Swift
public func createGetAllStorefrontsRequest() -> URLRequest
-
Generates “Add a catalog resource to a user’s iCloud Music Library” URL request
Declaration
Swift
public func createAddResourcesToLibraryRequest(playlistsIDs: [String], albumsIDs: [String], songsIDs: [String], musicVideosIDs: [String]) -> URLRequestParameters
playlistsIDsan array of unique catalog identifiers for targeted playlists
albumsIDsan array of unique catalog identifiers for targeted albums
songsIDsan array of unique catalog identifiers for targeted songs
musicVideosIDsan array of unique catalog identifiers for targeted music videos
Return Value
the URL request for adding catalog resources to a user’s iCloud Music Library
-
Generates “Fetch an album by using its identifier” URL request
Declaration
Swift
public func createGetACatalogAlbumRequest(storefront: String, albumID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
albumIDThe unique identifier for the album.
-
Generates “Fetch one or more albums by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogAlbumsRequest(storefront: String, albumIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
albumIDsThe unique identifiers for the albums. The maximum fetch limit is 100.
-
Generates “Fetch an album’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetACatalogAlbumRelationshipRequest(storefront: String, albumID: String, relationship: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
albumIDThe unique identifier for the album.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch a library album by using its identifier” URL request
Declaration
Swift
public func createGetALibraryAlbumRequest(albumID: String) -> URLRequestParameters
albumIDThe unique identifier for the album.
-
Generates “Fetch an album’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetALibraryAlbumRelationshipRequest(albumID: String, relationship: String) -> URLRequestParameters
albumIDThe unique identifier for the album.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch one or more library albums by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleLibraryAlbumsRequest(albumIDs: [String]) throws -> URLRequestParameters
albumIDsThe unique identifiers for the albums. The maximum fetch limit is 100.
-
Generates “Fetch all the library albums in alphabetical order” URL request
Throws
HummingKitRequestComposingError.invalidArgument if arguments contain cahracters other than digits, or .exceedMaxFetchLimit if limit is set to above 100.Declaration
Swift
public func createGetAllLibraryAlbumsRequest(limit: String = "25", offset: String = "0") throws -> URLRequestParameters
limitThe maximum limit count of library albums to be expected in response, default to 25, maximum at 100.
offsetThe offset for resources of current request (Pagination), default to 0.
Return Value
The “Fetch all the library albums in alphabetical order” URL request.
-
Generates “Fetch an artist by using the artist’s identifier” URL request
Declaration
Swift
public func createGetACatalogArtistRequest(storefront: String, artistID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
artistIDThe unique identifier for the artist.
-
Generates “Fetch one or more artists by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogArtistsRequest(storefront: String, artistIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
artistIDsThe unique identifiers for the artists. The maximum fetch limit is 25.
-
Generates “Fetch an artist’s relationship by using the artist’s identifier” URL request
Declaration
Swift
public func createGetACatalogArtistRelationshipRequest(storefront: String, artistID: String, relationship: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
artistIDThe unique identifier for the artist.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch a library artist by using its identifier” URL request
Declaration
Swift
public func createGetALibraryArtistRequest(artistID: String) -> URLRequestParameters
artistIDThe unique identifier for the artist.
-
Generates “Fetch all the library artists in alphabetical order” URL request
Throws
HummingKitRequestComposingError.invalidArgument if arguments contain cahracters other than digits, or .exceedMaxFetchLimit if limit is set to above 100.Declaration
Swift
public func createGetAllLibraryArtistsRequest(limit: String = "25", offset: String = "0") throws -> URLRequestParameters
limitThe maximum limit count of library artists to be expected in response, default to 25, maximum at 100.
offsetThe offset for resources of current request (Pagination), default to 0.
Return Value
The “Fetch all the library artists in alphabetical order” URL request
-
Generates “Fetch one or more library artists by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleLibraryArtistsRequest(artistIDs: [String]) throws -> URLRequestParameters
artistIDsThe unique identifiers for the albums. The maximum fetch limit is 25.
-
Generates “Fetch a library artist’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetALibraryArtistRelationshipRequest(artistID: String, relationship: String) -> URLRequestParameters
artistIDThe unique identifier for the artist.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch a song by using its identifier” URL request
Declaration
Swift
public func createGetACatalogSongRequest(storefront: String, songID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
songIDThe unique identifier for the song.
-
Generates “Fetch one or more songs by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogSongsRequest(storefront: String, songIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
songIDsAn array of catalogIDs for targeted catalog songs. The maximum fetch limit is 300.
-
Generates “Fetch an song’s relationship by using the song’s identifier” URL request
Declaration
Swift
public func createGetACatalogSongRelationshipRequest(storefront: String, songID: String, relationship: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
songIDThe unique identifier for the song.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch a library song by using its identifier” URL request
Declaration
Swift
public func createGetALibrarySongRequest(songID: String) -> URLRequestParameters
songIDThe unique identifier for the song.
-
Generates “Fetch all the library songs in alphabetical order” URL request.
Throws
HummingKitRequestComposingError.invalidArgument if arguments contain cahracters other than digits, or .exceedMaxFetchLimit if limit is set to above 100.Declaration
Swift
public func createGetAllLibrarySongsRequest(limit: String = "25", offset: String = "0") throws -> URLRequestParameters
limitThe maximum limit count of library songs to be expected in response, default to 25, maximum at 100.
offsetThe offset for resources of current request (Pagination), default to 0.
Return Value
The “Fetch all the library songs in alphabetical order” URL request.
-
Generates “Fetch one or more library songs by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleLibrarySongsRequest(songIDs: [String]) throws -> URLRequestParameters
songIDsAn array of catalogIDs for targeted catalog songs. The maximum fetch limit is 300.
-
Generates “Fetch a library song’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetALibrarySongRelationshipRequest(songID: String, relationship: String) -> URLRequestParameters
songIDThe unique identifier for the song.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch a music video by using its identifier” URL request
Declaration
Swift
public func createGetACatalogMVRequest(storefront: String, mvID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
mvIDThe unique identifier for the mv.
-
Generates “Fetch a music video’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetACatalogMVRelationshipRequest(storefront: String, mvID: String, relationship: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
mvIDThe unique identifier for the mv.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch one or more music videos by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogMVsRequest(storefront: String, mvIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
mvIDsAn array of catalogIDs for targeted catalog mvs. The maximum fetch limit is 100.
-
Generates “Fetch a library music video by using its identifier” URL request
Declaration
Swift
public func createGetALibraryMVRequest(mvID: String) -> URLRequestParameters
mvIDThe unique identifier for the mv.
-
Generates “Fetch a library music video’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetALibraryMVRelationshipRequest(mvID: String, relationship: String) -> URLRequestParameters
mvIDThe unique identifier for the mv.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch one or more library music videos by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleLibraryMVsRequest(mvIDs: [String]) throws -> URLRequestParameters
mvIDsThe unique identifiers for the mvs. The maximum fetch limit is 100.
-
Generates “Fetch all the library music videos in alphabetical order” URL request.
Throws
HummingKitRequestComposingError.invalidArgument if arguments contain cahracters other than digits, or .exceedMaxFetchLimit if limit is set to above 100.Declaration
Swift
public func createGetAllLibraryMVsRequest(limit: String = "25", offset: String = "0") throws -> URLRequestParameters
limitThe maximum limit count of library music videos to be expected in response, default to 25, maximum at 100.
offsetThe offset for resources of current request (Pagination), default to 0.
Return Value
The “Fetch all the library music videos in alphabetical order” URL request.
-
Generates “Fetch a playlist by using its identifier” URL request
Declaration
Swift
public func createGetACatalogPlaylistRequest(storefront: String, playlistID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
playlistIDThe unique identifier for the playlist.
-
Generates “Fetch a playlist’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetACatalogPlaylistRelationshipRequest(storefront: String, playlistID: String, relationship: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
playlistIDThe unique identifier for the playlist.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch one or more playlists by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogPlaylistsRequest(storefront: String, playlistIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
playlistIDsAn array of catalogIDs for targeted catalog playlists. The maximum fetch limit is 25.
-
Generates “Fetch a library playlist by using its identifier” URL request
Declaration
Swift
public func createGetALibraryPlaylistRequest(playlistID: String) -> URLRequestParameters
playlistIDThe unique identifier for the playlist.
-
Generates “Fetch a library playlist’s relationship by using its identifier” URL request
Declaration
Swift
public func createGetALibraryPlaylistRelationshipRequest(playlistID: String, relationship: String) -> URLRequestParameters
playlistIDThe unique identifier for the playlist.
relationshipThe name of the relationship you want to fetch for this resource.
-
Generates “Fetch one or more library music videos by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleLibraryPlaylistsRequest(playlistIDs: [String]) throws -> URLRequestParameters
playlistIDsAn array of catalogIDs for targeted catalog playlists. The maximum fetch limit is 25.
-
Generates “Fetch all the library playlists in alphabetical order” URL request.
Throws
HummingKitRequestComposingError.invalidArgument if arguments contain cahracters other than digits, or .exceedMaxFetchLimit if limit is set to above 100.Declaration
Swift
public func createGetAllLibraryPlaylistsRequest(limit: String = "25", offset: String = "0") throws -> URLRequestParameters
limitThe maximum limit count of library playlists to be expected in response, default to 25, maximum at 100.
offsetThe offset for resources of current request (Pagination), default to 0.
Return Value
The “Fetch all the library playlists in alphabetical order” URL request.
-
Generates “Create a new playlist in a user’s library” URL request
Declaration
Swift
public func createCreateANewLibraryPlaylistRequest(name: String, description: String, songsIDs: [String]) -> URLRequestParameters
nameThe name of playlist to be created.
descriptionThe description of the playlist to be created.
songsIDsAn array of identifiers of songs in the new playlist.
-
Generates “Add Tracks to a Library Playlist” URL request
Declaration
Swift
public func createAddTracksToAPlaylistRequest(playlistID: String, songsIDs: [String]) -> URLRequestParameters
playlistIDThe unique identifier for the playlist.
songIDsAn array of identifiers of songs to be added to playlist.
-
Generates “Fetch a station by using its identifier” URL request
Declaration
Swift
public func createGetACatalogStationRequest(storefront: String, stationID: String) -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
stationIDThe unique identifier for the station.
-
Generates “Fetch one or more stations by using their identifiers” URL request
Declaration
Swift
public func createGetMultipleCatalogStationsRequest(storefront: String, stationIDs: [String]) throws -> URLRequestParameters
storefrontAn identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.
stationIDsAn array of catalogIDs for targeted catalog stations. The maximum fetch limit is 100.
-
Function for generating “Search for Catalog Resources” URL request
Declaration
Swift
public func createSearchRequest(storefront: String, term: String) -> URLRequestParameters
storefrontthe expected Apple Music storefront for request to happen, usually the same as user’s Apple Music account storefront
termthe user entered text for search, “ ” -> “+” character replacement is handled
Return Value
the URL request for searching catalog resources(by using a query) from Apple Music server
-
Function for generating “Get Recently Played Resources” URL request
Declaration
Swift
public func createGetRecentlyPlayedRequest() -> URLRequestReturn Value
the URL request for fetching the recently played resources for the user
HummingKitRequestFactory Class Reference