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,420 lines 184 kB
{ "type": "File", "start": 0, "end": 2749, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2749, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 62, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 62 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 42, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 42 } }, "imported": { "type": "Identifier", "start": 8, "end": 30, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 30 }, "identifierName": "NEW_RELEASE_CATEGORIES" }, "name": "NEW_RELEASE_CATEGORIES" }, "local": { "type": "Identifier", "start": 34, "end": 42, "loc": { "start": { "line": 1, "column": 34 }, "end": { "line": 1, "column": 42 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 49, "end": 62, "loc": { "start": { "line": 1, "column": 49 }, "end": { "line": 1, "column": 62 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 63, "end": 94, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 70, "end": 77, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 70, "end": 77, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 83, "end": 94, "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 categories of new release albums.\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/new-release-categories\n ", "start": 96, "end": 228, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 229, "end": 2749, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 77, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 244, "end": 2749, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 77, "column": 1 } }, "id": { "type": "Identifier", "start": 250, "end": 275, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 46 }, "identifierName": "NewReleaseCategoryFetcher" }, "name": "NewReleaseCategoryFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 284, "end": 291, "loc": { "start": { "line": 8, "column": 55 }, "end": { "line": 8, "column": 62 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 292, "end": 2749, "loc": { "start": { "line": 8, "column": 63 }, "end": { "line": 77, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 329, "end": 484, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 329, "end": 340, "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": 341, "end": 345, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 347, "end": 363, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 347, "end": 356, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 359, "end": 363, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 365, "end": 484, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 375, "end": 397, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 375, "end": 397, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 375, "end": 380, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 381, "end": 385, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 387, "end": 396, "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": 407, "end": 441, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 450, "end": 478, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 450, "end": 478, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 450, "end": 466, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 450, "end": 454, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 455, "end": 466, "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": 469, "end": 478, "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": 407, "end": 441, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 298, "end": 324, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "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://kkbox.gelato.io/docs/versions/1.1/resources/new-release-categories/endpoints/get-new-release-categories\n ", "start": 490, "end": 900, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 29, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 905, "end": 1124, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 36, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 905, "end": 933, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 32 }, "identifierName": "fetchAllNewReleaseCategories" }, "name": "fetchAllNewReleaseCategories", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 934, "end": 951, "loc": { "start": { "line": 30, "column": 33 }, "end": { "line": 30, "column": 50 } }, "left": { "type": "Identifier", "start": 934, "end": 939, "loc": { "start": { "line": 30, "column": 33 }, "end": { "line": 30, "column": 38 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 942, "end": 951, "loc": { "start": { "line": 30, "column": 41 }, "end": { "line": 30, "column": 50 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 953, "end": 971, "loc": { "start": { "line": 30, "column": 52 }, "end": { "line": 30, "column": 70 } }, "left": { "type": "Identifier", "start": 953, "end": 959, "loc": { "start": { "line": 30, "column": 52 }, "end": { "line": 30, "column": 58 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 962, "end": 971, "loc": { "start": { "line": 30, "column": 61 }, "end": { "line": 30, "column": 70 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 973, "end": 1124, "loc": { "start": { "line": 30, "column": 72 }, "end": { "line": 36, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 983, "end": 1118, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 35, "column": 10 } }, "argument": { "type": "CallExpression", "start": 990, "end": 1118, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 35, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 990, "end": 1003, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 28 } }, "object": { "type": "MemberExpression", "start": 990, "end": 999, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 24 } }, "object": { "type": "ThisExpression", "start": 990, "end": 994, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 19 } } }, "property": { "type": "Identifier", "start": 995, "end": 999, "loc": { "start": { "line": 31, "column": 20 }, "end": { "line": 31, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1000, "end": 1003, "loc": { "start": { "line": 31, "column": 25 }, "end": { "line": 31, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 1004, "end": 1012, "loc": { "start": { "line": 31, "column": 29 }, "end": { "line": 31, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 1014, "end": 1117, "loc": { "start": { "line": 31, "column": 39 }, "end": { "line": 35, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 1028, "end": 1040, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 24 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1028, "end": 1033, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 17 }, "identifierName": "limit" }, "name": "limit" }, "value": { "type": "Identifier", "start": 1035, "end": 1040, "loc": { "start": { "line": 32, "column": 19 }, "end": { "line": 32, "column": 24 }, "identifierName": "limit" }, "name": "limit" } }, { "type": "ObjectProperty", "start": 1054, "end": 1068, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1054, "end": 1060, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 18 }, "identifierName": "offset" }, "name": "offset" }, "value": { "type": "Identifier", "start": 1062, "end": 1068, "loc": { "start": { "line": 33, "column": 20 }, "end": { "line": 33, "column": 26 }, "identifierName": "offset" }, "name": "offset" } }, { "type": "ObjectProperty", "start": 1082, "end": 1107, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 37 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1082, "end": 1091, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 21 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1093, "end": 1107, "loc": { "start": { "line": 34, "column": 23 }, "end": { "line": 34, "column": 37 } }, "object": { "type": "ThisExpression", "start": 1093, "end": 1097, "loc": { "start": { "line": 34, "column": 23 }, "end": { "line": 34, "column": 27 } } }, "property": { "type": "Identifier", "start": 1098, "end": 1107, "loc": { "start": { "line": 34, "column": 28 }, "end": { "line": 34, "column": 37 }, "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://kkbox.gelato.io/docs/versions/1.1/resources/new-release-categories/endpoints/get-new-release-categories\n ", "start": 490, "end": 900, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 29, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the new release category fetcher.\n *\n * @param {string} category_id - The category ID.\n * @return {NewReleaseCategoryFetcher}\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/new-release-categories/endpoints/get-new-release-categories-category_id\n ", "start": 1130, "end": 1427, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 44, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1432, "end": 1533, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 48, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1432, "end": 1445, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 17 }, "identifierName": "setCategoryID" }, "name": "setCategoryID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1446, "end": 1457, "loc": { "start": { "line": 45, "column": 18 }, "end": { "line": 45, "column": 29 }, "identifierName": "category_id" }, "name": "category_id" } ], "body": { "type": "BlockStatement", "start": 1459, "end": 1533, "loc": { "start": { "line": 45, "column": 31 }, "end": { "line": 48, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1469, "end": 1499, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 1469, "end": 1499, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1469, "end": 1485, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1469, "end": 1473, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 12 } } }, "property": { "type": "Identifier", "start": 1474, "end": 1485, "loc": { "start": { "line": 46, "column": 13 }, "end": { "line": 46, "column": 24 }, "identifierName": "category_id" }, "name": "category_id" }, "computed": false }, "right": { "type": "Identifier", "start": 1488, "end": 1499, "loc": { "start": { "line": 46, "column": 27 }, "end": { "line": 46, "column": 38 }, "identifierName": "category_id" }, "name": "category_id" } } }, { "type": "ReturnStatement", "start": 1516, "end": 1527, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 1523, "end": 1527, "loc": { "start": { "line": 47, "column": 15 }, "end": { "line": 47, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the new release category fetcher.\n *\n * @param {string} category_id - The category ID.\n * @return {NewReleaseCategoryFetcher}\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/new-release-categories/endpoints/get-new-release-categories-category_id\n ", "start": 1130, "end": 1427, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 44, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the new release category you set.\n *\n * @return {Promise}\n * @example api.newReleaseCategoryFetcher.setCategoryID('Cng5IUIQhxb8w1cbsz').f