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,715 lines (1,714 loc) 79.8 kB
{ "type": "File", "start": 0, "end": 926, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 926, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 47, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 47 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 27, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 27 } }, "imported": { "type": "Identifier", "start": 8, "end": 15, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 15 }, "identifierName": "TICKETS" }, "name": "TICKETS" }, "local": { "type": "Identifier", "start": 19, "end": 27, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 27 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 34, "end": 47, "loc": { "start": { "line": 1, "column": 34 }, "end": { "line": 1, "column": 47 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 48, "end": 79, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 68, "end": 79, "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 playable URI.\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 81, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 156, "end": 926, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 42, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 171, "end": 926, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 42, "column": 1 } }, "id": { "type": "Identifier", "start": 177, "end": 190, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "TicketFetcher" }, "name": "TicketFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 199, "end": 206, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 50 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 207, "end": 926, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 42, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 244, "end": 367, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 19, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 244, "end": 255, "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": 256, "end": 260, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" } ], "body": { "type": "BlockStatement", "start": 262, "end": 367, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 272, "end": 283, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 19 } }, "expression": { "type": "CallExpression", "start": 272, "end": 283, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 19 } }, "callee": { "type": "Super", "start": 272, "end": 277, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 278, "end": 282, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 293, "end": 327, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 336, "end": 361, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 336, "end": 361, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 336, "end": 349, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 21 } }, "object": { "type": "ThisExpression", "start": 336, "end": 340, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 341, "end": 349, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 21 }, "identifierName": "track_id" }, "name": "track_id" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 352, "end": 361, "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": 293, "end": 327, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 213, "end": 239, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Init the ticket fetcher.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Ticket}\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 373, "end": 550, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 555, "end": 636, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 31, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 555, "end": 565, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 14 }, "identifierName": "setTrackID" }, "name": "setTrackID", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 566, "end": 574, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 23 }, "identifierName": "track_id" }, "name": "track_id" } ], "body": { "type": "BlockStatement", "start": 576, "end": 636, "loc": { "start": { "line": 28, "column": 25 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 586, "end": 610, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "expression": { "type": "AssignmentExpression", "start": 586, "end": 610, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 586, "end": 599, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 21 } }, "object": { "type": "ThisExpression", "start": 586, "end": 590, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 12 } } }, "property": { "type": "Identifier", "start": 591, "end": 599, "loc": { "start": { "line": 29, "column": 13 }, "end": { "line": 29, "column": 21 }, "identifierName": "track_id" }, "name": "track_id" }, "computed": false }, "right": { "type": "Identifier", "start": 602, "end": 610, "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 29, "column": 32 }, "identifierName": "track_id" }, "name": "track_id" } } }, { "type": "ReturnStatement", "start": 619, "end": 630, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 19 } }, "argument": { "type": "ThisExpression", "start": 626, "end": 630, "loc": { "start": { "line": 30, "column": 15 }, "end": { "line": 30, "column": 19 } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Init the ticket fetcher.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Ticket}\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 373, "end": 550, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch the track's download uris with ticket fetcher.\n *\n * @return {Promise}\n * @example api.Ticket.setTrackID('KpnEGVHEsGgkoB0MBk').fetchDownloadUris()\n ", "start": 642, "end": 825, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 830, "end": 924, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 830, "end": 847, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 39, "column": 21 }, "identifierName": "fetchDownloadUris" }, "name": "fetchDownloadUris", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 850, "end": 924, "loc": { "start": { "line": 39, "column": 24 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 860, "end": 918, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 66 } }, "argument": { "type": "CallExpression", "start": 867, "end": 918, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 66 } }, "callee": { "type": "MemberExpression", "start": 867, "end": 881, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 29 } }, "object": { "type": "MemberExpression", "start": 867, "end": 876, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 24 } }, "object": { "type": "ThisExpression", "start": 867, "end": 871, "loc": { "start": { "line": 40, "column": 15 }, "end": { "line": 40, "column": 19 } } }, "property": { "type": "Identifier", "start": 872, "end": 876, "loc": { "start": { "line": 40, "column": 20 }, "end": { "line": 40, "column": 24 }, "identifierName": "http" }, "name": "http" }, "computed": false }, "property": { "type": "Identifier", "start": 877, "end": 881, "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 29 }, "identifierName": "post" }, "name": "post" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 882, "end": 890, "loc": { "start": { "line": 40, "column": 30 }, "end": { "line": 40, "column": 38 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" }, { "type": "ObjectExpression", "start": 892, "end": 917, "loc": { "start": { "line": 40, "column": 40 }, "end": { "line": 40, "column": 65 } }, "properties": [ { "type": "ObjectProperty", "start": 893, "end": 916, "loc": { "start": { "line": 40, "column": 41 }, "end": { "line": 40, "column": 64 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 893, "end": 901, "loc": { "start": { "line": 40, "column": 41 }, "end": { "line": 40, "column": 49 }, "identifierName": "track_id" }, "name": "track_id" }, "value": { "type": "MemberExpression", "start": 903, "end": 916, "loc": { "start": { "line": 40, "column": 51 }, "end": { "line": 40, "column": 64 } }, "object": { "type": "ThisExpression", "start": 903, "end": 907, "loc": { "start": { "line": 40, "column": 51 }, "end": { "line": 40, "column": 55 } } }, "property": { "type": "Identifier", "start": 908, "end": 916, "loc": { "start": { "line": 40, "column": 56 }, "end": { "line": 40, "column": 64 }, "identifierName": "track_id" }, "name": "track_id" }, "computed": false } } ] } ] } } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Fetch the track's download uris with ticket fetcher.\n *\n * @return {Promise}\n * @example api.Ticket.setTrackID('KpnEGVHEsGgkoB0MBk').fetchDownloadUris()\n ", "start": 642, "end": 825, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get playable URI.\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 81, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Get playable URI.\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 81, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Get playable URI.\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 81, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 213, "end": 239, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 293, "end": 327, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } }, { "type": "CommentBlock", "value": "*\n * Init the ticket fetcher.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Ticket}\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 373, "end": 550, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Fetch the track's download uris with ticket fetcher.\n *\n * @return {Promise}\n * @example api.Ticket.setTrackID('KpnEGVHEsGgkoB0MBk').fetchDownloadUris()\n ", "start": 642, "end": 825, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 38, "column": 7 } } } ], "tokens": [ { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 0, "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 6 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 7, "end": 8, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "TICKETS", "start": 8, "end": 15, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 15 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "as", "start": 16, "end": 18, "loc": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 18 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ENDPOINT", "start": 19, "end": 27, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 27 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 27, "end": 28, "loc": { "start": { "line": 1, "column": 27 }, "end": { "line": 1, "column": 28 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 29, "end": 33, "loc": { "start": { "line": 1, "column": 29 }, "end": { "line": 1, "column": 33 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "../Endpoint", "start": 34, "end": 47, "loc": { "start": { "line": 1, "column": 34 }, "end": { "line": 1, "column": 47 } } }, { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 48, "end": 54, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 6 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Fetcher", "start": 55, "end": 62, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 63, "end": 67, "loc": { "start": { "line": 2, "column": 15 }, "end": { "line": 2, "column": 19 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "./Fetcher", "start": 68, "end": 79, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 31 } } }, { "type": "CommentBlock", "value": "*\n * Get playable URI.\n * @see https://docs.kkbox.codes/docs/tickets\n ", "start": 81, "end": 155, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "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": 156, "end": 162, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "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": 163, "end": 170, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "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": 171, "end": 176, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "TicketFetcher", "start": 177, "end": 190, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 } } }, {