mezon-js 2.8.81 → 2.8.83
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +94 -0
- package/client.ts +34 -0
- package/dist/api.gen.d.ts +18 -1
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +158 -59
- package/dist/mezon-js.esm.mjs +158 -59
- package/dist/socket.d.ts +0 -19
- package/package.json +1 -1
- package/socket.ts +0 -31
package/api.gen.ts
CHANGED
@@ -397,6 +397,8 @@ export interface ApiCategoryDesc {
|
|
397
397
|
//
|
398
398
|
category_name?: string;
|
399
399
|
//
|
400
|
+
category_order?: number;
|
401
|
+
//
|
400
402
|
clan_id?: string;
|
401
403
|
//
|
402
404
|
creator_id?: string;
|
@@ -408,6 +410,14 @@ export interface ApiCategoryDescList {
|
|
408
410
|
categorydesc?: Array<ApiCategoryDesc>;
|
409
411
|
}
|
410
412
|
|
413
|
+
/** */
|
414
|
+
export interface ApiCategoryOrderUpdate {
|
415
|
+
//
|
416
|
+
category_id?: string;
|
417
|
+
//
|
418
|
+
order?: number;
|
419
|
+
}
|
420
|
+
|
411
421
|
/** Update fields in a given channel. */
|
412
422
|
export interface ApiChangeChannelPrivateRequest {
|
413
423
|
//The ID of the channel to update.
|
@@ -506,6 +516,10 @@ export interface ApiChannelDescription {
|
|
506
516
|
usernames?: string;
|
507
517
|
//
|
508
518
|
status?: number;
|
519
|
+
//
|
520
|
+
metadata?: Array<string>;
|
521
|
+
//
|
522
|
+
about_me?: Array<string>;
|
509
523
|
}
|
510
524
|
|
511
525
|
/** A message sent on a channel. */
|
@@ -1506,6 +1520,13 @@ export interface ApiUpdateCategoryDescRequest {
|
|
1506
1520
|
// clan ID
|
1507
1521
|
ClanId: string;
|
1508
1522
|
}
|
1523
|
+
/** */
|
1524
|
+
export interface ApiUpdateCategoryOrderRequest {
|
1525
|
+
//
|
1526
|
+
categories?: Array<ApiCategoryOrderUpdate>;
|
1527
|
+
//
|
1528
|
+
clan_id?: string;
|
1529
|
+
}
|
1509
1530
|
|
1510
1531
|
/** */
|
1511
1532
|
export interface ApiUpdateRoleChannelRequest {
|
@@ -3208,6 +3229,41 @@ export class MezonApi {
|
|
3208
3229
|
),
|
3209
3230
|
]);
|
3210
3231
|
}
|
3232
|
+
/** */
|
3233
|
+
updateCategoryOrder(bearerToken: string,
|
3234
|
+
body:ApiUpdateCategoryOrderRequest,
|
3235
|
+
options: any = {}): Promise<any> {
|
3236
|
+
|
3237
|
+
if (body === null || body === undefined) {
|
3238
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3239
|
+
}
|
3240
|
+
const urlPath = "/v2/category/orders";
|
3241
|
+
const queryParams = new Map<string, any>();
|
3242
|
+
|
3243
|
+
let bodyJson : string = "";
|
3244
|
+
bodyJson = JSON.stringify(body || {});
|
3245
|
+
|
3246
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3247
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3248
|
+
if (bearerToken) {
|
3249
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3250
|
+
}
|
3251
|
+
|
3252
|
+
return Promise.race([
|
3253
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3254
|
+
if (response.status == 204) {
|
3255
|
+
return response;
|
3256
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3257
|
+
return response.json();
|
3258
|
+
} else {
|
3259
|
+
throw response;
|
3260
|
+
}
|
3261
|
+
}),
|
3262
|
+
new Promise((_, reject) =>
|
3263
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3264
|
+
),
|
3265
|
+
]);
|
3266
|
+
}
|
3211
3267
|
|
3212
3268
|
/** */
|
3213
3269
|
listCategoryDescs(bearerToken: string,
|
@@ -3215,6 +3271,7 @@ export class MezonApi {
|
|
3215
3271
|
creatorId?:string,
|
3216
3272
|
categoryName?:string,
|
3217
3273
|
categoryId?:string,
|
3274
|
+
categoryOrder?:number,
|
3218
3275
|
options: any = {}): Promise<ApiCategoryDescList> {
|
3219
3276
|
|
3220
3277
|
if (clanId === null || clanId === undefined) {
|
@@ -3226,6 +3283,7 @@ export class MezonApi {
|
|
3226
3283
|
queryParams.set("creator_id", creatorId);
|
3227
3284
|
queryParams.set("category_name", categoryName);
|
3228
3285
|
queryParams.set("category_id", categoryId);
|
3286
|
+
queryParams.set("category_order", categoryOrder);
|
3229
3287
|
|
3230
3288
|
let bodyJson : string = "";
|
3231
3289
|
|
@@ -4103,6 +4161,42 @@ export class MezonApi {
|
|
4103
4161
|
]);
|
4104
4162
|
}
|
4105
4163
|
|
4164
|
+
/** */
|
4165
|
+
deleteCategoryOrder(bearerToken: string,
|
4166
|
+
clanId:string,
|
4167
|
+
options: any = {}): Promise<any> {
|
4168
|
+
|
4169
|
+
if (clanId === null || clanId === undefined) {
|
4170
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4171
|
+
}
|
4172
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}"
|
4173
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
4174
|
+
const queryParams = new Map<string, any>();
|
4175
|
+
|
4176
|
+
let bodyJson : string = "";
|
4177
|
+
|
4178
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4179
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
4180
|
+
if (bearerToken) {
|
4181
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4182
|
+
}
|
4183
|
+
|
4184
|
+
return Promise.race([
|
4185
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4186
|
+
if (response.status == 204) {
|
4187
|
+
return response;
|
4188
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4189
|
+
return response.json();
|
4190
|
+
} else {
|
4191
|
+
throw response;
|
4192
|
+
}
|
4193
|
+
}),
|
4194
|
+
new Promise((_, reject) =>
|
4195
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4196
|
+
),
|
4197
|
+
]);
|
4198
|
+
}
|
4199
|
+
|
4106
4200
|
/** regist fcm device token */
|
4107
4201
|
registFCMDeviceToken(bearerToken: string,
|
4108
4202
|
token?:string,
|
package/client.ts
CHANGED
@@ -100,6 +100,7 @@ import {
|
|
100
100
|
ApiSystemMessage,
|
101
101
|
ApiSystemMessageRequest,
|
102
102
|
MezonUpdateSystemMessageBody,
|
103
|
+
ApiUpdateCategoryOrderRequest,
|
103
104
|
} from "./api.gen";
|
104
105
|
|
105
106
|
import { Session } from "./session";
|
@@ -3410,4 +3411,37 @@ export class Client {
|
|
3410
3411
|
return Promise.resolve(response);
|
3411
3412
|
});
|
3412
3413
|
}
|
3414
|
+
async updateCategoryOrder(
|
3415
|
+
session: Session,
|
3416
|
+
request: ApiUpdateCategoryOrderRequest
|
3417
|
+
): Promise<any> {
|
3418
|
+
if (
|
3419
|
+
this.autoRefreshSession &&
|
3420
|
+
session.refresh_token &&
|
3421
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3422
|
+
) {
|
3423
|
+
await this.sessionRefresh(session);
|
3424
|
+
}
|
3425
|
+
|
3426
|
+
return this.apiClient
|
3427
|
+
.updateCategoryOrder(session.token, request)
|
3428
|
+
.then((response: any) => {
|
3429
|
+
return Promise.resolve(response);
|
3430
|
+
});
|
3431
|
+
}
|
3432
|
+
async deleteCategoryOrder(session: Session, clanId: string): Promise<any> {
|
3433
|
+
if (
|
3434
|
+
this.autoRefreshSession &&
|
3435
|
+
session.refresh_token &&
|
3436
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3437
|
+
) {
|
3438
|
+
await this.sessionRefresh(session);
|
3439
|
+
}
|
3440
|
+
|
3441
|
+
return this.apiClient
|
3442
|
+
.deleteCategoryOrder(session.token, clanId)
|
3443
|
+
.then((response: any) => {
|
3444
|
+
return Promise.resolve(response);
|
3445
|
+
});
|
3446
|
+
}
|
3413
3447
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -231,6 +231,7 @@ export interface ApiAppList {
|
|
231
231
|
export interface ApiCategoryDesc {
|
232
232
|
category_id?: string;
|
233
233
|
category_name?: string;
|
234
|
+
category_order?: number;
|
234
235
|
clan_id?: string;
|
235
236
|
creator_id?: string;
|
236
237
|
}
|
@@ -238,6 +239,11 @@ export interface ApiCategoryDesc {
|
|
238
239
|
export interface ApiCategoryDescList {
|
239
240
|
categorydesc?: Array<ApiCategoryDesc>;
|
240
241
|
}
|
242
|
+
/** */
|
243
|
+
export interface ApiCategoryOrderUpdate {
|
244
|
+
category_id?: string;
|
245
|
+
order?: number;
|
246
|
+
}
|
241
247
|
/** Update fields in a given channel. */
|
242
248
|
export interface ApiChangeChannelPrivateRequest {
|
243
249
|
channel_id?: string;
|
@@ -292,6 +298,8 @@ export interface ApiChannelDescription {
|
|
292
298
|
user_id?: Array<string>;
|
293
299
|
usernames?: string;
|
294
300
|
status?: number;
|
301
|
+
metadata?: Array<string>;
|
302
|
+
about_me?: Array<string>;
|
295
303
|
}
|
296
304
|
/** A message sent on a channel. */
|
297
305
|
export interface ApiChannelMessage {
|
@@ -874,6 +882,11 @@ export interface ApiUpdateCategoryDescRequest {
|
|
874
882
|
ClanId: string;
|
875
883
|
}
|
876
884
|
/** */
|
885
|
+
export interface ApiUpdateCategoryOrderRequest {
|
886
|
+
categories?: Array<ApiCategoryOrderUpdate>;
|
887
|
+
clan_id?: string;
|
888
|
+
}
|
889
|
+
/** */
|
877
890
|
export interface ApiUpdateRoleChannelRequest {
|
878
891
|
channel_id?: string;
|
879
892
|
permission_update?: Array<ApiPermissionUpdate>;
|
@@ -1062,7 +1075,9 @@ export declare class MezonApi {
|
|
1062
1075
|
/** Unban an app. */
|
1063
1076
|
unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1064
1077
|
/** */
|
1065
|
-
|
1078
|
+
updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
|
1079
|
+
/** */
|
1080
|
+
listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, categoryOrder?: number, options?: any): Promise<ApiCategoryDescList>;
|
1066
1081
|
/** List a channel's message history. */
|
1067
1082
|
listChannelMessages(bearerToken: string, channelId: string, messageId?: string, direction?: number, limit?: number, options?: any): Promise<ApiChannelMessageList>;
|
1068
1083
|
/** Add users to a channel. */
|
@@ -1107,6 +1122,8 @@ export declare class MezonApi {
|
|
1107
1122
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
1108
1123
|
/** */
|
1109
1124
|
deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
|
1125
|
+
/** */
|
1126
|
+
deleteCategoryOrder(bearerToken: string, clanId: string, options?: any): Promise<any>;
|
1110
1127
|
/** regist fcm device token */
|
1111
1128
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
1112
1129
|
/** close direct message. */
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -548,4 +548,6 @@ export declare class Client {
|
|
548
548
|
createSystemMessage(session: Session, request: ApiSystemMessageRequest): Promise<any>;
|
549
549
|
updateSystemMessage(session: Session, clanId: string, request: MezonUpdateSystemMessageBody): Promise<any>;
|
550
550
|
deleteSystemMessage(session: Session, clanId: string): Promise<any>;
|
551
|
+
updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
|
552
|
+
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
551
553
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -65,11 +65,12 @@ __export(mezon_js_exports, {
|
|
65
65
|
module.exports = __toCommonJS(mezon_js_exports);
|
66
66
|
|
67
67
|
// ../../node_modules/whatwg-fetch/fetch.js
|
68
|
-
var
|
68
|
+
var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
|
69
|
+
typeof global !== "undefined" && global || {};
|
69
70
|
var support = {
|
70
|
-
searchParams: "URLSearchParams" in
|
71
|
-
iterable: "Symbol" in
|
72
|
-
blob: "FileReader" in
|
71
|
+
searchParams: "URLSearchParams" in g,
|
72
|
+
iterable: "Symbol" in g && "iterator" in Symbol,
|
73
|
+
blob: "FileReader" in g && "Blob" in g && function() {
|
73
74
|
try {
|
74
75
|
new Blob();
|
75
76
|
return true;
|
@@ -77,8 +78,8 @@ var support = {
|
|
77
78
|
return false;
|
78
79
|
}
|
79
80
|
}(),
|
80
|
-
formData: "FormData" in
|
81
|
-
arrayBuffer: "ArrayBuffer" in
|
81
|
+
formData: "FormData" in g,
|
82
|
+
arrayBuffer: "ArrayBuffer" in g
|
82
83
|
};
|
83
84
|
function isDataView(obj) {
|
84
85
|
return obj && DataView.prototype.isPrototypeOf(obj);
|
@@ -138,6 +139,9 @@ function Headers(headers) {
|
|
138
139
|
}, this);
|
139
140
|
} else if (Array.isArray(headers)) {
|
140
141
|
headers.forEach(function(header) {
|
142
|
+
if (header.length != 2) {
|
143
|
+
throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
|
144
|
+
}
|
141
145
|
this.append(header[0], header[1]);
|
142
146
|
}, this);
|
143
147
|
} else if (headers) {
|
@@ -197,6 +201,8 @@ if (support.iterable) {
|
|
197
201
|
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
198
202
|
}
|
199
203
|
function consumed(body) {
|
204
|
+
if (body._noBody)
|
205
|
+
return;
|
200
206
|
if (body.bodyUsed) {
|
201
207
|
return Promise.reject(new TypeError("Already read"));
|
202
208
|
}
|
@@ -221,7 +227,9 @@ function readBlobAsArrayBuffer(blob) {
|
|
221
227
|
function readBlobAsText(blob) {
|
222
228
|
var reader = new FileReader();
|
223
229
|
var promise = fileReaderReady(reader);
|
224
|
-
|
230
|
+
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
|
231
|
+
var encoding = match ? match[1] : "utf-8";
|
232
|
+
reader.readAsText(blob, encoding);
|
225
233
|
return promise;
|
226
234
|
}
|
227
235
|
function readArrayBufferAsText(buf) {
|
@@ -247,6 +255,7 @@ function Body() {
|
|
247
255
|
this.bodyUsed = this.bodyUsed;
|
248
256
|
this._bodyInit = body;
|
249
257
|
if (!body) {
|
258
|
+
this._noBody = true;
|
250
259
|
this._bodyText = "";
|
251
260
|
} else if (typeof body === "string") {
|
252
261
|
this._bodyText = body;
|
@@ -290,27 +299,28 @@ function Body() {
|
|
290
299
|
return Promise.resolve(new Blob([this._bodyText]));
|
291
300
|
}
|
292
301
|
};
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
} else {
|
307
|
-
return Promise.resolve(this._bodyArrayBuffer);
|
308
|
-
}
|
302
|
+
}
|
303
|
+
this.arrayBuffer = function() {
|
304
|
+
if (this._bodyArrayBuffer) {
|
305
|
+
var isConsumed = consumed(this);
|
306
|
+
if (isConsumed) {
|
307
|
+
return isConsumed;
|
308
|
+
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
309
|
+
return Promise.resolve(
|
310
|
+
this._bodyArrayBuffer.buffer.slice(
|
311
|
+
this._bodyArrayBuffer.byteOffset,
|
312
|
+
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
313
|
+
)
|
314
|
+
);
|
309
315
|
} else {
|
310
|
-
return
|
316
|
+
return Promise.resolve(this._bodyArrayBuffer);
|
311
317
|
}
|
312
|
-
}
|
313
|
-
|
318
|
+
} else if (support.blob) {
|
319
|
+
return this.blob().then(readBlobAsArrayBuffer);
|
320
|
+
} else {
|
321
|
+
throw new Error("could not read as ArrayBuffer");
|
322
|
+
}
|
323
|
+
};
|
314
324
|
this.text = function() {
|
315
325
|
var rejected = consumed(this);
|
316
326
|
if (rejected) {
|
@@ -336,7 +346,7 @@ function Body() {
|
|
336
346
|
};
|
337
347
|
return this;
|
338
348
|
}
|
339
|
-
var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
349
|
+
var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
340
350
|
function normalizeMethod(method) {
|
341
351
|
var upcased = method.toUpperCase();
|
342
352
|
return methods.indexOf(upcased) > -1 ? upcased : method;
|
@@ -372,7 +382,12 @@ function Request(input, options) {
|
|
372
382
|
}
|
373
383
|
this.method = normalizeMethod(options.method || this.method || "GET");
|
374
384
|
this.mode = options.mode || this.mode || null;
|
375
|
-
this.signal = options.signal || this.signal
|
385
|
+
this.signal = options.signal || this.signal || function() {
|
386
|
+
if ("AbortController" in g) {
|
387
|
+
var ctrl = new AbortController();
|
388
|
+
return ctrl.signal;
|
389
|
+
}
|
390
|
+
}();
|
376
391
|
this.referrer = null;
|
377
392
|
if ((this.method === "GET" || this.method === "HEAD") && body) {
|
378
393
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
@@ -415,7 +430,11 @@ function parseHeaders(rawHeaders) {
|
|
415
430
|
var key = parts.shift().trim();
|
416
431
|
if (key) {
|
417
432
|
var value = parts.join(":").trim();
|
418
|
-
|
433
|
+
try {
|
434
|
+
headers.append(key, value);
|
435
|
+
} catch (error) {
|
436
|
+
console.warn("Response " + error.message);
|
437
|
+
}
|
419
438
|
}
|
420
439
|
});
|
421
440
|
return headers;
|
@@ -430,6 +449,9 @@ function Response(bodyInit, options) {
|
|
430
449
|
}
|
431
450
|
this.type = "default";
|
432
451
|
this.status = options.status === void 0 ? 200 : options.status;
|
452
|
+
if (this.status < 200 || this.status > 599) {
|
453
|
+
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
|
454
|
+
}
|
433
455
|
this.ok = this.status >= 200 && this.status < 300;
|
434
456
|
this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
|
435
457
|
this.headers = new Headers(options.headers);
|
@@ -446,7 +468,9 @@ Response.prototype.clone = function() {
|
|
446
468
|
});
|
447
469
|
};
|
448
470
|
Response.error = function() {
|
449
|
-
var response = new Response(null, { status:
|
471
|
+
var response = new Response(null, { status: 200, statusText: "" });
|
472
|
+
response.ok = false;
|
473
|
+
response.status = 0;
|
450
474
|
response.type = "error";
|
451
475
|
return response;
|
452
476
|
};
|
@@ -457,7 +481,7 @@ Response.redirect = function(url, status) {
|
|
457
481
|
}
|
458
482
|
return new Response(null, { status, headers: { location: url } });
|
459
483
|
};
|
460
|
-
var DOMException =
|
484
|
+
var DOMException = g.DOMException;
|
461
485
|
try {
|
462
486
|
new DOMException();
|
463
487
|
} catch (err) {
|
@@ -482,10 +506,14 @@ function fetch2(input, init) {
|
|
482
506
|
}
|
483
507
|
xhr.onload = function() {
|
484
508
|
var options = {
|
485
|
-
status: xhr.status,
|
486
509
|
statusText: xhr.statusText,
|
487
510
|
headers: parseHeaders(xhr.getAllResponseHeaders() || "")
|
488
511
|
};
|
512
|
+
if (request.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
|
513
|
+
options.status = 200;
|
514
|
+
} else {
|
515
|
+
options.status = xhr.status;
|
516
|
+
}
|
489
517
|
options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
|
490
518
|
var body = "response" in xhr ? xhr.response : xhr.responseText;
|
491
519
|
setTimeout(function() {
|
@@ -499,7 +527,7 @@ function fetch2(input, init) {
|
|
499
527
|
};
|
500
528
|
xhr.ontimeout = function() {
|
501
529
|
setTimeout(function() {
|
502
|
-
reject(new TypeError("Network request
|
530
|
+
reject(new TypeError("Network request timed out"));
|
503
531
|
}, 0);
|
504
532
|
};
|
505
533
|
xhr.onabort = function() {
|
@@ -509,7 +537,7 @@ function fetch2(input, init) {
|
|
509
537
|
};
|
510
538
|
function fixUrl(url) {
|
511
539
|
try {
|
512
|
-
return url === "" &&
|
540
|
+
return url === "" && g.location.href ? g.location.href : url;
|
513
541
|
} catch (e) {
|
514
542
|
return url;
|
515
543
|
}
|
@@ -523,14 +551,21 @@ function fetch2(input, init) {
|
|
523
551
|
if ("responseType" in xhr) {
|
524
552
|
if (support.blob) {
|
525
553
|
xhr.responseType = "blob";
|
526
|
-
} else if (support.arrayBuffer
|
554
|
+
} else if (support.arrayBuffer) {
|
527
555
|
xhr.responseType = "arraybuffer";
|
528
556
|
}
|
529
557
|
}
|
530
|
-
if (init && typeof init.headers === "object" && !(init.headers instanceof Headers)) {
|
558
|
+
if (init && typeof init.headers === "object" && !(init.headers instanceof Headers || g.Headers && init.headers instanceof g.Headers)) {
|
559
|
+
var names = [];
|
531
560
|
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
561
|
+
names.push(normalizeName(name));
|
532
562
|
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
533
563
|
});
|
564
|
+
request.headers.forEach(function(value, name) {
|
565
|
+
if (names.indexOf(name) === -1) {
|
566
|
+
xhr.setRequestHeader(name, value);
|
567
|
+
}
|
568
|
+
});
|
534
569
|
} else {
|
535
570
|
request.headers.forEach(function(value, name) {
|
536
571
|
xhr.setRequestHeader(name, value);
|
@@ -548,16 +583,14 @@ function fetch2(input, init) {
|
|
548
583
|
});
|
549
584
|
}
|
550
585
|
fetch2.polyfill = true;
|
551
|
-
if (!
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
586
|
+
if (!g.fetch) {
|
587
|
+
g.fetch = fetch2;
|
588
|
+
g.Headers = Headers;
|
589
|
+
g.Request = Request;
|
590
|
+
g.Response = Response;
|
556
591
|
}
|
557
592
|
|
558
593
|
// ../../node_modules/js-base64/base64.mjs
|
559
|
-
var _hasatob = typeof atob === "function";
|
560
|
-
var _hasbtoa = typeof btoa === "function";
|
561
594
|
var _hasBuffer = typeof Buffer === "function";
|
562
595
|
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
563
596
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
@@ -570,7 +603,7 @@ var b64tab = ((a) => {
|
|
570
603
|
})(b64chs);
|
571
604
|
var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
572
605
|
var _fromCC = String.fromCharCode.bind(String);
|
573
|
-
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it
|
606
|
+
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
574
607
|
var _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
575
608
|
var _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
576
609
|
var btoaPolyfill = (bin) => {
|
@@ -584,7 +617,7 @@ var btoaPolyfill = (bin) => {
|
|
584
617
|
}
|
585
618
|
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
586
619
|
};
|
587
|
-
var _btoa =
|
620
|
+
var _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
588
621
|
var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
589
622
|
const maxargs = 4096;
|
590
623
|
let strs = [];
|
@@ -618,7 +651,7 @@ var atobPolyfill = (asc) => {
|
|
618
651
|
}
|
619
652
|
return bin;
|
620
653
|
};
|
621
|
-
var _atob =
|
654
|
+
var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
622
655
|
|
623
656
|
// utils.ts
|
624
657
|
function buildFetchOptions(method, options, bodyJson) {
|
@@ -1853,7 +1886,36 @@ var MezonApi = class {
|
|
1853
1886
|
]);
|
1854
1887
|
}
|
1855
1888
|
/** */
|
1856
|
-
|
1889
|
+
updateCategoryOrder(bearerToken, body, options = {}) {
|
1890
|
+
if (body === null || body === void 0) {
|
1891
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1892
|
+
}
|
1893
|
+
const urlPath = "/v2/category/orders";
|
1894
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1895
|
+
let bodyJson = "";
|
1896
|
+
bodyJson = JSON.stringify(body || {});
|
1897
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1898
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
1899
|
+
if (bearerToken) {
|
1900
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1901
|
+
}
|
1902
|
+
return Promise.race([
|
1903
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1904
|
+
if (response.status == 204) {
|
1905
|
+
return response;
|
1906
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1907
|
+
return response.json();
|
1908
|
+
} else {
|
1909
|
+
throw response;
|
1910
|
+
}
|
1911
|
+
}),
|
1912
|
+
new Promise(
|
1913
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1914
|
+
)
|
1915
|
+
]);
|
1916
|
+
}
|
1917
|
+
/** */
|
1918
|
+
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, categoryOrder, options = {}) {
|
1857
1919
|
if (clanId === null || clanId === void 0) {
|
1858
1920
|
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
1859
1921
|
}
|
@@ -1862,6 +1924,7 @@ var MezonApi = class {
|
|
1862
1924
|
queryParams.set("creator_id", creatorId);
|
1863
1925
|
queryParams.set("category_name", categoryName);
|
1864
1926
|
queryParams.set("category_id", categoryId);
|
1927
|
+
queryParams.set("category_order", categoryOrder);
|
1865
1928
|
let bodyJson = "";
|
1866
1929
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1867
1930
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -2535,6 +2598,34 @@ var MezonApi = class {
|
|
2535
2598
|
)
|
2536
2599
|
]);
|
2537
2600
|
}
|
2601
|
+
/** */
|
2602
|
+
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
2603
|
+
if (clanId === null || clanId === void 0) {
|
2604
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2605
|
+
}
|
2606
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2607
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2608
|
+
let bodyJson = "";
|
2609
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2610
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2611
|
+
if (bearerToken) {
|
2612
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2613
|
+
}
|
2614
|
+
return Promise.race([
|
2615
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2616
|
+
if (response.status == 204) {
|
2617
|
+
return response;
|
2618
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2619
|
+
return response.json();
|
2620
|
+
} else {
|
2621
|
+
throw response;
|
2622
|
+
}
|
2623
|
+
}),
|
2624
|
+
new Promise(
|
2625
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2626
|
+
)
|
2627
|
+
]);
|
2628
|
+
}
|
2538
2629
|
/** regist fcm device token */
|
2539
2630
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2540
2631
|
const urlPath = "/v2/devicetoken";
|
@@ -5291,18 +5382,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5291
5382
|
return response.notification_channel_category_setting_event;
|
5292
5383
|
});
|
5293
5384
|
}
|
5294
|
-
addUserEmojiUsage(add_user_emoji_usage_event) {
|
5295
|
-
return __async(this, null, function* () {
|
5296
|
-
const response = yield this.send({ add_user_emoji_usage_event: { add_user_emoji_usage_event } });
|
5297
|
-
return response.add_user_emoji_usage_event;
|
5298
|
-
});
|
5299
|
-
}
|
5300
|
-
getUserEmojiUsage(clan_id) {
|
5301
|
-
return __async(this, null, function* () {
|
5302
|
-
const response = yield this.send({ get_user_emoji_usage_event: { clan_id } });
|
5303
|
-
return response.get_user_emoji_usage_event;
|
5304
|
-
});
|
5305
|
-
}
|
5306
5385
|
pingPong() {
|
5307
5386
|
return __async(this, null, function* () {
|
5308
5387
|
if (!this.adapter.isOpen()) {
|
@@ -7125,4 +7204,24 @@ var Client = class {
|
|
7125
7204
|
});
|
7126
7205
|
});
|
7127
7206
|
}
|
7207
|
+
updateCategoryOrder(session, request) {
|
7208
|
+
return __async(this, null, function* () {
|
7209
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7210
|
+
yield this.sessionRefresh(session);
|
7211
|
+
}
|
7212
|
+
return this.apiClient.updateCategoryOrder(session.token, request).then((response) => {
|
7213
|
+
return Promise.resolve(response);
|
7214
|
+
});
|
7215
|
+
});
|
7216
|
+
}
|
7217
|
+
deleteCategoryOrder(session, clanId) {
|
7218
|
+
return __async(this, null, function* () {
|
7219
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7220
|
+
yield this.sessionRefresh(session);
|
7221
|
+
}
|
7222
|
+
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
7223
|
+
return Promise.resolve(response);
|
7224
|
+
});
|
7225
|
+
});
|
7226
|
+
}
|
7128
7227
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -36,11 +36,12 @@ var __async = (__this, __arguments, generator) => {
|
|
36
36
|
};
|
37
37
|
|
38
38
|
// ../../node_modules/whatwg-fetch/fetch.js
|
39
|
-
var
|
39
|
+
var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
|
40
|
+
typeof global !== "undefined" && global || {};
|
40
41
|
var support = {
|
41
|
-
searchParams: "URLSearchParams" in
|
42
|
-
iterable: "Symbol" in
|
43
|
-
blob: "FileReader" in
|
42
|
+
searchParams: "URLSearchParams" in g,
|
43
|
+
iterable: "Symbol" in g && "iterator" in Symbol,
|
44
|
+
blob: "FileReader" in g && "Blob" in g && function() {
|
44
45
|
try {
|
45
46
|
new Blob();
|
46
47
|
return true;
|
@@ -48,8 +49,8 @@ var support = {
|
|
48
49
|
return false;
|
49
50
|
}
|
50
51
|
}(),
|
51
|
-
formData: "FormData" in
|
52
|
-
arrayBuffer: "ArrayBuffer" in
|
52
|
+
formData: "FormData" in g,
|
53
|
+
arrayBuffer: "ArrayBuffer" in g
|
53
54
|
};
|
54
55
|
function isDataView(obj) {
|
55
56
|
return obj && DataView.prototype.isPrototypeOf(obj);
|
@@ -109,6 +110,9 @@ function Headers(headers) {
|
|
109
110
|
}, this);
|
110
111
|
} else if (Array.isArray(headers)) {
|
111
112
|
headers.forEach(function(header) {
|
113
|
+
if (header.length != 2) {
|
114
|
+
throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
|
115
|
+
}
|
112
116
|
this.append(header[0], header[1]);
|
113
117
|
}, this);
|
114
118
|
} else if (headers) {
|
@@ -168,6 +172,8 @@ if (support.iterable) {
|
|
168
172
|
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
169
173
|
}
|
170
174
|
function consumed(body) {
|
175
|
+
if (body._noBody)
|
176
|
+
return;
|
171
177
|
if (body.bodyUsed) {
|
172
178
|
return Promise.reject(new TypeError("Already read"));
|
173
179
|
}
|
@@ -192,7 +198,9 @@ function readBlobAsArrayBuffer(blob) {
|
|
192
198
|
function readBlobAsText(blob) {
|
193
199
|
var reader = new FileReader();
|
194
200
|
var promise = fileReaderReady(reader);
|
195
|
-
|
201
|
+
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
|
202
|
+
var encoding = match ? match[1] : "utf-8";
|
203
|
+
reader.readAsText(blob, encoding);
|
196
204
|
return promise;
|
197
205
|
}
|
198
206
|
function readArrayBufferAsText(buf) {
|
@@ -218,6 +226,7 @@ function Body() {
|
|
218
226
|
this.bodyUsed = this.bodyUsed;
|
219
227
|
this._bodyInit = body;
|
220
228
|
if (!body) {
|
229
|
+
this._noBody = true;
|
221
230
|
this._bodyText = "";
|
222
231
|
} else if (typeof body === "string") {
|
223
232
|
this._bodyText = body;
|
@@ -261,27 +270,28 @@ function Body() {
|
|
261
270
|
return Promise.resolve(new Blob([this._bodyText]));
|
262
271
|
}
|
263
272
|
};
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
} else {
|
278
|
-
return Promise.resolve(this._bodyArrayBuffer);
|
279
|
-
}
|
273
|
+
}
|
274
|
+
this.arrayBuffer = function() {
|
275
|
+
if (this._bodyArrayBuffer) {
|
276
|
+
var isConsumed = consumed(this);
|
277
|
+
if (isConsumed) {
|
278
|
+
return isConsumed;
|
279
|
+
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
280
|
+
return Promise.resolve(
|
281
|
+
this._bodyArrayBuffer.buffer.slice(
|
282
|
+
this._bodyArrayBuffer.byteOffset,
|
283
|
+
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
284
|
+
)
|
285
|
+
);
|
280
286
|
} else {
|
281
|
-
return
|
287
|
+
return Promise.resolve(this._bodyArrayBuffer);
|
282
288
|
}
|
283
|
-
}
|
284
|
-
|
289
|
+
} else if (support.blob) {
|
290
|
+
return this.blob().then(readBlobAsArrayBuffer);
|
291
|
+
} else {
|
292
|
+
throw new Error("could not read as ArrayBuffer");
|
293
|
+
}
|
294
|
+
};
|
285
295
|
this.text = function() {
|
286
296
|
var rejected = consumed(this);
|
287
297
|
if (rejected) {
|
@@ -307,7 +317,7 @@ function Body() {
|
|
307
317
|
};
|
308
318
|
return this;
|
309
319
|
}
|
310
|
-
var methods = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
320
|
+
var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
311
321
|
function normalizeMethod(method) {
|
312
322
|
var upcased = method.toUpperCase();
|
313
323
|
return methods.indexOf(upcased) > -1 ? upcased : method;
|
@@ -343,7 +353,12 @@ function Request(input, options) {
|
|
343
353
|
}
|
344
354
|
this.method = normalizeMethod(options.method || this.method || "GET");
|
345
355
|
this.mode = options.mode || this.mode || null;
|
346
|
-
this.signal = options.signal || this.signal
|
356
|
+
this.signal = options.signal || this.signal || function() {
|
357
|
+
if ("AbortController" in g) {
|
358
|
+
var ctrl = new AbortController();
|
359
|
+
return ctrl.signal;
|
360
|
+
}
|
361
|
+
}();
|
347
362
|
this.referrer = null;
|
348
363
|
if ((this.method === "GET" || this.method === "HEAD") && body) {
|
349
364
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
@@ -386,7 +401,11 @@ function parseHeaders(rawHeaders) {
|
|
386
401
|
var key = parts.shift().trim();
|
387
402
|
if (key) {
|
388
403
|
var value = parts.join(":").trim();
|
389
|
-
|
404
|
+
try {
|
405
|
+
headers.append(key, value);
|
406
|
+
} catch (error) {
|
407
|
+
console.warn("Response " + error.message);
|
408
|
+
}
|
390
409
|
}
|
391
410
|
});
|
392
411
|
return headers;
|
@@ -401,6 +420,9 @@ function Response(bodyInit, options) {
|
|
401
420
|
}
|
402
421
|
this.type = "default";
|
403
422
|
this.status = options.status === void 0 ? 200 : options.status;
|
423
|
+
if (this.status < 200 || this.status > 599) {
|
424
|
+
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
|
425
|
+
}
|
404
426
|
this.ok = this.status >= 200 && this.status < 300;
|
405
427
|
this.statusText = options.statusText === void 0 ? "" : "" + options.statusText;
|
406
428
|
this.headers = new Headers(options.headers);
|
@@ -417,7 +439,9 @@ Response.prototype.clone = function() {
|
|
417
439
|
});
|
418
440
|
};
|
419
441
|
Response.error = function() {
|
420
|
-
var response = new Response(null, { status:
|
442
|
+
var response = new Response(null, { status: 200, statusText: "" });
|
443
|
+
response.ok = false;
|
444
|
+
response.status = 0;
|
421
445
|
response.type = "error";
|
422
446
|
return response;
|
423
447
|
};
|
@@ -428,7 +452,7 @@ Response.redirect = function(url, status) {
|
|
428
452
|
}
|
429
453
|
return new Response(null, { status, headers: { location: url } });
|
430
454
|
};
|
431
|
-
var DOMException =
|
455
|
+
var DOMException = g.DOMException;
|
432
456
|
try {
|
433
457
|
new DOMException();
|
434
458
|
} catch (err) {
|
@@ -453,10 +477,14 @@ function fetch2(input, init) {
|
|
453
477
|
}
|
454
478
|
xhr.onload = function() {
|
455
479
|
var options = {
|
456
|
-
status: xhr.status,
|
457
480
|
statusText: xhr.statusText,
|
458
481
|
headers: parseHeaders(xhr.getAllResponseHeaders() || "")
|
459
482
|
};
|
483
|
+
if (request.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
|
484
|
+
options.status = 200;
|
485
|
+
} else {
|
486
|
+
options.status = xhr.status;
|
487
|
+
}
|
460
488
|
options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
|
461
489
|
var body = "response" in xhr ? xhr.response : xhr.responseText;
|
462
490
|
setTimeout(function() {
|
@@ -470,7 +498,7 @@ function fetch2(input, init) {
|
|
470
498
|
};
|
471
499
|
xhr.ontimeout = function() {
|
472
500
|
setTimeout(function() {
|
473
|
-
reject(new TypeError("Network request
|
501
|
+
reject(new TypeError("Network request timed out"));
|
474
502
|
}, 0);
|
475
503
|
};
|
476
504
|
xhr.onabort = function() {
|
@@ -480,7 +508,7 @@ function fetch2(input, init) {
|
|
480
508
|
};
|
481
509
|
function fixUrl(url) {
|
482
510
|
try {
|
483
|
-
return url === "" &&
|
511
|
+
return url === "" && g.location.href ? g.location.href : url;
|
484
512
|
} catch (e) {
|
485
513
|
return url;
|
486
514
|
}
|
@@ -494,14 +522,21 @@ function fetch2(input, init) {
|
|
494
522
|
if ("responseType" in xhr) {
|
495
523
|
if (support.blob) {
|
496
524
|
xhr.responseType = "blob";
|
497
|
-
} else if (support.arrayBuffer
|
525
|
+
} else if (support.arrayBuffer) {
|
498
526
|
xhr.responseType = "arraybuffer";
|
499
527
|
}
|
500
528
|
}
|
501
|
-
if (init && typeof init.headers === "object" && !(init.headers instanceof Headers)) {
|
529
|
+
if (init && typeof init.headers === "object" && !(init.headers instanceof Headers || g.Headers && init.headers instanceof g.Headers)) {
|
530
|
+
var names = [];
|
502
531
|
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
532
|
+
names.push(normalizeName(name));
|
503
533
|
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
504
534
|
});
|
535
|
+
request.headers.forEach(function(value, name) {
|
536
|
+
if (names.indexOf(name) === -1) {
|
537
|
+
xhr.setRequestHeader(name, value);
|
538
|
+
}
|
539
|
+
});
|
505
540
|
} else {
|
506
541
|
request.headers.forEach(function(value, name) {
|
507
542
|
xhr.setRequestHeader(name, value);
|
@@ -519,16 +554,14 @@ function fetch2(input, init) {
|
|
519
554
|
});
|
520
555
|
}
|
521
556
|
fetch2.polyfill = true;
|
522
|
-
if (!
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
557
|
+
if (!g.fetch) {
|
558
|
+
g.fetch = fetch2;
|
559
|
+
g.Headers = Headers;
|
560
|
+
g.Request = Request;
|
561
|
+
g.Response = Response;
|
527
562
|
}
|
528
563
|
|
529
564
|
// ../../node_modules/js-base64/base64.mjs
|
530
|
-
var _hasatob = typeof atob === "function";
|
531
|
-
var _hasbtoa = typeof btoa === "function";
|
532
565
|
var _hasBuffer = typeof Buffer === "function";
|
533
566
|
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
534
567
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
@@ -541,7 +574,7 @@ var b64tab = ((a) => {
|
|
541
574
|
})(b64chs);
|
542
575
|
var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
543
576
|
var _fromCC = String.fromCharCode.bind(String);
|
544
|
-
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it
|
577
|
+
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
545
578
|
var _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
546
579
|
var _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
547
580
|
var btoaPolyfill = (bin) => {
|
@@ -555,7 +588,7 @@ var btoaPolyfill = (bin) => {
|
|
555
588
|
}
|
556
589
|
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
557
590
|
};
|
558
|
-
var _btoa =
|
591
|
+
var _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
559
592
|
var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
560
593
|
const maxargs = 4096;
|
561
594
|
let strs = [];
|
@@ -589,7 +622,7 @@ var atobPolyfill = (asc) => {
|
|
589
622
|
}
|
590
623
|
return bin;
|
591
624
|
};
|
592
|
-
var _atob =
|
625
|
+
var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
593
626
|
|
594
627
|
// utils.ts
|
595
628
|
function buildFetchOptions(method, options, bodyJson) {
|
@@ -1824,7 +1857,36 @@ var MezonApi = class {
|
|
1824
1857
|
]);
|
1825
1858
|
}
|
1826
1859
|
/** */
|
1827
|
-
|
1860
|
+
updateCategoryOrder(bearerToken, body, options = {}) {
|
1861
|
+
if (body === null || body === void 0) {
|
1862
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1863
|
+
}
|
1864
|
+
const urlPath = "/v2/category/orders";
|
1865
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1866
|
+
let bodyJson = "";
|
1867
|
+
bodyJson = JSON.stringify(body || {});
|
1868
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1869
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
1870
|
+
if (bearerToken) {
|
1871
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1872
|
+
}
|
1873
|
+
return Promise.race([
|
1874
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1875
|
+
if (response.status == 204) {
|
1876
|
+
return response;
|
1877
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1878
|
+
return response.json();
|
1879
|
+
} else {
|
1880
|
+
throw response;
|
1881
|
+
}
|
1882
|
+
}),
|
1883
|
+
new Promise(
|
1884
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1885
|
+
)
|
1886
|
+
]);
|
1887
|
+
}
|
1888
|
+
/** */
|
1889
|
+
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, categoryOrder, options = {}) {
|
1828
1890
|
if (clanId === null || clanId === void 0) {
|
1829
1891
|
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
1830
1892
|
}
|
@@ -1833,6 +1895,7 @@ var MezonApi = class {
|
|
1833
1895
|
queryParams.set("creator_id", creatorId);
|
1834
1896
|
queryParams.set("category_name", categoryName);
|
1835
1897
|
queryParams.set("category_id", categoryId);
|
1898
|
+
queryParams.set("category_order", categoryOrder);
|
1836
1899
|
let bodyJson = "";
|
1837
1900
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1838
1901
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -2506,6 +2569,34 @@ var MezonApi = class {
|
|
2506
2569
|
)
|
2507
2570
|
]);
|
2508
2571
|
}
|
2572
|
+
/** */
|
2573
|
+
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
2574
|
+
if (clanId === null || clanId === void 0) {
|
2575
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2576
|
+
}
|
2577
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2578
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2579
|
+
let bodyJson = "";
|
2580
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2581
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2582
|
+
if (bearerToken) {
|
2583
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2584
|
+
}
|
2585
|
+
return Promise.race([
|
2586
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2587
|
+
if (response.status == 204) {
|
2588
|
+
return response;
|
2589
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2590
|
+
return response.json();
|
2591
|
+
} else {
|
2592
|
+
throw response;
|
2593
|
+
}
|
2594
|
+
}),
|
2595
|
+
new Promise(
|
2596
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2597
|
+
)
|
2598
|
+
]);
|
2599
|
+
}
|
2509
2600
|
/** regist fcm device token */
|
2510
2601
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2511
2602
|
const urlPath = "/v2/devicetoken";
|
@@ -5262,18 +5353,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5262
5353
|
return response.notification_channel_category_setting_event;
|
5263
5354
|
});
|
5264
5355
|
}
|
5265
|
-
addUserEmojiUsage(add_user_emoji_usage_event) {
|
5266
|
-
return __async(this, null, function* () {
|
5267
|
-
const response = yield this.send({ add_user_emoji_usage_event: { add_user_emoji_usage_event } });
|
5268
|
-
return response.add_user_emoji_usage_event;
|
5269
|
-
});
|
5270
|
-
}
|
5271
|
-
getUserEmojiUsage(clan_id) {
|
5272
|
-
return __async(this, null, function* () {
|
5273
|
-
const response = yield this.send({ get_user_emoji_usage_event: { clan_id } });
|
5274
|
-
return response.get_user_emoji_usage_event;
|
5275
|
-
});
|
5276
|
-
}
|
5277
5356
|
pingPong() {
|
5278
5357
|
return __async(this, null, function* () {
|
5279
5358
|
if (!this.adapter.isOpen()) {
|
@@ -7096,6 +7175,26 @@ var Client = class {
|
|
7096
7175
|
});
|
7097
7176
|
});
|
7098
7177
|
}
|
7178
|
+
updateCategoryOrder(session, request) {
|
7179
|
+
return __async(this, null, function* () {
|
7180
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7181
|
+
yield this.sessionRefresh(session);
|
7182
|
+
}
|
7183
|
+
return this.apiClient.updateCategoryOrder(session.token, request).then((response) => {
|
7184
|
+
return Promise.resolve(response);
|
7185
|
+
});
|
7186
|
+
});
|
7187
|
+
}
|
7188
|
+
deleteCategoryOrder(session, clanId) {
|
7189
|
+
return __async(this, null, function* () {
|
7190
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7191
|
+
yield this.sessionRefresh(session);
|
7192
|
+
}
|
7193
|
+
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
7194
|
+
return Promise.resolve(response);
|
7195
|
+
});
|
7196
|
+
});
|
7197
|
+
}
|
7099
7198
|
};
|
7100
7199
|
export {
|
7101
7200
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -510,21 +510,6 @@ export interface NotificationChannelCategorySettingEvent {
|
|
510
510
|
clan_id?: string;
|
511
511
|
notification_channel_category_settings_list?: NotificationChannelCategorySetting[];
|
512
512
|
}
|
513
|
-
export interface UserEmojiUsage {
|
514
|
-
user_id: string;
|
515
|
-
emoji_id: string;
|
516
|
-
clan_id: string;
|
517
|
-
create_time: string;
|
518
|
-
}
|
519
|
-
export interface AddUserEmojiUsageEvent {
|
520
|
-
emoji_id: string;
|
521
|
-
clan_id: string;
|
522
|
-
}
|
523
|
-
/** Response cho ListUserEmojiUsage */
|
524
|
-
export interface GetUserEmojiUsageEvent {
|
525
|
-
clanId: string;
|
526
|
-
user_emoji_usage: UserEmojiUsage[];
|
527
|
-
}
|
528
513
|
/** A socket connection to Mezon server. */
|
529
514
|
export interface Socket {
|
530
515
|
/** Connection is Open */
|
@@ -633,8 +618,6 @@ export interface Socket {
|
|
633
618
|
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
634
619
|
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
635
620
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
636
|
-
addUserEmojiUsage: (add_user_emoji_usage_event: AddUserEmojiUsageEvent) => void;
|
637
|
-
getUserEmojiUsage(clan_id: string): Promise<GetUserEmojiUsageEvent>;
|
638
621
|
}
|
639
622
|
/** Reports an error received from a socket message. */
|
640
623
|
export interface SocketError {
|
@@ -724,8 +707,6 @@ export declare class DefaultSocket implements Socket {
|
|
724
707
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
725
708
|
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
726
709
|
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
727
|
-
addUserEmojiUsage(add_user_emoji_usage_event: AddUserEmojiUsageEvent): Promise<any>;
|
728
|
-
getUserEmojiUsage(clan_id: string): Promise<GetUserEmojiUsageEvent>;
|
729
710
|
private pingPong;
|
730
711
|
}
|
731
712
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -772,23 +772,6 @@ export interface NotificationChannelCategorySettingEvent {
|
|
772
772
|
notification_channel_category_settings_list?: NotificationChannelCategorySetting[]
|
773
773
|
}
|
774
774
|
|
775
|
-
export interface UserEmojiUsage {
|
776
|
-
user_id: string;
|
777
|
-
emoji_id: string;
|
778
|
-
clan_id: string;
|
779
|
-
create_time: string;
|
780
|
-
}
|
781
|
-
|
782
|
-
export interface AddUserEmojiUsageEvent {
|
783
|
-
emoji_id: string;
|
784
|
-
clan_id: string;
|
785
|
-
}
|
786
|
-
|
787
|
-
/** Response cho ListUserEmojiUsage */
|
788
|
-
export interface GetUserEmojiUsageEvent {
|
789
|
-
clanId: string;
|
790
|
-
user_emoji_usage: UserEmojiUsage[];
|
791
|
-
}
|
792
775
|
|
793
776
|
/** A socket connection to Mezon server. */
|
794
777
|
export interface Socket {
|
@@ -972,11 +955,6 @@ export interface Socket {
|
|
972
955
|
getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
|
973
956
|
|
974
957
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
975
|
-
|
976
|
-
addUserEmojiUsage: (add_user_emoji_usage_event: AddUserEmojiUsageEvent) => void;
|
977
|
-
|
978
|
-
getUserEmojiUsage(clan_id: string): Promise<GetUserEmojiUsageEvent>
|
979
|
-
|
980
958
|
}
|
981
959
|
|
982
960
|
/** Reports an error received from a socket message. */
|
@@ -1596,16 +1574,7 @@ export class DefaultSocket implements Socket {
|
|
1596
1574
|
return response.notification_channel_category_setting_event
|
1597
1575
|
}
|
1598
1576
|
|
1599
|
-
async addUserEmojiUsage(add_user_emoji_usage_event: AddUserEmojiUsageEvent) {
|
1600
|
-
const response = await this.send({add_user_emoji_usage_event: {add_user_emoji_usage_event: add_user_emoji_usage_event}})
|
1601
|
-
return response.add_user_emoji_usage_event
|
1602
|
-
}
|
1603
1577
|
|
1604
|
-
async getUserEmojiUsage(clan_id: string): Promise<GetUserEmojiUsageEvent> {
|
1605
|
-
const response = await this.send({get_user_emoji_usage_event: {clan_id: clan_id}})
|
1606
|
-
return response.get_user_emoji_usage_event
|
1607
|
-
}
|
1608
|
-
|
1609
1578
|
private async pingPong(): Promise<void> {
|
1610
1579
|
if (!this.adapter.isOpen()) {
|
1611
1580
|
return;
|