KKBOXOpenAPI
@interface KKBOXOpenAPI : NSObject
The class helps to access KKBOX’s Open API on Apple platforms such as iOS, macOS, watchOS and tvOS.
To start accessing KKBOX’s API, you need to register your self to obtain a valid client ID(API Key) and shared secret, then you can use your client ID and secret to initialize an instance of the class. To obtain a client ID, please visit https://developer.kkbox.com/.
-
Create a new KKBOXOpenAPI instance. (Default scope is all)
Declaration
Objective-C
- (nonnull instancetype)initWithClientID:(nonnull NSString *)clientID secret:(nonnull NSString *)secret;Swift
init(clientID: String, secret: String)Parameters
clientIDthe API key
secretthe API secret
Return Value
A KKBOXOpenAPI instance
-
Create a new KKBOXOpenAPI instance.
Declaration
Objective-C
- (nonnull instancetype)initWithClientID:(nonnull NSString *)clientID secret:(nonnull NSString *)secret scope:(KKScope)scope;Swift
init(clientID: String, secret: String, scope: KKScope)Parameters
clientIDthe API key
secretthe API secret
scopethe OAuth permission scope
Return Value
A KKBOXOpenAPI instance
-
Clear existing access token.
Declaration
Objective-C
- (void)logout;Swift
func logout() -
The current access token.
Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) KKAccessToken *accessToken;Swift
var accessToken: KKAccessToken? { get } -
If there is a valid access token.
Declaration
Objective-C
@property (readonly, assign, atomic) BOOL loggedIn;Swift
var loggedIn: Bool { get }
-
To start using KKBOx’s Open API, you need to log-in in to KKBOX at first. You can generate a client credential to fetch an access token to let KKBOX identify you. It allows you to access public data from KKBOX such as public albums, playlists and so on.
Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchAccessTokenByClientCredentialWithCallback: (nonnull KKBOXOpenAPILoginCallback)callback;Swift
func fetchAccessTokenByClientCredential(callback: @escaping KKBOXOpenAPILoginCallback) -> URLSessionDataTaskParameters
callbackthe callback block.
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the detailed information of a song track.
See
https://docs-en.kkbox.codes/v1.1/reference#tracks_track_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTrackWithTrackID:(nonnull NSString *)trackID territory:(KKTerritoryCode)territory callback:(nonnull void (^)(KKTrackInfo *_Nullable, NSError *_Nullable))callback;Swift
func fetchTrack(withTrackID trackID: String, territory: KKTerritoryCode, callback: @escaping (KKTrackInfo?, Error?) -> Void) -> URLSessionDataTaskParameters
trackIDthe ID of the song track
territorythe given territory. The displayed information of a song track may differ in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the information of a given album.
See
https://docs-en.kkbox.codes/v1.1/reference#albums_album_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchAlbumWithAlbumID:(nonnull NSString *)albumID territory:(KKTerritoryCode)territory callback:(nonnull void (^)(KKAlbumInfo *_Nullable, NSError *_Nullable))callback;Swift
func fetchAlbum(withAlbumID albumID: String, territory: KKTerritoryCode, callback: @escaping (KKAlbumInfo?, Error?) -> Void) -> URLSessionDataTaskParameters
albumIDthe given album ID
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the song tracks contained in a given album.
See
https://docs-en.kkbox.codes/v1.1/reference#albums_album_id_tracks.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTracksWithAlbumID:(nonnull NSString *)albumID territory:(KKTerritoryCode)territory callback:(nonnull void (^)(NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchTracks(withAlbumID albumID: String, territory: KKTerritoryCode, callback: @escaping ([KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
albumIDthe given album ID
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the detailed profile of an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchArtistInfoWithArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory callback:(nonnull void (^)(KKArtistInfo *_Nullable, NSError *_Nullable))callback;Swift
func fetchArtistInfo(withArtistID artistID: String, territory: KKTerritoryCode, callback: @escaping (KKArtistInfo?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The displayed information of an artist may differ in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the list of the albums belong to an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_albumsDeclaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchAlbumsBelongToArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory callback: (nonnull void (^)(NSArray<KKAlbumInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchAlbumsBelong(toArtistID artistID: String, territory: KKTerritoryCode, callback: @escaping ([KKAlbumInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The albums list may differ in different territories since KKBOX may not be licensed to distribute music content in all territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the list of the albums belong to an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_albumsDeclaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchAlbumsBelongToArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)(NSArray<KKAlbumInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchAlbumsBelong(toArtistID artistID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKAlbumInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The albums list may differ in different territories since KKBOX may not be licensed to distribute music content in all territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the top tracks of an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_top-tracks.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTopTracksWithArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory callback: (nonnull void (^)(NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchTopTracks(withArtistID artistID: String, territory: KKTerritoryCode, callback: @escaping ([KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The displayed information of an artist may differ in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the top tracks of an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_top-tracks.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTopTracksWithArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)(NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchTopTracks(withArtistID artistID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The displayed information of an artist may differ in different territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch related artists of an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_related-artists.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchRelatedArtistsWithArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKArtistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchRelatedArtists(withArtistID artistID: String, territory: KKTerritoryCode, callback: @escaping ([KKArtistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The displayed information of an artist may differ in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch related artists of an artist.
See
https://docs-en.kkbox.codes/v1.1/reference#artists_artist_id_related-artists.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchRelatedArtistsWithArtistID:(nonnull NSString *)artistID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( NSArray<KKArtistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchRelatedArtists(withArtistID artistID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKArtistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
artistIDthe ID of the artist
territorythe given territory. The displayed information of an artist may differ in different territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetches information and song tracks of a given playlist.
See
https://docs-en.kkbox.codes/v1.1/reference#shared-playlists_playlist_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchPlaylistWithPlaylistID:(nonnull NSString *)playlistID territory:(KKTerritoryCode)territory callback:(nonnull void (^)(KKPlaylistInfo *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchPlaylist(withPlaylistID playlistID: String, territory: KKTerritoryCode, callback: @escaping (KKPlaylistInfo?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
playlistIDthe given playlist ID.
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetches information and song tracks of a given playlist.
See
https://docs-en.kkbox.codes/v1.1/reference#shared-playlists_playlist_id_tracks.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTracksInPlaylistWithPlaylistID:(nonnull NSString *)playlistID territory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchTracksInPlaylist(withPlaylistID playlistID: String, territory: KKTerritoryCode, callback: @escaping ([KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
playlistIDthe given playlist ID.
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetches information and song tracks of a given playlist.
See
https://docs-en.kkbox.codes/v1.1/reference#shared-playlists_playlist_id_tracks.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchTracksInPlaylistWithPlaylistID:(nonnull NSString *)playlistID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchTracksInPlaylist(withPlaylistID playlistID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
playlistIDthe given playlist ID.
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch featured playlists.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlists. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistsForTerritory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylists(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch featured playlists.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlists. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistsForTerritory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylists(forTerritory territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch new hits playlists.
See
https://docs-en.kkbox.codes/v1.1/reference#new-hits-playlists. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewHitsPlaylistsForTerritory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewHitsPlaylists(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch new hits playlists.
See
https://docs-en.kkbox.codes/v1.1/reference#new-hits-playlists. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewHitsPlaylistsForTerritory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewHitsPlaylists(forTerritory territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch feature playlist categories.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlist-categories.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistCategoriesForTerritory:(KKTerritoryCode)territory callback: (nonnull void (^)( NSArray< KKFeaturedPlaylistCategory *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylistCategories(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKFeaturedPlaylistCategory]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch feature playlist categories.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlist-categories.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistCategoriesForTerritory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)( NSArray< KKFeaturedPlaylistCategory *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylistCategories(forTerritory territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKFeaturedPlaylistCategory]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the feature playlists contained in a given category. You can obtain the categories from the previous method.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlist-categories_category_id. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistsInCategory:(nonnull NSString *)category territory:(KKTerritoryCode)territory callback:(nonnull void (^)( KKFeaturedPlaylistCategory *_Nullable, NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylists(inCategory category: String, territory: KKTerritoryCode, callback: @escaping (KKFeaturedPlaylistCategory?, [KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
categorythe given category
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the feature playlists contained in a given category. You can obtain the categories from the previous method.
See
https://docs-en.kkbox.codes/v1.1/reference#featured-playlist-categories_category_id_playlists. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchFeaturedPlaylistsInCategory:(nonnull NSString *)category territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( KKFeaturedPlaylistCategory *_Nullable, NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchFeaturedPlaylists(inCategory category: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping (KKFeaturedPlaylistCategory?, [KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
categorythe given category
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch mood station categories.
See
https://docs-en.kkbox.codes/v1.1/reference#mood-stations.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchMoodStationsForTerritory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKRadioStation *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchMoodStations(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKRadioStation]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch mood stations under a specific radio category.
See
https://docs-en.kkbox.codes/v1.1/reference#mood-stations_station_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchMoodStationWithStationID:(nonnull NSString *)stationID territory:(KKTerritoryCode)territory callback:(nonnull void (^)( KKRadioStation *_Nullable, NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchMoodStation(withStationID stationID: String, territory: KKTerritoryCode, callback: @escaping (KKRadioStation?, [KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
stationIDthe station ID. You can obtain IDs from the previous method.
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch mood stations under a specific radio category.
See
https://docs-en.kkbox.codes/v1.1/reference#mood-stations_station_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchMoodStationWithStationID:(nonnull NSString *)stationID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( KKRadioStation *_Nullable, NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchMoodStation(withStationID stationID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping (KKRadioStation?, [KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
stationIDthe station ID. You can obtain IDs from the previous method.
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the list of genre radio station categories.
See
https://docs-en.kkbox.codes/v1.1/reference#genre-stations.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchGenreStationsForTerritory:(KKTerritoryCode)territory callback:(nonnull void (^)( NSArray<KKRadioStation *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchGenreStations(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKRadioStation]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch genre-based radio stations under a specific genre category.
See
https://docs-en.kkbox.codes/v1.1/reference#genre-stations_station_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchGenreStationWithStationID:(nonnull NSString *)stationID territory:(KKTerritoryCode)territory callback:(nonnull void (^)( KKRadioStation *_Nullable, NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchGenreStation(withStationID stationID: String, territory: KKTerritoryCode, callback: @escaping (KKRadioStation?, [KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
stationIDthe station ID. You can obtain the list categories from the previous method.
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch genre-based radio stations under a specific genre category.
See
https://docs-en.kkbox.codes/v1.1/reference#genre-stations_station_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchGenreStationWithStationID:(nonnull NSString *)stationID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)( KKRadioStation *_Nullable, NSArray<KKTrackInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchGenreStation(withStationID stationID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping (KKRadioStation?, [KKTrackInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
stationIDthe station ID. You can obtain the list categories from the previous method.
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Search within KKBOX’s archive.
See
https://docs-en.kkbox.codes/v1.1/reference#search_1.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) searchWithKeyword:(nonnull NSString *)keyword searchTypes:(KKSearchType)searchTypes territory:(KKTerritoryCode)territory callback:(nonnull void (^)(KKSearchResults *_Nullable, NSError *_Nullable))callback;Swift
func search(withKeyword keyword: String, searchTypes: KKSearchType, territory: KKTerritoryCode, callback: @escaping (KKSearchResults?, Error?) -> Void) -> URLSessionDataTaskParameters
keywordthe keyword
searchTypessearch for song tracks, albums, artists or playlists.
territorythe given territory
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Search within KKBOX’s archive.
See
https://docs-en.kkbox.codes/v1.1/reference#search.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) searchWithKeyword:(nonnull NSString *)keyword searchTypes:(KKSearchType)searchTypes territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback:(nonnull void (^)(KKSearchResults *_Nullable, NSError *_Nullable))callback;Swift
func search(withKeyword keyword: String, searchTypes: KKSearchType, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping (KKSearchResults?, Error?) -> Void) -> URLSessionDataTaskParameters
keywordthe keyword
searchTypessearch for song tracks, albums, artists or playlists.
territorythe given territory
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the categories of new released albums in a specific territory.
See
https://docs-en.kkbox.codes/v1.1/reference#new-release-categories.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewReleaseAlbumCategoriesForTerritory:(KKTerritoryCode)territory callback: (nonnull void (^)( NSArray<KKNewReleaseAlbumsCategory *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewReleaseAlbumCategories(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKNewReleaseAlbumsCategory]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory. KKBOX may provide different new released albums in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the categories of new released albums in a specific territory.
See
https://docs-en.kkbox.codes/v1.1/reference#new-release-categories.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewReleaseAlbumCategoriesForTerritory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)( NSArray<KKNewReleaseAlbumsCategory *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewReleaseAlbumCategories(forTerritory territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKNewReleaseAlbumsCategory]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory. KKBOX may provide different new released albums in different territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch new released albums in a specific category and territory.
See
https://docs-en.kkbox.codes/v1.1/reference#new-release-categories_category_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewReleaseAlbumsUnderCategory:(nonnull NSString *)categoryID territory:(KKTerritoryCode)territory callback: (nonnull void (^)( KKNewReleaseAlbumsCategory *_Nullable, NSArray<KKAlbumInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewReleaseAlbumsUnderCategory(_ categoryID: String, territory: KKTerritoryCode, callback: @escaping (KKNewReleaseAlbumsCategory?, [KKAlbumInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
categoryIDthe ID of the category.
territorythe given territory. KKBOX may provide different new released albums in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch new released albums in a specific category and territory.
See
https://docs-en.kkbox.codes/v1.1/reference#new-release-categories_category_id.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchNewReleaseAlbumsUnderCategory:(nonnull NSString *)categoryID territory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)( KKNewReleaseAlbumsCategory *_Nullable, NSArray<KKAlbumInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchNewReleaseAlbumsUnderCategory(_ categoryID: String, territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping (KKNewReleaseAlbumsCategory?, [KKAlbumInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
categoryIDthe ID of the category.
territorythe given territory. KKBOX may provide different new released albums in different territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the categories of charts in a specific territory.
See
https://docs-en.kkbox.codes/v1.1/reference#charts. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchChartsForTerritory:(KKTerritoryCode)territory callback: (nonnull void (^)(NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchCharts(forTerritory territory: KKTerritoryCode, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory. KKBOX may provide different charts in different territories.
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
-
Fetch the categories of charts in a specific territory.
See
https://docs-en.kkbox.codes/v1.1/reference#charts. See alsofetchPlaylistWithPlaylistID:territory:callback:.Declaration
Objective-C
- (nonnull NSURLSessionDataTask *) fetchChartsForTerritory:(KKTerritoryCode)territory offset:(NSInteger)offset limit:(NSInteger)limit callback: (nonnull void (^)(NSArray<KKPlaylistInfo *> *_Nullable, KKPagingInfo *_Nullable, KKSummary *_Nullable, NSError *_Nullable))callback;Swift
func fetchCharts(forTerritory territory: KKTerritoryCode, offset: Int, limit: Int, callback: @escaping ([KKPlaylistInfo]?, KKPagingInfo?, KKSummary?, Error?) -> Void) -> URLSessionDataTaskParameters
territorythe given territory. KKBOX may provide different charts in different territories.
offsetthe offset
limitthe limit of response
callbackthe callback block
Return Value
an NSURLSessionDataTask object that allow you to cancel the task.
View on GitHub
KKBOXOpenAPI Class Reference