@kkboxorg/kkbox-javascript-developer-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,456 lines (1,455 loc) • 107 kB
JSON
{
"type": "File",
"start": 0,
"end": 1237,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 51,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1237,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 51,
"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": "TRACKS"
},
"name": "TRACKS"
},
"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 * Get metadata of a track.\n * @see https://docs.kkbox.codes/docs/tracks\n ",
"start": 80,
"end": 160,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 161,
"end": 1237,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 51,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 176,
"end": 1237,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 51,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 182,
"end": 194,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 33
},
"identifierName": "TrackFetcher"
},
"name": "TrackFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 203,
"end": 210,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 49
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 211,
"end": 1237,
"loc": {
"start": {
"line": 8,
"column": 50
},
"end": {
"line": 51,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 248,
"end": 400,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 248,
"end": 259,
"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": 260,
"end": 264,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 266,
"end": 282,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 266,
"end": 275,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 278,
"end": 282,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 284,
"end": 400,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 294,
"end": 316,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"expression": {
"type": "CallExpression",
"start": 294,
"end": 316,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"callee": {
"type": "Super",
"start": 294,
"end": 299,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 300,
"end": 304,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 306,
"end": 315,
"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": 326,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 369,
"end": 394,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 369,
"end": 394,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 33
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 369,
"end": 382,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 369,
"end": 373,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 374,
"end": 382,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 21
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 385,
"end": 394,
"loc": {
"start": {
"line": 18,
"column": 24
},
"end": {
"line": 18,
"column": 33
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 326,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 217,
"end": 243,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Track}\n * @see https://docs.kkbox.codes/docs/tracks\n ",
"start": 406,
"end": 590,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 595,
"end": 676,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 31,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 595,
"end": 605,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 28,
"column": 14
},
"identifierName": "setTrackID"
},
"name": "setTrackID",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 606,
"end": 614,
"loc": {
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 23
},
"identifierName": "track_id"
},
"name": "track_id"
}
],
"body": {
"type": "BlockStatement",
"start": 616,
"end": 676,
"loc": {
"start": {
"line": 28,
"column": 25
},
"end": {
"line": 31,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 626,
"end": 650,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 626,
"end": 650,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 626,
"end": 639,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 626,
"end": 630,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 631,
"end": 639,
"loc": {
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 29,
"column": 21
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 642,
"end": 650,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 32
},
"identifierName": "track_id"
},
"name": "track_id"
}
}
},
{
"type": "ReturnStatement",
"start": 659,
"end": 670,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 19
}
},
"argument": {
"type": "ThisExpression",
"start": 666,
"end": 670,
"loc": {
"start": {
"line": 30,
"column": 15
},
"end": {
"line": 30,
"column": 19
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Set the track fetcher's track ID.\n *\n * @param {string} track_id - The ID of a track.\n * @return {Track}\n * @see https://docs.kkbox.codes/docs/tracks\n ",
"start": 406,
"end": 590,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get metadata of the track with the track fetcher.\n *\n * @return {Promise}\n * @example api.Track.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata()\n ",
"start": 682,
"end": 857,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 38,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 862,
"end": 969,
"loc": {
"start": {
"line": 39,
"column": 4
},
"end": {
"line": 41,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 862,
"end": 875,
"loc": {
"start": {
"line": 39,
"column": 4
},
"end": {
"line": 39,
"column": 17
},
"identifierName": "fetchMetadata"
},
"name": "fetchMetadata",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 878,
"end": 969,
"loc": {
"start": {
"line": 39,
"column": 20
},
"end": {
"line": 41,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 888,
"end": 963,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 83
}
},
"argument": {
"type": "CallExpression",
"start": 895,
"end": 963,
"loc": {
"start": {
"line": 40,
"column": 15
},
"end": {
"line": 40,
"column": 83
}
},
"callee": {
"type": "MemberExpression",
"start": 895,
"end": 908,
"loc": {
"start": {
"line": 40,
"column": 15
},
"end": {
"line": 40,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 895,
"end": 904,
"loc": {
"start": {
"line": 40,
"column": 15
},
"end": {
"line": 40,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 895,
"end": 899,
"loc": {
"start": {
"line": 40,
"column": 15
},
"end": {
"line": 40,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 900,
"end": 904,
"loc": {
"start": {
"line": 40,
"column": 20
},
"end": {
"line": 40,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 905,
"end": 908,
"loc": {
"start": {
"line": 40,
"column": 25
},
"end": {
"line": 40,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "BinaryExpression",
"start": 909,
"end": 933,
"loc": {
"start": {
"line": 40,
"column": 29
},
"end": {
"line": 40,
"column": 53
}
},
"left": {
"type": "Identifier",
"start": 909,
"end": 917,
"loc": {
"start": {
"line": 40,
"column": 29
},
"end": {
"line": 40,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start": 920,
"end": 933,
"loc": {
"start": {
"line": 40,
"column": 40
},
"end": {
"line": 40,
"column": 53
}
},
"object": {
"type": "ThisExpression",
"start": 920,
"end": 924,
"loc": {
"start": {
"line": 40,
"column": 40
},
"end": {
"line": 40,
"column": 44
}
}
},
"property": {
"type": "Identifier",
"start": 925,
"end": 933,
"loc": {
"start": {
"line": 40,
"column": 45
},
"end": {
"line": 40,
"column": 53
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
}
},
{
"type": "ObjectExpression",
"start": 935,
"end": 962,
"loc": {
"start": {
"line": 40,
"column": 55
},
"end": {
"line": 40,
"column": 82
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 936,
"end": 961,
"loc": {
"start": {
"line": 40,
"column": 56
},
"end": {
"line": 40,
"column": 81
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 936,
"end": 945,
"loc": {
"start": {
"line": 40,
"column": 56
},
"end": {
"line": 40,
"column": 65
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 947,
"end": 961,
"loc": {
"start": {
"line": 40,
"column": 67
},
"end": {
"line": 40,
"column": 81
}
},
"object": {
"type": "ThisExpression",
"start": 947,
"end": 951,
"loc": {
"start": {
"line": 40,
"column": 67
},
"end": {
"line": 40,
"column": 71
}
}
},
"property": {
"type": "Identifier",
"start": 952,
"end": 961,
"loc": {
"start": {
"line": 40,
"column": 72
},
"end": {
"line": 40,
"column": 81
},
"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.Track.setTrackID('KpnEGVHEsGgkoB0MBk').fetchMetadata()\n ",
"start": 682,
"end": 857,
"loc": {
"start": {
"line": 33,
"column": 4
},
"end": {
"line": 38,
"column": 7
}
}
}
],
"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": 975,
"end": 1133,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 47,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1138,
"end": 1235,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1138,
"end": 1150,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 16
},
"identifierName": "getWidgetUri"
},
"name": "getWidgetUri",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 1152,
"end": 1235,
"loc": {
"start": {
"line": 48,
"column": 18
},
"end": {
"line": 50,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1162,
"end": 1229,
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 75
}
},
"argument": {
"type": "TemplateLiteral",
"start": 1169,
"end": 1229,
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 75
}
},
"expressions": [
{
"type": "MemberExpression",
"start": 1204,
"end": 1217,
"loc": {
"start": {
"line": 49,
"column": 50
},
"end": {
"line": 49,
"column": 63
}
},
"object": {
"type": "ThisExpression",
"start": 1204,
"end": 1208,
"loc": {
"start": {
"line": 49,
"column": 50
},
"end": {
"line": 49,
"column": 54
}
}
},
"property": {
"type": "Identifier",
"start": 1209,
"end": 1217,
"loc": {
"start": {
"line": 49,
"column": 55
},
"end": {
"line": 49,
"column": 63
},
"identifierName": "track_id"
},
"name": "track_id"
},
"computed": false
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 1170,
"end": 1202,
"loc": {
"start": {
"line": 49,
"column": 16
},
"end": {
"line": 49,
"column": 48
}
},
"value": {
"raw": "https://widget.kkbox.com/v1/?id=",
"cooked": "https://widget.kkbox.com/v1/?id="
},
"tail": false
},
{
"type": "TemplateElement",
"start": 1218,
"end": 1228,
"loc": {