mezon-js 2.8.2 → 2.8.3
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +10 -56
- package/client.ts +11 -24
- package/dist/api.gen.d.ts +5 -17
- package/dist/client.d.ts +4 -6
- package/dist/mezon-js.cjs.js +12 -49
- package/dist/mezon-js.esm.mjs +12 -49
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -540,6 +540,8 @@ export interface ApiClanEmojiCreateRequest {
|
|
540
540
|
//
|
541
541
|
clan_id?: string;
|
542
542
|
//
|
543
|
+
id?: string;
|
544
|
+
//
|
543
545
|
shortname?: string;
|
544
546
|
//
|
545
547
|
source?: string;
|
@@ -602,6 +604,8 @@ export interface ApiClanStickerAddRequest {
|
|
602
604
|
//
|
603
605
|
clan_id?: string;
|
604
606
|
//
|
607
|
+
id?: string;
|
608
|
+
//
|
605
609
|
shortname?: string;
|
606
610
|
//
|
607
611
|
source?: string;
|
@@ -725,16 +729,6 @@ export interface ApiCreateRoleRequest {
|
|
725
729
|
title?: string;
|
726
730
|
}
|
727
731
|
|
728
|
-
/** */
|
729
|
-
export interface ApiCreateWebhookRequest {
|
730
|
-
//
|
731
|
-
channel_id?: string;
|
732
|
-
//
|
733
|
-
clan_id?: string;
|
734
|
-
//
|
735
|
-
hook_name?: string;
|
736
|
-
}
|
737
|
-
|
738
732
|
/** Delete a channel the user has access to. */
|
739
733
|
export interface ApiDeleteChannelDescRequest {
|
740
734
|
//The id of a channel.
|
@@ -1588,16 +1582,6 @@ export interface ApiWebhookListResponse {
|
|
1588
1582
|
webhooks?: Array<ApiWebhook>;
|
1589
1583
|
}
|
1590
1584
|
|
1591
|
-
/** */
|
1592
|
-
export interface ApiWebhookResponse {
|
1593
|
-
//
|
1594
|
-
channel_id?: string;
|
1595
|
-
//
|
1596
|
-
hook_name?: string;
|
1597
|
-
//
|
1598
|
-
hook_url?: string;
|
1599
|
-
}
|
1600
|
-
|
1601
1585
|
/** The object to store. */
|
1602
1586
|
export interface ApiWriteStorageObject {
|
1603
1587
|
//The collection to store the object.
|
@@ -3978,6 +3962,7 @@ export class MezonApi {
|
|
3978
3962
|
/** Delete a emoji by ID. */
|
3979
3963
|
deleteByIdClanEmoji(bearerToken: string,
|
3980
3964
|
id:string,
|
3965
|
+
clanId?:string,
|
3981
3966
|
options: any = {}): Promise<any> {
|
3982
3967
|
|
3983
3968
|
if (id === null || id === undefined) {
|
@@ -3986,6 +3971,7 @@ export class MezonApi {
|
|
3986
3971
|
const urlPath = "/v2/emoji/{id}"
|
3987
3972
|
.replace("{id}", encodeURIComponent(String(id)));
|
3988
3973
|
const queryParams = new Map<string, any>();
|
3974
|
+
queryParams.set("clan_id", clanId);
|
3989
3975
|
|
3990
3976
|
let bodyJson : string = "";
|
3991
3977
|
|
@@ -5937,6 +5923,7 @@ export class MezonApi {
|
|
5937
5923
|
/** Delete a sticker by ID */
|
5938
5924
|
deleteClanStickerById(bearerToken: string,
|
5939
5925
|
id:string,
|
5926
|
+
clanId?:string,
|
5940
5927
|
options: any = {}): Promise<any> {
|
5941
5928
|
|
5942
5929
|
if (id === null || id === undefined) {
|
@@ -5945,6 +5932,7 @@ export class MezonApi {
|
|
5945
5932
|
const urlPath = "/v2/sticker/{id}"
|
5946
5933
|
.replace("{id}", encodeURIComponent(String(id)));
|
5947
5934
|
const queryParams = new Map<string, any>();
|
5935
|
+
queryParams.set("clan_id", clanId);
|
5948
5936
|
|
5949
5937
|
let bodyJson : string = "";
|
5950
5938
|
|
@@ -6428,42 +6416,6 @@ export class MezonApi {
|
|
6428
6416
|
]);
|
6429
6417
|
}
|
6430
6418
|
|
6431
|
-
/** Create webhook */
|
6432
|
-
createWebhookLink(bearerToken: string,
|
6433
|
-
body:ApiCreateWebhookRequest,
|
6434
|
-
options: any = {}): Promise<ApiWebhookResponse> {
|
6435
|
-
|
6436
|
-
if (body === null || body === undefined) {
|
6437
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
6438
|
-
}
|
6439
|
-
const urlPath = "/v2/webhook/create";
|
6440
|
-
const queryParams = new Map<string, any>();
|
6441
|
-
|
6442
|
-
let bodyJson : string = "";
|
6443
|
-
bodyJson = JSON.stringify(body || {});
|
6444
|
-
|
6445
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6446
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6447
|
-
if (bearerToken) {
|
6448
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6449
|
-
}
|
6450
|
-
|
6451
|
-
return Promise.race([
|
6452
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
6453
|
-
if (response.status == 204) {
|
6454
|
-
return response;
|
6455
|
-
} else if (response.status >= 200 && response.status < 300) {
|
6456
|
-
return response.json();
|
6457
|
-
} else {
|
6458
|
-
throw response;
|
6459
|
-
}
|
6460
|
-
}),
|
6461
|
-
new Promise((_, reject) =>
|
6462
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6463
|
-
),
|
6464
|
-
]);
|
6465
|
-
}
|
6466
|
-
|
6467
6419
|
/** create webhook */
|
6468
6420
|
generateWebhook(bearerToken: string,
|
6469
6421
|
body:ApiWebhookCreateRequest,
|
@@ -6544,6 +6496,7 @@ export class MezonApi {
|
|
6544
6496
|
/** list webhook belong to the channel */
|
6545
6497
|
listWebhookByChannelId(bearerToken: string,
|
6546
6498
|
channelId:string,
|
6499
|
+
clanId?:string,
|
6547
6500
|
options: any = {}): Promise<ApiWebhookListResponse> {
|
6548
6501
|
|
6549
6502
|
if (channelId === null || channelId === undefined) {
|
@@ -6552,6 +6505,7 @@ export class MezonApi {
|
|
6552
6505
|
const urlPath = "/v2/webhooks/{channelId}"
|
6553
6506
|
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
6554
6507
|
const queryParams = new Map<string, any>();
|
6508
|
+
queryParams.set("clan_id", clanId);
|
6555
6509
|
|
6556
6510
|
let bodyJson : string = "";
|
6557
6511
|
|
package/client.ts
CHANGED
@@ -90,8 +90,6 @@ import {
|
|
90
90
|
ApiSearchMessageResponse,
|
91
91
|
ApiPinMessageRequest,
|
92
92
|
ApiPinMessagesList,
|
93
|
-
ApiCreateWebhookRequest,
|
94
|
-
ApiWebhookResponse,
|
95
93
|
ApiDeleteChannelDescRequest,
|
96
94
|
ApiChangeChannelPrivateRequest,
|
97
95
|
ApiClanEmojiList,
|
@@ -792,18 +790,7 @@ export class Client {
|
|
792
790
|
});
|
793
791
|
}
|
794
792
|
|
795
|
-
|
796
|
-
async createWebhook(session: Session, request: ApiCreateWebhookRequest): Promise<ApiWebhookResponse> {
|
797
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
798
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
799
|
-
await this.sessionRefresh(session);
|
800
|
-
}
|
801
|
-
|
802
|
-
return this.apiClient.createWebhookLink(session.token, request).then((response: ApiWebhookResponse) => {
|
803
|
-
return Promise.resolve(response);
|
804
|
-
});
|
805
|
-
}
|
806
|
-
|
793
|
+
|
807
794
|
/** add role for channel. */
|
808
795
|
async addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean> {
|
809
796
|
if (this.autoRefreshSession && session.refresh_token &&
|
@@ -2294,13 +2281,13 @@ async updateClanEmojiById(session: Session, id: string, request: MezonUpdateClan
|
|
2294
2281
|
}
|
2295
2282
|
|
2296
2283
|
//**delete clan emoji by id */
|
2297
|
-
async deleteByIdClanEmoji(session: Session, id: string) {
|
2284
|
+
async deleteByIdClanEmoji(session: Session, id: string, clan_id: string) {
|
2298
2285
|
if (this.autoRefreshSession && session.refresh_token &&
|
2299
2286
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2300
2287
|
await this.sessionRefresh(session);
|
2301
2288
|
}
|
2302
2289
|
|
2303
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response: any) => {
|
2290
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response: any) => {
|
2304
2291
|
return response !== undefined;
|
2305
2292
|
});
|
2306
2293
|
}
|
@@ -2318,13 +2305,13 @@ async generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): P
|
|
2318
2305
|
}
|
2319
2306
|
|
2320
2307
|
//**list webhook belong to the channel */
|
2321
|
-
async listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse> {
|
2308
|
+
async listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse> {
|
2322
2309
|
if (this.autoRefreshSession && session.refresh_token &&
|
2323
2310
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2324
2311
|
await this.sessionRefresh(session);
|
2325
2312
|
}
|
2326
2313
|
|
2327
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response: ApiWebhookListResponse) => {
|
2314
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response: ApiWebhookListResponse) => {
|
2328
2315
|
return Promise.resolve(response);
|
2329
2316
|
})
|
2330
2317
|
}
|
@@ -2366,7 +2353,7 @@ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCh
|
|
2366
2353
|
}
|
2367
2354
|
|
2368
2355
|
//**Add a new sticker */
|
2369
|
-
async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
2356
|
+
async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
|
2370
2357
|
if (this.autoRefreshSession && session.refresh_token &&
|
2371
2358
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2372
2359
|
await this.sessionRefresh(session);
|
@@ -2378,7 +2365,7 @@ async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
|
2378
2365
|
}
|
2379
2366
|
|
2380
2367
|
//**List stickers by clan ID */
|
2381
|
-
async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2368
|
+
async listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2382
2369
|
if (this.autoRefreshSession && session.refresh_token &&
|
2383
2370
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2384
2371
|
await this.sessionRefresh(session);
|
@@ -2390,19 +2377,19 @@ async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStic
|
|
2390
2377
|
}
|
2391
2378
|
|
2392
2379
|
//**Delete a sticker by ID*/
|
2393
|
-
async deleteClanStickerById(session: Session,id: string) {
|
2380
|
+
async deleteClanStickerById(session: Session, id: string, clan_id: string) {
|
2394
2381
|
if (this.autoRefreshSession && session.refresh_token &&
|
2395
2382
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2396
2383
|
await this.sessionRefresh(session);
|
2397
2384
|
}
|
2398
2385
|
|
2399
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response: any) => {
|
2386
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response: any) => {
|
2400
2387
|
return response !== undefined;
|
2401
2388
|
})
|
2402
2389
|
}
|
2403
2390
|
|
2404
2391
|
//**Update a sticker by ID*/
|
2405
|
-
async updateClanStickerById(session: Session,id: string,request: MezonUpdateClanStickerByIdBody){
|
2392
|
+
async updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody){
|
2406
2393
|
if (this.autoRefreshSession && session.refresh_token &&
|
2407
2394
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2408
2395
|
await this.sessionRefresh(session);
|
@@ -2414,7 +2401,7 @@ async updateClanStickerById(session: Session,id: string,request: MezonUpdateClan
|
|
2414
2401
|
}
|
2415
2402
|
|
2416
2403
|
//** update the category of a channel */
|
2417
|
-
async changeChannelCategory(session: Session,id: string,request: MezonChangeChannelCategoryBody) {
|
2404
|
+
async changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody) {
|
2418
2405
|
if (this.autoRefreshSession && session.refresh_token &&
|
2419
2406
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2420
2407
|
await this.sessionRefresh(session);
|
package/dist/api.gen.d.ts
CHANGED
@@ -308,6 +308,7 @@ export interface ApiClanDescProfile {
|
|
308
308
|
export interface ApiClanEmojiCreateRequest {
|
309
309
|
category?: string;
|
310
310
|
clan_id?: string;
|
311
|
+
id?: string;
|
311
312
|
shortname?: string;
|
312
313
|
source?: string;
|
313
314
|
}
|
@@ -344,6 +345,7 @@ export interface ApiClanSticker {
|
|
344
345
|
export interface ApiClanStickerAddRequest {
|
345
346
|
category?: string;
|
346
347
|
clan_id?: string;
|
348
|
+
id?: string;
|
347
349
|
shortname?: string;
|
348
350
|
source?: string;
|
349
351
|
}
|
@@ -414,12 +416,6 @@ export interface ApiCreateRoleRequest {
|
|
414
416
|
role_icon?: string;
|
415
417
|
title?: string;
|
416
418
|
}
|
417
|
-
/** */
|
418
|
-
export interface ApiCreateWebhookRequest {
|
419
|
-
channel_id?: string;
|
420
|
-
clan_id?: string;
|
421
|
-
hook_name?: string;
|
422
|
-
}
|
423
419
|
/** Delete a channel the user has access to. */
|
424
420
|
export interface ApiDeleteChannelDescRequest {
|
425
421
|
channel_id?: string;
|
@@ -915,12 +911,6 @@ export interface ApiWebhookGenerateResponse {
|
|
915
911
|
export interface ApiWebhookListResponse {
|
916
912
|
webhooks?: Array<ApiWebhook>;
|
917
913
|
}
|
918
|
-
/** */
|
919
|
-
export interface ApiWebhookResponse {
|
920
|
-
channel_id?: string;
|
921
|
-
hook_name?: string;
|
922
|
-
hook_url?: string;
|
923
|
-
}
|
924
914
|
/** The object to store. */
|
925
915
|
export interface ApiWriteStorageObject {
|
926
916
|
collection?: string;
|
@@ -1075,7 +1065,7 @@ export declare class MezonApi {
|
|
1075
1065
|
/** Get emoji list by clan id */
|
1076
1066
|
listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
|
1077
1067
|
/** Delete a emoji by ID. */
|
1078
|
-
deleteByIdClanEmoji(bearerToken: string, id: string, options?: any): Promise<any>;
|
1068
|
+
deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1079
1069
|
/** Update ClanEmoj By id */
|
1080
1070
|
updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
|
1081
1071
|
/** Search message from elasticsearch service. */
|
@@ -1183,7 +1173,7 @@ export declare class MezonApi {
|
|
1183
1173
|
/** List stickers by clan ID */
|
1184
1174
|
listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
|
1185
1175
|
/** Delete a sticker by ID */
|
1186
|
-
deleteClanStickerById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1176
|
+
deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1187
1177
|
/** Update a sticker by ID */
|
1188
1178
|
updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
|
1189
1179
|
/** Get storage objects. */
|
@@ -1208,14 +1198,12 @@ export declare class MezonApi {
|
|
1208
1198
|
getUsers(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, facebookIds?: Array<string>, options?: any): Promise<ApiUsers>;
|
1209
1199
|
/** */
|
1210
1200
|
updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
|
1211
|
-
/** Create webhook */
|
1212
|
-
createWebhookLink(bearerToken: string, body: ApiCreateWebhookRequest, options?: any): Promise<ApiWebhookResponse>;
|
1213
1201
|
/** create webhook */
|
1214
1202
|
generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
|
1215
1203
|
/** update webhook name by id */
|
1216
1204
|
updateWebhookById(bearerToken: string, id: string, body: MezonUpdateWebhookByIdBody, options?: any): Promise<any>;
|
1217
1205
|
/** list webhook belong to the channel */
|
1218
|
-
listWebhookByChannelId(bearerToken: string, channelId: string, options?: any): Promise<ApiWebhookListResponse>;
|
1206
|
+
listWebhookByChannelId(bearerToken: string, channelId: string, clanId?: string, options?: any): Promise<ApiWebhookListResponse>;
|
1219
1207
|
/** disabled webhook */
|
1220
1208
|
deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1221
1209
|
buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
|
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, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList,
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, ApiClanStickerListByClanIdResponse, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -400,8 +400,6 @@ export declare class Client {
|
|
400
400
|
createRole(session: Session, request: ApiCreateRoleRequest): Promise<ApiRole>;
|
401
401
|
/** Create a new event for clan. */
|
402
402
|
createEvent(session: Session, request: ApiCreateEventRequest): Promise<ApiEventManagement>;
|
403
|
-
/** Create a new event for clan. */
|
404
|
-
createWebhook(session: Session, request: ApiCreateWebhookRequest): Promise<ApiWebhookResponse>;
|
405
403
|
/** add role for channel. */
|
406
404
|
addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean>;
|
407
405
|
/** Update action role when delete role */
|
@@ -587,15 +585,15 @@ export declare class Client {
|
|
587
585
|
/** create clan emoji */
|
588
586
|
createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
|
589
587
|
updateClanEmojiById(session: Session, id: string, request: MezonUpdateClanEmojiByIdBody): Promise<boolean>;
|
590
|
-
deleteByIdClanEmoji(session: Session, id: string): Promise<boolean>;
|
588
|
+
deleteByIdClanEmoji(session: Session, id: string, clan_id: string): Promise<boolean>;
|
591
589
|
generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): Promise<ApiWebhookGenerateResponse>;
|
592
|
-
listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse>;
|
590
|
+
listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse>;
|
593
591
|
updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
|
594
592
|
deleteWebhookById(session: Session, id: string): Promise<boolean>;
|
595
593
|
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
596
594
|
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
597
595
|
listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
598
|
-
deleteClanStickerById(session: Session, id: string): Promise<boolean>;
|
596
|
+
deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
599
597
|
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
600
598
|
changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
|
601
599
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2473,12 +2473,13 @@ var MezonApi = class {
|
|
2473
2473
|
]);
|
2474
2474
|
}
|
2475
2475
|
/** Delete a emoji by ID. */
|
2476
|
-
deleteByIdClanEmoji(bearerToken, id, options = {}) {
|
2476
|
+
deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
|
2477
2477
|
if (id === null || id === void 0) {
|
2478
2478
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
2479
2479
|
}
|
2480
2480
|
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
2481
2481
|
const queryParams = /* @__PURE__ */ new Map();
|
2482
|
+
queryParams.set("clan_id", clanId);
|
2482
2483
|
let bodyJson = "";
|
2483
2484
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2484
2485
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4012,12 +4013,13 @@ var MezonApi = class {
|
|
4012
4013
|
]);
|
4013
4014
|
}
|
4014
4015
|
/** Delete a sticker by ID */
|
4015
|
-
deleteClanStickerById(bearerToken, id, options = {}) {
|
4016
|
+
deleteClanStickerById(bearerToken, id, clanId, options = {}) {
|
4016
4017
|
if (id === null || id === void 0) {
|
4017
4018
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
4018
4019
|
}
|
4019
4020
|
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
4020
4021
|
const queryParams = /* @__PURE__ */ new Map();
|
4022
|
+
queryParams.set("clan_id", clanId);
|
4021
4023
|
let bodyJson = "";
|
4022
4024
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4023
4025
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4398,35 +4400,6 @@ var MezonApi = class {
|
|
4398
4400
|
)
|
4399
4401
|
]);
|
4400
4402
|
}
|
4401
|
-
/** Create webhook */
|
4402
|
-
createWebhookLink(bearerToken, body, options = {}) {
|
4403
|
-
if (body === null || body === void 0) {
|
4404
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4405
|
-
}
|
4406
|
-
const urlPath = "/v2/webhook/create";
|
4407
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4408
|
-
let bodyJson = "";
|
4409
|
-
bodyJson = JSON.stringify(body || {});
|
4410
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4411
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4412
|
-
if (bearerToken) {
|
4413
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4414
|
-
}
|
4415
|
-
return Promise.race([
|
4416
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4417
|
-
if (response.status == 204) {
|
4418
|
-
return response;
|
4419
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4420
|
-
return response.json();
|
4421
|
-
} else {
|
4422
|
-
throw response;
|
4423
|
-
}
|
4424
|
-
}),
|
4425
|
-
new Promise(
|
4426
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4427
|
-
)
|
4428
|
-
]);
|
4429
|
-
}
|
4430
4403
|
/** create webhook */
|
4431
4404
|
generateWebhook(bearerToken, body, options = {}) {
|
4432
4405
|
if (body === null || body === void 0) {
|
@@ -4489,12 +4462,13 @@ var MezonApi = class {
|
|
4489
4462
|
]);
|
4490
4463
|
}
|
4491
4464
|
/** list webhook belong to the channel */
|
4492
|
-
listWebhookByChannelId(bearerToken, channelId, options = {}) {
|
4465
|
+
listWebhookByChannelId(bearerToken, channelId, clanId, options = {}) {
|
4493
4466
|
if (channelId === null || channelId === void 0) {
|
4494
4467
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
4495
4468
|
}
|
4496
4469
|
const urlPath = "/v2/webhooks/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
|
4497
4470
|
const queryParams = /* @__PURE__ */ new Map();
|
4471
|
+
queryParams.set("clan_id", clanId);
|
4498
4472
|
let bodyJson = "";
|
4499
4473
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4500
4474
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -5454,17 +5428,6 @@ var Client = class {
|
|
5454
5428
|
});
|
5455
5429
|
});
|
5456
5430
|
}
|
5457
|
-
/** Create a new event for clan. */
|
5458
|
-
createWebhook(session, request) {
|
5459
|
-
return __async(this, null, function* () {
|
5460
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5461
|
-
yield this.sessionRefresh(session);
|
5462
|
-
}
|
5463
|
-
return this.apiClient.createWebhookLink(session.token, request).then((response) => {
|
5464
|
-
return Promise.resolve(response);
|
5465
|
-
});
|
5466
|
-
});
|
5467
|
-
}
|
5468
5431
|
/** add role for channel. */
|
5469
5432
|
addRolesChannelDesc(session, request) {
|
5470
5433
|
return __async(this, null, function* () {
|
@@ -6824,12 +6787,12 @@ var Client = class {
|
|
6824
6787
|
});
|
6825
6788
|
}
|
6826
6789
|
//**delete clan emoji by id */
|
6827
|
-
deleteByIdClanEmoji(session, id) {
|
6790
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6828
6791
|
return __async(this, null, function* () {
|
6829
6792
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6830
6793
|
yield this.sessionRefresh(session);
|
6831
6794
|
}
|
6832
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6795
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6833
6796
|
return response !== void 0;
|
6834
6797
|
});
|
6835
6798
|
});
|
@@ -6846,12 +6809,12 @@ var Client = class {
|
|
6846
6809
|
});
|
6847
6810
|
}
|
6848
6811
|
//**list webhook belong to the channel */
|
6849
|
-
listWebhookByChannelId(session, channel_id) {
|
6812
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6850
6813
|
return __async(this, null, function* () {
|
6851
6814
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6852
6815
|
yield this.sessionRefresh(session);
|
6853
6816
|
}
|
6854
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6817
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6855
6818
|
return Promise.resolve(response);
|
6856
6819
|
});
|
6857
6820
|
});
|
@@ -6912,12 +6875,12 @@ var Client = class {
|
|
6912
6875
|
});
|
6913
6876
|
}
|
6914
6877
|
//**Delete a sticker by ID*/
|
6915
|
-
deleteClanStickerById(session, id) {
|
6878
|
+
deleteClanStickerById(session, id, clan_id) {
|
6916
6879
|
return __async(this, null, function* () {
|
6917
6880
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6918
6881
|
yield this.sessionRefresh(session);
|
6919
6882
|
}
|
6920
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6883
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6921
6884
|
return response !== void 0;
|
6922
6885
|
});
|
6923
6886
|
});
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2444,12 +2444,13 @@ var MezonApi = class {
|
|
2444
2444
|
]);
|
2445
2445
|
}
|
2446
2446
|
/** Delete a emoji by ID. */
|
2447
|
-
deleteByIdClanEmoji(bearerToken, id, options = {}) {
|
2447
|
+
deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
|
2448
2448
|
if (id === null || id === void 0) {
|
2449
2449
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
2450
2450
|
}
|
2451
2451
|
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
2452
2452
|
const queryParams = /* @__PURE__ */ new Map();
|
2453
|
+
queryParams.set("clan_id", clanId);
|
2453
2454
|
let bodyJson = "";
|
2454
2455
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2455
2456
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -3983,12 +3984,13 @@ var MezonApi = class {
|
|
3983
3984
|
]);
|
3984
3985
|
}
|
3985
3986
|
/** Delete a sticker by ID */
|
3986
|
-
deleteClanStickerById(bearerToken, id, options = {}) {
|
3987
|
+
deleteClanStickerById(bearerToken, id, clanId, options = {}) {
|
3987
3988
|
if (id === null || id === void 0) {
|
3988
3989
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
3989
3990
|
}
|
3990
3991
|
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
3991
3992
|
const queryParams = /* @__PURE__ */ new Map();
|
3993
|
+
queryParams.set("clan_id", clanId);
|
3992
3994
|
let bodyJson = "";
|
3993
3995
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3994
3996
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4369,35 +4371,6 @@ var MezonApi = class {
|
|
4369
4371
|
)
|
4370
4372
|
]);
|
4371
4373
|
}
|
4372
|
-
/** Create webhook */
|
4373
|
-
createWebhookLink(bearerToken, body, options = {}) {
|
4374
|
-
if (body === null || body === void 0) {
|
4375
|
-
throw new Error("'body' is a required parameter but is null or undefined.");
|
4376
|
-
}
|
4377
|
-
const urlPath = "/v2/webhook/create";
|
4378
|
-
const queryParams = /* @__PURE__ */ new Map();
|
4379
|
-
let bodyJson = "";
|
4380
|
-
bodyJson = JSON.stringify(body || {});
|
4381
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4382
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4383
|
-
if (bearerToken) {
|
4384
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4385
|
-
}
|
4386
|
-
return Promise.race([
|
4387
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4388
|
-
if (response.status == 204) {
|
4389
|
-
return response;
|
4390
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4391
|
-
return response.json();
|
4392
|
-
} else {
|
4393
|
-
throw response;
|
4394
|
-
}
|
4395
|
-
}),
|
4396
|
-
new Promise(
|
4397
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4398
|
-
)
|
4399
|
-
]);
|
4400
|
-
}
|
4401
4374
|
/** create webhook */
|
4402
4375
|
generateWebhook(bearerToken, body, options = {}) {
|
4403
4376
|
if (body === null || body === void 0) {
|
@@ -4460,12 +4433,13 @@ var MezonApi = class {
|
|
4460
4433
|
]);
|
4461
4434
|
}
|
4462
4435
|
/** list webhook belong to the channel */
|
4463
|
-
listWebhookByChannelId(bearerToken, channelId, options = {}) {
|
4436
|
+
listWebhookByChannelId(bearerToken, channelId, clanId, options = {}) {
|
4464
4437
|
if (channelId === null || channelId === void 0) {
|
4465
4438
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
4466
4439
|
}
|
4467
4440
|
const urlPath = "/v2/webhooks/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
|
4468
4441
|
const queryParams = /* @__PURE__ */ new Map();
|
4442
|
+
queryParams.set("clan_id", clanId);
|
4469
4443
|
let bodyJson = "";
|
4470
4444
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4471
4445
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
@@ -5425,17 +5399,6 @@ var Client = class {
|
|
5425
5399
|
});
|
5426
5400
|
});
|
5427
5401
|
}
|
5428
|
-
/** Create a new event for clan. */
|
5429
|
-
createWebhook(session, request) {
|
5430
|
-
return __async(this, null, function* () {
|
5431
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5432
|
-
yield this.sessionRefresh(session);
|
5433
|
-
}
|
5434
|
-
return this.apiClient.createWebhookLink(session.token, request).then((response) => {
|
5435
|
-
return Promise.resolve(response);
|
5436
|
-
});
|
5437
|
-
});
|
5438
|
-
}
|
5439
5402
|
/** add role for channel. */
|
5440
5403
|
addRolesChannelDesc(session, request) {
|
5441
5404
|
return __async(this, null, function* () {
|
@@ -6795,12 +6758,12 @@ var Client = class {
|
|
6795
6758
|
});
|
6796
6759
|
}
|
6797
6760
|
//**delete clan emoji by id */
|
6798
|
-
deleteByIdClanEmoji(session, id) {
|
6761
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6799
6762
|
return __async(this, null, function* () {
|
6800
6763
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6801
6764
|
yield this.sessionRefresh(session);
|
6802
6765
|
}
|
6803
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6766
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6804
6767
|
return response !== void 0;
|
6805
6768
|
});
|
6806
6769
|
});
|
@@ -6817,12 +6780,12 @@ var Client = class {
|
|
6817
6780
|
});
|
6818
6781
|
}
|
6819
6782
|
//**list webhook belong to the channel */
|
6820
|
-
listWebhookByChannelId(session, channel_id) {
|
6783
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6821
6784
|
return __async(this, null, function* () {
|
6822
6785
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6823
6786
|
yield this.sessionRefresh(session);
|
6824
6787
|
}
|
6825
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6788
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6826
6789
|
return Promise.resolve(response);
|
6827
6790
|
});
|
6828
6791
|
});
|
@@ -6883,12 +6846,12 @@ var Client = class {
|
|
6883
6846
|
});
|
6884
6847
|
}
|
6885
6848
|
//**Delete a sticker by ID*/
|
6886
|
-
deleteClanStickerById(session, id) {
|
6849
|
+
deleteClanStickerById(session, id, clan_id) {
|
6887
6850
|
return __async(this, null, function* () {
|
6888
6851
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6889
6852
|
yield this.sessionRefresh(session);
|
6890
6853
|
}
|
6891
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6854
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6892
6855
|
return response !== void 0;
|
6893
6856
|
});
|
6894
6857
|
});
|