HummingKitRequestFactory

public class HummingKitRequestFactory

Undocumented

  • Initilazation of HummingKitRequestFactory object.

    Declaration

    Swift

    public init(developerToken: DeveloperToken, userToken: UserToken)

    Parameters

    developerToken

    Developer Token provided by the developer who use this package, required for authentication.

    userToken

    User Token fetched by device when app runs for the first time, required for authentication

Get a User’s Storefront

  • Generates “Fetch a User’s Storefront” URL request

    Declaration

    Swift

    public func createGetUserStorefrontRequest() -> URLRequest

Get a Storefront

  • Generates “Fetch a single storefront by using its identifier” URL request

    Declaration

    Swift

    public func createGetAStorefrontRequest(storefrontID: String) -> URLRequest

    Parameters

    storefrontID

    The identifier (an ISO 3166 alpha-2 country code) for the storefront you want to fetch.

Get Multiple Storefronts

  • Generates “Fetch one or more storefronts by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleStorefrontsRequest(storefrontIDs: [String]) -> URLRequest

    Parameters

    storefrontIDs

    An array of the identifiers (ISO 3166 alpha-2 country codes) for the storefronts you want to fetch.

Get All Storefronts

  • Generates “Fetch all the storefronts in alphabetical order” URL request

    Declaration

    Swift

    public func createGetAllStorefrontsRequest() -> URLRequest

Add a Resource to a Library

  • 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]) -> URLRequest

    Parameters

    playlistsIDs

    an array of unique catalog identifiers for targeted playlists

    albumsIDs

    an array of unique catalog identifiers for targeted albums

    songsIDs

    an array of unique catalog identifiers for targeted songs

    musicVideosIDs

    an 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

