UNPKG

@kkbox/kkbox-js-sdk

Version:

KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.

1,554 lines (1,553 loc) 165 kB
[ { "__docId__": 0, "kind": "file", "name": "src/Endpoint.js", "content": "const API_DOMAIN = (() => {\n return process.env.NODE_ENV === 'staging' ? 'https://api.kkbox-staging.com/v1.1/' : 'https://api.kkbox.com/v1.1/'\n})()\n/**\n * @ignore\n */\nexport const SEARCH = API_DOMAIN + 'search/'\n\n/**\n * @ignore\n */\nexport const TRACKS = API_DOMAIN + 'tracks/'\n\n/**\n * @ignore\n */\nexport const ARTISTS = API_DOMAIN + 'artists/'\n\n/**\n * @ignore\n */\nexport const ALBUMS = API_DOMAIN + 'albums/'\n\n/**\n * @ignore\n */\nexport const SHARED_PLAYLISTS = API_DOMAIN + 'shared-playlists/'\n\n/**\n * @ignore\n */\nexport const MOOD_STATIONS = API_DOMAIN + 'mood-stations/'\n\n/**\n * @ignore\n */\nexport const FEATURED_PLAYLISTS = API_DOMAIN + 'featured-playlists/'\n\n/**\n * @ignore\n */\nexport const FEATURED_PLAYLISTS_CATEGORIES = API_DOMAIN + 'featured-playlist-categories/'\n\n/**\n * @ignore\n */\nexport const NEW_RELEASE_CATEGORIES = API_DOMAIN + 'new-release-categories/'\n\n/**\n * @ignore\n */\nexport const NEW_HITS_PLAYLISTS = API_DOMAIN + 'new-hits-playlists/'\n\n/**\n * @ignore\n */\nexport const GENRE_STATIONS = API_DOMAIN + 'genre-stations/'\n\n/**\n * @ignore\n */\nexport const CHARTS = API_DOMAIN + 'charts/'\n\n/**\n * @ignore\n */\nexport const SEARCH_TYPES = {\n ARTIST: 'artist',\n ALBUM: 'album',\n TRACK: 'track',\n PLAY_LIST: 'playlist'\n}\n\nconst OAuth_DOMAIN = 'https://account.kkbox.com/oauth2/'\n\n/**\n * @ignore\n */\nexport const Token = OAuth_DOMAIN + 'token/'\n\n/**\n * @ignore\n */\nexport const Authorization = OAuth_DOMAIN + 'authorize/'", "static": true, "longname": "src/Endpoint.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 1, "kind": "variable", "name": "API_DOMAIN", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~API_DOMAIN", "access": null, "export": false, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": null, "description": null, "lineNumber": 1, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 2, "kind": "variable", "name": "SEARCH", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~SEARCH", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{SEARCH}", "description": "", "lineNumber": 7, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 3, "kind": "variable", "name": "TRACKS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~TRACKS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{TRACKS}", "description": "", "lineNumber": 12, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 4, "kind": "variable", "name": "ARTISTS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~ARTISTS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{ARTISTS}", "description": "", "lineNumber": 17, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 5, "kind": "variable", "name": "ALBUMS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~ALBUMS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{ALBUMS}", "description": "", "lineNumber": 22, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 6, "kind": "variable", "name": "SHARED_PLAYLISTS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~SHARED_PLAYLISTS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{SHARED_PLAYLISTS}", "description": "", "lineNumber": 27, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 7, "kind": "variable", "name": "MOOD_STATIONS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~MOOD_STATIONS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{MOOD_STATIONS}", "description": "", "lineNumber": 32, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 8, "kind": "variable", "name": "FEATURED_PLAYLISTS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~FEATURED_PLAYLISTS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{FEATURED_PLAYLISTS}", "description": "", "lineNumber": 37, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 9, "kind": "variable", "name": "FEATURED_PLAYLISTS_CATEGORIES", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~FEATURED_PLAYLISTS_CATEGORIES", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{FEATURED_PLAYLISTS_CATEGORIES}", "description": "", "lineNumber": 42, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 10, "kind": "variable", "name": "NEW_RELEASE_CATEGORIES", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~NEW_RELEASE_CATEGORIES", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{NEW_RELEASE_CATEGORIES}", "description": "", "lineNumber": 47, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 11, "kind": "variable", "name": "NEW_HITS_PLAYLISTS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~NEW_HITS_PLAYLISTS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{NEW_HITS_PLAYLISTS}", "description": "", "lineNumber": 52, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 12, "kind": "variable", "name": "GENRE_STATIONS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~GENRE_STATIONS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{GENRE_STATIONS}", "description": "", "lineNumber": 57, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 13, "kind": "variable", "name": "CHARTS", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~CHARTS", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{CHARTS}", "description": "", "lineNumber": 62, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 14, "kind": "variable", "name": "SEARCH_TYPES", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~SEARCH_TYPES", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{SEARCH_TYPES}", "description": "", "lineNumber": 67, "ignore": true, "type": { "types": [ "{\"ARTIST\": string, \"ALBUM\": string, \"TRACK\": string, \"PLAY_LIST\": string}" ] } }, { "__docId__": 15, "kind": "variable", "name": "OAuth_DOMAIN", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~OAuth_DOMAIN", "access": null, "export": false, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": null, "description": null, "lineNumber": 74, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "string" ] } }, { "__docId__": 16, "kind": "variable", "name": "Token", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~Token", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{Token}", "description": "", "lineNumber": 79, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 17, "kind": "variable", "name": "Authorization", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~Authorization", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/Endpoint.js", "importStyle": "{Authorization}", "description": "", "lineNumber": 84, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 18, "kind": "file", "name": "src/SDK.js", "content": "export {default as Auth} from './auth/Auth'\nexport {default as Api} from './api/Api'", "static": true, "longname": "src/SDK.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 19, "kind": "file", "name": "src/api/AlbumFetcher.js", "content": "import {ALBUMS as ENDPOINT} from '../Endpoint'\nimport Fetcher from './Fetcher'\n\n/**\n * Fetch metadata and tracks of a album.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums\n */\nexport default class AlbumFetcher extends Fetcher { \n /**\n * @ignore\n */\n constructor(http, territory = 'TW') {\n super(http, territory)\n\n /**\n * @ignore\n */\n this.album_id = undefined\n }\n\n /**\n * Set the album fetcher.\n *\n * @param {string} album_id - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n */\n setAlbumID(album_id) {\n this.album_id = album_id \n return this\n }\n\n /**\n * Fetcy metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + this.album_id, {territory: this.territory})\n }\n\n /**\n * Get KKBOX web widget uri of the album.\n * @example https://widget.kkbox.com/v1/?id=4qtXcj31wYJTRZbb23&type=album\n * @return {string}\n */\n getWidgetUri(){\n return `https://widget.kkbox.com/v1/?id=${this.album_id}&type=album`\n }\n\n /**\n * Get tracks in an album. Result will be return with pagination.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id-tracks\n */\n fetchTracks(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + this.album_id + '/tracks', {\n territory: this.territory,\n limit: limit,\n offset: offset\n })\n }\n}", "static": true, "longname": "src/api/AlbumFetcher.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 20, "kind": "class", "name": "AlbumFetcher", "memberof": "src/api/AlbumFetcher.js", "static": true, "longname": "src/api/AlbumFetcher.js~AlbumFetcher", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/api/AlbumFetcher.js", "importStyle": "AlbumFetcher", "description": "Fetch metadata and tracks of a album.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/albums" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 21, "kind": "constructor", "name": "constructor", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#constructor", "access": null, "description": "", "lineNumber": 12, "ignore": true, "params": [ { "name": "http", "types": [ "*" ] }, { "name": "territory", "optional": true, "types": [ "string" ], "defaultRaw": "TW", "defaultValue": "TW" } ] }, { "__docId__": 22, "kind": "member", "name": "album_id", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#album_id", "access": null, "description": "", "lineNumber": 18, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 23, "kind": "method", "name": "setAlbumID", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#setAlbumID", "access": null, "description": "Set the album fetcher.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id" ], "lineNumber": 28, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "album_id", "description": "The ID of an album." } ], "return": { "nullable": null, "types": [ "AlbumFetcher" ], "spread": false, "description": "" } }, { "__docId__": 24, "kind": "member", "name": "album_id", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#album_id", "access": null, "description": null, "lineNumber": 29, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 25, "kind": "method", "name": "fetchMetadata", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#fetchMetadata", "access": null, "description": "Fetcy metadata of the album you create.", "examples": [ "api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id" ], "lineNumber": 40, "params": [], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 26, "kind": "method", "name": "getWidgetUri", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#getWidgetUri", "access": null, "description": "Get KKBOX web widget uri of the album.", "examples": [ "https://widget.kkbox.com/v1/?id=4qtXcj31wYJTRZbb23&type=album" ], "lineNumber": 49, "params": [], "return": { "nullable": null, "types": [ "string" ], "spread": false, "description": "" } }, { "__docId__": 27, "kind": "method", "name": "fetchTracks", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#fetchTracks", "access": null, "description": "Get tracks in an album. Result will be return with pagination.", "examples": [ "api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/albums/endpoints/get-albums-album_id-tracks" ], "lineNumber": 62, "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "limit", "description": "The size for one page." }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "offset", "description": "The offset index for first element." } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 28, "kind": "file", "name": "src/api/Api.js", "content": "import HttpClient from './HttpClient'\nimport SearchFetcher from './SearchFetcher'\nimport TrackFetcher from './TrackFetcher'\nimport AlbumFetcher from './AlbumFetcher'\nimport ArtistFetcher from './ArtistFetcher'\nimport FeaturedPlaylistFetcher from './FeaturedPlaylistFetcher'\nimport FeaturedPlaylistCategoryFetcher from './FeaturedPlaylistCategoryFetcher'\nimport NewReleaseCategoryFetcher from './NewReleaseCategoryFetcher'\nimport NewHitsPlaylistFetcher from './NewHitsPlaylistFetcher'\nimport GenreStationFetcher from './GenreStationFetcher'\nimport MoodStationFetcher from './MoodStationFetcher'\nimport ChartFetcher from './ChartFetcher'\n\n/**\n * Fetch KKBOX resources.\n */\nexport default class Api {\n /**\n * Need access token to initialize.\n *\n * @param {string} token - Get via Auth.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher.\n * @example new Api(token)\n * @example new Api(token, 'TW')\n */\n constructor(token, territory = 'TW') { \n this.territory = territory\n this.httpClient = undefined\n this.setToken(token)\n }\n\n /**\n * Set new token and create fetchers with the new token.\n *\n * @param {string} token - Get via Auth.\n * @example api.setToken(token)\n */\n setToken(token) {\n this.httpClient = new HttpClient(token)\n\n /**\n * @type {SearchFetcher}\n */\n this.searchFetcher = new SearchFetcher(this.httpClient, this.territory)\n\n /**\n * @type {TrackFetcher}\n */\n this.trackFetcher = new TrackFetcher(this.httpClient, this.territory)\n\n /**\n * @type {AlbumFetcher}\n */\n this.albumFetcher = new AlbumFetcher(this.httpClient, this.territory)\n\n /**\n * @type {ArtistFetcher}\n */\n this.artistFetcher = new ArtistFetcher(this.httpClient, this.territory)\n\n /**\n * @type {FeaturedPlaylistFetcher}\n */\n this.featuredPlaylistFetcher = new FeaturedPlaylistFetcher(this.httpClient, this.territory)\n\n /**\n * @type {FeaturedPlaylistCategoryFetcher}\n */\n this.featuredPlaylistCategoryFetcher = new FeaturedPlaylistCategoryFetcher(this.httpClient, this.territory)\n\n /**\n * @type {NewReleaseCategoryFetcher}\n */ \n this.newReleaseCategoryFetcher = new NewReleaseCategoryFetcher(this.httpClient, this.territory)\n\n /**\n * @type {NewHitsPlaylistFetcher}\n */ \n this.newHitsPlaylistFetcher = new NewHitsPlaylistFetcher(this.httpClient, this.territory)\n \n /**\n * @type {GenreStationFetcher}\n */\n this.genreStationFetcher = new GenreStationFetcher(this.httpClient, this.territory)\n\n /**\n * @type {MoodStationFetcher}\n */\n this.moodStationFetcher = new MoodStationFetcher(this.httpClient, this.territory)\n\n /**\n * @type {ChartFetcher}\n */\n this.chartFetcher = new ChartFetcher(this.httpClient, this.territory) \n }\n}", "static": true, "longname": "src/api/Api.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 29, "kind": "class", "name": "Api", "memberof": "src/api/Api.js", "static": true, "longname": "src/api/Api.js~Api", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/api/Api.js", "importStyle": "Api", "description": "Fetch KKBOX resources.", "lineNumber": 17, "interface": false }, { "__docId__": 30, "kind": "constructor", "name": "constructor", "memberof": "src/api/Api.js~Api", "generator": false, "async": false, "static": false, "longname": "src/api/Api.js~Api#constructor", "access": null, "description": "Need access token to initialize.", "examples": [ "new Api(token)", "new Api(token, 'TW')" ], "lineNumber": 26, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "token", "description": "Get via Auth." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "defaultValue": " 'TW'", "defaultRaw": " 'TW'", "name": "territory", "description": "['TW', 'HK', 'SG', 'MY', 'JP'] The territory for the fetcher." } ] }, { "__docId__": 31, "kind": "member", "name": "territory", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#territory", "access": null, "description": null, "lineNumber": 27, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 32, "kind": "member", "name": "httpClient", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#httpClient", "access": null, "description": null, "lineNumber": 28, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 33, "kind": "method", "name": "setToken", "memberof": "src/api/Api.js~Api", "generator": false, "async": false, "static": false, "longname": "src/api/Api.js~Api#setToken", "access": null, "description": "Set new token and create fetchers with the new token.", "examples": [ "api.setToken(token)" ], "lineNumber": 38, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "token", "description": "Get via Auth." } ] }, { "__docId__": 34, "kind": "member", "name": "httpClient", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#httpClient", "access": null, "description": null, "lineNumber": 39, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 35, "kind": "member", "name": "searchFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#searchFetcher", "access": null, "description": "", "lineNumber": 44, "type": { "nullable": null, "types": [ "SearchFetcher" ], "spread": false, "description": null } }, { "__docId__": 36, "kind": "member", "name": "trackFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#trackFetcher", "access": null, "description": "", "lineNumber": 49, "type": { "nullable": null, "types": [ "TrackFetcher" ], "spread": false, "description": null } }, { "__docId__": 37, "kind": "member", "name": "albumFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#albumFetcher", "access": null, "description": "", "lineNumber": 54, "type": { "nullable": null, "types": [ "AlbumFetcher" ], "spread": false, "description": null } }, { "__docId__": 38, "kind": "member", "name": "artistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#artistFetcher", "access": null, "description": "", "lineNumber": 59, "type": { "nullable": null, "types": [ "ArtistFetcher" ], "spread": false, "description": null } }, { "__docId__": 39, "kind": "member", "name": "featuredPlaylistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#featuredPlaylistFetcher", "access": null, "description": "", "lineNumber": 64, "type": { "nullable": null, "types": [ "FeaturedPlaylistFetcher" ], "spread": false, "description": null } }, { "__docId__": 40, "kind": "member", "name": "featuredPlaylistCategoryFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#featuredPlaylistCategoryFetcher", "access": null, "description": "", "lineNumber": 69, "type": { "nullable": null, "types": [ "FeaturedPlaylistCategoryFetcher" ], "spread": false, "description": null } }, { "__docId__": 41, "kind": "member", "name": "newReleaseCategoryFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#newReleaseCategoryFetcher", "access": null, "description": "", "lineNumber": 74, "type": { "nullable": null, "types": [ "NewReleaseCategoryFetcher" ], "spread": false, "description": null } }, { "__docId__": 42, "kind": "member", "name": "newHitsPlaylistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#newHitsPlaylistFetcher", "access": null, "description": "", "lineNumber": 79, "type": { "nullable": null, "types": [ "NewHitsPlaylistFetcher" ], "spread": false, "description": null } }, { "__docId__": 43, "kind": "member", "name": "genreStationFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#genreStationFetcher", "access": null, "description": "", "lineNumber": 84, "type": { "nullable": null, "types": [ "GenreStationFetcher" ], "spread": false, "description": null } }, { "__docId__": 44, "kind": "member", "name": "moodStationFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#moodStationFetcher", "access": null, "description": "", "lineNumber": 89, "type": { "nullable": null, "types": [ "MoodStationFetcher" ], "spread": false, "description": null } }, { "__docId__": 45, "kind": "member", "name": "chartFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#chartFetcher", "access": null, "description": "", "lineNumber": 94, "type": { "nullable": null, "types": [ "ChartFetcher" ], "spread": false, "description": null } }, { "__docId__": 46, "kind": "file", "name": "src/api/ArtistFetcher.js", "content": "import {ARTISTS as ENDPOINT} from '../Endpoint'\nimport Fetcher from './Fetcher'\n\n/**\n * Get artist metadata.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists\n */\nexport default class ArtistFetcher extends Fetcher {\n /**\n * @ignore\n */\n constructor(http, territory = 'TW') {\n super(http, territory)\n\n /**\n * @ignore\n */\n this.artist_id = undefined\n }\n\n /**\n * Init the artist object.\n *\n * @param {string} artist_id - The ID of an artist.\n * @return {Artist}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n */\n setArtistID(artist_id) {\n this.artist_id = artist_id\n return this\n }\n\n /**\n * Fetch metadata of the artist you find.\n *\n * @return {Promise}\n * @example api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + this.artist_id, {territory: this.territory})\n }\n\n /**\n * Fetch albums belong to an artist.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchAlbums()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id-albums\n */\n fetchAlbums(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + this.artist_id + '/albums', {\n territory: this.territory,\n limit: limit,\n offset: offset\n })\n }\n\n /**\n * Fetch top tracks belong to an artist.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchTopTracks()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id-top-tracks\n */\n fetchTopTracks(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + this.artist_id + '/top-tracks', {\n territory: this.territory,\n limit: limit,\n offset: offset\n })\n }\n}", "static": true, "longname": "src/api/ArtistFetcher.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 47, "kind": "class", "name": "ArtistFetcher", "memberof": "src/api/ArtistFetcher.js", "static": true, "longname": "src/api/ArtistFetcher.js~ArtistFetcher", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/api/ArtistFetcher.js", "importStyle": "ArtistFetcher", "description": "Get artist metadata.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/artists" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 48, "kind": "constructor", "name": "constructor", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#constructor", "access": null, "description": "", "lineNumber": 12, "ignore": true, "params": [ { "name": "http", "types": [ "*" ] }, { "name": "territory", "optional": true, "types": [ "string" ], "defaultRaw": "TW", "defaultValue": "TW" } ] }, { "__docId__": 49, "kind": "member", "name": "artist_id", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#artist_id", "access": null, "description": "", "lineNumber": 18, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 50, "kind": "method", "name": "setArtistID", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#setArtistID", "access": null, "description": "Init the artist object.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id" ], "lineNumber": 28, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "artist_id", "description": "The ID of an artist." } ], "return": { "nullable": null, "types": [ "Artist" ], "spread": false, "description": "" } }, { "__docId__": 51, "kind": "member", "name": "artist_id", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#artist_id", "access": null, "description": null, "lineNumber": 29, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 52, "kind": "method", "name": "fetchMetadata", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchMetadata", "access": null, "description": "Fetch metadata of the artist you find.", "examples": [ "api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id" ], "lineNumber": 40, "params": [], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 53, "kind": "method", "name": "fetchAlbums", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchAlbums", "access": null, "description": "Fetch albums belong to an artist.", "examples": [ "api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchAlbums()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id-albums" ], "lineNumber": 53, "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "limit", "description": "The size for one page." }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "offset", "description": "The offset index for first element." } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 54, "kind": "method", "name": "fetchTopTracks", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchTopTracks", "access": null, "description": "Fetch top tracks belong to an artist.", "examples": [ "api.Artist.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchTopTracks()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/artists/endpoints/get-artists-artist_id-top-tracks" ], "lineNumber": 70, "params": [ { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "limit", "description": "The size for one page." }, { "nullable": null, "types": [ "number" ], "spread": false, "optional": true, "name": "offset", "description": "The offset index for first element." } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 55, "kind": "file", "name": "src/api/ChartFetcher.js", "content": "import {CHARTS as ENDPOINT} from '../Endpoint'\nimport Fetcher from './Fetcher'\n\n/**\n * The fetcher that can fetch chart playlists.\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/charts\n */\nexport default class ChartFetcher extends Fetcher {\n /**\n * @ignore\n */\n constructor(http, territory = 'TW') {\n super(http, territory = 'TW')\n }\n\n /**\n * Fetch chart playlists.\n *\n * @return {Promise}\n * @example api.chartFetcher.fetchCharts()\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/charts/endpoints/get-charts\n */\n fetchCharts() {\n return this.http.get(ENDPOINT, {\n territory: this.territory\n })\n }\n}", "static": true, "longname": "src/api/ChartFetcher.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 56, "kind": "class", "name": "ChartFetcher", "memberof": "src/api/ChartFetcher.js", "static": true, "longname": "src/api/ChartFetcher.js~ChartFetcher", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/api/ChartFetcher.js", "importStyle": "ChartFetcher", "description": "The fetcher that can fetch chart playlists.", "see": [ "https://kkbox.gelato.io/docs/versions/1.1/resources/charts" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 57, "kind": "constructor", "name": "constructor", "memberof": "src/api/ChartFetcher.js~ChartFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ChartFetcher.js~ChartFetcher#constructor", "access": null, "description": "", "lineNumber": 12, "ignore": true, "params": [ { "name": "http", "types": [ "*" ] }, { "name": "territory", "optional": true, "types": [ "string" ], "defaultRaw": "TW", "defaultValue": "TW" } ] }, { "__docId__": 58, "kind": "method", "name": "fetchCharts", "memberof": "src/api/ChartFetcher.js~ChartFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ChartFetcher.js~ChartFetcher#fetchCharts", "access": null, "description": "Fetch chart playlists.", "examples": [ "api.chartFetcher.fetchCharts()" ], "see": [ "https://kkbox.gelato.io/docs/versions/1.1/resources/charts/endpoints/get-charts" ], "lineNumber": 23, "params": [], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 59, "kind": "file", "name": "src/api/FeaturedPlaylistCategoryFetcher.js", "content": "import {FEATURED_PLAYLISTS_CATEGORIES as ENDPOINT} from '../Endpoint'\nimport Fetcher from './Fetcher'\n\n/**\n * List featured playlist categories.\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories\n */\nexport default class FeaturedPlaylistCategoryFetcher extends Fetcher {\n /**\n * @ignore\n */\n constructor(http, territory = 'TW') {\n super(http, territory)\n\n /**\n * @ignore\n */\n this.category_id = undefined\n }\n\n /**\n * Fetch all featured playlist categories.\n *\n * @return {Promise}\n * @example api.featuredPlaylistCategoryFetcher.fetchAllFeaturedPlaylistCategories()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories\n */\n fetchAllFeaturedPlaylistCategories() {\n return this.http.get(ENDPOINT, {territory: this.territory})\n }\n\n /**\n * Init the featured playlist category fetcher.\n *\n * @param {string} category_id - The category ID.\n * @return {FeaturedPlaylistCategoryFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id\n */\n setCategoryID(category_id) {\n this.category_id = category_id \n return this\n }\n\n /**\n * Fetch metadata of the category you init.\n *\n * @return {Promise}\n * @example api.featuredPlaylistCategoryFetcher.setCategoryID('LXUR688EBKRRZydAWb').fetchMetadata()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + this.category_id, {territory: this.territory})\n }\n\n /**\n * Fetch featured playlists of the category with the category fetcher you init. Result will be paged.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.featuredPlaylistCategoryFetcher.setCategoryID('LXUR688EBKRRZydAWb').fetchPlaylists()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id-playlists\n */\n fetchPlaylists(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + this.category_id + '/playlists', {\n territory: this.territory,\n limit: limit,\n offset: offset\n })\n }\n}", "static": true, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 60, "kind": "class", "name": "FeaturedPlaylistCategoryFetcher", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js", "static": true, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "access": null, "export": true, "importPath": "@kkboxorg/kkbox-javascript-developer-sdk/src/api/FeaturedPlaylistCategoryFetcher.js", "importStyle": "FeaturedPlaylistCategoryFetcher", "description": "List featured playlist categories.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 61, "kind": "constructor", "name": "constructor", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#constructor", "access": null, "description": "", "lineNumber": 12, "ignore": true, "params": [ { "name": "http", "types": [ "*" ] }, { "name": "territory", "optional": true, "types": [ "string" ], "defaultRaw": "TW", "defaultValue": "TW" } ] }, { "__docId__": 62, "kind": "member", "name": "category_id", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#category_id", "access": null, "description": "", "lineNumber": 18, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 63, "kind": "method", "name": "fetchAllFeaturedPlaylistCategories", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#fetchAllFeaturedPlaylistCategories", "access": null, "description": "Fetch all featured playlist categories.", "examples": [ "api.featuredPlaylistCategoryFetcher.fetchAllFeaturedPlaylistCategories()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories" ], "lineNumber": 28, "params": [], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 64, "kind": "method", "name": "setCategoryID", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#setCategoryID", "access": null, "description": "Init the featured playlist category fetcher.", "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id" ], "lineNumber": 39, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "category_id", "description": "The category ID." } ], "return": { "nullable": null, "types": [ "FeaturedPlaylistCategoryFetcher" ], "spread": false, "description": "" } }, { "__docId__": 65, "kind": "member", "name": "category_id", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#category_id", "access": null, "description": null, "lineNumber": 40, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 66, "kind": "method", "name": "fetchMetadata", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#fetchMetadata", "access": null, "description": "Fetch metadata of the category you init.", "examples": [ "api.featuredPlaylistCategoryFetcher.setCategoryID('LXUR688EBKRRZydAWb').fetchMetadata()" ], "see": [ "https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id" ], "lineNumber": 51, "params": [], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 67, "kind": "method", "name": "fetchPlaylists", "memberof": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/FeaturedPlaylistCategoryFetcher.js~FeaturedPlaylistCategoryFetcher#fetchPlaylists", "access": null, "description": "Fetch featured playlists of the category with the category fetcher you init. Result will be paged.", "examples": [ "api.featuredPlaylistCategoryFetcher.setCategoryID('LXUR688EBKRRZydAWb').fetchPlaylists()"