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,428 lines (1,427 loc) 192 kB
{ "type": "File", "start": 0, "end": 2398, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 80, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2398, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 80, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 65, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 65 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 43, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 43 } }, "imported": { "type": "Identifier", "start": 9, "end": 31, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 31 }, "identifierName": "NEW_RELEASE_CATEGORIES" }, "name": "NEW_RELEASE_CATEGORIES" }, "local": { "type": "Identifier", "start": 35, "end": 43, "loc": { "start": { "line": 1, "column": 35 }, "end": { "line": 1, "column": 43 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 51, "end": 64, "loc": { "start": { "line": 1, "column": 51 }, "end": { "line": 1, "column": 64 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 66, "end": 98, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 73, "end": 80, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 73, "end": 80, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 86, "end": 97, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * List categories of new release albums.\n * @see https://docs-en.kkbox.codes/v1.1/reference#new-release-categories\n ", "start": 100, "end": 223, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 224, "end": 2397, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 79, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 239, "end": 2397, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 79, "column": 1 } }, "id": { "type": "Identifier", "start": 245, "end": 270, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 46 }, "identifierName": "NewReleaseCategoryFetcher" }, "name": "NewReleaseCategoryFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 279, "end": 286, "loc": { "start": { "line": 8, "column": 55 }, "end": { "line": 8, "column": 62 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 287, "end": 2397, "loc": { "start": { "line": 8, "column": 63 }, "end": { "line": 79, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 316, "end": 450, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 316, "end": 327, "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": 328, "end": 332, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 334, "end": 350, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 36 } }, "left": { "type": "Identifier", "start": 334, "end": 343, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 346, "end": 350, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 352, "end": 450, "loc": { "start": { "line": 12, "column": 38 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 358, "end": 381, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "CallExpression", "start": 358, "end": 380, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 26 } }, "callee": { "type": "Super", "start": 358, "end": 363, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 364, "end": 368, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 14 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 370, "end": 379, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 25 }, "identifierName": "territory" }, "name": "territory" } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 387, "end": 413, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 418, "end": 446, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 418, "end": 445, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 31 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 418, "end": 433, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 19 } }, "object": { "type": "ThisExpression", "start": 418, "end": 422, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 423, "end": 433, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 19 }, "identifierName": "categoryID" }, "name": "categoryID" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 436, "end": 445, "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": 387, "end": 413, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 291, "end": 313, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all new release categories.\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.newReleaseCategoryFetcher.fetchAllNewReleaseCategories();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newreleasecategories\n ", "start": 454, "end": 801, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 29, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 804, "end": 996, "loc": { "start": { "line": 30, "column": 2 }, "end": { "line": 36, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 804, "end": 832, "loc": { "start": { "line": 30, "column": 2 }, "end": { "line": 30, "column": 30 }, "identifierName": "fetchAllNewReleaseCategories" }, "name": "fetchAllNewReleaseCategories", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 833, "end": 850, "loc": { "start": { "line": 30, "column": 31 }, "end": { "line": 30, "column": 48 } }, "left": { "type": "Identifier", "start": 833, "end": 838, "loc": { "start": { "line": 30, "column": 31 }, "end": { "line": 30, "column": 36 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 841, "end": 850, "loc": { "start": { "line": 30, "column": 39 }, "end": { "line": 30, "column": 48 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 852, "end": 870, "loc": { "start": { "line": 30, "column": 50 }, "end": { "line": 30, "column": 68 } }, "left": { "type": "Identifier", "start": 852, "end": 858, "loc": { "start": { "line": 30, "column": 50 }, "end": { "line": 30, "column": 56 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 861, "end": 870, "loc": { "start": { "line": 30, "column": 59 }, "end": { "line": 30, "column": 68 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 872, "end": 996, "loc": { "start": { "line": 30, "column": 70 }, "end": { "line": 36, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 878, "end": 992, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 35, "column": 7 } }, "argument": { "type": "CallExpression", "start": 885, "end": 991, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 35, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 885, "end": 898, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 24 } }, "object": { "type": "MemberExpression", "start": 885, "end": 894, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 20 } }, "object": { "type": "ThisExpression", "start": 885, "end": 889, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 15 } } }, "property": { "type": "Identifier", "start": 890, "end": 894, "loc": { "start": { "line": 31, "column": 16 }, "end": { "line": 31, "column": 20 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 895, "end": 898, "loc": { "start": { "line": 31, "column": 21 }, "end": { "line": 31, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 899, "end": 907, "loc": { "start": { "line": 31, "column": 25 }, "end": { "line": 31, "column": 33 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 909, "end": 990, "loc": { "start": { "line": 31, "column": 35 }, "end": { "line": 35, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 917, "end": 929, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 18 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 917, "end": 922, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 11 }, "identifierName": "limit" }, "name": "limit" }, "value": { "type": "Identifier", "start": 924, "end": 929, "loc": { "start": { "line": 32, "column": 13 }, "end": { "line": 32, "column": 18 }, "identifierName": "limit" }, "name": "limit" } }, { "type": "ObjectProperty", "start": 937, "end": 951, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 937, "end": 943, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 12 }, "identifierName": "offset" }, "name": "offset" }, "value": { "type": "Identifier", "start": 945, "end": 951, "loc": { "start": { "line": 33, "column": 14 }, "end": { "line": 33, "column": 20 }, "identifierName": "offset" }, "name": "offset" } }, { "type": "ObjectProperty", "start": 959, "end": 984, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 31 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 959, "end": 968, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 15 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 970, "end": 984, "loc": { "start": { "line": 34, "column": 17 }, "end": { "line": 34, "column": 31 } }, "object": { "type": "ThisExpression", "start": 970, "end": 974, "loc": { "start": { "line": 34, "column": 17 }, "end": { "line": 34, "column": 21 } } }, "property": { "type": "Identifier", "start": 975, "end": 984, "loc": { "start": { "line": 34, "column": 22 }, "end": { "line": 34, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all new release categories.\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.newReleaseCategoryFetcher.fetchAllNewReleaseCategories();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newreleasecategories\n ", "start": 454, "end": 801, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 29, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the new release category fetcher.\n *\n * @param {string} categoryID - The category ID.\n * @return {NewReleaseCategoryFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#newreleasecategories-category_id\n ", "start": 1000, "end": 1236, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 44, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1239, "end": 1321, "loc": { "start": { "line": 45, "column": 2 }, "end": { "line": 48, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1239, "end": 1252, "loc": { "start": { "line": 45, "column": 2 }, "end": { "line": 45, "column": 15 }, "identifierName": "setCategoryID" }, "name": "setCategoryID", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1253, "end": 1263, "loc": { "start": { "line": 45, "column": 16 }, "end": { "line": 45, "column": 26 }, "identifierName": "categoryID" }, "name": "categoryID" } ], "body": { "type": "BlockStatement", "start": 1265, "end": 1321, "loc": { "start": { "line": 45, "column": 28 }, "end": { "line": 48, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1271, "end": 1300, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 1271, "end": 1299, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1271, "end": 1286, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 19 } }, "object": { "type": "ThisExpression", "start": 1271, "end": 1275, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 8 } } }, "property": { "type": "Identifier", "start": 1276, "end": 1286, "loc": { "start": { "line": 46, "column": 9 }, "end": { "line": 46, "column": 19 }, "identifierName": "categoryID" }, "name": "categoryID" }, "computed": false }, "right": { "type": "Identifier", "start": 1289, "end": 1299, "loc": { "start": { "line": 46, "column": 22 }, "end": { "line": 46, "column": 32 }, "identifierName": "categoryID" }, "name": "categoryID" } } }, { "type": "ReturnStatement", "start": 1305, "end": 1317, "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 1312, "end": 1316, "loc": { "start": { "line": 47, "column": 11 }, "end": { "line": 47, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the new release category fetcher.\n *\n * @param {string} categoryID - The category ID.\n * @return {NewReleaseCategoryFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#newreleasecategories-category_id\n ", "start": 1000, "end": 1236, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 44, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the new release category you set.\n *\n * @return {Promise}\n * @example api.newReleaseCategoryFetcher.setCategoryID('Cng5IUIQhxb8w1cbsz').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newreleasecategories-category_id\n ", "start": 1325, "end": 1602, "loc": { "start": { "line": 50, "column": 2 }, "end": { "line": 56, "column": 5