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,443 lines 177 kB
{ "type": "File", "start": 0, "end": 2286, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 76, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2286, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 76, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 72, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 72 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 50, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 50 } }, "imported": { "type": "Identifier", "start": 9, "end": 38, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 38 }, "identifierName": "FEATURED_PLAYLISTS_CATEGORIES" }, "name": "FEATURED_PLAYLISTS_CATEGORIES" }, "local": { "type": "Identifier", "start": 42, "end": 50, "loc": { "start": { "line": 1, "column": 42 }, "end": { "line": 1, "column": 50 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 58, "end": 71, "loc": { "start": { "line": 1, "column": 58 }, "end": { "line": 1, "column": 71 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 73, "end": 105, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 80, "end": 87, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 80, "end": 87, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 93, "end": 104, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * List featured playlist categories.\n * @see https://docs-en.kkbox.codes/v1.1/reference#featured-playlist-categories\n ", "start": 107, "end": 232, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 233, "end": 2285, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 75, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 248, "end": 2285, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 75, "column": 1 } }, "id": { "type": "Identifier", "start": 254, "end": 285, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 52 }, "identifierName": "FeaturedPlaylistCategoryFetcher" }, "name": "FeaturedPlaylistCategoryFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 294, "end": 301, "loc": { "start": { "line": 8, "column": 61 }, "end": { "line": 8, "column": 68 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 302, "end": 2285, "loc": { "start": { "line": 8, "column": 69 }, "end": { "line": 75, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 331, "end": 465, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 331, "end": 342, "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": 343, "end": 347, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 349, "end": 365, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 36 } }, "left": { "type": "Identifier", "start": 349, "end": 358, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 361, "end": 365, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 367, "end": 465, "loc": { "start": { "line": 12, "column": 38 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 373, "end": 396, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "CallExpression", "start": 373, "end": 395, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 26 } }, "callee": { "type": "Super", "start": 373, "end": 378, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 379, "end": 383, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 14 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 385, "end": 394, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 25 }, "identifierName": "territory" }, "name": "territory" } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 402, "end": 428, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 433, "end": 461, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 433, "end": 460, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 31 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 433, "end": 448, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 19 } }, "object": { "type": "ThisExpression", "start": 433, "end": 437, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 438, "end": 448, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 19 }, "identifierName": "categoryID" }, "name": "categoryID" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 451, "end": 460, "loc": { "start": { "line": 18, "column": 22 }, "end": { "line": 18, "column": 31 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 402, "end": 428, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 306, "end": 328, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all featured playlist categories.\n *\n * @return {Promise}\n * @example api.featuredPlaylistCategoryFetcher.fetchAllFeaturedPlaylistCategories();\n * @see https://docs-en.kkbox.codes/v1.1/reference#featuredplaylistcategories\n ", "start": 469, "end": 719, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 27, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 722, "end": 841, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 32, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 722, "end": 756, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 28, "column": 36 }, "identifierName": "fetchAllFeaturedPlaylistCategories" }, "name": "fetchAllFeaturedPlaylistCategories", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 759, "end": 841, "loc": { "start": { "line": 28, "column": 39 }, "end": { "line": 32, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 765, "end": 837, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 31, "column": 7 } }, "argument": { "type": "CallExpression", "start": 772, "end": 836, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 31, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 772, "end": 785, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 29, "column": 24 } }, "object": { "type": "MemberExpression", "start": 772, "end": 781, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 29, "column": 20 } }, "object": { "type": "ThisExpression", "start": 772, "end": 776, "loc": { "start": { "line": 29, "column": 11 }, "end": { "line": 29, "column": 15 } } }, "property": { "type": "Identifier", "start": 777, "end": 781, "loc": { "start": { "line": 29, "column": 16 }, "end": { "line": 29, "column": 20 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 782, "end": 785, "loc": { "start": { "line": 29, "column": 21 }, "end": { "line": 29, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 786, "end": 794, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 33 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 796, "end": 835, "loc": { "start": { "line": 29, "column": 35 }, "end": { "line": 31, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 804, "end": 829, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 31 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 804, "end": 813, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 15 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 815, "end": 829, "loc": { "start": { "line": 30, "column": 17 }, "end": { "line": 30, "column": 31 } }, "object": { "type": "ThisExpression", "start": 815, "end": 819, "loc": { "start": { "line": 30, "column": 17 }, "end": { "line": 30, "column": 21 } } }, "property": { "type": "Identifier", "start": 820, "end": 829, "loc": { "start": { "line": 30, "column": 22 }, "end": { "line": 30, "column": 31 }, "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://docs-en.kkbox.codes/v1.1/reference#featuredplaylistcategories\n ", "start": 469, "end": 719, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 27, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the featured playlist category fetcher.\n *\n * @param {string} categoryID - The category ID.\n * @return {FeaturedPlaylistCategoryFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#featuredplaylistcategories-category_id\n ", "start": 845, "end": 1099, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 40, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1102, "end": 1184, "loc": { "start": { "line": 41, "column": 2 }, "end": { "line": 44, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1102, "end": 1115, "loc": { "start": { "line": 41, "column": 2 }, "end": { "line": 41, "column": 15 }, "identifierName": "setCategoryID" }, "name": "setCategoryID", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1116, "end": 1126, "loc": { "start": { "line": 41, "column": 16 }, "end": { "line": 41, "column": 26 }, "identifierName": "categoryID" }, "name": "categoryID" } ], "body": { "type": "BlockStatement", "start": 1128, "end": 1184, "loc": { "start": { "line": 41, "column": 28 }, "end": { "line": 44, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1134, "end": 1163, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 1134, "end": 1162, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1134, "end": 1149, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 19 } }, "object": { "type": "ThisExpression", "start": 1134, "end": 1138, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 8 } } }, "property": { "type": "Identifier", "start": 1139, "end": 1149, "loc": { "start": { "line": 42, "column": 9 }, "end": { "line": 42, "column": 19 }, "identifierName": "categoryID" }, "name": "categoryID" }, "computed": false }, "right": { "type": "Identifier", "start": 1152, "end": 1162, "loc": { "start": { "line": 42, "column": 22 }, "end": { "line": 42, "column": 32 }, "identifierName": "categoryID" }, "name": "categoryID" } } }, { "type": "ReturnStatement", "start": 1168, "end": 1180, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 1175, "end": 1179, "loc": { "start": { "line": 43, "column": 11 }, "end": { "line": 43, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the featured playlist category fetcher.\n *\n * @param {string} categoryID - The category ID.\n * @return {FeaturedPlaylistCategoryFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#featuredplaylistcategories-category_id\n ", "start": 845, "end": 1099, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 40, "column": 5 } } } ], "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://docs-en.kkbox.codes/v1.1/reference#featuredplaylistcategories-category_id\n ", "start": 1188, "end": 1466, "loc": { "start": { "line": 46, "column": 2 }, "end": { "line": 52, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1469, "end": 1591, "loc": { "start": { "line": 53, "column": 2 }, "end": { "line": 57, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1469, "end": 1482, "loc": { "start": { "line": 53, "column": 2 }, "end": { "line": 53, "column": 15 }, "identifierName": "fetchMetadata" }, "name": "fetchMetadata", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1485, "end": 1591, "loc": { "start": { "line": 53, "column": 18 }, "end": { "line": 57, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 1491, "end": 1587, "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 56, "column": 7 } }, "argument": { "type": "CallExpression", "start": 1498, "end": 1586, "loc": { "start": { "line": 54, "column": 11 }, "end": { "line": 56, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 1498, "end": 1511, "loc": { "start": { "line": 54, "column": 11 }, "end": { "line": 54, "column": 24 } }, "object": { "type": "MemberExpression", "start": 1498, "end": 1507, "loc": { "start": { "line": 54, "column": 11 }, "end": { "line": 54, "column": 20 } }, "object": { "type": "ThisExpression", "start": 1498, "end": 1502, "loc": { "start": { "line": 54, "column": 11 }, "end": { "line": 54, "column": 15 } } }, "property": { "type": "Identifier", "start": 1503, "end": 1507, "loc": { "start": { "line": 54, "column": 16 }, "end": { "line": 54, "column": 20 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1508, "end": 1511, "loc": { "start": { "line": 54, "column": 21 }, "end": { "line": 54, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1512, "end": 1544, "loc": { "start": { "line": 54, "column": 25 }, "end": { "line": 54, "column": 57 } }, "left": { "type": "BinaryExpression", "start": 1512, "end": 1526, "loc": { "start": { "line": 54, "column": 25 }, "end": { "line": 54, "column": 39 } }, "left": { "type": "Identifier", "start": 1512, "end": 1520, "loc": { "start": { "line": 54, "column": 25 }, "end": { "line": 54, "column": 33 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "StringLiteral", "start": 1523,