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,436 lines (1,435 loc) 168 kB
{ "type": "File", "start": 0, "end": 2628, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 71, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2628, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 71, "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://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories\n ", "start": 103, "end": 238, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 239, "end": 2628, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 71, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 254, "end": 2628, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 71, "column": 1 } }, "id": { "type": "Identifier", "start": 260, "end": 291, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 52 }, "identifierName": "FeaturedPlaylistCategoryFetcher" }, "name": "FeaturedPlaylistCategoryFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 300, "end": 307, "loc": { "start": { "line": 8, "column": 61 }, "end": { "line": 8, "column": 68 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 308, "end": 2628, "loc": { "start": { "line": 8, "column": 69 }, "end": { "line": 71, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 345, "end": 500, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 345, "end": 356, "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": 357, "end": 361, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 363, "end": 379, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 363, "end": 372, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 375, "end": 379, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 381, "end": 500, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 391, "end": 413, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 391, "end": 413, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 391, "end": 396, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 397, "end": 401, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 403, "end": 412, "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": 423, "end": 457, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 466, "end": 494, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 466, "end": 494, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 466, "end": 482, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 466, "end": 470, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 471, "end": 482, "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": 485, "end": 494, "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": 423, "end": 457, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 314, "end": 340, "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.featuredPlaylistCategoryFetcher.fetchAllFeaturedPlaylistCategories()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories\n ", "start": 506, "end": 822, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 827, "end": 939, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 30, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 827, "end": 861, "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": 864, "end": 939, "loc": { "start": { "line": 28, "column": 41 }, "end": { "line": 30, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 874, "end": 933, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 67 } }, "argument": { "type": "CallExpression", "start": 881, "end": 933, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 67 } }, "callee": { "type": "MemberExpression", "start": 881, "end": 894, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 28 } }, "object": { "type": "MemberExpression", "start": 881, "end": 890, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 24 } }, "object": { "type": "ThisExpression", "start": 881, "end": 885, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 19 } } }, "property": { "type": "Identifier", "start": 886, "end": 890, "loc": { "start": { "line": 29, "column": 20 }, "end": { "line": 29, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 891, "end": 894, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 895, "end": 903, "loc": { "start": { "line": 29, "column": 29 }, "end": { "line": 29, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 905, "end": 932, "loc": { "start": { "line": 29, "column": 39 }, "end": { "line": 29, "column": 66 } }, "properties": [ { "type": "ObjectProperty", "start": 906, "end": 931, "loc": { "start": { "line": 29, "column": 40 }, "end": { "line": 29, "column": 65 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 906, "end": 915, "loc": { "start": { "line": 29, "column": 40 }, "end": { "line": 29, "column": 49 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 917, "end": 931, "loc": { "start": { "line": 29, "column": 51 }, "end": { "line": 29, "column": 65 } }, "object": { "type": "ThisExpression", "start": 917, "end": 921, "loc": { "start": { "line": 29, "column": 51 }, "end": { "line": 29, "column": 55 } } }, "property": { "type": "Identifier", "start": 922, "end": 931, "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.featuredPlaylistCategoryFetcher.fetchAllFeaturedPlaylistCategories()\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories\n ", "start": 506, "end": 822, "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 {FeaturedPlaylistCategoryFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id\n ", "start": 945, "end": 1267, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1272, "end": 1373, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 42, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1272, "end": 1285, "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": 1286, "end": 1297, "loc": { "start": { "line": 39, "column": 18 }, "end": { "line": 39, "column": 29 }, "identifierName": "category_id" }, "name": "category_id" } ], "body": { "type": "BlockStatement", "start": 1299, "end": 1373, "loc": { "start": { "line": 39, "column": 31 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1309, "end": 1339, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 1309, "end": 1339, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1309, "end": 1325, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1309, "end": 1313, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 12 } } }, "property": { "type": "Identifier", "start": 1314, "end": 1325, "loc": { "start": { "line": 40, "column": 13 }, "end": { "line": 40, "column": 24 }, "identifierName": "category_id" }, "name": "category_id" }, "computed": false }, "right": { "type": "Identifier", "start": 1328, "end": 1339, "loc": { "start": { "line": 40, "column": 27 }, "end": { "line": 40, "column": 38 }, "identifierName": "category_id" }, "name": "category_id" } } }, { "type": "ReturnStatement", "start": 1356, "end": 1367, "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 1363, "end": 1367, "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 {FeaturedPlaylistCategoryFetcher}\n * @see https://kkbox.gelato.io/docs/versions/v1.1/resources/featured-playlist-categories/endpoints/get-featured-playlist-categories-category_id\n ", "start": 945, "end": 1267, "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.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 ", "start": 1379, "end": 1723, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 50, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1728, "end": 1838, "loc": { "start": { "line": 51, "column": 4 }, "end": { "line": 53, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1728, "end": 1741, "loc": { "start": { "line": 51, "column": 4 }, "end": { "line": 51, "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": 1744, "end": 1838, "loc": { "start": { "line": 51, "column": 20 }, "end": { "line": 53, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1754, "end": 1832, "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 86 } }, "argument": { "type": "CallExpression", "start": 1761, "end": 1832, "loc": { "start": { "line": 52, "column": 15 }, "end": { "line": 52, "column": 86 } }, "callee": { "type": "MemberExpression", "start": 1761, "end": 1774, "loc": { "start": { "line": 52, "column": 15 }, "end": { "line": 52, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1761, "end": 1770, "loc": { "start": { "line": 52, "column": 15 }, "end": { "line": 52, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1761, "end": 1765, "loc": { "start": { "line": 52, "column": 15 }, "end": { "line": 52, "column": 19 } } }, "property": { "type": "Identifier", "start": 1766, "end": 1770, "loc": { "start": { "line": 52, "column": 20 }, "end": { "line": 52, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1771, "end": 1774, "loc": { "start": { "line": 52, "column": 25 }, "end": { "line": 52, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1775, "end": 1802, "loc": { "start": { "line": 52, "column": 29 }, "end": { "line": 52, "column": 56 } }, "left": { "type": "Identifier", "start": 1775, "end": 1783, "loc": { "start": { "line": 52, "column": 29 }, "end": { "line": 52, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1786, "end": 1802, "loc": { "start": {