UNPKG

@kkboxorg/kkbox-javascript-developer-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,430 lines (1,429 loc) 132 kB
{ "type": "File", "start": 0, "end": 1704, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 59, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1704, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 59, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 54, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 54 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 34, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 34 } }, "imported": { "type": "Identifier", "start": 8, "end": 22, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 22 }, "identifierName": "GENRE_STATIONS" }, "name": "GENRE_STATIONS" }, "local": { "type": "Identifier", "start": 26, "end": 34, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 1, "column": 34 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 41, "end": 54, "loc": { "start": { "line": 1, "column": 41 }, "end": { "line": 1, "column": 54 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 55, "end": 86, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 62, "end": 69, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 62, "end": 69, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 75, "end": 86, "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 * Get genre stations.\n * @see https://docs.kkbox.codes/docs/genre-stations-genre\n ", "start": 88, "end": 177, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 178, "end": 1704, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 59, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 193, "end": 1704, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 59, "column": 1 } }, "id": { "type": "Identifier", "start": 199, "end": 218, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 40 }, "identifierName": "GenreStationFetcher" }, "name": "GenreStationFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 227, "end": 234, "loc": { "start": { "line": 8, "column": 49 }, "end": { "line": 8, "column": 56 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 235, "end": 1704, "loc": { "start": { "line": 8, "column": 57 }, "end": { "line": 59, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 272, "end": 434, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 272, "end": 283, "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": 284, "end": 288, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 290, "end": 306, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 290, "end": 299, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 302, "end": 306, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 308, "end": 434, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 318, "end": 340, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 318, "end": 340, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 318, "end": 323, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 324, "end": 328, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 330, "end": 339, "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": 350, "end": 385, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 394, "end": 427, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 41 } }, "expression": { "type": "AssignmentExpression", "start": 394, "end": 427, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 394, "end": 415, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 29 } }, "object": { "type": "ThisExpression", "start": 394, "end": 398, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 399, "end": 415, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 29 }, "identifierName": "genre_station_id" }, "name": "genre_station_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 418, "end": 427, "loc": { "start": { "line": 18, "column": 32 }, "end": { "line": 18, "column": 41 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 350, "end": 385, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 241, "end": 267, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "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.GenreStation.fetchAllGenreStations()\n * @see https://docs.kkbox.codes/docs/genre-stations-genre\n ", "start": 440, "end": 788, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 29, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 793, "end": 1017, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 36, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 793, "end": 814, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 25 }, "identifierName": "fetchAllGenreStations" }, "name": "fetchAllGenreStations", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 815, "end": 832, "loc": { "start": { "line": 30, "column": 26 }, "end": { "line": 30, "column": 43 } }, "left": { "type": "Identifier", "start": 815, "end": 820, "loc": { "start": { "line": 30, "column": 26 }, "end": { "line": 30, "column": 31 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 823, "end": 832, "loc": { "start": { "line": 30, "column": 34 }, "end": { "line": 30, "column": 43 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 834, "end": 852, "loc": { "start": { "line": 30, "column": 45 }, "end": { "line": 30, "column": 63 } }, "left": { "type": "Identifier", "start": 834, "end": 840, "loc": { "start": { "line": 30, "column": 45 }, "end": { "line": 30, "column": 51 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 843, "end": 852, "loc": { "start": { "line": 30, "column": 54 }, "end": { "line": 30, "column": 63 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 854, "end": 1017, "loc": { "start": { "line": 30, "column": 65 }, "end": { "line": 36, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 864, "end": 1011, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 35, "column": 10 } }, "argument": { "type": "CallExpression", "start": 871, "end": 1011, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 35, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 871, "end": 884, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 28 } }, "object": { "type": "MemberExpression", "start": 871, "end": 880, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 24 } }, "object": { "type": "ThisExpression", "start": 871, "end": 875, "loc": { "start": { "line": 31, "column": 15 }, "end": { "line": 31, "column": 19 } } }, "property": { "type": "Identifier", "start": 876, "end": 880, "loc": { "start": { "line": 31, "column": 20 }, "end": { "line": 31, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 881, "end": 884, "loc": { "start": { "line": 31, "column": 25 }, "end": { "line": 31, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 885, "end": 893, "loc": { "start": { "line": 31, "column": 29 }, "end": { "line": 31, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 895, "end": 1010, "loc": { "start": { "line": 31, "column": 39 }, "end": { "line": 35, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 909, "end": 934, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 37 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 909, "end": 918, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 21 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 920, "end": 934, "loc": { "start": { "line": 32, "column": 23 }, "end": { "line": 32, "column": 37 } }, "object": { "type": "ThisExpression", "start": 920, "end": 924, "loc": { "start": { "line": 32, "column": 23 }, "end": { "line": 32, "column": 27 } } }, "property": { "type": "Identifier", "start": 925, "end": 934, "loc": { "start": { "line": 32, "column": 28 }, "end": { "line": 32, "column": 37 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } }, { "type": "ObjectProperty", "start": 948, "end": 960, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 24 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 948, "end": 953, "loc": { "start": { "line": 33, "column": 12 }, "end": { "line": 33, "column": 17 }, "identifierName": "limit" }, "name": "limit" }, "value": { "type": "Identifier", "start": 955, "end": 960, "loc": { "start": { "line": 33, "column": 19 }, "end": { "line": 33, "column": 24 }, "identifierName": "limit" }, "name": "limit" } }, { "type": "ObjectProperty", "start": 974, "end": 988, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 974, "end": 980, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 34, "column": 18 }, "identifierName": "offset" }, "name": "offset" }, "value": { "type": "Identifier", "start": 982, "end": 988, "loc": { "start": { "line": 34, "column": 20 }, "end": { "line": 34, "column": 26 }, "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.GenreStation.fetchAllGenreStations()\n * @see https://docs.kkbox.codes/docs/genre-stations-genre\n ", "start": 440, "end": 788, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 29, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genre_station_id - The ID of a genre station.\n * @return {GenreStation}\n * @see https://docs.kkbox.codes/docs/genre-stations-station\n ", "start": 1023, "end": 1244, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 44, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1249, "end": 1369, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 48, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1249, "end": 1266, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 21 }, "identifierName": "setGenreStationID" }, "name": "setGenreStationID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 1267, "end": 1283, "loc": { "start": { "line": 45, "column": 22 }, "end": { "line": 45, "column": 38 }, "identifierName": "genre_station_id" }, "name": "genre_station_id" } ], "body": { "type": "BlockStatement", "start": 1285, "end": 1369, "loc": { "start": { "line": 45, "column": 40 }, "end": { "line": 48, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1295, "end": 1335, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 48 } }, "expression": { "type": "AssignmentExpression", "start": 1295, "end": 1335, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 48 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1295, "end": 1316, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 29 } }, "object": { "type": "ThisExpression", "start": 1295, "end": 1299, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 12 } } }, "property": { "type": "Identifier", "start": 1300, "end": 1316, "loc": { "start": { "line": 46, "column": 13 }, "end": { "line": 46, "column": 29 }, "identifierName": "genre_station_id" }, "name": "genre_station_id" }, "computed": false }, "right": { "type": "Identifier", "start": 1319, "end": 1335, "loc": { "start": { "line": 46, "column": 32 }, "end": { "line": 46, "column": 48 }, "identifierName": "genre_station_id" }, "name": "genre_station_id" } } }, { "type": "ReturnStatement", "start": 1352, "end": 1363, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 1359, "end": 1363, "loc": { "start": { "line": 47, "column": 15 }, "end": { "line": 47, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the genre station fetcher.\n *\n * @param {string} genre_station_id - The ID of a genre station.\n * @return {GenreStation}\n * @see https://docs.kkbox.codes/docs/genre-stations-station\n ", "start": 1023, "end": 1244, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 44, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the genre station with the genre station fetcher.\n *\n * @return {Promise}\n * @example api.GenreStation.setGenreStationID('TYq3EHFTl-1EOvJM5Y').fetchMetadata()\n ", "start": 1375, "end": 1582, "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 55,