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,698 lines 42.3 kB
{ "type": "File", "start": 0, "end": 479, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 24, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 479, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 24, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 70, "end": 479, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 24, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 85, "end": 479, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 24, "column": 1 } }, "id": { "type": "Identifier", "start": 91, "end": 108, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 38 }, "identifierName": "ClientCredentials" }, "name": "ClientCredentials", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 109, "end": 479, "loc": { "start": { "line": 4, "column": 39 }, "end": { "line": 24, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 146, "end": 242, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 13, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 146, "end": 157, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 158, "end": 163, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 21 }, "identifierName": "token" }, "name": "token" } ], "body": { "type": "BlockStatement", "start": 165, "end": 242, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 13, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 218, "end": 236, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 218, "end": 236, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 218, "end": 228, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 18 } }, "object": { "type": "ThisExpression", "start": 218, "end": 222, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 223, "end": 228, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 18 }, "identifierName": "token" }, "name": "token" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 231, "end": 236, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 26 }, "identifierName": "token" }, "name": "token" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 175, "end": 209, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 11, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 115, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentials.fetchAccessToken()\n ", "start": 248, "end": 376, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 20, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 381, "end": 477, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 23, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 381, "end": 397, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 20 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 400, "end": 477, "loc": { "start": { "line": 21, "column": 23 }, "end": { "line": 23, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 410, "end": 471, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 69 } }, "argument": { "type": "CallExpression", "start": 417, "end": 471, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 69 } }, "callee": { "type": "MemberExpression", "start": 417, "end": 435, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 33 } }, "object": { "type": "MemberExpression", "start": 417, "end": 427, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 25 } }, "object": { "type": "ThisExpression", "start": 417, "end": 421, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 19 } } }, "property": { "type": "Identifier", "start": 422, "end": 427, "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 25 }, "identifierName": "token" }, "name": "token" }, "computed": false }, "property": { "type": "Identifier", "start": 428, "end": 435, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 22, "column": 33 }, "identifierName": "request" }, "name": "request" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 436, "end": 470, "loc": { "start": { "line": 22, "column": 34 }, "end": { "line": 22, "column": 68 } }, "properties": [ { "type": "ObjectProperty", "start": 437, "end": 469, "loc": { "start": { "line": 22, "column": 35 }, "end": { "line": 22, "column": 67 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 437, "end": 447, "loc": { "start": { "line": 22, "column": 35 }, "end": { "line": 22, "column": 45 }, "identifierName": "grant_type" }, "name": "grant_type" }, "value": { "type": "StringLiteral", "start": 449, "end": 469, "loc": { "start": { "line": 22, "column": 47 }, "end": { "line": 22, "column": 67 } }, "extra": { "rawValue": "client_credentials", "raw": "'client_credentials'" }, "value": "client_credentials" } } ] } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentials.fetchAccessToken()\n ", "start": 248, "end": 376, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 20, "column": 7 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 69, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 69, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 69, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 115, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 175, "end": 209, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 11, "column": 11 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentials.fetchAccessToken()\n ", "start": 248, "end": 376, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 20, "column": 7 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * @see https://docs.kkbox.codes/docs/client-credentials-flow\n ", "start": 0, "end": 69, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 70, "end": 76, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 77, "end": 84, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 14 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 85, "end": 90, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ClientCredentials", "start": 91, "end": 108, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 38 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 109, "end": 110, "loc": { "start": { "line": 4, "column": 39 }, "end": { "line": 4, "column": 40 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 115, "end": 141, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 7, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 146, "end": 157, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 157, "end": 158, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 158, "end": 163, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 21 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 163, "end": 164, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 22 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 165, "end": 166, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 24 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 175, "end": 209, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 11, "column": 11 } } }, { "type": { "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "this", "start": 218, "end": 222, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 222, "end": 223, "loc": { "start": { "line": 12, "column": 12 }, "end": { "line": 12, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 223, "end": 228, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 18 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 229, "end": 230, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 12, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 231, "end": 236, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 26 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 241, "end": 242, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentials.fetchAccessToken()\n ", "start": 248, "end": 376, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 20, "column": 7 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fetchAccessToken", "start": 381, "end": 397, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 20 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 397, "end": 398, "loc": { "start": { "line": 21, "column": 20 }, "end": { "line": 21, "column": 21 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 398, "end": 399, "loc": { "start": { "line": 21, "column": 21 }, "end": { "line": 21, "column": 22 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 400, "end": 401, "loc": { "start": { "line": 21, "column": 23 }, "end": { "line": 21, "column": 24 } } }, { "type": { "label": "return", "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "return", "start": 410, "end": 416, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 14 } } }, { "type": { "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "this", "start": 417, "end": 421, "loc": { "start": { "line": 22, "column": 15 }, "end": { "line": 22, "column": 19 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 421, "end": 422, "loc": { "start": { "line": 22, "column": 19 }, "end": { "line": 22, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 422, "end": 427, "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 25 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 427, "end": 428, "loc": { "start": { "line": 22, "column": 25 }, "end": { "line": 22, "column": 26 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "request", "start": 428, "end": 435, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 22, "column": 33 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 435, "end": 436, "loc": { "start": { "line": 22, "column": 33 }, "end": { "line": 22, "column": 34 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 436, "end": 437, "loc": { "start": { "line": 22, "column": 34 }, "end": { "line": 22, "column": 35 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "grant_type", "start": 437, "end": 447, "loc": { "start": { "line": 22, "column": 35 }, "end": { "line": 22, "column": 45 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 447, "end": 448, "loc": { "start": { "line": 22, "column": 45 }, "end": { "line": 22, "column": 46 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "client_credentials", "start": 449, "end": 469, "loc": { "start": { "line": 22, "column": 47 }, "end": { "line": 22, "column": 67 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 469, "end": 470, "loc": { "start": { "line": 22, "column": 67 }, "end": { "line": 22, "column": 68 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 470, "end": 471, "loc": { "start": { "line": 22, "column": 68 }, "end": { "line": 22, "column": 69 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 476, "end": 477, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 5 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 478, "end": 479, "loc": { "start": { "line": 24, "column": 0 }, "end": { "line": 24, "column": 1 } } }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 479, "end": 479, "loc": { "start": { "line": 24, "column": 1 }, "end": { "line": 24, "column": 1 } } } ] }