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,408 lines (1,407 loc) 1.11 MB
{ "type": "File", "start": 0, "end": 7045, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 166, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 7045, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 166, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 46, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 46 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 8, "end": 26, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 26 } }, "imported": { "type": "Identifier", "start": 8, "end": 14, "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 14 }, "identifierName": "SEARCH" }, "name": "SEARCH" }, "local": { "type": "Identifier", "start": 18, "end": 26, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 26 }, "identifierName": "ENDPOINT" }, "name": "ENDPOINT" } } ], "source": { "type": "StringLiteral", "start": 33, "end": 46, "loc": { "start": { "line": 1, "column": 33 }, "end": { "line": 1, "column": 46 } }, "extra": { "rawValue": "../Endpoint", "raw": "'../Endpoint'" }, "value": "../Endpoint" } }, { "type": "ImportDeclaration", "start": 47, "end": 78, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 54, "end": 61, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "Fetcher" }, "name": "Fetcher" } } ], "source": { "type": "StringLiteral", "start": 67, "end": 78, "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 * Search API.\n * @see https://kkbox.gelato.io/docs/versions/1.1/resources/search\n ", "start": 80, "end": 169, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 170, "end": 2672, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 86, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 185, "end": 2672, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 86, "column": 1 } }, "id": { "type": "Identifier", "start": 191, "end": 204, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 34 }, "identifierName": "SearchFetcher" }, "name": "SearchFetcher", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 213, "end": 220, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 50 }, "identifierName": "Fetcher" }, "name": "Fetcher" }, "body": { "type": "ClassBody", "start": 221, "end": 2672, "loc": { "start": { "line": 8, "column": 51 }, "end": { "line": 86, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 258, "end": 563, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 29, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 258, "end": 269, "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": 270, "end": 274, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "http" }, "name": "http" }, { "type": "AssignmentPattern", "start": 276, "end": 292, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 38 } }, "left": { "type": "Identifier", "start": 276, "end": 285, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "territory" }, "name": "territory" }, "right": { "type": "StringLiteral", "start": 288, "end": 292, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 38 } }, "extra": { "rawValue": "TW", "raw": "'TW'" }, "value": "TW" } } ], "body": { "type": "BlockStatement", "start": 294, "end": 563, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 29, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 304, "end": 326, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 304, "end": 326, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Super", "start": 304, "end": 309, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 13 } } }, "arguments": [ { "type": "Identifier", "start": 310, "end": 314, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 18 }, "identifierName": "http" }, "name": "http" }, { "type": "Identifier", "start": 316, "end": 325, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 29 }, "identifierName": "territory" }, "name": "territory" } ], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 336, "end": 370, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 379, "end": 412, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 41 } }, "expression": { "type": "AssignmentExpression", "start": 379, "end": 412, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 379, "end": 400, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 29 } }, "object": { "type": "ThisExpression", "start": 379, "end": 383, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 384, "end": 400, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 29 }, "identifierName": "filterConditions" }, "name": "filterConditions" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 403, "end": 412, "loc": { "start": { "line": 18, "column": 32 }, "end": { "line": 18, "column": 41 }, "identifierName": "undefined" }, "name": "undefined", "leadingComments": null, "trailingComments": null }, "leadingComments": null, "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 336, "end": 370, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 17, "column": 11 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 422, "end": 456, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 22, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 465, "end": 483, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 465, "end": 483, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 465, "end": 471, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 14 } }, "object": { "type": "ThisExpression", "start": 465, "end": 469, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 470, "end": 471, "loc": { "start": { "line": 23, "column": 13 }, "end": { "line": 23, "column": 14 }, "identifierName": "q" }, "name": "q" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 474, "end": 483, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 26 }, "identifierName": "undefined" }, "name": "undefined", "leadingComments": null, "trailingComments": null }, "leadingComments": null, "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 422, "end": 456, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 22, "column": 11 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 493, "end": 527, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 27, "column": 11 } } } ] }, { "type": "ExpressionStatement", "start": 536, "end": 557, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 536, "end": 557, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 536, "end": 545, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 17 } }, "object": { "type": "ThisExpression", "start": 536, "end": 540, "loc": { "start": { "line": 28, "column": 8 }, "end": { "line": 28, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 541, "end": 545, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 17 }, "identifierName": "type" }, "name": "type" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 548, "end": 557, "loc": { "start": { "line": 28, "column": 20 }, "end": { "line": 28, "column": 29 }, "identifierName": "undefined" }, "name": "undefined" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 493, "end": 527, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 27, "column": 11 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * @ignore\n ", "start": 227, "end": 253, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 11, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Filter what you don't want when search.\n *\n * @param {Object} [conditions] - search conditions.\n * @param {string} conditions.track - track's name.\n * @param {string} conditions.album - album's name.\n * @param {string} conditions.artist - artist's name.\n * @param {string} conditions.playlist - playlist's title.\n * @param {string} conditions.available_territory - tracks and albums available territory.\n * @return {Search}\n * @example api.searchFetcher.setSearchCriteria('五月天 好好').filter({artist: '五月天'}).fetchSearchResult()\n ", "start": 569, "end": 1149, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 42, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 1154, "end": 1410, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 52, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 1154, "end": 1160, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 10 }, "identifierName": "filter" }, "name": "filter", "leadingComments": null }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 1161, "end": 1338, "loc": { "start": { "line": 43, "column": 11 }, "end": { "line": 49, "column": 10 } }, "left": { "type": "Identifier", "start": 1161, "end": 1171, "loc": { "start": { "line": 43, "column": 11 }, "end": { "line": 43, "column": 21 }, "identifierName": "conditions" }, "name": "conditions" }, "right": { "type": "AssignmentExpression", "start": 1174, "end": 1338, "loc": { "start": { "line": 43, "column": 24 }, "end": { "line": 49, "column": 10 } }, "operator": "=", "left": { "type": "ObjectPattern", "start": 1174, "end": 1333, "loc": { "start": { "line": 43, "column": 24 }, "end": { "line": 49, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 1184, "end": 1201, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 25 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1184, "end": 1189, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 13 }, "identifierName": "track" }, "name": "track" }, "value": { "type": "AssignmentPattern", "start": 1184, "end": 1201, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 25 } }, "left": { "type": "Identifier", "start": 1184, "end": 1189, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 13 }, "identifierName": "track" }, "name": "track" }, "right": { "type": "Identifier", "start": 1192, "end": 1201, "loc": { "start": { "line": 44, "column": 16 }, "end": { "line": 44, "column": 25 }, "identifierName": "undefined" }, "name": "undefined" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1211, "end": 1228, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 25 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1211, "end": 1216, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 13 }, "identifierName": "album" }, "name": "album" }, "value": { "type": "AssignmentPattern", "start": 1211, "end": 1228, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 25 } }, "left": { "type": "Identifier", "start": 1211, "end": 1216, "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 13 }, "identifierName": "album" }, "name": "album" }, "right": { "type": "Identifier", "start": 1219, "end": 1228, "loc": { "start": { "line": 45, "column": 16 }, "end": { "line": 45, "column": 25 }, "identifierName": "undefined" }, "name": "undefined" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1238, "end": 1256, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 26 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1238, "end": 1244, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 14 }, "identifierName": "artist" }, "name": "artist" }, "value": { "type": "AssignmentPattern", "start": 1238, "end": 1256, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 26 } }, "left": { "type": "Identifier", "start": 1238, "end": 1244, "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 14 }, "identifierName": "artist" }, "name": "artist" }, "right": { "type": "Identifier", "start": 1247, "end": 1256, "loc": { "start": { "line": 46, "column": 17 }, "end": { "line": 46, "column": 26 }, "identifierName": "undefined" }, "name": "undefined" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1266, "end": 1286, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 28 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 1266, "end": 1274, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 16 }, "identifierName": "playlist" }, "name": "playlist" }, "value": { "type": "AssignmentPattern", "start": 1266, "end": 1286, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 28 } }, "left": { "type": "Identifier", "start": 1266, "end": 1274, "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 16 }, "identifierName": "playlist" }, "name": "playlist" }, "right": { "type": "Identifier", "start": 1277, "end": 1286, "loc": { "start": { "line": 47, "column": 19 }, "end": { "line": 47, "column": 28 }, "identifierName": "undefined" }, "name": "undefined" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 1296, "end": 1327, "loc": { "start": { "line": 48, "column": 8 }, "end": { "line": 48, "column": 39 } }, "method": false, "shorthand": true,