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,431 lines (1,430 loc) 139 kB
{ "type": "File", "start": 0, "end": 1698, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 63, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1698, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 63, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 57, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 57 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 9, "end": 35, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 35 } }, "imported": { "type": "Identifier", "start": 9, "end": 23, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 23 }, "identifierName": "GENRE_STATIONS" }, "name": "GENRE_STATIONS" }, "local": { "type": "Identifier", "start": 27, "end": 35, "loc": { "start": { "line": 1, "column": 27 }, "end": { "line": 1, "column": 35 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 43, "end": 56, "loc": { "start": { "line": 1, "column": 43 }, "end": { "line": 1, "column": 56 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 58, "end": 90, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 32 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 65, "end": 72, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 65, "end": 72, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 78, "end": 89, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get genre stations.\n * @see https://docs-en.kkbox.codes/v1.1/reference#genre-stations\n ", "start": 92, "end": 188, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 189, "end": 1697, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 62, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 204, "end": 1697, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 62, "column": 1 } }, "id": { "type": "Identifier", "start": 210, "end": 229, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 40 }, "identifierName": "GenreStationFetcher" }, "name": "GenreStationFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 238, "end": 245, "loc": { "start": { "line": 8, "column": 49 }, "end": { "line": 8, "column": 56 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 246, "end": 1697, "loc": { "start": { "line": 8, "column": 57 }, "end": { "line": 62, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 275, "end": 414, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 19, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 275, "end": 286, "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": 287, "end": 291, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 293, "end": 309, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 36 } }, "left": { "type": "Identifier", "start": 293, "end": 302, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 305, "end": 309, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 36 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 311, "end": 414, "loc": { "start": { "line": 12, "column": 38 }, "end": { "line": 19, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 317, "end": 340, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "CallExpression", "start": 317, "end": 339, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 26 } }, "callee": { "type": "Super", "start": 317, "end": 322, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 323, "end": 327, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 14 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 329, "end": 338, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 25 }, "identifierName": "territory" }, "name": "territory" } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 346, "end": 373, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 378, "end": 410, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 378, "end": 409, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 378, "end": 397, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 23 } }, "object": { "type": "ThisExpression", "start": 378, "end": 382, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 383, "end": 397, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 23 }, "identifierName": "genreStationID" }, "name": "genreStationID" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 400, "end": 409, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 18, "column": 35 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 346, "end": 373, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 250, "end": 272, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 11, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all genre stations. The result will be paged.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.genreStationFetcher.fetchAllGenreStations();\n * @see https://docs-en.kkbox.codes/v1.1/reference#genrestations\n ", "start": 418, "end": 764, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 29, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 767, "end": 952, "loc": { "start": { "line": 30, "column": 2 }, "end": { "line": 36, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 767, "end": 788, "loc": { "start": { "line": 30, "column": 2 }, "end": { "line": 30, "column": 23 }, "identifierName": "fetchAllGenreStations" }, "name": "fetchAllGenreStations", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 789, "end": 806, "loc": { "start": { "line": 30, "column": 24 }, "end": { "line": 30, "column": 41 } }, "left": { "type": "Identifier", "start": 789, "end": 794, "loc": { "start": { "line": 30, "column": 24 }, "end": { "line": 30, "column": 29 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 797, "end": 806, "loc": { "start": { "line": 30, "column": 32 }, "end": { "line": 30, "column": 41 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 808, "end": 826, "loc": { "start": { "line": 30, "column": 43 }, "end": { "line": 30, "column": 61 } }, "left": { "type": "Identifier", "start": 808, "end": 814, "loc": { "start": { "line": 30, "column": 43 }, "end": { "line": 30, "column": 49 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 817, "end": 826, "loc": { "start": { "line": 30, "column": 52 }, "end": { "line": 30, "column": 61 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 828, "end": 952, "loc": { "start": { "line": 30, "column": 63 }, "end": { "line": 36, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 834, "end": 948, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 35, "column": 7 } }, "argument": { "type": "CallExpression", "start": 841, "end": 947, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 35, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 841, "end": 854, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 24 } }, "object": { "type": "MemberExpression", "start": 841, "end": 850, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 20 } }, "object": { "type": "ThisExpression", "start": 841, "end": 845, "loc": { "start": { "line": 31, "column": 11 }, "end": { "line": 31, "column": 15 } } }, "property": { "type": "Identifier", "start": 846, "end": 850, "loc": { "start": { "line": 31, "column": 16 }, "end": { "line": 31, "column": 20 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 851, "end": 854, "loc": { "start": { "line": 31, "column": 21 }, "end": { "line": 31, "column": 24 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 855, "end": 863, "loc": { "start": { "line": 31, "column": 25 }, "end": { "line": 31, "column": 33 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 865, "end": 946, "loc": { "start": { "line": 31, "column": 35 }, "end": { "line": 35, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 873, "end": 898, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 31 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 873, "end": 882, "loc": { "start": { "line": 32, "column": 6 }, "end": { "line": 32, "column": 15 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 884, "end": 898, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 31 } }, "object": { "type": "ThisExpression", "start": 884, "end": 888, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 21 } } }, "property": { "type": "Identifier", "start": 889, "end": 898, "loc": { "start": { "line": 32, "column": 22 }, "end": { "line": 32, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } }, { "type": "ObjectProperty", "start": 906, "end": 918, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 18 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 906, "end": 911, "loc": { "start": { "line": 33, "column": 6 }, "end": { "line": 33, "column": 11 }, "identifierName": "limit" }, "name": "limit" }, "value": { "type": "Identifier", "start": 913, "end": 918, "loc": { "start": { "line": 33, "column": 13 }, "end": { "line": 33, "column": 18 }, "identifierName": "limit" }, "name": "limit" } }, { "type": "ObjectProperty", "start": 926, "end": 940, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 926, "end": 932, "loc": { "start": { "line": 34, "column": 6 }, "end": { "line": 34, "column": 12 }, "identifierName": "offset" }, "name": "offset" }, "value": { "type": "Identifier", "start": 934, "end": 940, "loc": { "start": { "line": 34, "column": 14 }, "end": { "line": 34, "column": 20 }, "identifierName": "offset" }, "name": "offset" } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch all genre stations. The result will be paged.\n *\n * @param {number} [limit] - The size for one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.genreStationFetcher.fetchAllGenreStations();\n * @see https://docs-en.kkbox.codes/v1.1/reference#genrestations\n ", "start": 418, "end": 764, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 29, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genreStationID - The ID of a genre station.\n * @return {GenreStation}\n * @see https://docs-en.kkbox.codes/v1.1/reference#genrestations-station_id\n ", "start": 956, "end": 1178, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 44, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 1181, "end": 1279, "loc": { "start": { "line": 45, "column": 2 }, "end": { "line": 48, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 1181, "end": 1198, "loc": { "start": { "line": 45, "column": 2 }, "end": { "line": 45, "column": 19 }, "identifierName": "setGenreStationID" }, "name": "setGenreStationID", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1199, "end": 1213, "loc": { "start": { "line": 45, "column": 20 }, "end": { "line": 45, "column": 34 }, "identifierName": "genreStationID" }, "name": "genreStationID" } ], "body": { "type": "BlockStatement", "start": 1215, "end": 1279, "loc": { "start": { "line": 45, "column": 36 }, "end": { "line": 48, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1221, "end": 1258, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 41 } }, "expression": { "type": "AssignmentExpression", "start": 1221, "end": 1257, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 40 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1221, "end": 1240, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 23 } }, "object": { "type": "ThisExpression", "start": 1221, "end": 1225, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 8 } } }, "property": { "type": "Identifier", "start": 1226, "end": 1240, "loc": { "start": { "line": 46, "column": 9 }, "end": { "line": 46, "column": 23 }, "identifierName": "genreStationID" }, "name": "genreStationID" }, "computed": false }, "right": { "type": "Identifier", "start": 1243, "end": 1257, "loc": { "start": { "line": 46, "column": 26 }, "end": { "line": 46, "column": 40 }, "identifierName": "genreStationID" }, "name": "genreStationID" } } }, { "type": "ReturnStatement", "start": 1263, "end": 1275, "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 1270, "end": 1274, "loc": { "start": { "line": 47, "column": 11 }, "end": { "line": 47, "column": 15 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genreStationID - The ID of a genre station.\n * @return {GenreStation}\n * @see https://docs-en.kkbox.codes/v1.1/reference#genrestations-station_id\n ", "start": 956, "end": 1178, "loc": { "start": { "line": 38, "column": 2 }, "end": { "line": 44, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the genre station with the genre station fetcher.\n *\n * @return {Promise}\n * @example api.genreStationFetcher.setGenreStationID('TYq3EHFTl-1EOvJM5Y').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#genrestations-station_id\n ", "start": 1283, "end": 1566, "loc": { "start": { "line": 50, "column": 2 }, "end": { "line": 56, "column": 5 } } }