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,456 lines (1,455 loc) 156 kB
{ "type": "File", "start": 0, "end": 1874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 68, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 68, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 46, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 46 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 26, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 26 } }, "imported": { "type": "Identifier", "start": 8, "end": 14, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 14 }, "identifierName": "ALBUMS" }, "name": "ALBUMS" }, "local": { "type": "Identifier", "start": 18, "end": 26, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 26 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 33, "end": 46, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 46 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 47, "end": 78, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 67, "end": 78, "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 * Fetch metadata and tracks of a album.\n * @see https://docs.kkbox.codes/docs/albums\n ", "start": 80, "end": 173, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 174, "end": 1874, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 68, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 189, "end": 1874, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 68, "column": 1 } }, "id": { "type": "Identifier", "start": 195, "end": 207, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 33 }, "identifierName": "AlbumFetcher" }, "name": "AlbumFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 216, "end": 223, "loc": { "start": { "line": 8, "column": 42 }, "end": { "line": 8, "column": 49 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 224, "end": 1874, "loc": { "start": { "line": 8, "column": 50 }, "end": { "line": 68, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 265, "end": 417, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 265, "end": 276, "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": 277, "end": 281, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 283, "end": 299, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 283, "end": 292, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 295, "end": 299, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 301, "end": 417, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 311, "end": 333, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 311, "end": 333, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 311, "end": 316, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 317, "end": 321, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 323, "end": 332, "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": 343, "end": 377, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 386, "end": 411, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 386, "end": 411, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 386, "end": 399, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 21 } }, "object": { "type": "ThisExpression", "start": 386, "end": 390, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 391, "end": 399, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 21 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 402, "end": 411, "loc": { "start": { "line": 18, "column": 24 }, "end": { "line": 18, "column": 33 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 343, "end": 377, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 234, "end": 260, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} album_id - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://docs.kkbox.codes/docs/albums\n ", "start": 423, "end": 604, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 609, "end": 698, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 609, "end": 619, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 14 }, "identifierName": "setAlbumID" }, "name": "setAlbumID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 620, "end": 628, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 23 }, "identifierName": "album_id" }, "name": "album_id" } ], "body": { "type": "BlockStatement", "start": 630, "end": 698, "loc": { "start": { "line": 28, "column": 25 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 640, "end": 664, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 640, "end": 664, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 640, "end": 653, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 21 } }, "object": { "type": "ThisExpression", "start": 640, "end": 644, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 645, "end": 653, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 21 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false }, "right": { "type": "Identifier", "start": 656, "end": 664, "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 29, "column": 32 }, "identifierName": "album_id" }, "name": "album_id" } } }, { "type": "ReturnStatement", "start": 681, "end": 692, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 688, "end": 692, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Set the album fetcher.\n *\n * @param {string} album_id - The ID of an album.\n * @return {AlbumFetcher}\n * @see https://docs.kkbox.codes/docs/albums\n ", "start": 423, "end": 604, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetcy metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()\n ", "start": 704, "end": 876, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 881, "end": 988, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 881, "end": 894, "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": 897, "end": 988, "loc": { "start": { "line": 39, "column": 20 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 907, "end": 982, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 83 } }, "argument": { "type": "CallExpression", "start": 914, "end": 982, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 83 } }, "callee": { "type": "MemberExpression", "start": 914, "end": 927, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 28 } }, "object": { "type": "MemberExpression", "start": 914, "end": 923, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 914, "end": 918, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 19 } } }, "property": { "type": "Identifier", "start": 919, "end": 923, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 924, "end": 927, "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 928, "end": 952, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 53 } }, "left": { "type": "Identifier", "start": 928, "end": 936, "loc": { "start": { "line": 40, "column": 29 }, "end": { "line": 40, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "MemberExpression", "start": 939, "end": 952, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 53 } }, "object": { "type": "ThisExpression", "start": 939, "end": 943, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 44 } } }, "property": { "type": "Identifier", "start": 944, "end": 952, "loc": { "start": { "line": 40, "column": 45 }, "end": { "line": 40, "column": 53 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false } }, { "type": "ObjectExpression", "start": 954, "end": 981, "loc": { "start": { "line": 40, "column": 55 }, "end": { "line": 40, "column": 82 } }, "properties": [ { "type": "ObjectProperty", "start": 955, "end": 980, "loc": { "start": { "line": 40, "column": 56 }, "end": { "line": 40, "column": 81 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 955, "end": 964, "loc": { "start": { "line": 40, "column": 56 }, "end": { "line": 40, "column": 65 }, "identifierName": "territory" }, "name": "territory" }, "value": { "type": "MemberExpression", "start": 966, "end": 980, "loc": { "start": { "line": 40, "column": 67 }, "end": { "line": 40, "column": 81 } }, "object": { "type": "ThisExpression", "start": 966, "end": 970, "loc": { "start": { "line": 40, "column": 67 }, "end": { "line": 40, "column": 71 } } }, "property": { "type": "Identifier", "start": 971, "end": 980, "loc": { "start": { "line": 40, "column": 72 }, "end": { "line": 40, "column": 81 }, "identifierName": "territory" }, "name": "territory" }, "computed": false } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetcy metadata of the album you create.\n *\n * @return {Promise}\n * @example api.albumFetcher.setAlbumID('KmRKnW5qmUrTnGRuxF').fetchMetadata()\n ", "start": 704, "end": 876, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Get KKBOX web widget uri of the album.\n * @example https://widget.kkbox.com/v1/?id=4qtXcj31wYJTRZbb23&type=album\n * @return {string}\n ", "start": 994, "end": 1153, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 47, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1158, "end": 1256, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 50, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1158, "end": 1170, "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": 1172, "end": 1256, "loc": { "start": { "line": 48, "column": 18 }, "end": { "line": 50, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1182, "end": 1250, "loc": { "start": { "line": 49, "column": 8 }, "end": { "line": 49, "column": 76 } }, "argument": { "type": "TemplateLiteral", "start": 1189, "end": 1250, "loc": { "start": { "line": 49, "column": 15 }, "end": { "line": 49, "column": 76 } }, "expressions": [ { "type": "MemberExpression", "start": 1224, "end": 1237, "loc": { "start": { "line": 49, "column": 50 }, "end": { "line": 49, "column": 63 } }, "object": { "type": "ThisExpression", "start": 1224, "end": 1228, "loc": { "start": { "line": 49, "column": 50 }, "end": { "line": 49, "column": 54 } } }, "property": { "type": "Identifier", "start": 1229, "end": 1237, "loc": { "start": { "line": 49, "column": 55 }, "end": { "line": 49, "column": 63 }, "identifierName": "album_id" }, "name": "album_id" }, "computed": false } ], "quasis": [ { "type": "TemplateElement", "start": 1190, "end": 1222, "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=" }, "tail": false }, { "type": "TemplateElement", "start": 1238, "end": 1249, "loc": {