mezon-js 2.8.82 → 2.8.84
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +100 -5
- package/client.ts +37 -2
- package/dist/api.gen.d.ts +17 -2
- package/dist/client.d.ts +4 -2
- package/dist/mezon-js.cjs.js +167 -53
- package/dist/mezon-js.esm.mjs +167 -53
- package/package.json +1 -1
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.
|
@@ -1510,6 +1520,13 @@ export interface ApiUpdateCategoryDescRequest {
|
|
1510
1520
|
// clan ID
|
1511
1521
|
ClanId: string;
|
1512
1522
|
}
|
1523
|
+
/** */
|
1524
|
+
export interface ApiUpdateCategoryOrderRequest {
|
1525
|
+
//
|
1526
|
+
categories?: Array<ApiCategoryOrderUpdate>;
|
1527
|
+
//
|
1528
|
+
clan_id?: string;
|
1529
|
+
}
|
1513
1530
|
|
1514
1531
|
/** */
|
1515
1532
|
export interface ApiUpdateRoleChannelRequest {
|
@@ -3212,6 +3229,41 @@ export class MezonApi {
|
|
3212
3229
|
),
|
3213
3230
|
]);
|
3214
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
|
+
}
|
3215
3267
|
|
3216
3268
|
/** */
|
3217
3269
|
listCategoryDescs(bearerToken: string,
|
@@ -3219,6 +3271,7 @@ export class MezonApi {
|
|
3219
3271
|
creatorId?:string,
|
3220
3272
|
categoryName?:string,
|
3221
3273
|
categoryId?:string,
|
3274
|
+
categoryOrder?:number,
|
3222
3275
|
options: any = {}): Promise<ApiCategoryDescList> {
|
3223
3276
|
|
3224
3277
|
if (clanId === null || clanId === undefined) {
|
@@ -3230,6 +3283,7 @@ export class MezonApi {
|
|
3230
3283
|
queryParams.set("creator_id", creatorId);
|
3231
3284
|
queryParams.set("category_name", categoryName);
|
3232
3285
|
queryParams.set("category_id", categoryId);
|
3286
|
+
queryParams.set("category_order", categoryOrder);
|
3233
3287
|
|
3234
3288
|
let bodyJson : string = "";
|
3235
3289
|
|
@@ -4073,14 +4127,55 @@ export class MezonApi {
|
|
4073
4127
|
|
4074
4128
|
/** */
|
4075
4129
|
deleteCategoryDesc(bearerToken: string,
|
4076
|
-
|
4130
|
+
categoryId:string,
|
4131
|
+
clanId:string,
|
4077
4132
|
options: any = {}): Promise<any> {
|
4078
4133
|
|
4079
|
-
if (
|
4080
|
-
throw new Error("'
|
4134
|
+
if (categoryId === null || categoryId === undefined) {
|
4135
|
+
throw new Error("'categoryId' is a required parameter but is null or undefined.");
|
4136
|
+
}
|
4137
|
+
if (clanId === null || clanId === undefined) {
|
4138
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4081
4139
|
}
|
4082
|
-
const urlPath = "/v2/deletecategory/{
|
4083
|
-
.replace("{
|
4140
|
+
const urlPath = "/v2/deletecategory/category_id/{categoryId}/clan_id/{clanId}"
|
4141
|
+
.replace("{categoryId}", encodeURIComponent(String(categoryId)))
|
4142
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
4143
|
+
const queryParams = new Map<string, any>();
|
4144
|
+
|
4145
|
+
let bodyJson : string = "";
|
4146
|
+
|
4147
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4148
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
4149
|
+
if (bearerToken) {
|
4150
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4151
|
+
}
|
4152
|
+
|
4153
|
+
return Promise.race([
|
4154
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4155
|
+
if (response.status == 204) {
|
4156
|
+
return response;
|
4157
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4158
|
+
return response.json();
|
4159
|
+
} else {
|
4160
|
+
throw response;
|
4161
|
+
}
|
4162
|
+
}),
|
4163
|
+
new Promise((_, reject) =>
|
4164
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4165
|
+
),
|
4166
|
+
]);
|
4167
|
+
}
|
4168
|
+
|
4169
|
+
/** */
|
4170
|
+
deleteCategoryOrder(bearerToken: string,
|
4171
|
+
clanId:string,
|
4172
|
+
options: any = {}): Promise<any> {
|
4173
|
+
|
4174
|
+
if (clanId === null || clanId === undefined) {
|
4175
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4176
|
+
}
|
4177
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}"
|
4178
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
4084
4179
|
const queryParams = new Map<string, any>();
|
4085
4180
|
|
4086
4181
|
let bodyJson : 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";
|
@@ -1054,7 +1055,8 @@ export class Client {
|
|
1054
1055
|
/** Delete a category by ID. */
|
1055
1056
|
async deleteCategoryDesc(
|
1056
1057
|
session: Session,
|
1057
|
-
|
1058
|
+
categoryId: string,
|
1059
|
+
clanId: string,
|
1058
1060
|
): Promise<boolean> {
|
1059
1061
|
if (
|
1060
1062
|
this.autoRefreshSession &&
|
@@ -1065,7 +1067,7 @@ export class Client {
|
|
1065
1067
|
}
|
1066
1068
|
|
1067
1069
|
return this.apiClient
|
1068
|
-
.deleteCategoryDesc(session.token,
|
1070
|
+
.deleteCategoryDesc(session.token, categoryId, clanId)
|
1069
1071
|
.then((response: any) => {
|
1070
1072
|
return response !== undefined;
|
1071
1073
|
});
|
@@ -3410,4 +3412,37 @@ export class Client {
|
|
3410
3412
|
return Promise.resolve(response);
|
3411
3413
|
});
|
3412
3414
|
}
|
3415
|
+
async updateCategoryOrder(
|
3416
|
+
session: Session,
|
3417
|
+
request: ApiUpdateCategoryOrderRequest
|
3418
|
+
): Promise<any> {
|
3419
|
+
if (
|
3420
|
+
this.autoRefreshSession &&
|
3421
|
+
session.refresh_token &&
|
3422
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3423
|
+
) {
|
3424
|
+
await this.sessionRefresh(session);
|
3425
|
+
}
|
3426
|
+
|
3427
|
+
return this.apiClient
|
3428
|
+
.updateCategoryOrder(session.token, request)
|
3429
|
+
.then((response: any) => {
|
3430
|
+
return Promise.resolve(response);
|
3431
|
+
});
|
3432
|
+
}
|
3433
|
+
async deleteCategoryOrder(session: Session, clanId: string): Promise<any> {
|
3434
|
+
if (
|
3435
|
+
this.autoRefreshSession &&
|
3436
|
+
session.refresh_token &&
|
3437
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3438
|
+
) {
|
3439
|
+
await this.sessionRefresh(session);
|
3440
|
+
}
|
3441
|
+
|
3442
|
+
return this.apiClient
|
3443
|
+
.deleteCategoryOrder(session.token, clanId)
|
3444
|
+
.then((response: any) => {
|
3445
|
+
return Promise.resolve(response);
|
3446
|
+
});
|
3447
|
+
}
|
3413
3448
|
}
|
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;
|
@@ -876,6 +882,11 @@ export interface ApiUpdateCategoryDescRequest {
|
|
876
882
|
ClanId: string;
|
877
883
|
}
|
878
884
|
/** */
|
885
|
+
export interface ApiUpdateCategoryOrderRequest {
|
886
|
+
categories?: Array<ApiCategoryOrderUpdate>;
|
887
|
+
clan_id?: string;
|
888
|
+
}
|
889
|
+
/** */
|
879
890
|
export interface ApiUpdateRoleChannelRequest {
|
880
891
|
channel_id?: string;
|
881
892
|
permission_update?: Array<ApiPermissionUpdate>;
|
@@ -1064,7 +1075,9 @@ export declare class MezonApi {
|
|
1064
1075
|
/** Unban an app. */
|
1065
1076
|
unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1066
1077
|
/** */
|
1067
|
-
|
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>;
|
1068
1081
|
/** List a channel's message history. */
|
1069
1082
|
listChannelMessages(bearerToken: string, channelId: string, messageId?: string, direction?: number, limit?: number, options?: any): Promise<ApiChannelMessageList>;
|
1070
1083
|
/** Add users to a channel. */
|
@@ -1108,7 +1121,9 @@ export declare class MezonApi {
|
|
1108
1121
|
/** */
|
1109
1122
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
1110
1123
|
/** */
|
1111
|
-
deleteCategoryDesc(bearerToken: string,
|
1124
|
+
deleteCategoryDesc(bearerToken: string, categoryId: string, clanId: string, options?: any): Promise<any>;
|
1125
|
+
/** */
|
1126
|
+
deleteCategoryOrder(bearerToken: string, clanId: string, options?: any): Promise<any>;
|
1112
1127
|
/** regist fcm device token */
|
1113
1128
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
1114
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";
|
@@ -375,7 +375,7 @@ export declare class Client {
|
|
375
375
|
/** Delete a clan desc by ID. */
|
376
376
|
deleteClanDesc(session: Session, clanDescId: string): Promise<boolean>;
|
377
377
|
/** Delete a category by ID. */
|
378
|
-
deleteCategoryDesc(session: Session,
|
378
|
+
deleteCategoryDesc(session: Session, categoryId: string, clanId: string): Promise<boolean>;
|
379
379
|
/** Delete one or more notifications */
|
380
380
|
deleteNotifications(session: Session, ids?: Array<string>): Promise<boolean>;
|
381
381
|
/** Delete a role by ID. */
|
@@ -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);
|
@@ -2508,11 +2571,42 @@ var MezonApi = class {
|
|
2508
2571
|
]);
|
2509
2572
|
}
|
2510
2573
|
/** */
|
2511
|
-
deleteCategoryDesc(bearerToken,
|
2512
|
-
if (
|
2513
|
-
throw new Error("'
|
2574
|
+
deleteCategoryDesc(bearerToken, categoryId, clanId, options = {}) {
|
2575
|
+
if (categoryId === null || categoryId === void 0) {
|
2576
|
+
throw new Error("'categoryId' is a required parameter but is null or undefined.");
|
2514
2577
|
}
|
2515
|
-
|
2578
|
+
if (clanId === null || clanId === void 0) {
|
2579
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2580
|
+
}
|
2581
|
+
const urlPath = "/v2/deletecategory/category_id/{categoryId}/clan_id/{clanId}".replace("{categoryId}", encodeURIComponent(String(categoryId))).replace("{clanId}", encodeURIComponent(String(clanId)));
|
2582
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2583
|
+
let bodyJson = "";
|
2584
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2585
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2586
|
+
if (bearerToken) {
|
2587
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2588
|
+
}
|
2589
|
+
return Promise.race([
|
2590
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2591
|
+
if (response.status == 204) {
|
2592
|
+
return response;
|
2593
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2594
|
+
return response.json();
|
2595
|
+
} else {
|
2596
|
+
throw response;
|
2597
|
+
}
|
2598
|
+
}),
|
2599
|
+
new Promise(
|
2600
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2601
|
+
)
|
2602
|
+
]);
|
2603
|
+
}
|
2604
|
+
/** */
|
2605
|
+
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
2606
|
+
if (clanId === null || clanId === void 0) {
|
2607
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2608
|
+
}
|
2609
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2516
2610
|
const queryParams = /* @__PURE__ */ new Map();
|
2517
2611
|
let bodyJson = "";
|
2518
2612
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -5708,12 +5802,12 @@ var Client = class {
|
|
5708
5802
|
});
|
5709
5803
|
}
|
5710
5804
|
/** Delete a category by ID. */
|
5711
|
-
deleteCategoryDesc(session,
|
5805
|
+
deleteCategoryDesc(session, categoryId, clanId) {
|
5712
5806
|
return __async(this, null, function* () {
|
5713
5807
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5714
5808
|
yield this.sessionRefresh(session);
|
5715
5809
|
}
|
5716
|
-
return this.apiClient.deleteCategoryDesc(session.token,
|
5810
|
+
return this.apiClient.deleteCategoryDesc(session.token, categoryId, clanId).then((response) => {
|
5717
5811
|
return response !== void 0;
|
5718
5812
|
});
|
5719
5813
|
});
|
@@ -7113,4 +7207,24 @@ var Client = class {
|
|
7113
7207
|
});
|
7114
7208
|
});
|
7115
7209
|
}
|
7210
|
+
updateCategoryOrder(session, request) {
|
7211
|
+
return __async(this, null, function* () {
|
7212
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7213
|
+
yield this.sessionRefresh(session);
|
7214
|
+
}
|
7215
|
+
return this.apiClient.updateCategoryOrder(session.token, request).then((response) => {
|
7216
|
+
return Promise.resolve(response);
|
7217
|
+
});
|
7218
|
+
});
|
7219
|
+
}
|
7220
|
+
deleteCategoryOrder(session, clanId) {
|
7221
|
+
return __async(this, null, function* () {
|
7222
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7223
|
+
yield this.sessionRefresh(session);
|
7224
|
+
}
|
7225
|
+
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
7226
|
+
return Promise.resolve(response);
|
7227
|
+
});
|
7228
|
+
});
|
7229
|
+
}
|
7116
7230
|
};
|
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);
|
@@ -2479,11 +2542,42 @@ var MezonApi = class {
|
|
2479
2542
|
]);
|
2480
2543
|
}
|
2481
2544
|
/** */
|
2482
|
-
deleteCategoryDesc(bearerToken,
|
2483
|
-
if (
|
2484
|
-
throw new Error("'
|
2545
|
+
deleteCategoryDesc(bearerToken, categoryId, clanId, options = {}) {
|
2546
|
+
if (categoryId === null || categoryId === void 0) {
|
2547
|
+
throw new Error("'categoryId' is a required parameter but is null or undefined.");
|
2485
2548
|
}
|
2486
|
-
|
2549
|
+
if (clanId === null || clanId === void 0) {
|
2550
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2551
|
+
}
|
2552
|
+
const urlPath = "/v2/deletecategory/category_id/{categoryId}/clan_id/{clanId}".replace("{categoryId}", encodeURIComponent(String(categoryId))).replace("{clanId}", encodeURIComponent(String(clanId)));
|
2553
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2554
|
+
let bodyJson = "";
|
2555
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2556
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2557
|
+
if (bearerToken) {
|
2558
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2559
|
+
}
|
2560
|
+
return Promise.race([
|
2561
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2562
|
+
if (response.status == 204) {
|
2563
|
+
return response;
|
2564
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2565
|
+
return response.json();
|
2566
|
+
} else {
|
2567
|
+
throw response;
|
2568
|
+
}
|
2569
|
+
}),
|
2570
|
+
new Promise(
|
2571
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2572
|
+
)
|
2573
|
+
]);
|
2574
|
+
}
|
2575
|
+
/** */
|
2576
|
+
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
2577
|
+
if (clanId === null || clanId === void 0) {
|
2578
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2579
|
+
}
|
2580
|
+
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2487
2581
|
const queryParams = /* @__PURE__ */ new Map();
|
2488
2582
|
let bodyJson = "";
|
2489
2583
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -5679,12 +5773,12 @@ var Client = class {
|
|
5679
5773
|
});
|
5680
5774
|
}
|
5681
5775
|
/** Delete a category by ID. */
|
5682
|
-
deleteCategoryDesc(session,
|
5776
|
+
deleteCategoryDesc(session, categoryId, clanId) {
|
5683
5777
|
return __async(this, null, function* () {
|
5684
5778
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5685
5779
|
yield this.sessionRefresh(session);
|
5686
5780
|
}
|
5687
|
-
return this.apiClient.deleteCategoryDesc(session.token,
|
5781
|
+
return this.apiClient.deleteCategoryDesc(session.token, categoryId, clanId).then((response) => {
|
5688
5782
|
return response !== void 0;
|
5689
5783
|
});
|
5690
5784
|
});
|
@@ -7084,6 +7178,26 @@ var Client = class {
|
|
7084
7178
|
});
|
7085
7179
|
});
|
7086
7180
|
}
|
7181
|
+
updateCategoryOrder(session, request) {
|
7182
|
+
return __async(this, null, function* () {
|
7183
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7184
|
+
yield this.sessionRefresh(session);
|
7185
|
+
}
|
7186
|
+
return this.apiClient.updateCategoryOrder(session.token, request).then((response) => {
|
7187
|
+
return Promise.resolve(response);
|
7188
|
+
});
|
7189
|
+
});
|
7190
|
+
}
|
7191
|
+
deleteCategoryOrder(session, clanId) {
|
7192
|
+
return __async(this, null, function* () {
|
7193
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7194
|
+
yield this.sessionRefresh(session);
|
7195
|
+
}
|
7196
|
+
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
7197
|
+
return Promise.resolve(response);
|
7198
|
+
});
|
7199
|
+
});
|
7200
|
+
}
|
7087
7201
|
};
|
7088
7202
|
export {
|
7089
7203
|
ChannelStreamMode,
|