@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,465 lines (1,464 loc) • 126 kB
JSON
{
"type": "File",
"start": 0,
"end": 1535,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 55,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1535,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 55,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 33
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "MOOD_STATIONS"
},
"name": "MOOD_STATIONS"
},
"local": {
"type": "Identifier",
"start": 25,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 33
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
}
}
],
"source": {
"type": "StringLiteral",
"start": 40,
"end": 53,
"loc": {
"start": {
"line": 1,
"column": 40
},
"end": {
"line": 1,
"column": 53
}
},
"extra": {
"rawValue": "../Endpoint",
"raw": "'../Endpoint'"
},
"value": "../Endpoint"
}
},
{
"type": "ImportDeclaration",
"start": 54,
"end": 85,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 31
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 61,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
}
},
"local": {
"type": "Identifier",
"start": 61,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 14
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
}
}
],
"source": {
"type": "StringLiteral",
"start": 74,
"end": 85,
"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 mood stations.\n * @see https://docs.kkbox.codes/docs/mood-stations-mood\n ",
"start": 87,
"end": 173,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 174,
"end": 1535,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 55,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 189,
"end": 1535,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 55,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 195,
"end": 213,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 39
},
"identifierName": "MoodStationFetcher"
},
"name": "MoodStationFetcher",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 222,
"end": 229,
"loc": {
"start": {
"line": 8,
"column": 48
},
"end": {
"line": 8,
"column": 55
},
"identifierName": "Fetcher"
},
"name": "Fetcher"
},
"body": {
"type": "ClassBody",
"start": 230,
"end": 1535,
"loc": {
"start": {
"line": 8,
"column": 56
},
"end": {
"line": 55,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 267,
"end": 426,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 19,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 267,
"end": 278,
"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": 279,
"end": 283,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "AssignmentPattern",
"start": 285,
"end": 301,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 285,
"end": 294,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 31
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 297,
"end": 301,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 38
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 303,
"end": 426,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 19,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 313,
"end": 335,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"expression": {
"type": "CallExpression",
"start": 313,
"end": 335,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 30
}
},
"callee": {
"type": "Super",
"start": 313,
"end": 318,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 319,
"end": 323,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 18
},
"identifierName": "http"
},
"name": "http"
},
{
"type": "Identifier",
"start": 325,
"end": 334,
"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": 345,
"end": 379,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 388,
"end": 420,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 40
}
},
"expression": {
"type": "AssignmentExpression",
"start": 388,
"end": 420,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 40
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 388,
"end": 408,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 388,
"end": 392,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 393,
"end": 408,
"loc": {
"start": {
"line": 18,
"column": 13
},
"end": {
"line": 18,
"column": 28
},
"identifierName": "mood_station_id"
},
"name": "mood_station_id"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 411,
"end": 420,
"loc": {
"start": {
"line": 18,
"column": 31
},
"end": {
"line": 18,
"column": 40
},
"identifierName": "undefined"
},
"name": "undefined"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 345,
"end": 379,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 17,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * @ignore\n ",
"start": 236,
"end": 262,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all mood stations.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.fetchAllMoodStations()\n * @see https://docs.kkbox.codes/docs/mood-stations-mood\n ",
"start": 432,
"end": 630,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 635,
"end": 733,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 30,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 635,
"end": 655,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 28,
"column": 24
},
"identifierName": "fetchAllMoodStations"
},
"name": "fetchAllMoodStations",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 658,
"end": 733,
"loc": {
"start": {
"line": 28,
"column": 27
},
"end": {
"line": 30,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 668,
"end": 727,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 67
}
},
"argument": {
"type": "CallExpression",
"start": 675,
"end": 727,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 67
}
},
"callee": {
"type": "MemberExpression",
"start": 675,
"end": 688,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 675,
"end": 684,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 675,
"end": 679,
"loc": {
"start": {
"line": 29,
"column": 15
},
"end": {
"line": 29,
"column": 19
}
}
},
"property": {
"type": "Identifier",
"start": 680,
"end": 684,
"loc": {
"start": {
"line": 29,
"column": 20
},
"end": {
"line": 29,
"column": 24
},
"identifierName": "http"
},
"name": "http"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 685,
"end": 688,
"loc": {
"start": {
"line": 29,
"column": 25
},
"end": {
"line": 29,
"column": 28
},
"identifierName": "get"
},
"name": "get"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 689,
"end": 697,
"loc": {
"start": {
"line": 29,
"column": 29
},
"end": {
"line": 29,
"column": 37
},
"identifierName": "ENDPOINT"
},
"name": "ENDPOINT"
},
{
"type": "ObjectExpression",
"start": 699,
"end": 726,
"loc": {
"start": {
"line": 29,
"column": 39
},
"end": {
"line": 29,
"column": 66
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 700,
"end": 725,
"loc": {
"start": {
"line": 29,
"column": 40
},
"end": {
"line": 29,
"column": 65
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 700,
"end": 709,
"loc": {
"start": {
"line": 29,
"column": 40
},
"end": {
"line": 29,
"column": 49
},
"identifierName": "territory"
},
"name": "territory"
},
"value": {
"type": "MemberExpression",
"start": 711,
"end": 725,
"loc": {
"start": {
"line": 29,
"column": 51
},
"end": {
"line": 29,
"column": 65
}
},
"object": {
"type": "ThisExpression",
"start": 711,
"end": 715,
"loc": {
"start": {
"line": 29,
"column": 51
},
"end": {
"line": 29,
"column": 55
}
}
},
"property": {
"type": "Identifier",
"start": 716,
"end": 725,
"loc": {
"start": {
"line": 29,
"column": 56
},
"end": {
"line": 29,
"column": 65
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
}
}
]
}
]
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch all mood stations.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.fetchAllMoodStations()\n * @see https://docs.kkbox.codes/docs/mood-stations-mood\n ",
"start": 432,
"end": 630,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 27,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the mood station fetcher.\n *\n * @param {string} mood_station_id - The ID of a mood station.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory of a mood station.\n * @return {MoodStation}\n * @see https://docs.kkbox.codes/docs/mood-stations-station\n ",
"start": 739,
"end": 1063,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 39,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1068,
"end": 1229,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 44,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1068,
"end": 1084,
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 20
},
"identifierName": "setMoodStationID"
},
"name": "setMoodStationID",
"leadingComments": null
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1085,
"end": 1100,
"loc": {
"start": {
"line": 40,
"column": 21
},
"end": {
"line": 40,
"column": 36
},
"identifierName": "mood_station_id"
},
"name": "mood_station_id"
},
{
"type": "AssignmentPattern",
"start": 1102,
"end": 1118,
"loc": {
"start": {
"line": 40,
"column": 38
},
"end": {
"line": 40,
"column": 54
}
},
"left": {
"type": "Identifier",
"start": 1102,
"end": 1111,
"loc": {
"start": {
"line": 40,
"column": 38
},
"end": {
"line": 40,
"column": 47
},
"identifierName": "territory"
},
"name": "territory"
},
"right": {
"type": "StringLiteral",
"start": 1114,
"end": 1118,
"loc": {
"start": {
"line": 40,
"column": 50
},
"end": {
"line": 40,
"column": 54
}
},
"extra": {
"rawValue": "TW",
"raw": "'TW'"
},
"value": "TW"
}
}
],
"body": {
"type": "BlockStatement",
"start": 1120,
"end": 1229,
"loc": {
"start": {
"line": 40,
"column": 56
},
"end": {
"line": 44,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1130,
"end": 1168,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 46
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1130,
"end": 1168,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 46
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1130,
"end": 1150,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 1130,
"end": 1134,
"loc": {
"start": {
"line": 41,
"column": 8
},
"end": {
"line": 41,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1135,
"end": 1150,
"loc": {
"start": {
"line": 41,
"column": 13
},
"end": {
"line": 41,
"column": 28
},
"identifierName": "mood_station_id"
},
"name": "mood_station_id"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1153,
"end": 1168,
"loc": {
"start": {
"line": 41,
"column": 31
},
"end": {
"line": 41,
"column": 46
},
"identifierName": "mood_station_id"
},
"name": "mood_station_id"
}
}
},
{
"type": "ExpressionStatement",
"start": 1177,
"end": 1203,
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 34
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1177,
"end": 1203,
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 34
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1177,
"end": 1191,
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 1177,
"end": 1181,
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1182,
"end": 1191,
"loc": {
"start": {
"line": 42,
"column": 13
},
"end": {
"line": 42,
"column": 22
},
"identifierName": "territory"
},
"name": "territory"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1194,
"end": 1203,
"loc": {
"start": {
"line": 42,
"column": 25
},
"end": {
"line": 42,
"column": 34
},
"identifierName": "territory"
},
"name": "territory"
}
}
},
{
"type": "ReturnStatement",
"start": 1212,
"end": 1223,
"loc": {
"start": {
"line": 43,
"column": 8
},
"end": {
"line": 43,
"column": 19
}
},
"argument": {
"type": "ThisExpression",
"start": 1219,
"end": 1223,
"loc": {
"start": {
"line": 43,
"column": 15
},
"end": {
"line": 43,
"column": 19
}
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Init the mood station fetcher.\n *\n * @param {string} mood_station_id - The ID of a mood station.\n * @param {string} [territory = 'TW'] - ['TW', 'HK', 'SG', 'MY', 'JP'] The territory of a mood station.\n * @return {MoodStation}\n * @see https://docs.kkbox.codes/docs/mood-stations-station\n ",
"start": 739,
"end": 1063,
"loc": {
"start": {
"line": 32,
"column": 4
},
"end": {
"line": 39,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Fetch the mood station's metadata.\n *\n * @return {Promise}\n * @example api.moodStationFetcher.setMoodStationID('StGZp2ToWq92diPHS7').fetchMetadata()\n ",
"start": 1235,
"end": 1414,
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 51,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1419,
"end": 1533,
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 54,
"column": 5
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1419,
"end": 1432,
"loc": {
"start": {
"line": 52,
"column": 4
},
"end": {
"line": 52,
"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": 1435,
"end": 1533,
"loc": {
"start": {
"line": 52,
"column": 20
},
"end": {
"line": 54,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1445,
"end": 1527,
"loc": {
"start": {
"line": 53,
"column": 8
},
"end": {
"line": 53,
"column": 90
}
},
"argument": {
"type": "CallExpression",
"start": 1452,
"end": 1527,
"loc": {
"start": {
"line": 53,
"column": 15
},
"end": {
"line": 53,
"column": 90
}
},
"callee": {