Get a Catalog Album

  • Generates “Fetch an album by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogAlbumRequest(storefront: String, albumID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    albumID

    The unique identifier for the album.

Get Multiple Catalog Albums

  • Generates “Fetch one or more albums by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogAlbumsRequest(storefront: String, albumIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    albumIDs

    The unique identifiers for the albums. The maximum fetch limit is 100.

Get a Catalog Album’s Relationship Directly by Name

  • Generates “Fetch an album’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogAlbumRelationshipRequest(storefront: String, albumID: String, relationship: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    albumID

    The unique identifier for the album.

    relationship

    The name of the relationship you want to fetch for this resource.

Get a Library Album

  • Generates “Fetch a library album by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryAlbumRequest(albumID: String) -> URLRequest

    Parameters

    albumID

    The unique identifier for the album.

Get a Library Album’s Relationship Directly by Name

  • Generates “Fetch an album’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryAlbumRelationshipRequest(albumID: String, relationship: String) -> URLRequest

    Parameters

    albumID

    The unique identifier for the album.

    relationship

    The name of the relationship you want to fetch for this resource.

Get Multiple Library Albums

  • Generates “Fetch one or more library albums by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleLibraryAlbumsRequest(albumIDs: [String]) throws -> URLRequest

    Parameters

    albumIDs

    The unique identifiers for the albums. The maximum fetch limit is 100.

Get All Library Albums

  • 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 -> URLRequest

    Parameters

    limit

    The maximum limit count of library albums to be expected in response, default to 25, maximum at 100.

    offset

    The offset for resources of current request (Pagination), default to 0.

    Return Value

    The “Fetch all the library albums in alphabetical order” URL request.

Get a Catalog Artist

  • Generates “Fetch an artist by using the artist’s identifier” URL request

    Declaration

    Swift

    public func createGetACatalogArtistRequest(storefront: String, artistID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    artistID

    The unique identifier for the artist.

Get Multiple Catalog Artists

  • Generates “Fetch one or more artists by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogArtistsRequest(storefront: String, artistIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    artistIDs

    The unique identifiers for the artists. The maximum fetch limit is 25.

Get a Catalog Artist’s Relationship Directly by Name

  • 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) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    artistID

    The unique identifier for the artist.

    relationship

    The name of the relationship you want to fetch for this resource.

Get a Library Artist

  • Generates “Fetch a library artist by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryArtistRequest(artistID: String) -> URLRequest

    Parameters

    artistID

    The unique identifier for the artist.

Get All Library Artists

  • 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 -> URLRequest

    Parameters

    limit

    The maximum limit count of library artists to be expected in response, default to 25, maximum at 100.

    offset

    The offset for resources of current request (Pagination), default to 0.

    Return Value

    The “Fetch all the library artists in alphabetical order” URL request

Get Multiple Library Artists

  • Generates “Fetch one or more library artists by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleLibraryArtistsRequest(artistIDs: [String]) throws -> URLRequest

    Parameters

    artistIDs

    The unique identifiers for the albums. The maximum fetch limit is 25.

Get a Library Artist’s Relationship Directly by Name

  • Generates “Fetch a library artist’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryArtistRelationshipRequest(artistID: String, relationship: String) -> URLRequest

    Parameters

    artistID

    The unique identifier for the artist.

    relationship

    The name of the relationship you want to fetch for this resource.

Get a Catalog Song

  • Generates “Fetch a song by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogSongRequest(storefront: String, songID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    songID

    The unique identifier for the song.

Get Multiple Catalog Songs by ID

  • Generates “Fetch one or more songs by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogSongsRequest(storefront: String, songIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    songIDs

    An array of catalogIDs for targeted catalog songs. The maximum fetch limit is 300.

Get a Catalog Song’s Relationship Directly by Name

  • 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) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    songID

    The unique identifier for the song.

    relationship

    The name of the relationship you want to fetch for this resource.

Get a Library Song

  • Generates “Fetch a library song by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibrarySongRequest(songID: String) -> URLRequest

    Parameters

    songID

    The unique identifier for the song.

Get All Library Songs

  • 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 -> URLRequest

    Parameters

    limit

    The maximum limit count of library songs to be expected in response, default to 25, maximum at 100.

    offset

    The offset for resources of current request (Pagination), default to 0.

    Return Value

    The “Fetch all the library songs in alphabetical order” URL request.

Get Multiple Library Songs

  • Generates “Fetch one or more library songs by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleLibrarySongsRequest(songIDs: [String]) throws -> URLRequest

    Parameters

    songIDs

    An array of catalogIDs for targeted catalog songs. The maximum fetch limit is 300.

Get a Library Song’s Relationship Directly by Name

  • Generates “Fetch a library song’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibrarySongRelationshipRequest(songID: String, relationship: String) -> URLRequest

    Parameters

    songID

    The unique identifier for the song.

    relationship

    The name of the relationship you want to fetch for this resource.

Get a Catalog MV

  • Generates “Fetch a music video by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogMVRequest(storefront: String, mvID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    mvID

    The unique identifier for the mv.

Get a Catalog MV’s Relationship Directly by Name

  • Generates “Fetch a music video’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogMVRelationshipRequest(storefront: String, mvID: String, relationship: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    mvID

    The unique identifier for the mv.

    relationship

    The name of the relationship you want to fetch for this resource.

Get Multiple Catalog MVs by ID

  • Generates “Fetch one or more music videos by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogMVsRequest(storefront: String, mvIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    mvIDs

    An array of catalogIDs for targeted catalog mvs. The maximum fetch limit is 100.

Get a Library MV

  • Generates “Fetch a library music video by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryMVRequest(mvID: String) -> URLRequest

    Parameters

    mvID

    The unique identifier for the mv.

Get a Library MV’s Relationship Directly by Name

  • Generates “Fetch a library music video’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryMVRelationshipRequest(mvID: String, relationship: String) -> URLRequest

    Parameters

    mvID

    The unique identifier for the mv.

    relationship

    The name of the relationship you want to fetch for this resource.

Get Multiple Library MVs

  • Generates “Fetch one or more library music videos by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleLibraryMVsRequest(mvIDs: [String]) throws -> URLRequest

    Parameters

    mvIDs

    The unique identifiers for the mvs. The maximum fetch limit is 100.

Get All Library MVs

  • 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 -> URLRequest

    Parameters

    limit

    The maximum limit count of library music videos to be expected in response, default to 25, maximum at 100.

    offset

    The offset for resources of current request (Pagination), default to 0.

    Return Value

    The “Fetch all the library music videos in alphabetical order” URL request.

Get a Catalog Playlist

  • Generates “Fetch a playlist by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogPlaylistRequest(storefront: String, playlistID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    playlistID

    The unique identifier for the playlist.

Get a Catalog Playlist’s Relationship Directly by Name

  • Generates “Fetch a playlist’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogPlaylistRelationshipRequest(storefront: String, playlistID: String, relationship: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    playlistID

    The unique identifier for the playlist.

    relationship

    The name of the relationship you want to fetch for this resource.

Get Multiple Catalog Playlists

  • Generates “Fetch one or more playlists by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogPlaylistsRequest(storefront: String, playlistIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    playlistIDs

    An array of catalogIDs for targeted catalog playlists. The maximum fetch limit is 25.

Get a Library Playlist

  • Generates “Fetch a library playlist by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryPlaylistRequest(playlistID: String) -> URLRequest

    Parameters

    playlistID

    The unique identifier for the playlist.

Get a Library Playlist’s Relationship Directly by Name

  • Generates “Fetch a library playlist’s relationship by using its identifier” URL request

    Declaration

    Swift

    public func createGetALibraryPlaylistRelationshipRequest(playlistID: String, relationship: String) -> URLRequest

    Parameters

    playlistID

    The unique identifier for the playlist.

    relationship

    The name of the relationship you want to fetch for this resource.

Get Multiple Library Playlists

  • Generates “Fetch one or more library music videos by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleLibraryPlaylistsRequest(playlistIDs: [String]) throws -> URLRequest

    Parameters

    playlistIDs

    An array of catalogIDs for targeted catalog playlists. The maximum fetch limit is 25.

Get All Library Playlists

  • 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 -> URLRequest

    Parameters

    limit

    The maximum limit count of library playlists to be expected in response, default to 25, maximum at 100.

    offset

    The offset for resources of current request (Pagination), default to 0.

    Return Value

    The “Fetch all the library playlists in alphabetical order” URL request.

Create a New Library Playlist

  • Generates “Create a new playlist in a user’s library” URL request

    Declaration

    Swift

    public func createCreateANewLibraryPlaylistRequest(name: String, description: String, songsIDs: [String]) -> URLRequest

    Parameters

    name

    The name of playlist to be created.

    description

    The description of the playlist to be created.

    songsIDs

    An 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]) -> URLRequest

    Parameters

    playlistID

    The unique identifier for the playlist.

    songIDs

    An array of identifiers of songs to be added to playlist.

Get a Catalog Station

  • Generates “Fetch a station by using its identifier” URL request

    Declaration

    Swift

    public func createGetACatalogStationRequest(storefront: String, stationID: String) -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    stationID

    The unique identifier for the station.

Get Multiple Catalog Stations

  • Generates “Fetch one or more stations by using their identifiers” URL request

    Declaration

    Swift

    public func createGetMultipleCatalogStationsRequest(storefront: String, stationIDs: [String]) throws -> URLRequest

    Parameters

    storefront

    An identifier (ISO 3166 alpha-2 country codes) of the storefront you want to perform this request in.

    stationIDs

    An array of catalogIDs for targeted catalog stations. The maximum fetch limit is 100.

Not Revised

  • Function for generating “Search for Catalog Resources” URL request

    Declaration

    Swift

    public func createSearchRequest(storefront: String, term: String) -> URLRequest

    Parameters

    storefront

    the expected Apple Music storefront for request to happen, usually the same as user’s Apple Music account storefront

    term

    the 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() -> URLRequest

    Return Value

    the URL request for fetching the recently played resources for the user