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,456 lines 190 kB
[ { "__docId__": 1, "kind": "external", "name": "Infinity", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Infinity", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 2, "kind": "external", "name": "NaN", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~NaN", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 3, "kind": "external", "name": "undefined", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~undefined", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 4, "kind": "external", "name": "null", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~null", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 5, "kind": "external", "name": "Object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 6, "kind": "external", "name": "object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 7, "kind": "external", "name": "Function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 8, "kind": "external", "name": "function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 9, "kind": "external", "name": "Boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 10, "kind": "external", "name": "boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 11, "kind": "external", "name": "Symbol", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Symbol", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 12, "kind": "external", "name": "Error", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Error", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 13, "kind": "external", "name": "EvalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~EvalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 14, "kind": "external", "name": "InternalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~InternalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 15, "kind": "external", "name": "RangeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~RangeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 16, "kind": "external", "name": "ReferenceError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~ReferenceError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 17, "kind": "external", "name": "SyntaxError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~SyntaxError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 18, "kind": "external", "name": "TypeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~TypeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 19, "kind": "external", "name": "URIError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~URIError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 20, "kind": "external", "name": "Number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 21, "kind": "external", "name": "number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 22, "kind": "external", "name": "Date", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Date", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 23, "kind": "external", "name": "String", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~String", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 24, "kind": "external", "name": "string", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~string", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 25, "kind": "external", "name": "RegExp", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~RegExp", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 26, "kind": "external", "name": "Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 27, "kind": "external", "name": "Int8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 28, "kind": "external", "name": "Uint8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 29, "kind": "external", "name": "Uint8ClampedArray", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint8ClampedArray", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 30, "kind": "external", "name": "Int16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 31, "kind": "external", "name": "Uint16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 32, "kind": "external", "name": "Int32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Int32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 33, "kind": "external", "name": "Uint32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Uint32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 34, "kind": "external", "name": "Float32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Float32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 35, "kind": "external", "name": "Float64Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Float64Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 36, "kind": "external", "name": "Map", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Map", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 37, "kind": "external", "name": "Set", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Set", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 38, "kind": "external", "name": "WeakMap", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~WeakMap", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 39, "kind": "external", "name": "WeakSet", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~WeakSet", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 40, "kind": "external", "name": "ArrayBuffer", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~ArrayBuffer", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 41, "kind": "external", "name": "DataView", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~DataView", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 42, "kind": "external", "name": "JSON", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~JSON", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 43, "kind": "external", "name": "Promise", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Promise", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 44, "kind": "external", "name": "Generator", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Generator", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 45, "kind": "external", "name": "GeneratorFunction", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~GeneratorFunction", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 46, "kind": "external", "name": "Reflect", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Reflect", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 47, "kind": "external", "name": "Proxy", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", "memberof": "src/.external-ecmascript.js", "static": true, "longname": "src/.external-ecmascript.js~Proxy", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 48, "kind": "file", "name": "src/Endpoint.js", "content": "const API_DOMAIN = 'https://api.kkbox.com/v1.1/';\nconst OAUTH_DOMAIN = 'https://account.kkbox.com/oauth2/';\n\nmodule.exports = {\n SEARCH: API_DOMAIN + 'search',\n TRACKS: API_DOMAIN + 'tracks',\n ARTISTS: API_DOMAIN + 'artists',\n ALBUMS: API_DOMAIN + 'albums',\n SHARED_PLAYLISTS: API_DOMAIN + 'shared-playlists',\n MOOD_STATIONS: API_DOMAIN + 'mood-stations',\n FEATURED_PLAYLISTS: API_DOMAIN + 'featured-playlists',\n FEATURED_PLAYLISTS_CATEGORIES: API_DOMAIN + 'featured-playlist-categories',\n NEW_RELEASE_CATEGORIES: API_DOMAIN + 'new-release-categories',\n NEW_HITS_PLAYLISTS: API_DOMAIN + 'new-hits-playlists',\n GENRE_STATIONS: API_DOMAIN + 'genre-stations',\n CHARTS: API_DOMAIN + 'charts',\n Token: OAUTH_DOMAIN + 'token/',\n Authorization: OAUTH_DOMAIN + 'authorize/'\n};\n", "static": true, "longname": "/Users/ajhsu/Git/kkcorp/OpenAPI-JavaScript/src/Endpoint.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 49, "kind": "variable", "name": "API_DOMAIN", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~API_DOMAIN", "access": "public", "export": false, "importPath": "@kkbox/kkbox-js-sdk/src/Endpoint.js", "importStyle": null, "description": null, "lineNumber": 1, "undocument": true, "type": { "types": [ "string" ] }, "ignore": true }, { "__docId__": 50, "kind": "variable", "name": "OAUTH_DOMAIN", "memberof": "src/Endpoint.js", "static": true, "longname": "src/Endpoint.js~OAUTH_DOMAIN", "access": "public", "export": false, "importPath": "@kkbox/kkbox-js-sdk/src/Endpoint.js", "importStyle": null, "description": null, "lineNumber": 2, "undocument": true, "type": { "types": [ "string" ] }, "ignore": true }, { "__docId__": 51, "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://docs-en.kkbox.codes/v1.1/reference#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.albumID = undefined;\n }\n\n /**\n * Set the album fetcher.\n *\n * @param {string} albumID - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n */\n setAlbumID(albumID) {\n this.albumID = albumID;\n return this;\n }\n\n /**\n * Fetch metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#albums-album_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + '/' + this.albumID, {\n territory: this.territory\n });\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.albumID}&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://docs-en.kkbox.codes/v1.1/reference#albums-album_id-tracks\n */\n fetchTracks(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + '/' + this.albumID + '/tracks', {\n territory: this.territory,\n limit: limit,\n offset: offset\n });\n }\n}\n", "static": true, "longname": "/Users/ajhsu/Git/kkcorp/OpenAPI-JavaScript/src/api/AlbumFetcher.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 52, "kind": "class", "name": "AlbumFetcher", "memberof": "src/api/AlbumFetcher.js", "static": true, "longname": "src/api/AlbumFetcher.js~AlbumFetcher", "access": "public", "export": true, "importPath": "@kkbox/kkbox-js-sdk/src/api/AlbumFetcher.js", "importStyle": "AlbumFetcher", "description": "Fetch metadata and tracks of a album.", "see": [ "https://docs-en.kkbox.codes/v1.1/reference#albums" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 53, "kind": "constructor", "name": "constructor", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#constructor", "access": "public", "description": "", "lineNumber": 12, "ignore": true }, { "__docId__": 54, "kind": "member", "name": "albumID", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#albumID", "access": "public", "description": "", "lineNumber": 18, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 55, "kind": "method", "name": "setAlbumID", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#setAlbumID", "access": "public", "description": "Set the album fetcher.", "see": [ "https://docs-en.kkbox.codes/v1.1/reference#albums-album_id" ], "lineNumber": 28, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "albumID", "description": "The ID of an album." } ], "return": { "nullable": null, "types": [ "AlbumFetcher" ], "spread": false, "description": "" } }, { "__docId__": 57, "kind": "method", "name": "fetchMetadata", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#fetchMetadata", "access": "public", "description": "Fetch metadata of the album you create.", "examples": [ "api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#albums-album_id" ], "lineNumber": 40, "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" }, "params": [] }, { "__docId__": 58, "kind": "method", "name": "getWidgetUri", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#getWidgetUri", "access": "public", "description": "Get KKBOX web widget uri of the album.", "examples": [ "https://widget.kkbox.com/v1/?id=4qtXcj31wYJTRZbb23&type=album" ], "lineNumber": 51, "return": { "nullable": null, "types": [ "string" ], "spread": false, "description": "" }, "params": [] }, { "__docId__": 59, "kind": "method", "name": "fetchTracks", "memberof": "src/api/AlbumFetcher.js~AlbumFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/AlbumFetcher.js~AlbumFetcher#fetchTracks", "access": "public", "description": "Get tracks in an album. Result will be return with pagination.", "examples": [ "api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchTracks();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#albums-album_id-tracks" ], "lineNumber": 64, "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__": 60, "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';\nimport SharedPlaylistFetcher from './SharedPlaylistFetcher';\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(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {FeaturedPlaylistCategoryFetcher}\n */\n this.featuredPlaylistCategoryFetcher = new FeaturedPlaylistCategoryFetcher(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {NewReleaseCategoryFetcher}\n */\n this.newReleaseCategoryFetcher = new NewReleaseCategoryFetcher(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {NewHitsPlaylistFetcher}\n */\n this.newHitsPlaylistFetcher = new NewHitsPlaylistFetcher(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {GenreStationFetcher}\n */\n this.genreStationFetcher = new GenreStationFetcher(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {MoodStationFetcher}\n */\n this.moodStationFetcher = new MoodStationFetcher(\n this.httpClient,\n this.territory\n );\n\n /**\n * @type {ChartFetcher}\n */\n this.chartFetcher = new ChartFetcher(this.httpClient, this.territory);\n\n /**\n * @type {SharedPlaylistFetcher}\n */\n this.sharedPlaylistFetcher = new SharedPlaylistFetcher(\n this.httpClient,\n this.territory\n );\n }\n}\n", "static": true, "longname": "/Users/ajhsu/Git/kkcorp/OpenAPI-JavaScript/src/api/Api.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 61, "kind": "class", "name": "Api", "memberof": "src/api/Api.js", "static": true, "longname": "src/api/Api.js~Api", "access": "public", "export": true, "importPath": "@kkbox/kkbox-js-sdk/src/api/Api.js", "importStyle": "Api", "description": "Fetch KKBOX resources.", "lineNumber": 18, "interface": false }, { "__docId__": 62, "kind": "constructor", "name": "constructor", "memberof": "src/api/Api.js~Api", "generator": false, "async": false, "static": false, "longname": "src/api/Api.js~Api#constructor", "access": "public", "description": "Need access token to initialize.", "examples": [ "new Api(token);", "new Api(token, 'TW');" ], "lineNumber": 27, "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__": 63, "kind": "member", "name": "territory", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#territory", "access": "public", "description": null, "lineNumber": 28, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 64, "kind": "member", "name": "httpClient", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#httpClient", "access": "public", "description": null, "lineNumber": 29, "undocument": true, "type": { "types": [ "*" ] } }, { "__docId__": 65, "kind": "method", "name": "setToken", "memberof": "src/api/Api.js~Api", "generator": false, "async": false, "static": false, "longname": "src/api/Api.js~Api#setToken", "access": "public", "description": "Set new token and create fetchers with the new token.", "examples": [ "api.setToken(token);" ], "lineNumber": 39, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "token", "description": "Get via Auth." } ], "return": null }, { "__docId__": 67, "kind": "member", "name": "searchFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#searchFetcher", "access": "public", "description": "", "lineNumber": 45, "type": { "nullable": null, "types": [ "SearchFetcher" ], "spread": false, "description": null } }, { "__docId__": 68, "kind": "member", "name": "trackFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#trackFetcher", "access": "public", "description": "", "lineNumber": 50, "type": { "nullable": null, "types": [ "TrackFetcher" ], "spread": false, "description": null } }, { "__docId__": 69, "kind": "member", "name": "albumFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#albumFetcher", "access": "public", "description": "", "lineNumber": 55, "type": { "nullable": null, "types": [ "AlbumFetcher" ], "spread": false, "description": null } }, { "__docId__": 70, "kind": "member", "name": "artistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#artistFetcher", "access": "public", "description": "", "lineNumber": 60, "type": { "nullable": null, "types": [ "ArtistFetcher" ], "spread": false, "description": null } }, { "__docId__": 71, "kind": "member", "name": "featuredPlaylistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#featuredPlaylistFetcher", "access": "public", "description": "", "lineNumber": 65, "type": { "nullable": null, "types": [ "FeaturedPlaylistFetcher" ], "spread": false, "description": null } }, { "__docId__": 72, "kind": "member", "name": "featuredPlaylistCategoryFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#featuredPlaylistCategoryFetcher", "access": "public", "description": "", "lineNumber": 73, "type": { "nullable": null, "types": [ "FeaturedPlaylistCategoryFetcher" ], "spread": false, "description": null } }, { "__docId__": 73, "kind": "member", "name": "newReleaseCategoryFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#newReleaseCategoryFetcher", "access": "public", "description": "", "lineNumber": 81, "type": { "nullable": null, "types": [ "NewReleaseCategoryFetcher" ], "spread": false, "description": null } }, { "__docId__": 74, "kind": "member", "name": "newHitsPlaylistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#newHitsPlaylistFetcher", "access": "public", "description": "", "lineNumber": 89, "type": { "nullable": null, "types": [ "NewHitsPlaylistFetcher" ], "spread": false, "description": null } }, { "__docId__": 75, "kind": "member", "name": "genreStationFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#genreStationFetcher", "access": "public", "description": "", "lineNumber": 97, "type": { "nullable": null, "types": [ "GenreStationFetcher" ], "spread": false, "description": null } }, { "__docId__": 76, "kind": "member", "name": "moodStationFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#moodStationFetcher", "access": "public", "description": "", "lineNumber": 105, "type": { "nullable": null, "types": [ "MoodStationFetcher" ], "spread": false, "description": null } }, { "__docId__": 77, "kind": "member", "name": "chartFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#chartFetcher", "access": "public", "description": "", "lineNumber": 113, "type": { "nullable": null, "types": [ "ChartFetcher" ], "spread": false, "description": null } }, { "__docId__": 78, "kind": "member", "name": "sharedPlaylistFetcher", "memberof": "src/api/Api.js~Api", "static": false, "longname": "src/api/Api.js~Api#sharedPlaylistFetcher", "access": "public", "description": "", "lineNumber": 118, "type": { "nullable": null, "types": [ "SharedPlaylistFetcher" ], "spread": false, "description": null } }, { "__docId__": 79, "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://docs-en.kkbox.codes/v1.1/reference#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.artistID = undefined;\n }\n\n /**\n * Init the artist object.\n *\n * @param {string} artistID - The ID of an artist.\n * @return {Artist}\n * @see https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id\n */\n setArtistID(artistID) {\n this.artistID = artistID;\n return this;\n }\n\n /**\n * Fetch metadata of the artist you find.\n *\n * @return {Promise}\n * @example api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + '/' + this.artistID, {\n territory: this.territory\n });\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://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-albums\n */\n fetchAlbums(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + '/' + this.artistID + '/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.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchTopTracks();\n * @see https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-toptracks\n */\n fetchTopTracks(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + '/' + this.artistID + '/top-tracks', {\n territory: this.territory,\n limit: limit,\n offset: offset\n });\n }\n\n /**\n * Fetch related artists\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').fetchRelatedArtists();\n * @see https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-relatedartists\n */\n fetchRelatedArtists(limit = undefined, offset = undefined) {\n return this.http.get(ENDPOINT + '/' + this.artistID + '/related-artists', {\n territory: this.territory,\n limit: limit,\n offset: offset\n });\n }\n}\n", "static": true, "longname": "/Users/ajhsu/Git/kkcorp/OpenAPI-JavaScript/src/api/ArtistFetcher.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 80, "kind": "class", "name": "ArtistFetcher", "memberof": "src/api/ArtistFetcher.js", "static": true, "longname": "src/api/ArtistFetcher.js~ArtistFetcher", "access": "public", "export": true, "importPath": "@kkbox/kkbox-js-sdk/src/api/ArtistFetcher.js", "importStyle": "ArtistFetcher", "description": "Get artist metadata.", "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists" ], "lineNumber": 8, "interface": false, "extends": [ "src/api/Fetcher.js~Fetcher" ] }, { "__docId__": 81, "kind": "constructor", "name": "constructor", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#constructor", "access": "public", "description": "", "lineNumber": 12, "ignore": true }, { "__docId__": 82, "kind": "member", "name": "artistID", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#artistID", "access": "public", "description": "", "lineNumber": 18, "ignore": true, "type": { "types": [ "*" ] } }, { "__docId__": 83, "kind": "method", "name": "setArtistID", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#setArtistID", "access": "public", "description": "Init the artist object.", "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id" ], "lineNumber": 28, "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "artistID", "description": "The ID of an artist." } ], "return": { "nullable": null, "types": [ "Artist" ], "spread": false, "description": "" } }, { "__docId__": 85, "kind": "method", "name": "fetchMetadata", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchMetadata", "access": "public", "description": "Fetch metadata of the artist you find.", "examples": [ "api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchMetadata();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id" ], "lineNumber": 40, "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" }, "params": [] }, { "__docId__": 86, "kind": "method", "name": "fetchAlbums", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchAlbums", "access": "public", "description": "Fetch albums belong to an artist.", "examples": [ "api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchAlbums();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-albums" ], "lineNumber": 55, "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__": 87, "kind": "method", "name": "fetchTopTracks", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchTopTracks", "access": "public", "description": "Fetch top tracks belong to an artist.", "examples": [ "api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchTopTracks();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-toptracks" ], "lineNumber": 72, "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__": 88, "kind": "method", "name": "fetchRelatedArtists", "memberof": "src/api/ArtistFetcher.js~ArtistFetcher", "generator": false, "async": false, "static": false, "longname": "src/api/ArtistFetcher.js~ArtistFetcher#fetchRelatedArtists", "access": "public", "description": "Fetch related artists", "examples": [ "api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchRelatedArtists();" ], "see": [ "https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-relatedartists" ], "lineNumber": 89, "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__": 89, "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://docs-en.kkbox.codes/v1.1/reference#charts\n */\nexport default class ChartFetcher extends Fetcher {\n /**\n * @ignore\n */\n constructor(http, territory = 'TW') {\n super(http, territory);\n\n /**\n * @ignore\n */\n this.playlistID = undefined;\n }\n\n /**\n * Fetch chart playlists.\n *\n * @return {Promise}\n * @example api.chartFetcher.fetchCharts();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts_1\n */\n fetchCharts() {\n return this.http.get(ENDPOINT, {\n territory: this.territory\n });\n }\n\n /**\n * Init the chart fetcher.\n *\n * @param {string} playlistID - The playlist ID.\n * @return {ChartFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id\n */\n setPlaylistID(playlistID) {\n this.playlistID = playlistID;\n return this;\n }\n\n /**\n * Fetch playlist of the chart you set.\n *\n * @return {Promise}\n * @example api.chartFetcher.setPlaylistID('4mJSYXvueA8t0odsny').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id\n */\n fetchMetadata() {\n return this.http.get(ENDPOINT + '/' + this.playlistID, {\n territory: this.territory\n });\n }\n\n /**\n * Fetch tracks of the playlist with the chart 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.chartFetcher.setPlaylistID('4mJSYXvueA8t0odsny').fetchTracks();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id-tracks\n */\n fetchTra