mezon-js 2.9.95 → 2.9.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.gen.ts +699 -638
- package/client.ts +6 -37
- package/dist/api.gen.d.ts +4 -9
- package/dist/client.d.ts +1 -3
- package/dist/index.d.ts +1 -0
- package/dist/mezon-js.cjs.js +179 -122
- package/dist/mezon-js.esm.mjs +179 -122
- package/index.ts +1 -0
- package/package.json +1 -1
- package/utils.ts +1 -1
package/dist/mezon-js.esm.mjs
CHANGED
@@ -610,6 +610,19 @@ var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
610
610
|
var utob = (u) => u.replace(re_utob, cb_utob);
|
611
611
|
var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
612
612
|
var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
613
|
+
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
614
|
+
var cb_btou = (cccc) => {
|
615
|
+
switch (cccc.length) {
|
616
|
+
case 4:
|
617
|
+
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
618
|
+
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
619
|
+
case 3:
|
620
|
+
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
621
|
+
default:
|
622
|
+
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
623
|
+
}
|
624
|
+
};
|
625
|
+
var btou = (b) => b.replace(re_btou, cb_btou);
|
613
626
|
var atobPolyfill = (asc) => {
|
614
627
|
asc = asc.replace(/\s+/g, "");
|
615
628
|
if (!b64re.test(asc))
|
@@ -623,6 +636,10 @@ var atobPolyfill = (asc) => {
|
|
623
636
|
return bin;
|
624
637
|
};
|
625
638
|
var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
639
|
+
var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
640
|
+
var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
641
|
+
var _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
642
|
+
var decode2 = (src) => _decode(_unURI(src));
|
626
643
|
|
627
644
|
// utils.ts
|
628
645
|
function buildFetchOptions(method, options, bodyJson) {
|
@@ -650,6 +667,19 @@ function buildFetchOptions(method, options, bodyJson) {
|
|
650
667
|
}
|
651
668
|
return fetchOptions;
|
652
669
|
}
|
670
|
+
function b64EncodeUnicode(str) {
|
671
|
+
return encode(encodeURIComponent(str).replace(
|
672
|
+
/%([0-9A-F]{2})/g,
|
673
|
+
function toSolidBytes(_match, p1) {
|
674
|
+
return String.fromCharCode(Number("0x" + p1));
|
675
|
+
}
|
676
|
+
));
|
677
|
+
}
|
678
|
+
function b64DecodeUnicode(str) {
|
679
|
+
return decodeURIComponent(decode2(str).split("").map(function(c) {
|
680
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
681
|
+
}).join(""));
|
682
|
+
}
|
653
683
|
function safeJSONParse(jsonString) {
|
654
684
|
try {
|
655
685
|
const unescapedJSON = jsonString.replace(/\\./g, (match) => {
|
@@ -667,7 +697,7 @@ function safeJSONParse(jsonString) {
|
|
667
697
|
const parsedData = JSON.parse(unescapedJSON);
|
668
698
|
return parsedData;
|
669
699
|
} catch (error) {
|
670
|
-
console.error("Error parsing JSON:", error);
|
700
|
+
console.error("Error parsing JSON:", jsonString, error);
|
671
701
|
return null;
|
672
702
|
}
|
673
703
|
}
|
@@ -821,7 +851,9 @@ var MezonApi = class {
|
|
821
851
|
/** */
|
822
852
|
checkLoginRequest(basicAuthUsername, basicAuthPassword, body, options = {}) {
|
823
853
|
if (body === null || body === void 0) {
|
824
|
-
throw new Error(
|
854
|
+
throw new Error(
|
855
|
+
"'body' is a required parameter but is null or undefined."
|
856
|
+
);
|
825
857
|
}
|
826
858
|
const urlPath = "/v2/account/authenticate/checklogin";
|
827
859
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -850,7 +882,9 @@ var MezonApi = class {
|
|
850
882
|
/** */
|
851
883
|
confirmLogin(bearerToken, body, options = {}) {
|
852
884
|
if (body === null || body === void 0) {
|
853
|
-
throw new Error(
|
885
|
+
throw new Error(
|
886
|
+
"'body' is a required parameter but is null or undefined."
|
887
|
+
);
|
854
888
|
}
|
855
889
|
const urlPath = "/v2/account/authenticate/confirmlogin";
|
856
890
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -879,7 +913,9 @@ var MezonApi = class {
|
|
879
913
|
/** */
|
880
914
|
createQRLogin(basicAuthUsername, basicAuthPassword, body, options = {}) {
|
881
915
|
if (body === null || body === void 0) {
|
882
|
-
throw new Error(
|
916
|
+
throw new Error(
|
917
|
+
"'body' is a required parameter but is null or undefined."
|
918
|
+
);
|
883
919
|
}
|
884
920
|
const urlPath = "/v2/account/authenticate/createqrlogin";
|
885
921
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -1819,7 +1855,9 @@ var MezonApi = class {
|
|
1819
1855
|
/** Create user activity */
|
1820
1856
|
createActiviy(bearerToken, body, options = {}) {
|
1821
1857
|
if (body === null || body === void 0) {
|
1822
|
-
throw new Error(
|
1858
|
+
throw new Error(
|
1859
|
+
"'body' is a required parameter but is null or undefined."
|
1860
|
+
);
|
1823
1861
|
}
|
1824
1862
|
const urlPath = "/v2/activity";
|
1825
1863
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -2228,9 +2266,14 @@ var MezonApi = class {
|
|
2228
2266
|
/** */
|
2229
2267
|
getChannelCanvasList(bearerToken, channelId, clanId, limit, page, options = {}) {
|
2230
2268
|
if (channelId === null || channelId === void 0) {
|
2231
|
-
throw new Error(
|
2269
|
+
throw new Error(
|
2270
|
+
"'channelId' is a required parameter but is null or undefined."
|
2271
|
+
);
|
2232
2272
|
}
|
2233
|
-
const urlPath = "/v2/channel-canvases/{channelId}".replace(
|
2273
|
+
const urlPath = "/v2/channel-canvases/{channelId}".replace(
|
2274
|
+
"{channelId}",
|
2275
|
+
encodeURIComponent(String(channelId))
|
2276
|
+
);
|
2234
2277
|
const queryParams = /* @__PURE__ */ new Map();
|
2235
2278
|
queryParams.set("clan_id", clanId);
|
2236
2279
|
queryParams.set("limit", limit);
|
@@ -2259,7 +2302,9 @@ var MezonApi = class {
|
|
2259
2302
|
/** */
|
2260
2303
|
addChannelFavorite(bearerToken, body, options = {}) {
|
2261
2304
|
if (body === null || body === void 0) {
|
2262
|
-
throw new Error(
|
2305
|
+
throw new Error(
|
2306
|
+
"'body' is a required parameter but is null or undefined."
|
2307
|
+
);
|
2263
2308
|
}
|
2264
2309
|
const urlPath = "/v2/channel/favorite";
|
2265
2310
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -2288,9 +2333,14 @@ var MezonApi = class {
|
|
2288
2333
|
/** */
|
2289
2334
|
removeChannelFavorite(bearerToken, channelId, options = {}) {
|
2290
2335
|
if (channelId === null || channelId === void 0) {
|
2291
|
-
throw new Error(
|
2336
|
+
throw new Error(
|
2337
|
+
"'channelId' is a required parameter but is null or undefined."
|
2338
|
+
);
|
2292
2339
|
}
|
2293
|
-
const urlPath = "/v2/channel/favorite/{channelId}".replace(
|
2340
|
+
const urlPath = "/v2/channel/favorite/{channelId}".replace(
|
2341
|
+
"{channelId}",
|
2342
|
+
encodeURIComponent(String(channelId))
|
2343
|
+
);
|
2294
2344
|
const queryParams = /* @__PURE__ */ new Map();
|
2295
2345
|
let bodyJson = "";
|
2296
2346
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -2316,9 +2366,14 @@ var MezonApi = class {
|
|
2316
2366
|
/** */
|
2317
2367
|
getListFavoriteChannel(bearerToken, clanId, options = {}) {
|
2318
2368
|
if (clanId === null || clanId === void 0) {
|
2319
|
-
throw new Error(
|
2369
|
+
throw new Error(
|
2370
|
+
"'clanId' is a required parameter but is null or undefined."
|
2371
|
+
);
|
2320
2372
|
}
|
2321
|
-
const urlPath = "/v2/channel/favorite/{clanId}".replace(
|
2373
|
+
const urlPath = "/v2/channel/favorite/{clanId}".replace(
|
2374
|
+
"{clanId}",
|
2375
|
+
encodeURIComponent(String(clanId))
|
2376
|
+
);
|
2322
2377
|
const queryParams = /* @__PURE__ */ new Map();
|
2323
2378
|
let bodyJson = "";
|
2324
2379
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -2453,9 +2508,14 @@ var MezonApi = class {
|
|
2453
2508
|
/** get channel encryption method */
|
2454
2509
|
getChanEncryptionMethod(bearerToken, channelId, method, options = {}) {
|
2455
2510
|
if (channelId === null || channelId === void 0) {
|
2456
|
-
throw new Error(
|
2511
|
+
throw new Error(
|
2512
|
+
"'channelId' is a required parameter but is null or undefined."
|
2513
|
+
);
|
2457
2514
|
}
|
2458
|
-
const urlPath = "/v2/channel/{channelId}/encrypt_method".replace(
|
2515
|
+
const urlPath = "/v2/channel/{channelId}/encrypt_method".replace(
|
2516
|
+
"{channelId}",
|
2517
|
+
encodeURIComponent(String(channelId))
|
2518
|
+
);
|
2459
2519
|
const queryParams = /* @__PURE__ */ new Map();
|
2460
2520
|
queryParams.set("method", method);
|
2461
2521
|
let bodyJson = "";
|
@@ -2482,12 +2542,19 @@ var MezonApi = class {
|
|
2482
2542
|
/** store channel encryption method */
|
2483
2543
|
setChanEncryptionMethod(bearerToken, channelId, body, options = {}) {
|
2484
2544
|
if (channelId === null || channelId === void 0) {
|
2485
|
-
throw new Error(
|
2545
|
+
throw new Error(
|
2546
|
+
"'channelId' is a required parameter but is null or undefined."
|
2547
|
+
);
|
2486
2548
|
}
|
2487
2549
|
if (body === null || body === void 0) {
|
2488
|
-
throw new Error(
|
2550
|
+
throw new Error(
|
2551
|
+
"'body' is a required parameter but is null or undefined."
|
2552
|
+
);
|
2489
2553
|
}
|
2490
|
-
const urlPath = "/v2/channel/{channelId}/encrypt_method".replace(
|
2554
|
+
const urlPath = "/v2/channel/{channelId}/encrypt_method".replace(
|
2555
|
+
"{channelId}",
|
2556
|
+
encodeURIComponent(String(channelId))
|
2557
|
+
);
|
2491
2558
|
const queryParams = /* @__PURE__ */ new Map();
|
2492
2559
|
let bodyJson = "";
|
2493
2560
|
bodyJson = JSON.stringify(body || {});
|
@@ -2779,9 +2846,14 @@ var MezonApi = class {
|
|
2779
2846
|
/** List channel setting */
|
2780
2847
|
listChannelSetting(bearerToken, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page, channelLabel, options = {}) {
|
2781
2848
|
if (clanId === null || clanId === void 0) {
|
2782
|
-
throw new Error(
|
2849
|
+
throw new Error(
|
2850
|
+
"'clanId' is a required parameter but is null or undefined."
|
2851
|
+
);
|
2783
2852
|
}
|
2784
|
-
const urlPath = "/v2/channelsetting/{clanId}".replace(
|
2853
|
+
const urlPath = "/v2/channelsetting/{clanId}".replace(
|
2854
|
+
"{clanId}",
|
2855
|
+
encodeURIComponent(String(clanId))
|
2856
|
+
);
|
2785
2857
|
const queryParams = /* @__PURE__ */ new Map();
|
2786
2858
|
queryParams.set("parent_id", parentId);
|
2787
2859
|
queryParams.set("category_id", categoryId);
|
@@ -3179,60 +3251,6 @@ var MezonApi = class {
|
|
3179
3251
|
]);
|
3180
3252
|
}
|
3181
3253
|
/** */
|
3182
|
-
getCustomDisplay(bearerToken, options = {}) {
|
3183
|
-
const urlPath = "/v2/customdisplay";
|
3184
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3185
|
-
let bodyJson = "";
|
3186
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3187
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3188
|
-
if (bearerToken) {
|
3189
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3190
|
-
}
|
3191
|
-
return Promise.race([
|
3192
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3193
|
-
if (response.status == 204) {
|
3194
|
-
return response;
|
3195
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3196
|
-
return response.json();
|
3197
|
-
} else {
|
3198
|
-
throw response;
|
3199
|
-
}
|
3200
|
-
}),
|
3201
|
-
new Promise(
|
3202
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3203
|
-
)
|
3204
|
-
]);
|
3205
|
-
}
|
3206
|
-
/** */
|
3207
|
-
updateCustomDisplay(bearerToken, body, options = {}) {
|
3208
|
-
if (body === null || body === void 0) {
|
3209
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
3210
|
-
}
|
3211
|
-
const urlPath = "/v2/customdisplay";
|
3212
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3213
|
-
let bodyJson = "";
|
3214
|
-
bodyJson = JSON.stringify(body || {});
|
3215
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3216
|
-
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3217
|
-
if (bearerToken) {
|
3218
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3219
|
-
}
|
3220
|
-
return Promise.race([
|
3221
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3222
|
-
if (response.status == 204) {
|
3223
|
-
return response;
|
3224
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3225
|
-
return response.json();
|
3226
|
-
} else {
|
3227
|
-
throw response;
|
3228
|
-
}
|
3229
|
-
}),
|
3230
|
-
new Promise(
|
3231
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3232
|
-
)
|
3233
|
-
]);
|
3234
|
-
}
|
3235
|
-
/** */
|
3236
3254
|
deleteCategoryDesc(bearerToken, categoryId, clanId, options = {}) {
|
3237
3255
|
if (categoryId === null || categoryId === void 0) {
|
3238
3256
|
throw new Error(
|
@@ -4283,7 +4301,9 @@ var MezonApi = class {
|
|
4283
4301
|
/** Mark as read */
|
4284
4302
|
markAsRead(bearerToken, body, options = {}) {
|
4285
4303
|
if (body === null || body === void 0) {
|
4286
|
-
throw new Error(
|
4304
|
+
throw new Error(
|
4305
|
+
"'body' is a required parameter but is null or undefined."
|
4306
|
+
);
|
4287
4307
|
}
|
4288
4308
|
const urlPath = "/v2/markasread";
|
4289
4309
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -4799,7 +4819,9 @@ var MezonApi = class {
|
|
4799
4819
|
/** set notification user channel. */
|
4800
4820
|
createPinMessage(bearerToken, body, options = {}) {
|
4801
4821
|
if (body === null || body === void 0) {
|
4802
|
-
throw new Error(
|
4822
|
+
throw new Error(
|
4823
|
+
"'body' is a required parameter but is null or undefined."
|
4824
|
+
);
|
4803
4825
|
}
|
4804
4826
|
const urlPath = "/v2/pinmessage/set";
|
4805
4827
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -4885,7 +4907,9 @@ var MezonApi = class {
|
|
4885
4907
|
/** store pubkey for e2ee */
|
4886
4908
|
pushPubKey(bearerToken, body, options = {}) {
|
4887
4909
|
if (body === null || body === void 0) {
|
4888
|
-
throw new Error(
|
4910
|
+
throw new Error(
|
4911
|
+
"'body' is a required parameter but is null or undefined."
|
4912
|
+
);
|
4889
4913
|
}
|
4890
4914
|
const urlPath = "/v2/pubkey/push";
|
4891
4915
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -5367,7 +5391,9 @@ var MezonApi = class {
|
|
5367
5391
|
/** UpdateWallets */
|
5368
5392
|
sendToken(bearerToken, body, options = {}) {
|
5369
5393
|
if (body === null || body === void 0) {
|
5370
|
-
throw new Error(
|
5394
|
+
throw new Error(
|
5395
|
+
"'body' is a required parameter but is null or undefined."
|
5396
|
+
);
|
5371
5397
|
}
|
5372
5398
|
const urlPath = "/v2/sendtoken";
|
5373
5399
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -5801,9 +5827,14 @@ var MezonApi = class {
|
|
5801
5827
|
/** List user channels */
|
5802
5828
|
listThreadDescs(bearerToken, channelId, limit, state, clanId, threadId, options = {}) {
|
5803
5829
|
if (channelId === null || channelId === void 0) {
|
5804
|
-
throw new Error(
|
5830
|
+
throw new Error(
|
5831
|
+
"'channelId' is a required parameter but is null or undefined."
|
5832
|
+
);
|
5805
5833
|
}
|
5806
|
-
const urlPath = "/v2/thread/{channelId}".replace(
|
5834
|
+
const urlPath = "/v2/thread/{channelId}".replace(
|
5835
|
+
"{channelId}",
|
5836
|
+
encodeURIComponent(String(channelId))
|
5837
|
+
);
|
5807
5838
|
const queryParams = /* @__PURE__ */ new Map();
|
5808
5839
|
queryParams.set("limit", limit);
|
5809
5840
|
queryParams.set("state", state);
|
@@ -6109,7 +6140,9 @@ var MezonApi = class {
|
|
6109
6140
|
/** Update user status */
|
6110
6141
|
updateUserStatus(bearerToken, body, options = {}) {
|
6111
6142
|
if (body === null || body === void 0) {
|
6112
|
-
throw new Error(
|
6143
|
+
throw new Error(
|
6144
|
+
"'body' is a required parameter but is null or undefined."
|
6145
|
+
);
|
6113
6146
|
}
|
6114
6147
|
const urlPath = "/v2/userstatus";
|
6115
6148
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -6271,9 +6304,14 @@ var MezonApi = class {
|
|
6271
6304
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6272
6305
|
}
|
6273
6306
|
if (body === null || body === void 0) {
|
6274
|
-
throw new Error(
|
6307
|
+
throw new Error(
|
6308
|
+
"'body' is a required parameter but is null or undefined."
|
6309
|
+
);
|
6275
6310
|
}
|
6276
|
-
const urlPath = "/v2/webhooks/{id}".replace(
|
6311
|
+
const urlPath = "/v2/webhooks/{id}".replace(
|
6312
|
+
"{id}",
|
6313
|
+
encodeURIComponent(String(id))
|
6314
|
+
);
|
6277
6315
|
const queryParams = /* @__PURE__ */ new Map();
|
6278
6316
|
let bodyJson = "";
|
6279
6317
|
bodyJson = JSON.stringify(body || {});
|
@@ -6346,7 +6384,9 @@ var MezonApi = class {
|
|
6346
6384
|
/** WithdrawToken */
|
6347
6385
|
withdrawToken(bearerToken, body, options = {}) {
|
6348
6386
|
if (body === null || body === void 0) {
|
6349
|
-
throw new Error(
|
6387
|
+
throw new Error(
|
6388
|
+
"'body' is a required parameter but is null or undefined."
|
6389
|
+
);
|
6350
6390
|
}
|
6351
6391
|
const urlPath = "/v2/withdrawtoken";
|
6352
6392
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -6472,7 +6512,9 @@ var MezonApi = class {
|
|
6472
6512
|
/** create onboarding. */
|
6473
6513
|
createOnboarding(bearerToken, body, options = {}) {
|
6474
6514
|
if (body === null || body === void 0) {
|
6475
|
-
throw new Error(
|
6515
|
+
throw new Error(
|
6516
|
+
"'body' is a required parameter but is null or undefined."
|
6517
|
+
);
|
6476
6518
|
}
|
6477
6519
|
const urlPath = "/v2/onboarding";
|
6478
6520
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -6503,7 +6545,10 @@ var MezonApi = class {
|
|
6503
6545
|
if (id === null || id === void 0) {
|
6504
6546
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6505
6547
|
}
|
6506
|
-
const urlPath = "/v2/onboarding/{id}".replace(
|
6548
|
+
const urlPath = "/v2/onboarding/{id}".replace(
|
6549
|
+
"{id}",
|
6550
|
+
encodeURIComponent(String(id))
|
6551
|
+
);
|
6507
6552
|
const queryParams = /* @__PURE__ */ new Map();
|
6508
6553
|
queryParams.set("clan_id", clanId);
|
6509
6554
|
let bodyJson = "";
|
@@ -6532,7 +6577,10 @@ var MezonApi = class {
|
|
6532
6577
|
if (id === null || id === void 0) {
|
6533
6578
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6534
6579
|
}
|
6535
|
-
const urlPath = "/v2/onboarding/{id}".replace(
|
6580
|
+
const urlPath = "/v2/onboarding/{id}".replace(
|
6581
|
+
"{id}",
|
6582
|
+
encodeURIComponent(String(id))
|
6583
|
+
);
|
6536
6584
|
const queryParams = /* @__PURE__ */ new Map();
|
6537
6585
|
queryParams.set("clan_id", clanId);
|
6538
6586
|
let bodyJson = "";
|
@@ -6562,9 +6610,14 @@ var MezonApi = class {
|
|
6562
6610
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6563
6611
|
}
|
6564
6612
|
if (body === null || body === void 0) {
|
6565
|
-
throw new Error(
|
6613
|
+
throw new Error(
|
6614
|
+
"'body' is a required parameter but is null or undefined."
|
6615
|
+
);
|
6566
6616
|
}
|
6567
|
-
const urlPath = "/v2/onboarding/{id}".replace(
|
6617
|
+
const urlPath = "/v2/onboarding/{id}".replace(
|
6618
|
+
"{id}",
|
6619
|
+
encodeURIComponent(String(id))
|
6620
|
+
);
|
6568
6621
|
const queryParams = /* @__PURE__ */ new Map();
|
6569
6622
|
let bodyJson = "";
|
6570
6623
|
bodyJson = JSON.stringify(body || {});
|
@@ -6591,7 +6644,9 @@ var MezonApi = class {
|
|
6591
6644
|
/** Generate clan webhook. */
|
6592
6645
|
generateClanWebhook(bearerToken, body, options = {}) {
|
6593
6646
|
if (body === null || body === void 0) {
|
6594
|
-
throw new Error(
|
6647
|
+
throw new Error(
|
6648
|
+
"'body' is a required parameter but is null or undefined."
|
6649
|
+
);
|
6595
6650
|
}
|
6596
6651
|
const urlPath = "/v2/clanwebhooks";
|
6597
6652
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -6620,9 +6675,14 @@ var MezonApi = class {
|
|
6620
6675
|
/** List clan webhook. */
|
6621
6676
|
listClanWebhook(bearerToken, clanId, options = {}) {
|
6622
6677
|
if (clanId === null || clanId === void 0) {
|
6623
|
-
throw new Error(
|
6678
|
+
throw new Error(
|
6679
|
+
"'clanId' is a required parameter but is null or undefined."
|
6680
|
+
);
|
6624
6681
|
}
|
6625
|
-
const urlPath = "/v2/clanwebhooks/{clanId}".replace(
|
6682
|
+
const urlPath = "/v2/clanwebhooks/{clanId}".replace(
|
6683
|
+
"{clanId}",
|
6684
|
+
encodeURIComponent(String(clanId))
|
6685
|
+
);
|
6626
6686
|
const queryParams = /* @__PURE__ */ new Map();
|
6627
6687
|
let bodyJson = "";
|
6628
6688
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -6650,7 +6710,10 @@ var MezonApi = class {
|
|
6650
6710
|
if (id === null || id === void 0) {
|
6651
6711
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6652
6712
|
}
|
6653
|
-
const urlPath = "/v2/clanwebhooks/{id}".replace(
|
6713
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace(
|
6714
|
+
"{id}",
|
6715
|
+
encodeURIComponent(String(id))
|
6716
|
+
);
|
6654
6717
|
const queryParams = /* @__PURE__ */ new Map();
|
6655
6718
|
queryParams.set("clan_id", clanId);
|
6656
6719
|
let bodyJson = "";
|
@@ -6680,9 +6743,14 @@ var MezonApi = class {
|
|
6680
6743
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6681
6744
|
}
|
6682
6745
|
if (body === null || body === void 0) {
|
6683
|
-
throw new Error(
|
6746
|
+
throw new Error(
|
6747
|
+
"'body' is a required parameter but is null or undefined."
|
6748
|
+
);
|
6684
6749
|
}
|
6685
|
-
const urlPath = "/v2/clanwebhooks/{id}".replace(
|
6750
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace(
|
6751
|
+
"{id}",
|
6752
|
+
encodeURIComponent(String(id))
|
6753
|
+
);
|
6686
6754
|
const queryParams = /* @__PURE__ */ new Map();
|
6687
6755
|
let bodyJson = "";
|
6688
6756
|
bodyJson = JSON.stringify(body || {});
|
@@ -6737,12 +6805,19 @@ var MezonApi = class {
|
|
6737
6805
|
/** Update onboarding step. */
|
6738
6806
|
updateOnboardingStepByClanId(bearerToken, clanId, body, options = {}) {
|
6739
6807
|
if (clanId === null || clanId === void 0) {
|
6740
|
-
throw new Error(
|
6808
|
+
throw new Error(
|
6809
|
+
"'clanId' is a required parameter but is null or undefined."
|
6810
|
+
);
|
6741
6811
|
}
|
6742
6812
|
if (body === null || body === void 0) {
|
6743
|
-
throw new Error(
|
6813
|
+
throw new Error(
|
6814
|
+
"'body' is a required parameter but is null or undefined."
|
6815
|
+
);
|
6744
6816
|
}
|
6745
|
-
const urlPath = "/v2/onboardingsteps/{clanId}".replace(
|
6817
|
+
const urlPath = "/v2/onboardingsteps/{clanId}".replace(
|
6818
|
+
"{clanId}",
|
6819
|
+
encodeURIComponent(String(clanId))
|
6820
|
+
);
|
6746
6821
|
const queryParams = /* @__PURE__ */ new Map();
|
6747
6822
|
let bodyJson = "";
|
6748
6823
|
bodyJson = JSON.stringify(body || {});
|
@@ -6833,7 +6908,7 @@ var encode2 = function(arraybuffer) {
|
|
6833
6908
|
}
|
6834
6909
|
return base64;
|
6835
6910
|
};
|
6836
|
-
var
|
6911
|
+
var decode3 = function(base64) {
|
6837
6912
|
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
6838
6913
|
if (base64[base64.length - 1] === "=") {
|
6839
6914
|
bufferLength--;
|
@@ -6877,7 +6952,7 @@ var WebSocketAdapterText = class {
|
|
6877
6952
|
const message = safeJSONParse(evt.data);
|
6878
6953
|
if (message.party_data && message.party_data.data) {
|
6879
6954
|
message.party_data.data = new Uint8Array(
|
6880
|
-
|
6955
|
+
decode3(message.party_data.data)
|
6881
6956
|
);
|
6882
6957
|
}
|
6883
6958
|
value(message);
|
@@ -10384,28 +10459,6 @@ var Client = class {
|
|
10384
10459
|
});
|
10385
10460
|
});
|
10386
10461
|
}
|
10387
|
-
//**get custom display */
|
10388
|
-
getCustomDisplay(session) {
|
10389
|
-
return __async(this, null, function* () {
|
10390
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10391
|
-
yield this.sessionRefresh(session);
|
10392
|
-
}
|
10393
|
-
return this.apiClient.getCustomDisplay(session.token).then((response) => {
|
10394
|
-
return Promise.resolve(response);
|
10395
|
-
});
|
10396
|
-
});
|
10397
|
-
}
|
10398
|
-
//**update custom display */
|
10399
|
-
updateCustomDisplay(session, request) {
|
10400
|
-
return __async(this, null, function* () {
|
10401
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10402
|
-
yield this.sessionRefresh(session);
|
10403
|
-
}
|
10404
|
-
return this.apiClient.updateCustomDisplay(session.token, request).then((response) => {
|
10405
|
-
return response !== void 0;
|
10406
|
-
});
|
10407
|
-
});
|
10408
|
-
}
|
10409
10462
|
//**list wallet ledger */
|
10410
10463
|
listWalletLedger(session, limit, cursor, transactionId) {
|
10411
10464
|
return __async(this, null, function* () {
|
@@ -10426,5 +10479,9 @@ export {
|
|
10426
10479
|
NotificationType,
|
10427
10480
|
Session,
|
10428
10481
|
WebSocketAdapterText,
|
10429
|
-
WebrtcSignalingType
|
10482
|
+
WebrtcSignalingType,
|
10483
|
+
b64DecodeUnicode,
|
10484
|
+
b64EncodeUnicode,
|
10485
|
+
buildFetchOptions,
|
10486
|
+
safeJSONParse
|
10430
10487
|
};
|
package/index.ts
CHANGED
@@ -20,6 +20,7 @@ export * from "./client";
|
|
20
20
|
export * from "./session";
|
21
21
|
export * from "./socket";
|
22
22
|
export * from "./web_socket_adapter";
|
23
|
+
export * from "./utils"
|
23
24
|
|
24
25
|
/**
|
25
26
|
* Reexported due to duplicate definition of ChannelMessage in [Client]{@link ./client.ts} and [Session]{@link ./session.ts}
|
package/package.json
CHANGED
package/utils.ts
CHANGED
@@ -66,7 +66,7 @@ export function safeJSONParse(jsonString: string) {
|
|
66
66
|
|
67
67
|
return parsedData;
|
68
68
|
} catch (error) {
|
69
|
-
console.error('Error parsing JSON:', error);
|
69
|
+
console.error('Error parsing JSON:', jsonString, error);
|
70
70
|
return null; // Handle the error gracefully or throw an exception if necessary
|
71
71
|
}
|
72
72
|
}
|