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,449 lines (1,448 loc) 157 kB
{ "type": "File", "start": 0, "end": 1996, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 68, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1996, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 68, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 56, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 56 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 36, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 36 } }, "imported": { "type": "Identifier", "start": 8, "end": 24, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 24 }, "identifierName": "SHARED_PLAYLISTS" }, "name": "SHARED_PLAYLISTS" }, "local": { "type": "Identifier", "start": 28, "end": 36, "loc": { "start": { "line": 1, "column": 28 }, "end": { "line": 1, "column": 36 }, "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": 57, "end": 88, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 64, "end": 71, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 64, "end": 71, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 77, "end": 88, "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 playlist metadata.\n * @see https://docs.kkbox.codes/docs/shared-playlists\n ", "start": 90, "end": 178, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 179, "end": 1996, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 68, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 194, "end": 1996, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 68, "column": 1 } }, "id": { "type": "Identifier", "start": 200, "end": 221, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 42 }, "identifierName": "SharedPlaylistFetcher" }, "name": "SharedPlaylistFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 230, "end": 237, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 8, "column": 58 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 238, "end": 1996, "loc": { "start": { "line": 8, "column": 59 }, "end": { "line": 68, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 275, "end": 430, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 275, "end": 286, "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": 287, "end": 291, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 293, "end": 309, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 293, "end": 302, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 305, "end": 309, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 311, "end": 430, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 321, "end": 343, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 321, "end": 343, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 321, "end": 326, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 327, "end": 331, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 333, "end": 342, "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": 353, "end": 387, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 396, "end": 424, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 396, "end": 424, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 396, "end": 412, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 396, "end": 400, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 401, "end": 412, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 24 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 415, "end": 424, "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": 353, "end": 387, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 244, "end": 270, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the shared playlist fetcher.\n *\n * @param {string} playlist_id - The ID of a playlist.\n * @return {SharedPlaylistFetcher}\n * @see https://docs.kkbox.codes/docs/shared-playlists\n ", "start": 436, "end": 652, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 657, "end": 750, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 657, "end": 670, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 17 }, "identifierName": "setPlaylistID" }, "name": "setPlaylistID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 671, "end": 682, "loc": { "start": { "line": 28, "column": 18 }, "end": { "line": 28, "column": 29 }, "identifierName": "playlist_id" }, "name": "playlist_id" } ], "body": { "type": "BlockStatement", "start": 684, "end": 750, "loc": { "start": { "line": 28, "column": 31 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 694, "end": 724, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 694, "end": 724, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 694, "end": 710, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 24 } }, "object": { "type": "ThisExpression", "start": 694, "end": 698, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 699, "end": 710, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 24 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false }, "right": { "type": "Identifier", "start": 713, "end": 724, "loc": { "start": { "line": 29, "column": 27 }, "end": { "line": 29, "column": 38 }, "identifierName": "playlist_id" }, "name": "playlist_id" } } }, { "type": "ReturnStatement", "start": 733, "end": 744, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 740, "end": 744, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the shared playlist fetcher.\n *\n * @param {string} playlist_id - The ID of a playlist.\n * @return {SharedPlaylistFetcher}\n * @see https://docs.kkbox.codes/docs/shared-playlists\n ", "start": 436, "end": 652, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the shared playlist with the shared playlist fetcher.\n *\n * @return {Promise}\n * @example api.SharedPlaylistFetcher.setPlaylistID('4nUZM-TY2aVxZ2xaA-').fetchMetadata()\n ", "start": 756, "end": 972, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 977, "end": 1087, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 977, "end": 990, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 39, "column": 17 }, "identifierName": "fetchMetadata" }, "name": "fetchMetadata", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 993, "end": 1087, "loc": { "start": { "line": 39, "column": 20 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1003, "end": 1081, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 86 } }, "argument": { "type": "CallExpression", "start": 1010, "end": 1081, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 86 } }, "callee": { "type": "MemberExpression", "start": 1010, "end": 1023, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1010, "end": 1019, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1010, "end": 1014, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 19 } } }, "property": { "type": "Identifier", "start": 1015, "end": 1019, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1020, "end": 1023, "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1024, "end": 1051, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 56 } }, "left": { "type": "Identifier", "start": 1024, "end": 1032, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1035, "end": 1051, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 56 } }, "object": { "type": "ThisExpression", "start": 1035, "end": 1039, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 44 } } }, "property": { "type": "Identifier", "start": 1040, "end": 1051, "loc": { "start": { "line": 40, "column": 45 }, "end": { "line": 40, "column": 56 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 1053, "end": 1080, "loc": { "start": { "line": 40, "column": 58 }, "end": { "line": 40, "column": 85 } }, "properties": [ { "type": "ObjectProperty", "start": 1054, "end": 1079, "loc": { "start": { "line": 40, "column": 59 }, "end": { "line": 40, "column": 84 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1054, "end": 1063, "loc": { "start": { "line": 40, "column": 59 }, "end": { "line": 40, "column": 68 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1065, "end": 1079, "loc": { "start": { "line": 40, "column": 70 }, "end": { "line": 40, "column": 84 } }, "object": { "type": "ThisExpression", "start": 1065, "end": 1069, "loc": { "start": { "line": 40, "column": 70 }, "end": { "line": 40, "column": 74 } } }, "property": { "type": "Identifier", "start": 1070, "end": 1079, "loc": { "start": { "line": 40, "column": 75 }, "end": { "line": 40, "column": 84 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch metadata of the shared playlist with the shared playlist fetcher.\n *\n * @return {Promise}\n * @example api.SharedPlaylistFetcher.setPlaylistID('4nUZM-TY2aVxZ2xaA-').fetchMetadata()\n ", "start": 756, "end": 972, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get KKBOX web widget uri of the playlist.\n * @example https://widget.kkbox.com/v1/?id=KmjwNXizu5MxHFSloP&type=playlist\n * @return {string}\n ", "start": 1093, "end": 1258, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 47, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1263, "end": 1367, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 50, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1263, "end": 1275, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 16 }, "identifierName": "getWidgetUri" }, "name": "getWidgetUri", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1277, "end": 1367, "loc": { "start": { "line": 48, "column": 18 }, "end": { "line": 50, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1287, "end": 1361, "loc": { "start": { "line": 49, "column": 8 }, "end": { "line": 49, "column": 82 } }, "argument": { "type": "TemplateLiteral", "start": 1294, "end": 1361, "loc": { "start": { "line": 49, "column": 15 }, "end": { "line": 49, "column": 82 } }, "expressions": [ { "type": "MemberExpression", "start": 1329, "end": 1345, "loc": { "start": { "line": 49, "column": 50 }, "end": { "line": 49, "column": 66 } }, "object": { "type": "ThisExpression", "start": 1329, "end": 1333, "loc": { "start": { "line": 49, "column": 50 }, "end": { "line": 49, "column": 54 } } }, "property": { "type": "Identifier", "start": 1334, "end": 1345, "loc": { "start": { "line": 49, "column": 55 }, "end": { "line": 49, "column": 66 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 1295, "end": 1327, "loc": { "start": { "line": 49, "column": 16 }, "end": { "line": 49, "column": 48 } }, "value": { "raw": "https://widget.kkbox.com/v1/?id=", "cooked": "https://widget.kkbox.com/v1/?id=" },