@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,450 lines • 114 kB
JSON
{
"type": "File",
"start": 0,
"end": 1278,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 55,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1278,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 55,
"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": "TRACKS"
},
"name": "TRACKS"
},
"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 * Get metadata of a track.\n * @see https://docs-en.kkbox.codes/v1.1/reference#tracks\n ",
"start": 84,
"end": 177,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 178,
"end": 1277,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 54,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 193,
"end": 1277,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 54,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 199,
"end": 211,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 33
},
"identifierName": "TrackFetcher"
},
"name": "TrackFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 220,
"end": 227,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 49
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 228,
"end": 1277,
"loc": {
"start": {
"line": 8,
"column": 50
},
"end": {
"line": 54,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 257,
"end": 388,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 257,
"end": 268,
"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": 269,
"end": 273,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 275,
"end": 291,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 36
}
},
"left": {
"type": "Identifier",
"start": 275,
"end": 284,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 287,
"end": 291,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 36
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 293,
"end": 388,
"loc": {
"start": {
"line": 12,
"column": 38
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 299,
"end": 322,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 27
}
},
"expression": {
"type": "CallExpression",
"start": 299,
"end": 321,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"callee": {
"type": "Super",
"start": 299,
"end": 304,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 305,
"end": 309,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 14
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 311,
"end": 320,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 25
},
"identifierName": "territory"
},
"name": "territory"
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 328,
"end": 354,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 359,
"end": 384,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 29
}
},
"expression": {
"type": "AssignmentExpression",
"start": 359,
"end": 383,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 28
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 359,
"end": 371,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 359,
"end": 363,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 364,
"end": 371,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 16
},
"identifierName": "trackID"
},
"name": "trackID"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 374,
"end": 383,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 18,
"column": 28
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 328,
"end": 354,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 17,
"column": 7
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 232,
"end": 254,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} trackID - The ID of a track.\n * @return {Track}\n * @see https://docs-en.kkbox.codes/v1.1/reference#tracks-track_id\n ",
"start": 392,
"end": 585,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 588,
"end": 658,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 31,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 588,
"end": 598,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 12
},
"identifierName": "setTrackID"
},
"name": "setTrackID",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 599,
"end": 606,
"loc": {
"start": {
"line": 28,
"column": 13
},
"end": {
"line": 28,
"column": 20
},
"identifierName": "trackID"
},
"name": "trackID"
}
],
"body": {
"type": "BlockStatement",
"start": 608,
"end": 658,
"loc": {
"start": {
"line": 28,
"column": 22
},
"end": {
"line": 31,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 614,
"end": 637,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 614,
"end": 636,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 614,
"end": 626,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 614,
"end": 618,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 619,
"end": 626,
"loc": {
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 16
},
"identifierName": "trackID"
},
"name": "trackID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 629,
"end": 636,
"loc": {
"start": {
"line": 29,
"column": 19
},
"end": {
"line": 29,
"column": 26
},
"identifierName": "trackID"
},
"name": "trackID"
}
}
},
{
"type": "ReturnStatement",
"start": 642,
"end": 654,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 16
}
},
"argument": {
"type": "ThisExpression",
"start": 649,
"end": 653,
"loc": {
"start": {
"line": 30,
"column": 11
},
"end": {
"line": 30,
"column": 15
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} trackID - The ID of a track.\n * @return {Track}\n * @see https://docs-en.kkbox.codes/v1.1/reference#tracks-track_id\n ",
"start": 392,
"end": 585,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 27,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get metadata of the track with the track fetcher.\n *\n * @return {Promise}\n * @example api.trackFetcher.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#tracks-track_id\n ",
"start": 662,
"end": 904,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 907,
"end": 1026,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 44,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 907,
"end": 920,
"loc": {
"start": {
"line": 40,
"column": 2
},
"end": {
"line": 40,
"column": 15
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 923,
"end": 1026,
"loc": {
"start": {
"line": 40,
"column": 18
},
"end": {
"line": 44,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 929,
"end": 1022,
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 43,
"column": 7
}
},
"argument": {
"type": "CallExpression",
"start": 936,
"end": 1021,
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 43,
"column": 6
}
},
"callee": {
"type": "MemberExpression",
"start": 936,
"end": 949,
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 24
}
},
"object": {
"type": "MemberExpression",
"start": 936,
"end": 945,
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 20
}
},
"object": {
"type": "ThisExpression",
"start": 936,
"end": 940,
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 941,
"end": 945,
"loc": {
"start": {
"line": 41,
"column": 16
},
"end": {
"line": 41,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 946,
"end": 949,
"loc": {
"start": {
"line": 41,
"column": 21
},
"end": {
"line": 41,
"column": 24
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 950,
"end": 979,
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 54
}
},
"left": {
"type": "BinaryExpression",
"start": 950,
"end": 964,
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 950,
"end": 958,
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
"operator": "+",
"right": {
"type": "StringLiteral",
"start": 961,
"end": 964,
"loc": {
"start": {
"line": 41,
"column": 36
},
"end": {
"line": 41,
"column": 39
}
},
"extra": {
"rawValue": "/",
"raw": "'/'"
},
"value": "/"
}
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start": 967,
"end": 979,
"loc": {
"start": {
"line": 41,
"column": 42
},
"end": {
"line": 41,
"column": 54
}
},
"object": {
"type": "ThisExpression",
"start": 967,
"end": 971,
"loc": {
"start": {
"line": 41,
"column": 42
},
"end": {
"line": 41,
"column": 46
}
}
},
"property": {
"type": "Identifier",
"start": 972,
"end": 979,
"loc": {
"start": {
"line": 41,
"column": 47
},
"end": {
"line": 41,
"column": 54
},
"identifierName": "trackID"
},
"name": "trackID"
},
"computed": false
}
},
{
"type": "ObjectExpression",
"start": 981,
"end": 1020,
"loc": {
"start": {
"line": 41,
"column": 56
},
"end": {
"line": 43,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 989,
"end": 1014,
"loc": {
"start": {
"line": 42,
"column": 6
},
"end": {
"line": 42,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 989,
"end": 998,
"loc": {
"start": {
"line": 42,
"column": 6
},
"end": {
"line": 42,
"column": 15
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 1000,
"end": 1014,
"loc": {
"start": {
"line": 42,
"column": 17
},
"end": {
"line": 42,
"column": 31
}
},
"object": {
"type": "ThisExpression",
"start": 1000,
"end": 1004,
"loc": {
"start": {
"line": 42,
"column": 17
},
"end": {
"line": 42,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"start": 1005,
"end": 1014,
"loc": {
"start": {
"line": 42,
"column": 22
},
"end": {
"line": 42,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get metadata of the track with the track fetcher.\n *\n * @return {Promise}\n * @example api.trackFetcher.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata();\n * @see https://docs-en.kkbox.codes/v1.1/reference#tracks-track_id\n ",
"start": 662,
"end": 904,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 39,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get KKBOX web widget uri of the track.\n * @example https://widget.kkbox.com/v1/?id=8sD5pE4dV0Zqmmler6&type=song\n * @return {string}\n ",
"start": 1030,
"end": 1180,
"loc": {
"start": {
"line": 46,
"column": 2
},
"end": {
"line": 50,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1183,
"end": 1275,
"loc": {
"start": {
"line": 51,
"column": 2
},
"end": {
"line": 53,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 1183,
"end": 1195,
"loc": {
"start": {
"line": 51,
"column": 2
},
"end": {
"line": 51,
"column": 14
},
"identifierName": "getWidgetUri"
},
"name": "getWidgetUri",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1198,
"end": 1275,
"loc": {
"start": {
"line": 51,
"column": 17
},
"end": {
"line": 53,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1204,
"end": 1271,
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 52,
"column": 71
}
},
"argument": {
"type": "TemplateLiteral",
"start": 1211,
"end": 1270,
"loc": {
"start": {
"line": 52,
"column": 11
},
"end": {
"line": 52,
"column": 70
}
},
"expressions": [
{
"type": "MemberExpression",
"start": 1246,
"end": 1258,
"loc": {
"start": {
"line": 52,
"column": 46
},
"end": {
"line": 52,
"column": 58
}
},
"object": {
"type": "ThisExpression",
"start": 1246,
"end": 1250,
"loc": {
"start": {
"line": 52,
"column": 46
},
"end": {
"line": 52,
"column": 50
}
}
},
"property": {
"type": "Identifier",
"start": 1251,
"end": 1258,
"loc": {
"start": {
"line": 52,
"column": 5