mezon-js 2.10.87 → 2.10.89
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +257 -132
- package/client.ts +30 -10
- package/dist/api.gen.d.ts +68 -12
- package/dist/client.d.ts +5 -4
- package/dist/mezon-js.cjs.js +111 -81
- package/dist/mezon-js.esm.mjs +111 -81
- package/package.json +1 -1
package/dist/mezon-js.esm.mjs
CHANGED
@@ -931,39 +931,6 @@ var MezonApi = class {
|
|
931
931
|
)
|
932
932
|
]);
|
933
933
|
}
|
934
|
-
/** Authenticate a user with a custom id against the server. */
|
935
|
-
authenticateCustom(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
|
936
|
-
if (account === null || account === void 0) {
|
937
|
-
throw new Error(
|
938
|
-
"'account' is a required parameter but is null or undefined."
|
939
|
-
);
|
940
|
-
}
|
941
|
-
const urlPath = "/v2/account/authenticate/custom";
|
942
|
-
const queryParams = /* @__PURE__ */ new Map();
|
943
|
-
queryParams.set("create", create);
|
944
|
-
queryParams.set("username", username);
|
945
|
-
let bodyJson = "";
|
946
|
-
bodyJson = JSON.stringify(account || {});
|
947
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
948
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
949
|
-
if (basicAuthUsername) {
|
950
|
-
fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
951
|
-
}
|
952
|
-
return Promise.race([
|
953
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
954
|
-
if (response.status == 204) {
|
955
|
-
return response;
|
956
|
-
} else if (response.status >= 200 && response.status < 300) {
|
957
|
-
return response.json();
|
958
|
-
} else {
|
959
|
-
throw response;
|
960
|
-
}
|
961
|
-
}),
|
962
|
-
new Promise(
|
963
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
964
|
-
)
|
965
|
-
]);
|
966
|
-
}
|
967
934
|
/** Authenticate a user with a device id against the server. */
|
968
935
|
authenticateDevice(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
|
969
936
|
if (account === null || account === void 0) {
|
@@ -1162,18 +1129,15 @@ var MezonApi = class {
|
|
1162
1129
|
)
|
1163
1130
|
]);
|
1164
1131
|
}
|
1165
|
-
/** Authenticate a user with
|
1166
|
-
|
1132
|
+
/** Authenticate a user with Mezon against the server. */
|
1133
|
+
authenticateMezon(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
|
1167
1134
|
if (account === null || account === void 0) {
|
1168
|
-
throw new Error(
|
1169
|
-
"'account' is a required parameter but is null or undefined."
|
1170
|
-
);
|
1135
|
+
throw new Error("'account' is a required parameter but is null or undefined.");
|
1171
1136
|
}
|
1172
|
-
const urlPath = "/v2/account/authenticate/
|
1137
|
+
const urlPath = "/v2/account/authenticate/mezon";
|
1173
1138
|
const queryParams = /* @__PURE__ */ new Map();
|
1174
1139
|
queryParams.set("create", create);
|
1175
1140
|
queryParams.set("username", username);
|
1176
|
-
queryParams.set("sync", sync);
|
1177
1141
|
let bodyJson = "";
|
1178
1142
|
bodyJson = JSON.stringify(account || {});
|
1179
1143
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -1196,21 +1160,24 @@ var MezonApi = class {
|
|
1196
1160
|
)
|
1197
1161
|
]);
|
1198
1162
|
}
|
1199
|
-
/**
|
1200
|
-
|
1201
|
-
if (
|
1163
|
+
/** Authenticate a user with Steam against the server. */
|
1164
|
+
authenticateSteam(basicAuthUsername, basicAuthPassword, account, create, username, sync, options = {}) {
|
1165
|
+
if (account === null || account === void 0) {
|
1202
1166
|
throw new Error(
|
1203
|
-
"'
|
1167
|
+
"'account' is a required parameter but is null or undefined."
|
1204
1168
|
);
|
1205
1169
|
}
|
1206
|
-
const urlPath = "/v2/account/
|
1170
|
+
const urlPath = "/v2/account/authenticate/steam";
|
1207
1171
|
const queryParams = /* @__PURE__ */ new Map();
|
1172
|
+
queryParams.set("create", create);
|
1173
|
+
queryParams.set("username", username);
|
1174
|
+
queryParams.set("sync", sync);
|
1208
1175
|
let bodyJson = "";
|
1209
|
-
bodyJson = JSON.stringify(
|
1176
|
+
bodyJson = JSON.stringify(account || {});
|
1210
1177
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1211
1178
|
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1212
|
-
if (
|
1213
|
-
fetchOptions.headers["Authorization"] = "
|
1179
|
+
if (basicAuthUsername) {
|
1180
|
+
fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
1214
1181
|
}
|
1215
1182
|
return Promise.race([
|
1216
1183
|
fetch(fullUrl, fetchOptions).then((response) => {
|
@@ -1227,14 +1194,14 @@ var MezonApi = class {
|
|
1227
1194
|
)
|
1228
1195
|
]);
|
1229
1196
|
}
|
1230
|
-
/** Add
|
1231
|
-
|
1197
|
+
/** Add an Apple ID to the social profiles on the current user's account. */
|
1198
|
+
linkApple(bearerToken, body, options = {}) {
|
1232
1199
|
if (body === null || body === void 0) {
|
1233
1200
|
throw new Error(
|
1234
1201
|
"'body' is a required parameter but is null or undefined."
|
1235
1202
|
);
|
1236
1203
|
}
|
1237
|
-
const urlPath = "/v2/account/link/
|
1204
|
+
const urlPath = "/v2/account/link/apple";
|
1238
1205
|
const queryParams = /* @__PURE__ */ new Map();
|
1239
1206
|
let bodyJson = "";
|
1240
1207
|
bodyJson = JSON.stringify(body || {});
|
@@ -1414,6 +1381,35 @@ var MezonApi = class {
|
|
1414
1381
|
)
|
1415
1382
|
]);
|
1416
1383
|
}
|
1384
|
+
/** Add a mezon ID to the social profiles on the current user's account. */
|
1385
|
+
linkMezon(bearerToken, body, options = {}) {
|
1386
|
+
if (body === null || body === void 0) {
|
1387
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1388
|
+
}
|
1389
|
+
const urlPath = "/v2/account/link/mezon";
|
1390
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1391
|
+
let bodyJson = "";
|
1392
|
+
bodyJson = JSON.stringify(body || {});
|
1393
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1394
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1395
|
+
if (bearerToken) {
|
1396
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1397
|
+
}
|
1398
|
+
return Promise.race([
|
1399
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1400
|
+
if (response.status == 204) {
|
1401
|
+
return response;
|
1402
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1403
|
+
return response.json();
|
1404
|
+
} else {
|
1405
|
+
throw response;
|
1406
|
+
}
|
1407
|
+
}),
|
1408
|
+
new Promise(
|
1409
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1410
|
+
)
|
1411
|
+
]);
|
1412
|
+
}
|
1417
1413
|
/** Add Google to the social profiles on the current user's account. */
|
1418
1414
|
linkGoogle(bearerToken, body, options = {}) {
|
1419
1415
|
if (body === null || body === void 0) {
|
@@ -1569,14 +1565,14 @@ var MezonApi = class {
|
|
1569
1565
|
)
|
1570
1566
|
]);
|
1571
1567
|
}
|
1572
|
-
/** Remove the
|
1573
|
-
|
1568
|
+
/** Remove the device ID from the social profiles on the current user's account. */
|
1569
|
+
unlinkDevice(bearerToken, body, options = {}) {
|
1574
1570
|
if (body === null || body === void 0) {
|
1575
1571
|
throw new Error(
|
1576
1572
|
"'body' is a required parameter but is null or undefined."
|
1577
1573
|
);
|
1578
1574
|
}
|
1579
|
-
const urlPath = "/v2/account/unlink/
|
1575
|
+
const urlPath = "/v2/account/unlink/device";
|
1580
1576
|
const queryParams = /* @__PURE__ */ new Map();
|
1581
1577
|
let bodyJson = "";
|
1582
1578
|
bodyJson = JSON.stringify(body || {});
|
@@ -1600,14 +1596,14 @@ var MezonApi = class {
|
|
1600
1596
|
)
|
1601
1597
|
]);
|
1602
1598
|
}
|
1603
|
-
/** Remove the
|
1604
|
-
|
1599
|
+
/** Remove the email+password from the social profiles on the current user's account. */
|
1600
|
+
unlinkEmail(bearerToken, body, options = {}) {
|
1605
1601
|
if (body === null || body === void 0) {
|
1606
1602
|
throw new Error(
|
1607
1603
|
"'body' is a required parameter but is null or undefined."
|
1608
1604
|
);
|
1609
1605
|
}
|
1610
|
-
const urlPath = "/v2/account/unlink/
|
1606
|
+
const urlPath = "/v2/account/unlink/email";
|
1611
1607
|
const queryParams = /* @__PURE__ */ new Map();
|
1612
1608
|
let bodyJson = "";
|
1613
1609
|
bodyJson = JSON.stringify(body || {});
|
@@ -1631,14 +1627,14 @@ var MezonApi = class {
|
|
1631
1627
|
)
|
1632
1628
|
]);
|
1633
1629
|
}
|
1634
|
-
/** Remove
|
1635
|
-
|
1630
|
+
/** Remove Facebook from the social profiles on the current user's account. */
|
1631
|
+
unlinkFacebook(bearerToken, body, options = {}) {
|
1636
1632
|
if (body === null || body === void 0) {
|
1637
1633
|
throw new Error(
|
1638
1634
|
"'body' is a required parameter but is null or undefined."
|
1639
1635
|
);
|
1640
1636
|
}
|
1641
|
-
const urlPath = "/v2/account/unlink/
|
1637
|
+
const urlPath = "/v2/account/unlink/facebook";
|
1642
1638
|
const queryParams = /* @__PURE__ */ new Map();
|
1643
1639
|
let bodyJson = "";
|
1644
1640
|
bodyJson = JSON.stringify(body || {});
|
@@ -1662,14 +1658,14 @@ var MezonApi = class {
|
|
1662
1658
|
)
|
1663
1659
|
]);
|
1664
1660
|
}
|
1665
|
-
/** Remove Facebook from the social profiles on the current user's account. */
|
1666
|
-
|
1661
|
+
/** Remove Facebook Instant Game profile from the social profiles on the current user's account. */
|
1662
|
+
unlinkFacebookInstantGame(bearerToken, body, options = {}) {
|
1667
1663
|
if (body === null || body === void 0) {
|
1668
1664
|
throw new Error(
|
1669
1665
|
"'body' is a required parameter but is null or undefined."
|
1670
1666
|
);
|
1671
1667
|
}
|
1672
|
-
const urlPath = "/v2/account/unlink/
|
1668
|
+
const urlPath = "/v2/account/unlink/facebookinstantgame";
|
1673
1669
|
const queryParams = /* @__PURE__ */ new Map();
|
1674
1670
|
let bodyJson = "";
|
1675
1671
|
bodyJson = JSON.stringify(body || {});
|
@@ -1693,14 +1689,14 @@ var MezonApi = class {
|
|
1693
1689
|
)
|
1694
1690
|
]);
|
1695
1691
|
}
|
1696
|
-
/** Remove
|
1697
|
-
|
1692
|
+
/** Remove Apple's GameCenter from the social profiles on the current user's account. */
|
1693
|
+
unlinkGameCenter(bearerToken, body, options = {}) {
|
1698
1694
|
if (body === null || body === void 0) {
|
1699
1695
|
throw new Error(
|
1700
1696
|
"'body' is a required parameter but is null or undefined."
|
1701
1697
|
);
|
1702
1698
|
}
|
1703
|
-
const urlPath = "/v2/account/unlink/
|
1699
|
+
const urlPath = "/v2/account/unlink/gamecenter";
|
1704
1700
|
const queryParams = /* @__PURE__ */ new Map();
|
1705
1701
|
let bodyJson = "";
|
1706
1702
|
bodyJson = JSON.stringify(body || {});
|
@@ -1724,14 +1720,14 @@ var MezonApi = class {
|
|
1724
1720
|
)
|
1725
1721
|
]);
|
1726
1722
|
}
|
1727
|
-
/** Remove
|
1728
|
-
|
1723
|
+
/** Remove Google from the social profiles on the current user's account. */
|
1724
|
+
unlinkGoogle(bearerToken, body, options = {}) {
|
1729
1725
|
if (body === null || body === void 0) {
|
1730
1726
|
throw new Error(
|
1731
1727
|
"'body' is a required parameter but is null or undefined."
|
1732
1728
|
);
|
1733
1729
|
}
|
1734
|
-
const urlPath = "/v2/account/unlink/
|
1730
|
+
const urlPath = "/v2/account/unlink/google";
|
1735
1731
|
const queryParams = /* @__PURE__ */ new Map();
|
1736
1732
|
let bodyJson = "";
|
1737
1733
|
bodyJson = JSON.stringify(body || {});
|
@@ -1755,14 +1751,12 @@ var MezonApi = class {
|
|
1755
1751
|
)
|
1756
1752
|
]);
|
1757
1753
|
}
|
1758
|
-
/** Remove
|
1759
|
-
|
1754
|
+
/** Remove the mezon ID from the social profiles on the current user's account. */
|
1755
|
+
unlinkMezon(bearerToken, body, options = {}) {
|
1760
1756
|
if (body === null || body === void 0) {
|
1761
|
-
throw new Error(
|
1762
|
-
"'body' is a required parameter but is null or undefined."
|
1763
|
-
);
|
1757
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1764
1758
|
}
|
1765
|
-
const urlPath = "/v2/account/unlink/
|
1759
|
+
const urlPath = "/v2/account/unlink/mezon";
|
1766
1760
|
const queryParams = /* @__PURE__ */ new Map();
|
1767
1761
|
let bodyJson = "";
|
1768
1762
|
bodyJson = JSON.stringify(body || {});
|
@@ -4324,6 +4318,31 @@ var MezonApi = class {
|
|
4324
4318
|
)
|
4325
4319
|
]);
|
4326
4320
|
}
|
4321
|
+
/** List mezon OAuth client */
|
4322
|
+
listMezonOauthClient(bearerToken, options = {}) {
|
4323
|
+
const urlPath = "/v2/mznoauthclient";
|
4324
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4325
|
+
let bodyJson = "";
|
4326
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4327
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4328
|
+
if (bearerToken) {
|
4329
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4330
|
+
}
|
4331
|
+
return Promise.race([
|
4332
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4333
|
+
if (response.status == 204) {
|
4334
|
+
return response;
|
4335
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4336
|
+
return response.json();
|
4337
|
+
} else {
|
4338
|
+
throw response;
|
4339
|
+
}
|
4340
|
+
}),
|
4341
|
+
new Promise(
|
4342
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4343
|
+
)
|
4344
|
+
]);
|
4345
|
+
}
|
4327
4346
|
/** set mute notification user channel. */
|
4328
4347
|
setMuteNotificationCategory(bearerToken, body, options = {}) {
|
4329
4348
|
if (body === null || body === void 0) {
|
@@ -8219,12 +8238,12 @@ var Client = class {
|
|
8219
8238
|
});
|
8220
8239
|
}
|
8221
8240
|
/** Authenticate a user with a custom id against the server. */
|
8222
|
-
|
8241
|
+
authenticateMezon(token, create, username, vars = {}, options = {}) {
|
8223
8242
|
const request = {
|
8224
|
-
|
8243
|
+
token,
|
8225
8244
|
vars
|
8226
8245
|
};
|
8227
|
-
return this.apiClient.
|
8246
|
+
return this.apiClient.authenticateMezon(
|
8228
8247
|
this.serverkey,
|
8229
8248
|
"",
|
8230
8249
|
request,
|
@@ -9100,12 +9119,12 @@ var Client = class {
|
|
9100
9119
|
});
|
9101
9120
|
}
|
9102
9121
|
/** Add a custom ID to the social profiles on the current user's account. */
|
9103
|
-
|
9122
|
+
linkMezon(session, request) {
|
9104
9123
|
return __async(this, null, function* () {
|
9105
9124
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9106
9125
|
yield this.sessionRefresh(session);
|
9107
9126
|
}
|
9108
|
-
return this.apiClient.
|
9127
|
+
return this.apiClient.linkMezon(session.token, request).then((response) => {
|
9109
9128
|
return response !== void 0;
|
9110
9129
|
});
|
9111
9130
|
});
|
@@ -9355,7 +9374,7 @@ var Client = class {
|
|
9355
9374
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9356
9375
|
yield this.sessionRefresh(session);
|
9357
9376
|
}
|
9358
|
-
return this.apiClient.
|
9377
|
+
return this.apiClient.unlinkMezon(session.token, request).then((response) => {
|
9359
9378
|
return response !== void 0;
|
9360
9379
|
});
|
9361
9380
|
});
|
@@ -10747,6 +10766,17 @@ var Client = class {
|
|
10747
10766
|
});
|
10748
10767
|
});
|
10749
10768
|
}
|
10769
|
+
//**list webhook belong to the clan */
|
10770
|
+
listMezonOauthClient(session) {
|
10771
|
+
return __async(this, null, function* () {
|
10772
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10773
|
+
yield this.sessionRefresh(session);
|
10774
|
+
}
|
10775
|
+
return this.apiClient.listMezonOauthClient(session.token).then((response) => {
|
10776
|
+
return Promise.resolve(response);
|
10777
|
+
});
|
10778
|
+
});
|
10779
|
+
}
|
10750
10780
|
};
|
10751
10781
|
export {
|
10752
10782
|
ChannelStreamMode,
|