@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,463 lines (1,462 loc) • 183 kB
JSON
{
"type": "File",
"start": 0,
"end": 2255,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 78,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2255,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 78,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 61,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 61
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 39
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 27
},
"identifierName": "NEW_HITS_PLAYLISTS"
},
"name": "NEW_HITS_PLAYLISTS"
},
"local": {
"type": "Identifier",
"start": 31,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 39
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 47,
"end": 60,
"loc": {
"start": {
"line": 1,
"column": 47
},
"end": {
"line": 1,
"column": 60
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 62,
"end": 94,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 69,
"end": 76,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 69,
"end": 76,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 82,
"end": 93,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "./Fetcher",
"raw": "'./Fetcher'"
},
"value": "./Fetcher"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * List new hits playlists.\n * @see https://docs-en.kkbox.codes/v1.1/reference#new-hits-playlists\n ",
"start": 96,
"end": 201,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 202,
"end": 2254,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 77,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 217,
"end": 2254,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 77,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 223,
"end": 245,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 43
},
"identifierName": "NewHitsPlaylistFetcher"
},
"name": "NewHitsPlaylistFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 254,
"end": 261,
"loc": {
"start": {
"line": 8,
"column": 52
},
"end": {
"line": 8,
"column": 59
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 262,
"end": 2254,
"loc": {
"start": {
"line": 8,
"column": 60
},
"end": {
"line": 77,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 291,
"end": 425,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 291,
"end": 302,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 303,
"end": 307,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 309,
"end": 325,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 309,
"end": 318,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 321,
"end": 325,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 36
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 327,
"end": 425,
"loc": {
"start": {
"line": 12,
"column": 38
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 333,
"end": 356,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 27
}
},
"expression": {
"type": "CallExpression",
"start": 333,
"end": 355,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"callee": {
"type": "Super",
"start": 333,
"end": 338,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 339,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 14
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 345,
"end": 354,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "territory"
},
"name": "territory"
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 362,
"end": 388,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 393,
"end": 421,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 393,
"end": 420,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 393,
"end": 408,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 393,
"end": 397,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 398,
"end": 408,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 411,
"end": 420,
"loc": {
"start": {
"line": 18,
"column": 22
},
"end": {
"line": 18,
"column": 31
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 362,
"end": 388,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 266,
"end": 288,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all new hits playlists.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.newHitsPlaylistFetcher.fetchAllNewHitsPlaylists();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newhitsplaylists\n ",
"start": 429,
"end": 761,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 29,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 764,
"end": 910,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 764,
"end": 788,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 26
},
"identifierName": "fetchAllNewHitsPlaylists"
},
"name": "fetchAllNewHitsPlaylists",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 789,
"end": 806,
"loc": {
"start": {
"line": 30,
"column": 27
},
"end": {
"line": 30,
"column": 44
}
},
"left": {
"type": "Identifier",
"start": 789,
"end": 794,
"loc": {
"start": {
"line": 30,
"column": 27
},
"end": {
"line": 30,
"column": 32
},
"identifierName": "limit"
},
"name": "limit"
},
"right": {
"type": "Identifier",
"start": 797,
"end": 806,
"loc": {
"start": {
"line": 30,
"column": 35
},
"end": {
"line": 30,
"column": 44
},
"identifierName": "undefined"
},
"name": "undefined"
}
},
{
"type": "AssignmentPattern",
"start": 808,
"end": 826,
"loc": {
"start": {
"line": 30,
"column": 46
},
"end": {
"line": 30,
"column": 64
}
},
"left": {
"type": "Identifier",
"start": 808,
"end": 814,
"loc": {
"start": {
"line": 30,
"column": 46
},
"end": {
"line": 30,
"column": 52
},
"identifierName": "offset"
},
"name": "offset"
},
"right": {
"type": "Identifier",
"start": 817,
"end": 826,
"loc": {
"start": {
"line": 30,
"column": 55
},
"end": {
"line": 30,
"column": 64
},
"identifierName": "undefined"
},
"name": "undefined"
}
}
],
"body": {
"type": "BlockStatement",
"start": 828,
"end": 910,
"loc": {
"start": {
"line": 30,
"column": 66
},
"end": {
"line": 34,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 834,
"end": 906,
"loc": {
"start": {
"line": 31,
"column": 4
},
"end": {
"line": 33,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 841,
"end": 905,
"loc": {
"start": {
"line": 31,
"column": 11
},
"end": {
"line": 33,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 841,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 11
},
"end": {
"line": 31,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 841,
"end": 850,
"loc": {
"start": {
"line": 31,
"column": 11
},
"end": {
"line": 31,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 841,
"end": 845,
"loc": {
"start": {
"line": 31,
"column": 11
},
"end": {
"line": 31,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 846,
"end": 850,
"loc": {
"start": {
"line": 31,
"column": 16
},
"end": {
"line": 31,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 851,
"end": 854,
"loc": {
"start": {
"line": 31,
"column": 21
},
"end": {
"line": 31,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 855,
"end": 863,
"loc": {
"start": {
"line": 31,
"column": 25
},
"end": {
"line": 31,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 865,
"end": 904,
"loc": {
"start": {
"line": 31,
"column": 35
},
"end": {
"line": 33,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 873,
"end": 898,
"loc": {
"start": {
"line": 32,
"column": 6
},
"end": {
"line": 32,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 873,
"end": 882,
"loc": {
"start": {
"line": 32,
"column": 6
},
"end": {
"line": 32,
"column": 15
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 884,
"end": 898,
"loc": {
"start": {
"line": 32,
"column": 17
},
"end": {
"line": 32,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 884,
"end": 888,
"loc": {
"start": {
"line": 32,
"column": 17
},
"end": {
"line": 32,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"start": 889,
"end": 898,
"loc": {
"start": {
"line": 32,
"column": 22
},
"end": {
"line": 32,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all new hits playlists.\n *\n * @param {number} [limit] - The size of one page.\n * @param {number} [offset] - The offset index for first element.\n * @return {Promise}\n * @example api.newHitsPlaylistFetcher.fetchAllNewHitsPlaylists();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newhitsplaylists\n ",
"start": 429,
"end": 761,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 29,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the new hits playlist fetcher.\n *\n * @param {string} playlistID - The playlist ID.\n * @return {NewHitsPlaylistFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#newhitsplaylists-playlist_id\n ",
"start": 914,
"end": 1140,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 42,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1143,
"end": 1225,
"loc": {
"start": {
"line": 43,
"column": 2
},
"end": {
"line": 46,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1143,
"end": 1156,
"loc": {
"start": {
"line": 43,
"column": 2
},
"end": {
"line": 43,
"column": 15
},
"identifierName": "setPlaylistID"
},
"name": "setPlaylistID",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1157,
"end": 1167,
"loc": {
"start": {
"line": 43,
"column": 16
},
"end": {
"line": 43,
"column": 26
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
],
"body": {
"type": "BlockStatement",
"start": 1169,
"end": 1225,
"loc": {
"start": {
"line": 43,
"column": 28
},
"end": {
"line": 46,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1175,
"end": 1204,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1175,
"end": 1203,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1175,
"end": 1190,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 1175,
"end": 1179,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 1180,
"end": 1190,
"loc": {
"start": {
"line": 44,
"column": 9
},
"end": {
"line": 44,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1193,
"end": 1203,
"loc": {
"start": {
"line": 44,
"column": 22
},
"end": {
"line": 44,
"column": 32
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
}
},
{
"type": "ReturnStatement",
"start": 1209,
"end": 1221,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 16
}
},
"argument": {
"type": "ThisExpression",
"start": 1216,
"end": 1220,
"loc": {
"start": {
"line": 45,
"column": 11
},
"end": {
"line": 45,
"column": 15
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the new hits playlist fetcher.\n *\n * @param {string} playlistID - The playlist ID.\n * @return {NewHitsPlaylistFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#newhitsplaylists-playlist_id\n ",
"start": 914,
"end": 1140,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 42,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch metadata of the new hits playlist you set.\n *\n * @return {Promise}\n * @example api.newHitsPlaylistFetcher.setPlaylistID('DZrC8m29ciOFY2JAm3').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#newhitsplaylists-playlist_id\n ",
"start": 1229,
"end": 1496,
"loc": {
"start": {
"line": 48,
"column": 2
},
"end": {
"line": 54,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1499,
"end": 1621,
"loc": {
"start": {
"line": 55,
"column": 2
},
"end": {
"line": 59,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1499,
"end": 1512,
"loc": {
"start": {
"line": 55,
"column": 2
},
"end": {
"line": 55,
"column": 15
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1515,
"end": 1621,
"loc": {
"start": {
"line": 55,
"column": 18
},
"end": {
"line": 59,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1521,
"end": 1617,
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 58,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 1528,
"end": 1616,
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 58,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 1528,
"end": 1541,
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 1528,
"end": 1537,
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 1528,
"end": 1532,
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 1533,
"end": 1537,
"loc": {
"start": {
"line": 56,
"column": 16