UNPKG

@kkboxorg/kkbox-javascript-developer-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,447 lines (1,446 loc) 166 kB
{ "type": "File", "start": 0, "end": 2212, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 70, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2212, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 70, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 69, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 69 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 49, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 49 } }, "imported": { "type": "Identifier", "start": 8, "end": 37, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 37 }, "identifierName": "FEATURED_PLAYLISTS_CATEGORIES" }, "name": "FEATURED_PLAYLISTS_CATEGORIES" }, "local": { "type": "Identifier", "start": 41, "end": 49, "loc": { "start": { "line": 1, "column": 41 }, "end": { "line": 1, "column": 49 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 56, "end": 69, "loc": { "start": { "line": 1, "column": 56 }, "end": { "line": 1, "column": 69 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 70, "end": 101, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 77, "end": 84, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 77, "end": 84, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 90, "end": 101, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher", "leadingComments": null, "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * List featured playlist categories.\n * @see https://docs.kkbox.codes/docs/featured-playlist-categories\n ", "start": 103, "end": 215, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 216, "end": 2212, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 70, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 231, "end": 2212, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 70, "column": 1 } }, "id": { "type": "Identifier", "start": 237, "end": 268, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 52 }, "identifierName": "FeaturedPlaylistCategoryFetcher" }, "name": "FeaturedPlaylistCategoryFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 277, "end": 284, "loc": { "start": { "line": 8, "column": 61 }, "end": { "line": 8, "column": 68 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 285, "end": 2212, "loc": { "start": { "line": 8, "column": 69 }, "end": { "line": 70, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 322, "end": 477, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 322, "end": 333, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 334, "end": 338, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 340, "end": 356, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 340, "end": 349, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 352, "end": 356, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 358, "end": 477, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 368, "end": 390, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 368, "end": 390, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 368, "end": 373, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 374, "end": 378, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 380, "end": 389, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 29 }, "identifierName": "territory" }, "name": "territory" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 400, "end": 434, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 443, "end": 471, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 443, "end": 471, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 443, "end": 459, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 443, "end": 447, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 448, "end": 459, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 24 }, "identifierName": "category_id" }, "name": "category_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 462, "end": 471, "loc": { "start": { "line": 18, "column": 27 }, "end": { "line": 18, "column": 36 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 400, "end": 434, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 291, "end": 317, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all featured playlist categories.\n *\n * @return {Promise}\n * @example api.FeaturedPlaylistCategory.fetchAllFeaturedPlaylistCategories()\n * @see https://docs.kkbox.codes/docs/featured-playlist-categories\n ", "start": 483, "end": 726, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 731, "end": 843, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 30, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 731, "end": 765, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 38 }, "identifierName": "fetchAllFeaturedPlaylistCategories" }, "name": "fetchAllFeaturedPlaylistCategories", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 768, "end": 843, "loc": { "start": { "line": 28, "column": 41 }, "end": { "line": 30, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 778, "end": 837, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 67 } }, "argument": { "type": "CallExpression", "start": 785, "end": 837, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 67 } }, "callee": { "type": "MemberExpression", "start": 785, "end": 798, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 28 } }, "object": { "type": "MemberExpression", "start": 785, "end": 794, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 24 } }, "object": { "type": "ThisExpression", "start": 785, "end": 789, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 19 } } }, "property": { "type": "Identifier", "start": 790, "end": 794, "loc": { "start": { "line": 29, "column": 20 }, "end": { "line": 29, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 795, "end": 798, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 799, "end": 807, "loc": { "start": { "line": 29, "column": 29 }, "end": { "line": 29, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 809, "end": 836, "loc": { "start": { "line": 29, "column": 39 }, "end": { "line": 29, "column": 66 } }, "properties": [ { "type": "ObjectProperty", "start": 810, "end": 835, "loc": { "start": { "line": 29, "column": 40 }, "end": { "line": 29, "column": 65 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 810, "end": 819, "loc": { "start": { "line": 29, "column": 40 }, "end": { "line": 29, "column": 49 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 821, "end": 835, "loc": { "start": { "line": 29, "column": 51 }, "end": { "line": 29, "column": 65 } }, "object": { "type": "ThisExpression", "start": 821, "end": 825, "loc": { "start": { "line": 29, "column": 51 }, "end": { "line": 29, "column": 55 } } }, "property": { "type": "Identifier", "start": 826, "end": 835, "loc": { "start": { "line": 29, "column": 56 }, "end": { "line": 29, "column": 65 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all featured playlist categories.\n *\n * @return {Promise}\n * @example api.FeaturedPlaylistCategory.fetchAllFeaturedPlaylistCategories()\n * @see https://docs.kkbox.codes/docs/featured-playlist-categories\n ", "start": 483, "end": 726, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the featured playlist category fetcher.\n *\n * @param {string} category_id - The category ID.\n * @return {FeaturedPlaylistCategory}\n * @see https://docs.kkbox.codes/docs/feature-playlist-category\n ", "start": 849, "end": 1083, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1088, "end": 1189, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 42, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1088, "end": 1101, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 39, "column": 17 }, "identifierName": "setCategoryID" }, "name": "setCategoryID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1102, "end": 1113, "loc": { "start": { "line": 39, "column": 18 }, "end": { "line": 39, "column": 29 }, "identifierName": "category_id" }, "name": "category_id" } ], "body": { "type": "BlockStatement", "start": 1115, "end": 1189, "loc": { "start": { "line": 39, "column": 31 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1125, "end": 1155, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 1125, "end": 1155, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1125, "end": 1141, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1125, "end": 1129, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 12 } } }, "property": { "type": "Identifier", "start": 1130, "end": 1141, "loc": { "start": { "line": 40, "column": 13 }, "end": { "line": 40, "column": 24 }, "identifierName": "category_id" }, "name": "category_id" }, "computed": false }, "right": { "type": "Identifier", "start": 1144, "end": 1155, "loc": { "start": { "line": 40, "column": 27 }, "end": { "line": 40, "column": 38 }, "identifierName": "category_id" }, "name": "category_id" } } }, { "type": "ReturnStatement", "start": 1172, "end": 1183, "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 1179, "end": 1183, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the featured playlist category fetcher.\n *\n * @param {string} category_id - The category ID.\n * @return {FeaturedPlaylistCategory}\n * @see https://docs.kkbox.codes/docs/feature-playlist-category\n ", "start": 849, "end": 1083, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 38, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the category you init.\n *\n * @return {Promise}\n * @example api.FeaturedPlaylistCategory.setCategoryID('LXUR688EBKRRZydAWb').fetchMetadata()\n ", "start": 1195, "end": 1383, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 49, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1388, "end": 1498, "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 52, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1388, "end": 1401, "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 50, "column": 17 }, "identifierName": "fetchMetadata" }, "name": "fetchMetadata", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1404, "end": 1498, "loc": { "start": { "line": 50, "column": 20 }, "end": { "line": 52, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1414, "end": 1492, "loc": { "start": { "line": 51, "column": 8 }, "end": { "line": 51, "column": 86 } }, "argument": { "type": "CallExpression", "start": 1421, "end": 1492, "loc": { "start": { "line": 51, "column": 15 }, "end": { "line": 51, "column": 86 } }, "callee": { "type": "MemberExpression", "start": 1421, "end": 1434, "loc": { "start": { "line": 51, "column": 15 }, "end": { "line": 51, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1421, "end": 1430, "loc": { "start": { "line": 51, "column": 15 }, "end": { "line": 51, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1421, "end": 1425, "loc": { "start": { "line": 51, "column": 15 }, "end": { "line": 51, "column": 19 } } }, "property": { "type": "Identifier", "start": 1426, "end": 1430, "loc": { "start": { "line": 51, "column": 20 }, "end": { "line": 51, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1431, "end": 1434, "loc": { "start": { "line": 51, "column": 25 }, "end": { "line": 51, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1435, "end": 1462, "loc": { "start": { "line": 51, "column": 29 }, "end": { "line": 51, "column": 56 } }, "left": { "type": "Identifier", "start": 1435, "end": 1443, "loc": { "start": { "line": 51, "column": 29 }, "end": { "line": 51, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1446, "end": 1462, "loc": { "start": { "line": 51, "column": 40 }, "end": { "line": 51, "column": 56 } }, "object": { "type": "ThisExpression", "start": 1446,