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,800 lines (1,799 loc) 6.64 MB
{ "type": "File", "start": 0, "end": 24867, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 656, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 24867, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 656, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 28, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 28 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 } }, "local": { "type": "Identifier", "start": 7, "end": 13, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 13 }, "identifierName": "should" }, "name": "should" } } ], "source": { "type": "StringLiteral", "start": 19, "end": 27, "loc": { "start": { "line": 1, "column": 19 }, "end": { "line": 1, "column": 27 } }, "extra": { "rawValue": "should", "raw": "'should'" }, "value": "should" } }, { "type": "ImportDeclaration", "start": 29, "end": 72, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 43 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 36, "end": 46, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 17 } }, "local": { "type": "Identifier", "start": 36, "end": 46, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 17 }, "identifierName": "HttpClient" }, "name": "HttpClient" } } ], "source": { "type": "StringLiteral", "start": 52, "end": 71, "loc": { "start": { "line": 2, "column": 23 }, "end": { "line": 2, "column": 42 } }, "extra": { "rawValue": "../api/HttpClient", "raw": "'../api/HttpClient'" }, "value": "../api/HttpClient" } }, { "type": "ImportDeclaration", "start": 73, "end": 122, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 80, "end": 93, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 20 } }, "local": { "type": "Identifier", "start": 80, "end": 93, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 20 }, "identifierName": "SearchFetcher" }, "name": "SearchFetcher" } } ], "source": { "type": "StringLiteral", "start": 99, "end": 121, "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 48 } }, "extra": { "rawValue": "../api/SearchFetcher", "raw": "'../api/SearchFetcher'" }, "value": "../api/SearchFetcher" } }, { "type": "ImportDeclaration", "start": 123, "end": 170, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 47 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 130, "end": 142, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 19 } }, "local": { "type": "Identifier", "start": 130, "end": 142, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 19 }, "identifierName": "AlbumFetcher" }, "name": "AlbumFetcher" } } ], "source": { "type": "StringLiteral", "start": 148, "end": 169, "loc": { "start": { "line": 4, "column": 25 }, "end": { "line": 4, "column": 46 } }, "extra": { "rawValue": "../api/AlbumFetcher", "raw": "'../api/AlbumFetcher'" }, "value": "../api/AlbumFetcher" } }, { "type": "ImportDeclaration", "start": 171, "end": 220, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 178, "end": 191, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 20 } }, "local": { "type": "Identifier", "start": 178, "end": 191, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 20 }, "identifierName": "ArtistFetcher" }, "name": "ArtistFetcher" } } ], "source": { "type": "StringLiteral", "start": 197, "end": 219, "loc": { "start": { "line": 5, "column": 26 }, "end": { "line": 5, "column": 48 } }, "extra": { "rawValue": "../api/ArtistFetcher", "raw": "'../api/ArtistFetcher'" }, "value": "../api/ArtistFetcher" } }, { "type": "ImportDeclaration", "start": 221, "end": 290, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 69 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 228, "end": 251, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 30 } }, "local": { "type": "Identifier", "start": 228, "end": 251, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 30 }, "identifierName": "FeaturedPlaylistFetcher" }, "name": "FeaturedPlaylistFetcher" } } ], "source": { "type": "StringLiteral", "start": 257, "end": 289, "loc": { "start": { "line": 6, "column": 36 }, "end": { "line": 6, "column": 68 } }, "extra": { "rawValue": "../api/FeaturedPlaylistFetcher", "raw": "'../api/FeaturedPlaylistFetcher'" }, "value": "../api/FeaturedPlaylistFetcher" } }, { "type": "ImportDeclaration", "start": 291, "end": 376, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 85 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 298, "end": 329, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 38 } }, "local": { "type": "Identifier", "start": 298, "end": 329, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 38 }, "identifierName": "FeaturedPlaylistCategoryFetcher" }, "name": "FeaturedPlaylistCategoryFetcher" } } ], "source": { "type": "StringLiteral", "start": 335, "end": 375, "loc": { "start": { "line": 7, "column": 44 }, "end": { "line": 7, "column": 84 } }, "extra": { "rawValue": "../api/FeaturedPlaylistCategoryFetcher", "raw": "'../api/FeaturedPlaylistCategoryFetcher'" }, "value": "../api/FeaturedPlaylistCategoryFetcher" } }, { "type": "ImportDeclaration", "start": 377, "end": 450, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 73 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 384, "end": 409, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 32 } }, "local": { "type": "Identifier", "start": 384, "end": 409, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 32 }, "identifierName": "NewReleaseCategoryFetcher" }, "name": "NewReleaseCategoryFetcher" } } ], "source": { "type": "StringLiteral", "start": 415, "end": 449, "loc": { "start": { "line": 8, "column": 38 }, "end": { "line": 8, "column": 72 } }, "extra": { "rawValue": "../api/NewReleaseCategoryFetcher", "raw": "'../api/NewReleaseCategoryFetcher'" }, "value": "../api/NewReleaseCategoryFetcher" } }, { "type": "ImportDeclaration", "start": 451, "end": 518, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 67 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 458, "end": 480, "loc": { "start": { "line": 9, "column": 7 }, "end": { "line": 9, "column": 29 } }, "local": { "type": "Identifier", "start": 458, "end": 480, "loc": { "start": { "line": 9, "column": 7 }, "end": { "line": 9, "column": 29 }, "identifierName": "NewHitsPlaylistFetcher" }, "name": "NewHitsPlaylistFetcher" } } ], "source": { "type": "StringLiteral", "start": 486, "end": 517, "loc": { "start": { "line": 9, "column": 35 }, "end": { "line": 9, "column": 66 } }, "extra": { "rawValue": "../api/NewHitsPlaylistFetcher", "raw": "'../api/NewHitsPlaylistFetcher'" }, "value": "../api/NewHitsPlaylistFetcher" } }, { "type": "ImportDeclaration", "start": 519, "end": 584, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 65 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 526, "end": 547, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 28 } }, "local": { "type": "Identifier", "start": 526, "end": 547, "loc": { "start": { "line": 10, "column": 7 }, "end": { "line": 10, "column": 28 }, "identifierName": "SharedPlaylistFetcher" }, "name": "SharedPlaylistFetcher" } } ], "source": { "type": "StringLiteral", "start": 553, "end": 583, "loc": { "start": { "line": 10, "column": 34 }, "end": { "line": 10, "column": 64 } }, "extra": { "rawValue": "../api/SharedPlaylistFetcher", "raw": "'../api/SharedPlaylistFetcher'" }, "value": "../api/SharedPlaylistFetcher" } }, { "type": "ImportDeclaration", "start": 585, "end": 644, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 59 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 592, "end": 610, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 25 } }, "local": { "type": "Identifier", "start": 592, "end": 610, "loc": { "start": { "line": 11, "column": 7 }, "end": { "line": 11, "column": 25 }, "identifierName": "MoodStationFetcher" }, "name": "MoodStationFetcher" } } ], "source": { "type": "StringLiteral", "start": 616, "end": 643, "loc": { "start": { "line": 11, "column": 31 }, "end": { "line": 11, "column": 58 } }, "extra": { "rawValue": "../api/MoodStationFetcher", "raw": "'../api/MoodStationFetcher'" }, "value": "../api/MoodStationFetcher" } }, { "type": "ImportDeclaration", "start": 645, "end": 706, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 61 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 652, "end": 671, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 26 } }, "local": { "type": "Identifier", "start": 652, "end": 671, "loc": { "start": { "line": 12, "column": 7 }, "end": { "line": 12, "column": 26 }, "identifierName": "GenreStationFetcher" }, "name": "GenreStationFetcher" } } ], "source": { "type": "StringLiteral", "start": 677, "end": 705, "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 60 } }, "extra": { "rawValue": "../api/GenreStationFetcher", "raw": "'../api/GenreStationFetcher'" }, "value": "../api/GenreStationFetcher" } }, { "type": "ImportDeclaration", "start": 707, "end": 754, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 47 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 714, "end": 726, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 19 } }, "local": { "type": "Identifier", "start": 714, "end": 726, "loc": { "start": { "line": 13, "column": 7 }, "end": { "line": 13, "column": 19 }, "identifierName": "ChartFetcher" }, "name": "ChartFetcher" } } ], "source": { "type": "StringLiteral", "start": 732, "end": 753, "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 46 } }, "extra": { "rawValue": "../api/ChartFetcher", "raw": "'../api/ChartFetcher'" }, "value": "../api/ChartFetcher" } }, { "type": "ImportDeclaration", "start": 755, "end": 802, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 47 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 762, "end": 774, "loc": { "start": { "line": 14, "column": 7 }, "end": { "line": 14, "column": 19 } }, "local": { "type": "Identifier", "start": 762, "end": 774, "loc": { "start": { "line": 14, "column": 7 }, "end": { "line": 14, "column": 19 }, "identifierName": "TrackFetcher" }, "name": "TrackFetcher" } } ], "source": { "type": "StringLiteral", "start": 780, "end": 801, "loc": { "start": { "line": 14, "column": 25 }, "end": { "line": 14, "column": 46 } }, "extra": { "rawValue": "../api/TrackFetcher", "raw": "'../api/TrackFetcher'" }, "value": "../api/TrackFetcher" } }, { "type": "ImportDeclaration", "start": 803, "end": 851, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 48 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 810, "end": 822, "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 15, "column": 19 } }, "local": { "type": "Identifier", "start": 810, "end": 822, "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 15, "column": 19 }, "identifierName": "TokenFetcher" }, "name": "TokenFetcher" } } ], "source": { "type": "StringLiteral", "start": 828, "end": 850, "loc": { "start": { "line": 15, "column": 25 }, "end": { "line": 15, "column": 47 } }, "extra": { "rawValue": "../auth/TokenFetcher", "raw": "'../auth/TokenFetcher'" }, "value": "../auth/TokenFetcher" } }, { "type": "ImportDeclaration", "start": 852, "end": 914, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 62 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 859, "end": 876, "loc": { "start": { "line": 16, "column": 7 }, "end": { "line": 16, "column": 24 } }, "local": { "type": "Identifier", "start": 859, "end": 876, "loc": { "start": { "line": 16, "column": 7 }, "end": { "line": 16, "column": 24 }, "identifierName": "ClientCredentials" }, "name": "ClientCredentials" } } ], "source": { "type": "StringLiteral", "start": 882, "end": 913, "loc": { "start": { "line": 16, "column": 30 }, "end": { "line": 16, "column": 61 } }, "extra": { "rawValue": "../auth/ClientCredentialsFlow", "raw": "'../auth/ClientCredentialsFlow'" }, "value": "../auth/ClientCredentialsFlow" } }, { "type": "ImportDeclaration", "start": 915, "end": 969, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 54 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 924, "end": 933, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 } }, "imported": { "type": "Identifier", "start": 924, "end": 933, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 }, "identifierName": "kkbox_sdk" }, "name": "kkbox_sdk" }, "local": { "type": "Identifier", "start": 924, "end": 933, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 }, "identifierName": "kkbox_sdk" }, "name": "kkbox_sdk" } } ], "source": { "type": "StringLiteral", "start": 941, "end": 968, "loc": { "start": { "line": 17, "column": 26 }, "end": { "line": 17, "column": 53 } }, "extra": { "rawValue": "../../client_secrets.json", "raw": "'../../client_secrets.json'" }, "value": "../../client_secrets.json" } }, { "type": "VariableDeclaration", "start": 970, "end": 1008, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 38 } }, "declarations": [ { "type": "VariableDeclarator", "start": 976, "end": 1007, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 37 } }, "id": { "type": "Identifier", "start": 976, "end": 985, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 }, "identifierName": "CLIENT_ID" }, "name": "CLIENT_ID" }, "init": { "type": "MemberExpression", "start": 988, "end": 1007, "loc": { "start": { "line": 18, "column": 18 }, "end": { "line": 18, "column": 37 } }, "object": { "type": "Identifier", "start": 988, "end": 997, "loc": { "start": { "line": 18, "column": 18 }, "end": { "line": 18, "column": 27 }, "identifierName": "kkbox_sdk" }, "name": "kkbox_sdk" }, "property": { "type": "Identifier", "start": 998, "end": 1007, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 37 }, "identifierName": "client_id" }, "name": "client_id" }, "computed": false } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 1009, "end": 1055, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 46 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1015, "end": 1054, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 45 } }, "id": { "type": "Identifier", "start": 1015, "end": 1028, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 19 }, "identifierName": "CLIENT_SECRET" }, "name": "CLIENT_SECRET" }, "init": { "type": "MemberExpression", "start": 1031, "end": 1054, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 45 } }, "object": { "type": "Identifier", "start": 1031, "end": 1040, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 31 }, "identifierName": "kkbox_sdk" }, "name": "kkbox_sdk" }, "property": { "type": "Identifier", "start": 1041, "end": 1054, "loc": { "start": { "line": 19, "column": 32 }, "end": { "line": 19, "column": 45 }, "identifierName": "client_secret" }, "name": "client_secret" }, "computed": false } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 1057, "end": 24866, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 655, "column": 3 } }, "expression": { "type": "CallExpression", "start": 1057, "end": 24865, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 655, "column": 2 } }, "callee": { "type": "Identifier", "start": 1057, "end": 1065, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 21, "column": 8 }, "identifierName": "describe" }, "name": "describe" }, "arguments": [ { "type": "StringLiteral", "start": 1066, "end": 1085, "loc": { "start": { "line": 21, "column": 9 }, "end": { "line": 21, "column": 28 } }, "extra": { "rawValue": "Api Begin to Test", "raw": "'Api Begin to Test'" }, "value": "Api Begin to Test" }, { "type": "ArrowFunctionExpression", "start": 1087, "end": 24864, "loc": { "start": { "line": 21, "column": 30 }, "end": { "line": 655, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1093, "end": 24864, "loc": { "start": { "line": 21, "column": 36 }, "end": { "line": 655, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 1097, "end": 24862, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 654, "column": 5 } }, "expression": { "type": "CallExpression", "start": 1097, "end": 24861, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 654, "column": 4 } }, "callee": { "type": "Identifier", "start": 1097, "end": 1105, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 22, "column": 10 }, "identifierName": "describe" }, "name": "describe" }, "arguments": [ { "type": "StringLiteral", "start": 1106, "end": 1125, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 30 } }, "extra": { "rawValue": "ClientCredentials", "raw": "'ClientCredentials'" }, "value": "ClientCredentials" }, { "type": "ArrowFunctionExpression", "start": 1127, "end": 24860, "loc": { "start": { "line": 22, "column": 32 }, "end": { "line": 654, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1133, "end": 24860, "loc": { "start": { "line": 22, "column": 38 }, "end": { "line": 654, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 1139, "end": 24856, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 653, "column": 7 } }, "expression": { "type": "CallExpression", "start": 1139, "end": 24855, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 653, "column": 6 } }, "callee": { "type": "Identifier", "start": 1139, "end": 1147, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 12 }, "identifierName": "describe" }, "name": "describe" }, "arguments": [ { "type": "StringLiteral", "start": 1148, "end": 1175, "loc": { "start": { "line": 23, "column": 13 }, "end": { "line": 23, "column": 40 } }, "extra": { "rawValue": "#fetch the access token()", "raw": "'#fetch the access token()'" }, "value": "#fetch the access token()" }, { "type": "ArrowFunctionExpression", "start": 1177, "end": 24854, "loc": { "start": { "line": 23, "column": 42 }, "end": { "line": 653, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 1183, "end": 24854, "loc": { "start": { "line": 23, "column": 48 }, "end": { "line": 653, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 1191, "end": 24848, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 652, "column": 9 } }, "expression": { "type": "CallExpression", "start": 1191, "end": 24847, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 652, "column": 8 } }, "callee": { "type": "Identifier", "start": 1191, "end": 1193, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 8 }, "identifierName": "it" }, "name": "it" }, "arguments": [ { "type": "StringLiteral", "start": 1194, "end": 1221, "loc": { "start": { "line": 24, "column": 9 }, "end": { "line": 24, "column": 36 } }, "extra": { "rawValue": "should fetch access token", "raw": "'should fetch access token'" }, "value": "should fetch access token" }, { "type": "ArrowFunctionExpression", "start": 1223, "end": 24846, "loc": { "start": { "line": 24, "column": 38 }, "end": { "line": 652, "column": 7 }