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,750 lines 43.8 kB
{ "type": "File", "start": 0, "end": 579, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 29, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 579, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 29, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 183, "end": 578, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 28, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 198, "end": 578, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 28, "column": 1 } }, "id": { "type": "Identifier", "start": 204, "end": 225, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 42 }, "identifierName": "ClientCredentialsFlow" }, "name": "ClientCredentialsFlow", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 226, "end": 578, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 28, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 255, "end": 334, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 15, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 255, "end": 266, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 267, "end": 272, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 19 }, "identifierName": "token" }, "name": "token" } ], "body": { "type": "BlockStatement", "start": 274, "end": 334, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 15, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 311, "end": 330, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 23 } }, "expression": { "type": "AssignmentExpression", "start": 311, "end": 329, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 311, "end": 321, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 14 } }, "object": { "type": "ThisExpression", "start": 311, "end": 315, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 316, "end": 321, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 14 }, "identifierName": "token" }, "name": "token" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 324, "end": 329, "loc": { "start": { "line": 14, "column": 17 }, "end": { "line": 14, "column": 22 }, "identifierName": "token" }, "name": "token" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 280, "end": 306, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 7 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 230, "end": 252, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 9, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken();\n ", "start": 338, "end": 461, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 22, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 464, "end": 576, "loc": { "start": { "line": 23, "column": 2 }, "end": { "line": 27, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 464, "end": 480, "loc": { "start": { "line": 23, "column": 2 }, "end": { "line": 23, "column": 18 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 483, "end": 576, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 27, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 489, "end": 572, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 7 } }, "argument": { "type": "CallExpression", "start": 496, "end": 571, "loc": { "start": { "line": 24, "column": 11 }, "end": { "line": 26, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 496, "end": 523, "loc": { "start": { "line": 24, "column": 11 }, "end": { "line": 24, "column": 38 } }, "object": { "type": "MemberExpression", "start": 496, "end": 506, "loc": { "start": { "line": 24, "column": 11 }, "end": { "line": 24, "column": 21 } }, "object": { "type": "ThisExpression", "start": 496, "end": 500, "loc": { "start": { "line": 24, "column": 11 }, "end": { "line": 24, "column": 15 } } }, "property": { "type": "Identifier", "start": 501, "end": 506, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 21 }, "identifierName": "token" }, "name": "token" }, "computed": false }, "property": { "type": "Identifier", "start": 507, "end": 523, "loc": { "start": { "line": 24, "column": 22 }, "end": { "line": 24, "column": 38 }, "identifierName": "fetchAccessToken" }, "name": "fetchAccessToken" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 524, "end": 570, "loc": { "start": { "line": 24, "column": 39 }, "end": { "line": 26, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 532, "end": 564, "loc": { "start": { "line": 25, "column": 6 }, "end": { "line": 25, "column": 38 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 532, "end": 542, "loc": { "start": { "line": 25, "column": 6 }, "end": { "line": 25, "column": 16 }, "identifierName": "grant_type" }, "name": "grant_type" }, "value": { "type": "StringLiteral", "start": 544, "end": 564, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 38 } }, "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.clientCredentialsFlow.fetchAccessToken();\n ", "start": 338, "end": 461, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 22, "column": 5 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs-en.kkbox.codes/docs/getting-started\n ", "start": 0, "end": 182, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs-en.kkbox.codes/docs/getting-started\n ", "start": 0, "end": 182, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs-en.kkbox.codes/docs/getting-started\n ", "start": 0, "end": 182, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 230, "end": 252, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 9, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 280, "end": 306, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken();\n ", "start": 338, "end": 461, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 22, "column": 5 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Implements the client credentials flow. Used for accessing APIs that don't need any KKBOX\n * user's personal data.\n * @see https://docs-en.kkbox.codes/docs/getting-started\n ", "start": 0, "end": 182, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 5, "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": 183, "end": 189, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "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": 190, "end": 197, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "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": 198, "end": 203, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 6, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ClientCredentialsFlow", "start": 204, "end": 225, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 42 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 226, "end": 227, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 6, "column": 44 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 230, "end": 252, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 9, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 255, "end": 266, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 13 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 266, "end": 267, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 14 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 267, "end": 272, "loc": { "start": { "line": 10, "column": 14 }, "end": { "line": 10, "column": 19 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 272, "end": 273, "loc": { "start": { "line": 10, "column": 19 }, "end": { "line": 10, "column": 20 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 274, "end": 275, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 22 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 280, "end": 306, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 7 } } }, { "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": 311, "end": 315, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 315, "end": 316, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 316, "end": 321, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 14 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 322, "end": 323, "loc": { "start": { "line": 14, "column": 15 }, "end": { "line": 14, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 324, "end": 329, "loc": { "start": { "line": 14, "column": 17 }, "end": { "line": 14, "column": 22 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 329, "end": 330, "loc": { "start": { "line": 14, "column": 22 }, "end": { "line": 14, "column": 23 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 333, "end": 334, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * Fetch access token.\n *\n * @return {Promise}\n * @example auth.clientCredentialsFlow.fetchAccessToken();\n ", "start": 338, "end": 461, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 22, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fetchAccessToken", "start": 464, "end": 480, "loc": { "start": { "line": 23, "column": 2 }, "end": { "line": 23, "column": 18 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 480, "end": 481, "loc": { "start": { "line": 23, "column": 18 }, "end": { "line": 23, "column": 19 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 481, "end": 482, "loc": { "start": { "line": 23, "column": 19 }, "end": { "line": 23, "column": 20 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 483, "end": 484, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 22 } } }, { "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": 489, "end": 495, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 10 } } }, { "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": 496, "end": 500, "loc": { "start": { "line": 24, "column": 11 }, "end": { "line": 24, "column": 15 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 500, "end": 501, "loc": { "start": { "line": 24, "column": 15 }, "end": { "line": 24, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "token", "start": 501, "end": 506, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 21 } } }, { "type": { "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 506, "end": 507, "loc": { "start": { "line": 24, "column": 21 }, "end": { "line": 24, "column": 22 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "fetchAccessToken", "start": 507, "end": 523, "loc": { "start": { "line": 24, "column": 22 }, "end": { "line": 24, "column": 38 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 523, "end": 524, "loc": { "start": { "line": 24, "column": 38 }, "end": { "line": 24, "column": 39 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 524, "end": 525, "loc": { "start": { "line": 24, "column": 39 }, "end": { "line": 24, "column": 40 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "grant_type", "start": 532, "end": 542, "loc": { "start": { "line": 25, "column": 6 }, "end": { "line": 25, "column": 16 } } }, { "type": { "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 542, "end": 543, "loc": { "start": { "line": 25, "column": 16 }, "end": { "line": 25, "column": 17 } } }, { "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": 544, "end": 564, "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 38 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 569, "end": 570, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 5 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 570, "end": 571, "loc": { "start": { "line": 26, "column": 5 }, "end": { "line": 26, "column": 6 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 571, "end": 572, "loc": { "start": { "line": 26, "column": 6 }, "end": { "line": 26, "column": 7 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 575, "end": 576, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 3 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 577, "end": 578, "loc": { "start": { "line": 28, "column": 0 }, "end": { "line": 28, "column": 1 } } }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 579, "end": 579, "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 29, "column": 0 } } } ] }