@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,455 lines (1,454 loc) • 175 kB
JSON
{
"type": "File",
"start": 0,
"end": 1962,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 76,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1962,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 76,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 49
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 27
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "CHARTS"
},
"name": "CHARTS"
},
"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": 35,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 48
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 50,
"end": 82,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 57,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 57,
"end": 64,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 70,
"end": 81,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 31
}
},
"extra": {
"rawValue": "./Fetcher",
"raw": "'./Fetcher'"
},
"value": "./Fetcher"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * The fetcher that can fetch chart playlists.\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts\n ",
"start": 84,
"end": 196,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 197,
"end": 1961,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 75,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 212,
"end": 1961,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 75,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 218,
"end": 230,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 33
},
"identifierName": "ChartFetcher"
},
"name": "ChartFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 239,
"end": 246,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 49
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 247,
"end": 1961,
"loc": {
"start": {
"line": 8,
"column": 50
},
"end": {
"line": 75,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 276,
"end": 410,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 276,
"end": 287,
"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": 288,
"end": 292,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 294,
"end": 310,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 294,
"end": 303,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 306,
"end": 310,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 36
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 312,
"end": 410,
"loc": {
"start": {
"line": 12,
"column": 38
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 318,
"end": 341,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 27
}
},
"expression": {
"type": "CallExpression",
"start": 318,
"end": 340,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"callee": {
"type": "Super",
"start": 318,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 324,
"end": 328,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 14
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 330,
"end": 339,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "territory"
},
"name": "territory"
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 347,
"end": 373,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 378,
"end": 406,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 378,
"end": 405,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 31
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 378,
"end": 393,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 378,
"end": 382,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 383,
"end": 393,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 396,
"end": 405,
"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": 347,
"end": 373,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 251,
"end": 273,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch chart playlists.\n *\n * @return {Promise}\n * @example api.chartFetcher.fetchCharts();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts_1\n ",
"start": 414,
"end": 587,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 590,
"end": 686,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 32,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 590,
"end": 601,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 13
},
"identifierName": "fetchCharts"
},
"name": "fetchCharts",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 604,
"end": 686,
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 32,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 610,
"end": 682,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 31,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 617,
"end": 681,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 31,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 617,
"end": 630,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 617,
"end": 626,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 617,
"end": 621,
"loc": {
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 622,
"end": 626,
"loc": {
"start": {
"line": 29,
"column": 16
},
"end": {
"line": 29,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 627,
"end": 630,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 631,
"end": 639,
"loc": {
"start": {
"line": 29,
"column": 25
},
"end": {
"line": 29,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 641,
"end": 680,
"loc": {
"start": {
"line": 29,
"column": 35
},
"end": {
"line": 31,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 649,
"end": 674,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 649,
"end": 658,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 15
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 660,
"end": 674,
"loc": {
"start": {
"line": 30,
"column": 17
},
"end": {
"line": 30,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 660,
"end": 664,
"loc": {
"start": {
"line": 30,
"column": 17
},
"end": {
"line": 30,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"start": 665,
"end": 674,
"loc": {
"start": {
"line": 30,
"column": 22
},
"end": {
"line": 30,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch chart playlists.\n *\n * @return {Promise}\n * @example api.chartFetcher.fetchCharts();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts_1\n ",
"start": 414,
"end": 587,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the chart fetcher.\n *\n * @param {string} playlistID - The playlist ID.\n * @return {ChartFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id\n ",
"start": 690,
"end": 884,
"loc": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 40,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 887,
"end": 969,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 44,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 887,
"end": 900,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 41,
"column": 15
},
"identifierName": "setPlaylistID"
},
"name": "setPlaylistID",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 901,
"end": 911,
"loc": {
"start": {
"line": 41,
"column": 16
},
"end": {
"line": 41,
"column": 26
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
],
"body": {
"type": "BlockStatement",
"start": 913,
"end": 969,
"loc": {
"start": {
"line": 41,
"column": 28
},
"end": {
"line": 44,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 919,
"end": 948,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 919,
"end": 947,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 919,
"end": 934,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 919,
"end": 923,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 924,
"end": 934,
"loc": {
"start": {
"line": 42,
"column": 9
},
"end": {
"line": 42,
"column": 19
},
"identifierName": "playlistID"
},
"name": "playlistID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 937,
"end": 947,
"loc": {
"start": {
"line": 42,
"column": 22
},
"end": {
"line": 42,
"column": 32
},
"identifierName": "playlistID"
},
"name": "playlistID"
}
}
},
{
"type": "ReturnStatement",
"start": 953,
"end": 965,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 16
}
},
"argument": {
"type": "ThisExpression",
"start": 960,
"end": 964,
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 15
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the chart fetcher.\n *\n * @param {string} playlistID - The playlist ID.\n * @return {ChartFetcher}\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id\n ",
"start": 690,
"end": 884,
"loc": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 40,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch playlist of the chart you set.\n *\n * @return {Promise}\n * @example api.chartFetcher.setPlaylistID('4mJSYXvueA8t0odsny').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#charts-playlist_id\n ",
"start": 973,
"end": 1208,
"loc": {
"start": {
"line": 46,
"column": 2
},
"end": {
"line": 52,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1211,
"end": 1333,
"loc": {
"start": {
"line": 53,
"column": 2
},
"end": {
"line": 57,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1211,
"end": 1224,
"loc": {
"start": {
"line": 53,
"column": 2
},
"end": {
"line": 53,
"column": 15
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1227,
"end": 1333,
"loc": {
"start": {
"line": 53,
"column": 18
},
"end": {
"line": 57,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1233,
"end": 1329,
"loc": {
"start": {
"line": 54,
"column": 4
},
"end": {
"line": 56,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 1240,
"end": 1328,
"loc": {
"start": {
"line": 54,
"column": 11
},
"end": {
"line": 56,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 1240,
"end": 1253,
"loc": {
"start": {
"line": 54,
"column": 11
},
"end": {
"line": 54,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 1240,
"end": 1249,
"loc": {
"start": {
"line": 54,
"column": 11
},
"end": {
"line": 54,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 1240,
"end": 1244,
"loc": {
"start": {
"line": 54,
"column": 11
},
"end": {
"line": 54,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 1245,
"end": 1249,
"loc": {
"start": {
"line": 54,
"column": 16
},
"end": {
"line": 54,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 1250,
"end": 1253,
"loc": {
"start": {
"line": 54,
"column": 21
},
"end": {
"line": 54,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 1254,
"end": 1286,
"loc": {
"start": {
"line": 54,
"column": 25
},
"end": {
"line": 54,
"column": 57
}
},
"left": {
"type": "BinaryExpression",
"start": 1254,
"end": 1268,
"loc": {
"start": {
"line": 54,
"column": 25
},
"end": {
"line": 54,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 1254,
"end": 1262,
"loc": {
"start": {
"line": 54,
"column": 25
},
"end": {
"line": 54,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
"operator": "+",
"right": {
"type": "StringLiteral",
"start": 1265,
"end": 1268,
"loc": {
"start": {
"line": 54,
"column": 36
},
"end": {
"line": 54,
"column": 39
}
},