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,467 lines (1,466 loc) 225 kB
{ "type": "File", "start": 0, "end": 2946, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 98, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 2946, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 98, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 42, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 42 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 22, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 22 } }, "imported": { "type": "Identifier", "start": 8, "end": 10, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 10 }, "identifierName": "ME" }, "name": "ME" }, "local": { "type": "Identifier", "start": 14, "end": 22, "loc": { "start": { "line": 1, "column": 14 }, "end": { "line": 1, "column": 22 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 29, "end": 42, "loc": { "start": { "line": 1, "column": 29 }, "end": { "line": 1, "column": 42 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 43, "end": 94, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 50, "end": 67, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 24 } }, "local": { "type": "Identifier", "start": 50, "end": 67, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 24 }, "identifierName": "MyPlaylistFetcher" }, "name": "MyPlaylistFetcher" } } ], "source": { "type": "StringLiteral", "start": 73, "end": 94, "loc": { "start": { "line": 2, "column": 30 }, "end": { "line": 2, "column": 51 } }, "extra": { "rawValue": "./MyPlaylistFetcher", "raw": "'./MyPlaylistFetcher'" }, "value": "./MyPlaylistFetcher" } }, { "type": "ImportDeclaration", "start": 95, "end": 126, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 102, "end": 109, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 14 } }, "local": { "type": "Identifier", "start": 102, "end": 109, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 115, "end": 126, "loc": { "start": { "line": 3, "column": 20 }, "end": { "line": 3, "column": 31 } }, "extra": { "rawValue": "./Fetcher", "raw": "'./Fetcher'" }, "value": "./Fetcher", "leadingComments": null, "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self profile.\n * @see https://docs.kkbox.codes/docs/me\n ", "start": 128, "end": 206, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 8, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 207, "end": 2946, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 98, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 222, "end": 2946, "loc": { "start": { "line": 9, "column": 15 }, "end": { "line": 98, "column": 1 } }, "id": { "type": "Identifier", "start": 228, "end": 237, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 30 }, "identifierName": "MeFetcher" }, "name": "MeFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 246, "end": 253, "loc": { "start": { "line": 9, "column": 39 }, "end": { "line": 9, "column": 46 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 254, "end": 2946, "loc": { "start": { "line": 9, "column": 47 }, "end": { "line": 98, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 291, "end": 441, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 20, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 291, "end": 302, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 303, "end": 307, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 20 }, "identifierName": "http" }, "name": "http" } ], "body": { "type": "BlockStatement", "start": 309, "end": 441, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 20, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 319, "end": 330, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 19 } }, "expression": { "type": "CallExpression", "start": 319, "end": 330, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 19 } }, "callee": { "type": "Super", "start": 319, "end": 324, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 325, "end": 329, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 18 }, "identifierName": "http" }, "name": "http" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 340, "end": 374, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 383, "end": 435, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 60 } }, "expression": { "type": "AssignmentExpression", "start": 383, "end": 435, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 60 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 383, "end": 405, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 30 } }, "object": { "type": "ThisExpression", "start": 383, "end": 387, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 388, "end": 405, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 30 }, "identifierName": "MyPlaylistFetcher" }, "name": "MyPlaylistFetcher" }, "computed": false, "leadingComments": null }, "right": { "type": "NewExpression", "start": 408, "end": 435, "loc": { "start": { "line": 19, "column": 33 }, "end": { "line": 19, "column": 60 } }, "callee": { "type": "Identifier", "start": 412, "end": 429, "loc": { "start": { "line": 19, "column": 37 }, "end": { "line": 19, "column": 54 }, "identifierName": "MyPlaylistFetcher" }, "name": "MyPlaylistFetcher" }, "arguments": [ { "type": "Identifier", "start": 430, "end": 434, "loc": { "start": { "line": 19, "column": 55 }, "end": { "line": 19, "column": 59 }, "identifierName": "http" }, "name": "http" } ] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 340, "end": 374, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 18, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 260, "end": 286, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self profile.\n *\n * @return {Promise}\n * @example api.meFetcher.fetchProfile()\n * @see https://docs.kkbox.codes/docs/me\n ", "start": 447, "end": 614, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 28, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 619, "end": 680, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 619, "end": 631, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 }, "identifierName": "fetchProfile" }, "name": "fetchProfile", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 634, "end": 680, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 644, "end": 674, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 38 } }, "argument": { "type": "CallExpression", "start": 651, "end": 674, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 38 } }, "callee": { "type": "MemberExpression", "start": 651, "end": 664, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 28 } }, "object": { "type": "MemberExpression", "start": 651, "end": 660, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 24 } }, "object": { "type": "ThisExpression", "start": 651, "end": 655, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } }, "property": { "type": "Identifier", "start": 656, "end": 660, "loc": { "start": { "line": 30, "column": 20 }, "end": { "line": 30, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 661, "end": 664, "loc": { "start": { "line": 30, "column": 25 }, "end": { "line": 30, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 665, "end": 673, "loc": { "start": { "line": 30, "column": 29 }, "end": { "line": 30, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self profile.\n *\n * @return {Promise}\n * @example api.meFetcher.fetchProfile()\n * @see https://docs.kkbox.codes/docs/me\n ", "start": 447, "end": 614, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 28, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self shared playlists.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.meFetcher.fetchSharedPlaylists()\n * @see https://docs.kkbox.codes/docs/me-shared-playlists\n ", "start": 686, "end": 1012, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 41, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1017, "end": 1210, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 47, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1017, "end": 1037, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 24 }, "identifierName": "fetchSharedPlaylists" }, "name": "fetchSharedPlaylists", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1038, "end": 1055, "loc": { "start": { "line": 42, "column": 25 }, "end": { "line": 42, "column": 42 } }, "left": { "type": "Identifier", "start": 1038, "end": 1043, "loc": { "start": { "line": 42, "column": 25 }, "end": { "line": 42, "column": 30 }, "identifierName": "limit" }, "name": "limit" }, "right": { "type": "Identifier", "start": 1046, "end": 1055, "loc": { "start": { "line": 42, "column": 33 }, "end": { "line": 42, "column": 42 }, "identifierName": "undefined" }, "name": "undefined" } }, { "type": "AssignmentPattern", "start": 1057, "end": 1075, "loc": { "start": { "line": 42, "column": 44 }, "end": { "line": 42, "column": 62 } }, "left": { "type": "Identifier", "start": 1057, "end": 1063, "loc": { "start": { "line": 42, "column": 44 }, "end": { "line": 42, "column": 50 }, "identifierName": "offset" }, "name": "offset" }, "right": { "type": "Identifier", "start": 1066, "end": 1075, "loc": { "start": { "line": 42, "column": 53 }, "end": { "line": 42, "column": 62 }, "identifierName": "undefined" }, "name": "undefined" } } ], "body": { "type": "BlockStatement", "start": 1077, "end": 1210, "loc": { "start": { "line": 42, "column": 64 }, "end": { "line": 47, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 1087, "end": 1204, "loc": { "start": { "line": 43, "column": 8 }, "end": { "line": 46, "column": 10 } }, "argument": { "type": "CallExpression", "start": 1094, "end": 1204, "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 46, "column": 10 } }, "callee": { "type": "MemberExpression", "start": 1094, "end": 1107, "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 28 } }, "object": { "type": "MemberExpression", "start": 1094, "end": 1103, "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 24 } }, "object": { "type": "ThisExpression", "start": 1094, "end": 1098, "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 19 } } }, "property": { "type": "Identifier", "start": 1099, "end": 1103, "loc": { "start": { "line": 43, "column": 20 }, "end": { "line": 43, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 1104, "end": 1107, "loc": { "start": { "line": 43, "column": 25 }, "end": { "line": 43, "column": 28 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "BinaryExpression", "start": 1108, "end": 1137, "loc": { "start": { "line": 43, "column": 29 }, "end": { "line": 43, "column": 58 } }, "left": { "type": "Identifier", "start": 1108, "end": 1116, "loc": { "start": { "line": 43, "column": 29 }, "end": { "line": 43, "column": 37 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, "operator": "+", "right": { "type": "StringLiteral", "start": 1119, "end": 1137, "loc": { "start": { "line": 43, "column": 40 }, "end": { "line": 43, "column": 58 } }, "extra": { "rawValue": "shared-playlists", "raw": "'shared-playlists'" }, "value": "shared-playlists" } }, { "type": "ObjectExpression", "start": 1139, "end": 1203, "loc": { "start": { "line": 43, "column": 60 }, "end": { "line": 46, "column": 9 } }, "properties": [ { "type": "ObjectProperty", "start": 1153, "end": 1165, "loc": { "start": { "line": 44, "column": 12 }, "end": { "line": 44, "column": 24 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1153, "end": 1158, "loc": { "start": { "line": 44, "column": 12 }, "end": { "line": 44, "column": 17 }, "identifierName": "limit" }, "name": "limit" }, "value": { "type": "Identifier", "start": 1160, "end": 1165, "loc": { "start": { "line": 44, "column": 19 }, "end": { "line": 44, "column": 24 }, "identifierName": "limit" }, "name": "limit" } }, { "type": "ObjectProperty", "start": 1179, "end": 1193, "loc": { "start": { "line": 45, "column": 12 }, "end": { "line": 45, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1179, "end": 1185, "loc": { "start": { "line": 45, "column": 12 }, "end": { "line": 45, "column": 18 }, "identifierName": "offset" }, "name": "offset" }, "value": { "type": "Identifier", "start": 1187, "end": 1193, "loc": { "start": { "line": 45, "column": 20 }, "end": { "line": 45, "column": 26 }, "identifierName": "offset" }, "name": "offset" } } ] } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self shared playlists.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.meFetcher.fetchSharedPlaylists()\n * @see https://docs.kkbox.codes/docs/me-shared-playlists\n ", "start": 686, "end": 1012, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 41, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch user's self favorite tracks. The access token must be granted from authorization code flow.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.meFetcher.fetchFavoriteTracks()\n * @see https://docs.kkbox.codes/docs/me-favorite-tracks\n ", "start": 1216, "end": 1602, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 57, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1607, "end": 1791, "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 63, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1607, "end": 1626, "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 58, "column": 23 }, "identifierName": "fetchFavoriteTracks" }, "name": "fetchFavoriteTracks", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1627, "end": 1644, "loc": { "start": { "line": 58, "column": 24 }, "end": { "line": 58, "column": 41 } }, "left": { "type": "Identifier", "start": 1627, "end": 1632,