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,466 lines (1,465 loc) 1.1 MB
{ "type": "File", "start": 0, "end": 6075, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 202, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 6075, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 202, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 49, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 49 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 27, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 27 } }, "imported": { "type": "Identifier", "start": 9, "end": 15, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 15 }, "identifierName": "SEARCH" }, "name": "SEARCH" }, "local": { "type": "Identifier", "start": 19, "end": 27, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 27 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 35, "end": 48, "loc": { "start": { "line": 1, "column": 35 }, "end": { "line": 1, "column": 48 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 50, "end": 82, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 57, "end": 64, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 57, "end": 64, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 70, "end": 81, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Search API.\n * @see https://docs-en.kkbox.codes/v1.1/reference#search\n ", "start": 84, "end": 164, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 165, "end": 2342, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 89, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 180, "end": 2342, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 89, "column": 1 } }, "id": { "type": "Identifier", "start": 186, "end": 199, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "SearchFetcher" }, "name": "SearchFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 208, "end": 215, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 50 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 216, "end": 2342, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 89, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 245, "end": 500, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 29, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 245, "end": 256, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 257, "end": 261, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 263, "end": 279, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 36 } }, "left": { "type": "Identifier", "start": 263, "end": 272, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 275, "end": 279, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 281, "end": 500, "loc": { "start": { "line": 12, "column": 38 }, "end": { "line": 29, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 287, "end": 310, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "CallExpression", "start": 287, "end": 309, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 26 } }, "callee": { "type": "Super", "start": 287, "end": 292, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 293, "end": 297, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 14 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 299, "end": 308, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 25 }, "identifierName": "territory" }, "name": "territory" } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 316, "end": 342, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 347, "end": 381, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 347, "end": 380, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 37 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 347, "end": 368, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 25 } }, "object": { "type": "ThisExpression", "start": 347, "end": 351, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 352, "end": 368, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 25 }, "identifierName": "filterConditions" }, "name": "filterConditions" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 371, "end": 380, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 37 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 316, "end": 342, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 387, "end": 413, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 22, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 418, "end": 437, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 23 } }, "expression": { "type": "AssignmentExpression", "start": 418, "end": 436, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 418, "end": 424, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 10 } }, "object": { "type": "ThisExpression", "start": 418, "end": 422, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 423, "end": 424, "loc": { "start": { "line": 23, "column": 9 }, "end": { "line": 23, "column": 10 }, "identifierName": "q" }, "name": "q" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 427, "end": 436, "loc": { "start": { "line": 23, "column": 13 }, "end": { "line": 23, "column": 22 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 387, "end": 413, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 22, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 443, "end": 469, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 474, "end": 496, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 474, "end": 495, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 474, "end": 483, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 13 } }, "object": { "type": "ThisExpression", "start": 474, "end": 478, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 479, "end": 483, "loc": { "start": { "line": 28, "column": 9 }, "end": { "line": 28, "column": 13 }, "identifierName": "type" }, "name": "type" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 486, "end": 495, "loc": { "start": { "line": 28, "column": 16 }, "end": { "line": 28, "column": 25 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 443, "end": 469, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 220, "end": 242, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Filter what you don't want when search.\n *\n * @param {Object} [conditions] - search conditions.\n * @param {string} conditions.track - track's name.\n * @param {string} conditions.album - album's name.\n * @param {string} conditions.artist - artist's name.\n * @param {string} conditions.playlist - playlist's title.\n * @param {string} conditions.availableTerritory - tracks and albums available territory.\n * @return {Search}\n * @example\n * api.searchFetcher\n * .setSearchCriteria('五月天 好好')\n * .filter({artist: '五月天'})\n * .fetchSearchResult();\n ", "start": 504, "end": 1088, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 46, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1091, "end": 1177, "loc": { "start": { "line": 47, "column": 2 }, "end": { "line": 50, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1091, "end": 1097, "loc": { "start": { "line": 47, "column": 2 }, "end": { "line": 47, "column": 8 }, "identifierName": "filter" }, "name": "filter", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1098, "end": 1113, "loc": { "start": { "line": 47, "column": 9 }, "end": { "line": 47, "column": 24 } }, "left": { "type": "Identifier", "start": 1098, "end": 1108, "loc": { "start": { "line": 47, "column": 9 }, "end": { "line": 47, "column": 19 }, "identifierName": "conditions" }, "name": "conditions" }, "right": { "type": "ObjectExpression", "start": 1111, "end": 1113, "loc": { "start": { "line": 47, "column": 22 }, "end": { "line": 47, "column": 24 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 1115, "end": 1177, "loc": { "start": { "line": 47, "column": 26 }, "end": { "line": 50, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1121, "end": 1156, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 39 } }, "expression": { "type": "AssignmentExpression", "start": 1121, "end": 1155, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1121, "end": 1142, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 25 } }, "object": { "type": "ThisExpression", "start": 1121, "end": 1125, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 8 } } }, "property": { "type": "Identifier", "start": 1126, "end": 1142, "loc": { "start": { "line": 48, "column": 9 }, "end": { "line": 48, "column": 25 }, "identifierName": "filterConditions" }, "name": "filterConditions" }, "computed": false }, "right": { "type": "Identifier", "start": 1145, "end": 1155, "loc": { "start": { "line": 48, "column": 28 }, "end": { "line": 48, "column": 38 }, "identifierName": "conditions" }, "name": "conditions" } } }, { "type": "ReturnStatement", "start": 1161, "end": 1173, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 1168, "end": 1172, "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Filter what you don't want when search.\n *\n * @param {Object} [conditions] - search conditions.\n * @param {string} conditions.track - track's name.\n * @param {string} conditions.album - album's name.\n * @param {string} conditions.artist - artist's name.\n * @param {string} conditions.playlist - playlist's title.\n * @param {string} conditions.availableTerritory - tracks and albums available territory.\n * @return {Search}\n * @example\n * api.searchFetcher\n * .setSearchCriteria('五月天 好好')\n * .filter({artist: '五月天'})\n * .fetchSearchResult();\n ", "start": 504, "end": 1088, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 46, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the search fetcher for the artist, album, track or playlist.\n *\n * @param {string} q - The keyword to be searched.\n * @param {string} [type] - ['artist', 'album', 'track', 'playlist'] The type of search. Default to search all types. If you want to use multiple type at the same time, you may use ',' to separate them.\n * @return {Search}\n * @see https://docs-en.kkbox.codes/v1.1/reference#search_1\n ", "start": 1181, "end": 1608, "loc": { "start": { "line": 52, "column": 2 }, "end": { "line": 59, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1611, "end": 1710, "loc": { "start": { "line": 60, "column": 2 }, "end": { "line": 64, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1611, "end": 1628, "loc": { "start": { "line": 60, "column": 2 }, "end": { "line": 60, "column": 19 }, "identifierName": "setSearchCriteria" }, "name": "setSearchCriteria", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1629, "end": 1630, "loc": { "start": { "line": 60, "column": 20 }, "end": { "line": 60, "column": 21 }, "identifierName": "q" }, "name": "q" }, { "type": "AssignmentPattern", "start": 1632, "end": 1648, "loc": { "start": { "line": 60, "column": 23 }, "end": { "line": 60, "column": 39 } }, "left": { "type": "Identifier", "start": 1632, "end": 1636, "loc": { "start": { "line": 60, "column": 23 }, "end": { "line": 60, "column": 27 }, "identifierName": "type" }, "name": "type" }, "right": { "type": "Identifier", "start": 1639, "end": 1648, "loc": { "start": { "line": 60, "column": 30 }, "end": { "line": 60, "column": 39 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 1650, "end": 1710, "loc": { "start": { "line": 60, "column": 41 }, "end": { "line": 64, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1656, "end": 1667, "loc": { "start": { "line": 61, "column": 4 }, "end": { "line": 61, "column": 15 } }, "expression": { "type": "AssignmentExpression", "start": 1656, "end": 1666, "loc": { "start": { "line": 61, "column": 4 }, "end": { "line": 61, "column": 14 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1656, "end": 1662, "loc": { "start": { "line": 61, "column": 4 }, "end": { "line": 61, "column": 10 } }, "object": { "type": "ThisExpression", "start": 1656, "end": 1660, "loc": { "start": { "line": 61, "column": 4 }, "end": { "line": 61, "column": 8 } } }, "property": { "type": "Identifier", "start": 1661, "end": 1662, "loc": { "start": { "line": 61, "column": 9 }, "end": { "line": 61, "column": 10 }, "identifierName": "q" }, "name": "q" }, "computed": false }, "right": { "type": "Identifier", "start": 1665, "end": 1666, "loc": { "start": { "line": 61, "column": 13 }, "end": { "line": 61, "column": 14 }, "identifierName": "q" }, "name": "q" } } }, { "type": "ExpressionStatement", "start": 1672, "end": 1689, "loc": { "start": { "line": 62, "column": 4 }, "end": { "line": 62, "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 1672, "end": 1688, "loc": { "start": { "line": 62, "column": 4 }, "end": { "line": 62, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1672, "end": 1681, "loc": { "start": { "line": 62, "column": 4 }, "end": { "line": 62, "column": 13 } },