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,440 lines (1,439 loc) 158 kB
{ "type": "File", "start": 0, "end": 2262, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2262, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "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://kkbox.gelato.io/docs/versions/1.1/resources/shared-playlists\n ", "start": 90, "end": 200, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 201, "end": 2262, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 69, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 216, "end": 2262, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 69, "column": 1 } }, "id": { "type": "Identifier", "start": 222, "end": 243, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 42 }, "identifierName": "SharedPlaylistFetcher" }, "name": "SharedPlaylistFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 252, "end": 259, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 8, "column": 58 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 260, "end": 2262, "loc": { "start": { "line": 8, "column": 59 }, "end": { "line": 69, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 297, "end": 452, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 297, "end": 308, "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": 309, "end": 313, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 315, "end": 331, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 315, "end": 324, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 327, "end": 331, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 333, "end": 452, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 343, "end": 365, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 343, "end": 365, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 343, "end": 348, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 349, "end": 353, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 355, "end": 364, "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": 375, "end": 409, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 418, "end": 446, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 418, "end": 446, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 418, "end": 434, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 24 } }, "object": { "type": "ThisExpression", "start": 418, "end": 422, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 423, "end": 434, "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": 437, "end": 446, "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": 375, "end": 409, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 266, "end": 292, "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://kkbox.gelato.io/docs/versions/1.1/resources/shared-playlists/endpoints/get-shared-playlists-playlist_id\n ", "start": 458, "end": 739, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 744, "end": 837, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 744, "end": 757, "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": 758, "end": 769, "loc": { "start": { "line": 28, "column": 18 }, "end": { "line": 28, "column": 29 }, "identifierName": "playlist_id" }, "name": "playlist_id" } ], "body": { "type": "BlockStatement", "start": 771, "end": 837, "loc": { "start": { "line": 28, "column": 31 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 781, "end": 811, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 38 } }, "expression": { "type": "AssignmentExpression", "start": 781, "end": 811, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 781, "end": 797, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 24 } }, "object": { "type": "ThisExpression", "start": 781, "end": 785, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 786, "end": 797, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 24 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false }, "right": { "type": "Identifier", "start": 800, "end": 811, "loc": { "start": { "line": 29, "column": 27 }, "end": { "line": 29, "column": 38 }, "identifierName": "playlist_id" }, "name": "playlist_id" } } }, { "type": "ReturnStatement", "start": 820, "end": 831, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 827, "end": 831, "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://kkbox.gelato.io/docs/versions/1.1/resources/shared-playlists/endpoints/get-shared-playlists-playlist_id\n ", "start": 458, "end": 739, "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 * @see https://kkbox.gelato.io/docs/versions/1.1/resources/shared-playlists/endpoints/get-shared-playlists-playlist_id\n ", "start": 843, "end": 1183, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1188, "end": 1298, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1188, "end": 1201, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "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": 1204, "end": 1298, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1214, "end": 1292, "loc": { "start": { "line": 41, "column": 8 }, "end": { "line": 41, "column": 86 } }, "argument": { "type": "CallExpression", "start": 1221, "end": 1292, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 86 } }, "callee": { "type": "MemberExpression", "start": 1221, "end": 1234, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1221, "end": 1230, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1221, "end": 1225, "loc": { "start": { "line": 41, "column": 15 }, "end": { "line": 41, "column": 19 } } }, "property": { "type": "Identifier", "start": 1226, "end": 1230, "loc": { "start": { "line": 41, "column": 20 }, "end": { "line": 41, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1231, "end": 1234, "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1235, "end": 1262, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 56 } }, "left": { "type": "Identifier", "start": 1235, "end": 1243, "loc": { "start": { "line": 41, "column": 29 }, "end": { "line": 41, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 1246, "end": 1262, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 56 } }, "object": { "type": "ThisExpression", "start": 1246, "end": 1250, "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 44 } } }, "property": { "type": "Identifier", "start": 1251, "end": 1262, "loc": { "start": { "line": 41, "column": 45 }, "end": { "line": 41, "column": 56 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 1264, "end": 1291, "loc": { "start": { "line": 41, "column": 58 }, "end": { "line": 41, "column": 85 } }, "properties": [ { "type": "ObjectProperty", "start": 1265, "end": 1290, "loc": { "start": { "line": 41, "column": 59 }, "end": { "line": 41, "column": 84 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1265, "end": 1274, "loc": { "start": { "line": 41, "column": 59 }, "end": { "line": 41, "column": 68 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 1276, "end": 1290, "loc": { "start": { "line": 41, "column": 70 }, "end": { "line": 41, "column": 84 } }, "object": { "type": "ThisExpression", "start": 1276, "end": 1280, "loc": { "start": { "line": 41, "column": 70 }, "end": { "line": 41, "column": 74 } } }, "property": { "type": "Identifier", "start": 1281, "end": 1290, "loc": { "start": { "line": 41, "column": 75 }, "end": { "line": 41, "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 * @see https://kkbox.gelato.io/docs/versions/1.1/resources/shared-playlists/endpoints/get-shared-playlists-playlist_id\n ", "start": 843, "end": 1183, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 39, "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": 1304, "end": 1469, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 48, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1474, "end": 1578, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 51, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1474, "end": 1486, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "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": 1488, "end": 1578, "loc": { "start": { "line": 49, "column": 18 }, "end": { "line": 51, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1498, "end": 1572, "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 82 } }, "argument": { "type": "TemplateLiteral", "start": 1505, "end": 1572, "loc": { "start": { "line": 50, "column": 15 }, "end": { "line": 50, "column": 82 } }, "expressions": [ { "type": "MemberExpression", "start": 1540, "end": 1556, "loc": { "start": { "line": 50, "column": 50 }, "end": { "line": 50, "column": 66 } }, "object": { "type": "ThisExpression", "start": 1540, "end": 1544, "loc": { "start": { "line": 50, "column": 50 }, "end": { "line": 50, "column": 54 } } }, "property": { "type": "Identifier", "start": 1545, "end": 1556, "loc": { "start": { "line": 50, "column": 55 }, "end": { "line": 50, "column": 66 }, "identifierName": "playlist_id" }, "name": "playlist_id" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 1506, "end": 1538, "loc": { "start": { "line": 50, "column": 16 },