mezon-js 2.8.1 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.gen.ts +11 -57
- package/client.ts +13 -25
- package/dist/api.gen.d.ts +6 -18
- package/dist/client.d.ts +4 -6
- package/dist/mezon-js.cjs.js +14 -50
- package/dist/mezon-js.esm.mjs +14 -50
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -23,7 +23,7 @@ export interface ChannelUserListChannelUser {
|
|
23
23
|
/** A single user-role pair. */
|
24
24
|
export interface ClanUserListClanUser {
|
25
25
|
//from the `nick_name` field in the `clan_desc_profile` table.
|
26
|
-
|
26
|
+
clan_nick?: string;
|
27
27
|
//Their relationship to the role.
|
28
28
|
role_id?: string;
|
29
29
|
//User.
|
@@ -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 &&
|
@@ -1243,7 +1230,8 @@ export class Client {
|
|
1243
1230
|
username: gu.user!.username,
|
1244
1231
|
metadata: gu.user!.metadata ? JSON.parse(gu.user!.metadata!) : undefined
|
1245
1232
|
},
|
1246
|
-
role_id: gu!.role_id
|
1233
|
+
role_id: gu!.role_id,
|
1234
|
+
clan_nick: gu!.clan_nick
|
1247
1235
|
})
|
1248
1236
|
});
|
1249
1237
|
return Promise.resolve(result);
|
@@ -2293,13 +2281,13 @@ async updateClanEmojiById(session: Session, id: string, request: MezonUpdateClan
|
|
2293
2281
|
}
|
2294
2282
|
|
2295
2283
|
//**delete clan emoji by id */
|
2296
|
-
async deleteByIdClanEmoji(session: Session, id: string) {
|
2284
|
+
async deleteByIdClanEmoji(session: Session, id: string, clan_id: string) {
|
2297
2285
|
if (this.autoRefreshSession && session.refresh_token &&
|
2298
2286
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2299
2287
|
await this.sessionRefresh(session);
|
2300
2288
|
}
|
2301
2289
|
|
2302
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response: any) => {
|
2290
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response: any) => {
|
2303
2291
|
return response !== undefined;
|
2304
2292
|
});
|
2305
2293
|
}
|
@@ -2317,13 +2305,13 @@ async generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): P
|
|
2317
2305
|
}
|
2318
2306
|
|
2319
2307
|
//**list webhook belong to the channel */
|
2320
|
-
async listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse> {
|
2308
|
+
async listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse> {
|
2321
2309
|
if (this.autoRefreshSession && session.refresh_token &&
|
2322
2310
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2323
2311
|
await this.sessionRefresh(session);
|
2324
2312
|
}
|
2325
2313
|
|
2326
|
-
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) => {
|
2327
2315
|
return Promise.resolve(response);
|
2328
2316
|
})
|
2329
2317
|
}
|
@@ -2365,7 +2353,7 @@ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCh
|
|
2365
2353
|
}
|
2366
2354
|
|
2367
2355
|
//**Add a new sticker */
|
2368
|
-
async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
2356
|
+
async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
|
2369
2357
|
if (this.autoRefreshSession && session.refresh_token &&
|
2370
2358
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2371
2359
|
await this.sessionRefresh(session);
|
@@ -2377,7 +2365,7 @@ async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
|
2377
2365
|
}
|
2378
2366
|
|
2379
2367
|
//**List stickers by clan ID */
|
2380
|
-
async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2368
|
+
async listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2381
2369
|
if (this.autoRefreshSession && session.refresh_token &&
|
2382
2370
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2383
2371
|
await this.sessionRefresh(session);
|
@@ -2389,19 +2377,19 @@ async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStic
|
|
2389
2377
|
}
|
2390
2378
|
|
2391
2379
|
//**Delete a sticker by ID*/
|
2392
|
-
async deleteClanStickerById(session: Session,id: string) {
|
2380
|
+
async deleteClanStickerById(session: Session, id: string, clan_id: string) {
|
2393
2381
|
if (this.autoRefreshSession && session.refresh_token &&
|
2394
2382
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2395
2383
|
await this.sessionRefresh(session);
|
2396
2384
|
}
|
2397
2385
|
|
2398
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response: any) => {
|
2386
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response: any) => {
|
2399
2387
|
return response !== undefined;
|
2400
2388
|
})
|
2401
2389
|
}
|
2402
2390
|
|
2403
2391
|
//**Update a sticker by ID*/
|
2404
|
-
async updateClanStickerById(session: Session,id: string,request: MezonUpdateClanStickerByIdBody){
|
2392
|
+
async updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody){
|
2405
2393
|
if (this.autoRefreshSession && session.refresh_token &&
|
2406
2394
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2407
2395
|
await this.sessionRefresh(session);
|
@@ -2413,7 +2401,7 @@ async updateClanStickerById(session: Session,id: string,request: MezonUpdateClan
|
|
2413
2401
|
}
|
2414
2402
|
|
2415
2403
|
//** update the category of a channel */
|
2416
|
-
async changeChannelCategory(session: Session,id: string,request: MezonChangeChannelCategoryBody) {
|
2404
|
+
async changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody) {
|
2417
2405
|
if (this.autoRefreshSession && session.refresh_token &&
|
2418
2406
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2419
2407
|
await this.sessionRefresh(session);
|
package/dist/api.gen.d.ts
CHANGED
@@ -9,7 +9,7 @@ export interface ChannelUserListChannelUser {
|
|
9
9
|
}
|
10
10
|
/** A single user-role pair. */
|
11
11
|
export interface ClanUserListClanUser {
|
12
|
-
|
12
|
+
clan_nick?: string;
|
13
13
|
role_id?: string;
|
14
14
|
user?: ApiUser;
|
15
15
|
}
|
@@ -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* () {
|
@@ -5868,7 +5831,8 @@ var Client = class {
|
|
5868
5831
|
username: gu.user.username,
|
5869
5832
|
metadata: gu.user.metadata ? JSON.parse(gu.user.metadata) : void 0
|
5870
5833
|
},
|
5871
|
-
role_id: gu.role_id
|
5834
|
+
role_id: gu.role_id,
|
5835
|
+
clan_nick: gu.clan_nick
|
5872
5836
|
});
|
5873
5837
|
});
|
5874
5838
|
return Promise.resolve(result);
|
@@ -6823,12 +6787,12 @@ var Client = class {
|
|
6823
6787
|
});
|
6824
6788
|
}
|
6825
6789
|
//**delete clan emoji by id */
|
6826
|
-
deleteByIdClanEmoji(session, id) {
|
6790
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6827
6791
|
return __async(this, null, function* () {
|
6828
6792
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6829
6793
|
yield this.sessionRefresh(session);
|
6830
6794
|
}
|
6831
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6795
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6832
6796
|
return response !== void 0;
|
6833
6797
|
});
|
6834
6798
|
});
|
@@ -6845,12 +6809,12 @@ var Client = class {
|
|
6845
6809
|
});
|
6846
6810
|
}
|
6847
6811
|
//**list webhook belong to the channel */
|
6848
|
-
listWebhookByChannelId(session, channel_id) {
|
6812
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6849
6813
|
return __async(this, null, function* () {
|
6850
6814
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6851
6815
|
yield this.sessionRefresh(session);
|
6852
6816
|
}
|
6853
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6817
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6854
6818
|
return Promise.resolve(response);
|
6855
6819
|
});
|
6856
6820
|
});
|
@@ -6911,12 +6875,12 @@ var Client = class {
|
|
6911
6875
|
});
|
6912
6876
|
}
|
6913
6877
|
//**Delete a sticker by ID*/
|
6914
|
-
deleteClanStickerById(session, id) {
|
6878
|
+
deleteClanStickerById(session, id, clan_id) {
|
6915
6879
|
return __async(this, null, function* () {
|
6916
6880
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6917
6881
|
yield this.sessionRefresh(session);
|
6918
6882
|
}
|
6919
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6883
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6920
6884
|
return response !== void 0;
|
6921
6885
|
});
|
6922
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* () {
|
@@ -5839,7 +5802,8 @@ var Client = class {
|
|
5839
5802
|
username: gu.user.username,
|
5840
5803
|
metadata: gu.user.metadata ? JSON.parse(gu.user.metadata) : void 0
|
5841
5804
|
},
|
5842
|
-
role_id: gu.role_id
|
5805
|
+
role_id: gu.role_id,
|
5806
|
+
clan_nick: gu.clan_nick
|
5843
5807
|
});
|
5844
5808
|
});
|
5845
5809
|
return Promise.resolve(result);
|
@@ -6794,12 +6758,12 @@ var Client = class {
|
|
6794
6758
|
});
|
6795
6759
|
}
|
6796
6760
|
//**delete clan emoji by id */
|
6797
|
-
deleteByIdClanEmoji(session, id) {
|
6761
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6798
6762
|
return __async(this, null, function* () {
|
6799
6763
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6800
6764
|
yield this.sessionRefresh(session);
|
6801
6765
|
}
|
6802
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6766
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6803
6767
|
return response !== void 0;
|
6804
6768
|
});
|
6805
6769
|
});
|
@@ -6816,12 +6780,12 @@ var Client = class {
|
|
6816
6780
|
});
|
6817
6781
|
}
|
6818
6782
|
//**list webhook belong to the channel */
|
6819
|
-
listWebhookByChannelId(session, channel_id) {
|
6783
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6820
6784
|
return __async(this, null, function* () {
|
6821
6785
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6822
6786
|
yield this.sessionRefresh(session);
|
6823
6787
|
}
|
6824
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6788
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6825
6789
|
return Promise.resolve(response);
|
6826
6790
|
});
|
6827
6791
|
});
|
@@ -6882,12 +6846,12 @@ var Client = class {
|
|
6882
6846
|
});
|
6883
6847
|
}
|
6884
6848
|
//**Delete a sticker by ID*/
|
6885
|
-
deleteClanStickerById(session, id) {
|
6849
|
+
deleteClanStickerById(session, id, clan_id) {
|
6886
6850
|
return __async(this, null, function* () {
|
6887
6851
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6888
6852
|
yield this.sessionRefresh(session);
|
6889
6853
|
}
|
6890
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6854
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6891
6855
|
return response !== void 0;
|
6892
6856
|
});
|
6893
6857
|
});
|