mezon-js 2.8.2 → 2.8.5
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 +18 -58
- package/client.ts +15 -25
- package/dist/api.gen.d.ts +9 -18
- package/dist/client.d.ts +6 -6
- package/dist/mezon-js.cjs.js +22 -51
- package/dist/mezon-js.esm.mjs +22 -51
- package/dist/socket.d.ts +12 -0
- package/package.json +1 -1
- package/socket.ts +29 -2
package/api.gen.ts
CHANGED
@@ -6,11 +6,13 @@ import { encode } from 'js-base64';
|
|
6
6
|
|
7
7
|
/** A single user-role pair. */
|
8
8
|
export interface ChannelUserListChannelUser {
|
9
|
-
//
|
10
|
-
clan_nick?: string;
|
11
9
|
//
|
12
10
|
clan_avatar?: string;
|
13
11
|
//
|
12
|
+
clan_id?: string;
|
13
|
+
//
|
14
|
+
clan_nick?: string;
|
15
|
+
//
|
14
16
|
id?: string;
|
15
17
|
//Their relationship to the role.
|
16
18
|
role_id?: Array<string>;
|
@@ -22,6 +24,8 @@ export interface ChannelUserListChannelUser {
|
|
22
24
|
|
23
25
|
/** A single user-role pair. */
|
24
26
|
export interface ClanUserListClanUser {
|
27
|
+
//from the `avatar_url` field in the `clan_desc_profile` table.
|
28
|
+
clan_avatar?: string;
|
25
29
|
//from the `nick_name` field in the `clan_desc_profile` table.
|
26
30
|
clan_nick?: string;
|
27
31
|
//Their relationship to the role.
|
@@ -469,6 +473,8 @@ export interface ApiChannelMessageHeader {
|
|
469
473
|
export interface ApiChannelMessageList {
|
470
474
|
//
|
471
475
|
last_seen_message?: ApiChannelMessageHeader;
|
476
|
+
//
|
477
|
+
last_sent_message?: ApiChannelMessageHeader;
|
472
478
|
//A list of messages.
|
473
479
|
messages?: Array<ApiChannelMessage>;
|
474
480
|
}
|
@@ -540,6 +546,8 @@ export interface ApiClanEmojiCreateRequest {
|
|
540
546
|
//
|
541
547
|
clan_id?: string;
|
542
548
|
//
|
549
|
+
id?: string;
|
550
|
+
//
|
543
551
|
shortname?: string;
|
544
552
|
//
|
545
553
|
source?: string;
|
@@ -602,6 +610,8 @@ export interface ApiClanStickerAddRequest {
|
|
602
610
|
//
|
603
611
|
clan_id?: string;
|
604
612
|
//
|
613
|
+
id?: string;
|
614
|
+
//
|
605
615
|
shortname?: string;
|
606
616
|
//
|
607
617
|
source?: string;
|
@@ -725,16 +735,6 @@ export interface ApiCreateRoleRequest {
|
|
725
735
|
title?: string;
|
726
736
|
}
|
727
737
|
|
728
|
-
/** */
|
729
|
-
export interface ApiCreateWebhookRequest {
|
730
|
-
//
|
731
|
-
channel_id?: string;
|
732
|
-
//
|
733
|
-
clan_id?: string;
|
734
|
-
//
|
735
|
-
hook_name?: string;
|
736
|
-
}
|
737
|
-
|
738
738
|
/** Delete a channel the user has access to. */
|
739
739
|
export interface ApiDeleteChannelDescRequest {
|
740
740
|
//The id of a channel.
|
@@ -1588,16 +1588,6 @@ export interface ApiWebhookListResponse {
|
|
1588
1588
|
webhooks?: Array<ApiWebhook>;
|
1589
1589
|
}
|
1590
1590
|
|
1591
|
-
/** */
|
1592
|
-
export interface ApiWebhookResponse {
|
1593
|
-
//
|
1594
|
-
channel_id?: string;
|
1595
|
-
//
|
1596
|
-
hook_name?: string;
|
1597
|
-
//
|
1598
|
-
hook_url?: string;
|
1599
|
-
}
|
1600
|
-
|
1601
1591
|
/** The object to store. */
|
1602
1592
|
export interface ApiWriteStorageObject {
|
1603
1593
|
//The collection to store the object.
|
@@ -3978,6 +3968,7 @@ export class MezonApi {
|
|
3978
3968
|
/** Delete a emoji by ID. */
|
3979
3969
|
deleteByIdClanEmoji(bearerToken: string,
|
3980
3970
|
id:string,
|
3971
|
+
clanId?:string,
|
3981
3972
|
options: any = {}): Promise<any> {
|
3982
3973
|
|
3983
3974
|
if (id === null || id === undefined) {
|
@@ -3986,6 +3977,7 @@ export class MezonApi {
|
|
3986
3977
|
const urlPath = "/v2/emoji/{id}"
|
3987
3978
|
.replace("{id}", encodeURIComponent(String(id)));
|
3988
3979
|
const queryParams = new Map<string, any>();
|
3980
|
+
queryParams.set("clan_id", clanId);
|
3989
3981
|
|
3990
3982
|
let bodyJson : string = "";
|
3991
3983
|
|
@@ -5937,6 +5929,7 @@ export class MezonApi {
|
|
5937
5929
|
/** Delete a sticker by ID */
|
5938
5930
|
deleteClanStickerById(bearerToken: string,
|
5939
5931
|
id:string,
|
5932
|
+
clanId?:string,
|
5940
5933
|
options: any = {}): Promise<any> {
|
5941
5934
|
|
5942
5935
|
if (id === null || id === undefined) {
|
@@ -5945,6 +5938,7 @@ export class MezonApi {
|
|
5945
5938
|
const urlPath = "/v2/sticker/{id}"
|
5946
5939
|
.replace("{id}", encodeURIComponent(String(id)));
|
5947
5940
|
const queryParams = new Map<string, any>();
|
5941
|
+
queryParams.set("clan_id", clanId);
|
5948
5942
|
|
5949
5943
|
let bodyJson : string = "";
|
5950
5944
|
|
@@ -6428,42 +6422,6 @@ export class MezonApi {
|
|
6428
6422
|
]);
|
6429
6423
|
}
|
6430
6424
|
|
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
6425
|
/** create webhook */
|
6468
6426
|
generateWebhook(bearerToken: string,
|
6469
6427
|
body:ApiWebhookCreateRequest,
|
@@ -6544,6 +6502,7 @@ export class MezonApi {
|
|
6544
6502
|
/** list webhook belong to the channel */
|
6545
6503
|
listWebhookByChannelId(bearerToken: string,
|
6546
6504
|
channelId:string,
|
6505
|
+
clanId?:string,
|
6547
6506
|
options: any = {}): Promise<ApiWebhookListResponse> {
|
6548
6507
|
|
6549
6508
|
if (channelId === null || channelId === undefined) {
|
@@ -6552,6 +6511,7 @@ export class MezonApi {
|
|
6552
6511
|
const urlPath = "/v2/webhooks/{channelId}"
|
6553
6512
|
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
6554
6513
|
const queryParams = new Map<string, any>();
|
6514
|
+
queryParams.set("clan_id", clanId);
|
6555
6515
|
|
6556
6516
|
let bodyJson : string = "";
|
6557
6517
|
|
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,
|
@@ -255,6 +253,8 @@ export interface ChannelMessageList {
|
|
255
253
|
cacheable_cursor?: string;
|
256
254
|
/**last seen message from user on channel */
|
257
255
|
last_seen_message?: ApiChannelMessageHeader;
|
256
|
+
/**last sent message from channel */
|
257
|
+
last_sent_message?: ApiChannelMessageHeader;
|
258
258
|
/** A list of messages. */
|
259
259
|
messages?: Array<ChannelMessage>;
|
260
260
|
/** The cursor to send when retireving the next page, if any. */
|
@@ -792,18 +792,7 @@ export class Client {
|
|
792
792
|
});
|
793
793
|
}
|
794
794
|
|
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
|
-
|
795
|
+
|
807
796
|
/** add role for channel. */
|
808
797
|
async addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean> {
|
809
798
|
if (this.autoRefreshSession && session.refresh_token &&
|
@@ -1062,7 +1051,8 @@ export class Client {
|
|
1062
1051
|
return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response: ApiChannelMessageList) => {
|
1063
1052
|
var result: ChannelMessageList = {
|
1064
1053
|
messages: [],
|
1065
|
-
last_seen_message: response.last_seen_message
|
1054
|
+
last_seen_message: response.last_seen_message,
|
1055
|
+
last_sent_message: response.last_sent_message
|
1066
1056
|
};
|
1067
1057
|
|
1068
1058
|
if (response.messages == null) {
|
@@ -2294,13 +2284,13 @@ async updateClanEmojiById(session: Session, id: string, request: MezonUpdateClan
|
|
2294
2284
|
}
|
2295
2285
|
|
2296
2286
|
//**delete clan emoji by id */
|
2297
|
-
async deleteByIdClanEmoji(session: Session, id: string) {
|
2287
|
+
async deleteByIdClanEmoji(session: Session, id: string, clan_id: string) {
|
2298
2288
|
if (this.autoRefreshSession && session.refresh_token &&
|
2299
2289
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2300
2290
|
await this.sessionRefresh(session);
|
2301
2291
|
}
|
2302
2292
|
|
2303
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response: any) => {
|
2293
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response: any) => {
|
2304
2294
|
return response !== undefined;
|
2305
2295
|
});
|
2306
2296
|
}
|
@@ -2318,13 +2308,13 @@ async generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): P
|
|
2318
2308
|
}
|
2319
2309
|
|
2320
2310
|
//**list webhook belong to the channel */
|
2321
|
-
async listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse> {
|
2311
|
+
async listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse> {
|
2322
2312
|
if (this.autoRefreshSession && session.refresh_token &&
|
2323
2313
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2324
2314
|
await this.sessionRefresh(session);
|
2325
2315
|
}
|
2326
2316
|
|
2327
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response: ApiWebhookListResponse) => {
|
2317
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response: ApiWebhookListResponse) => {
|
2328
2318
|
return Promise.resolve(response);
|
2329
2319
|
})
|
2330
2320
|
}
|
@@ -2366,7 +2356,7 @@ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCh
|
|
2366
2356
|
}
|
2367
2357
|
|
2368
2358
|
//**Add a new sticker */
|
2369
|
-
async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
2359
|
+
async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
|
2370
2360
|
if (this.autoRefreshSession && session.refresh_token &&
|
2371
2361
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2372
2362
|
await this.sessionRefresh(session);
|
@@ -2378,7 +2368,7 @@ async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
|
2378
2368
|
}
|
2379
2369
|
|
2380
2370
|
//**List stickers by clan ID */
|
2381
|
-
async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2371
|
+
async listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
2382
2372
|
if (this.autoRefreshSession && session.refresh_token &&
|
2383
2373
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2384
2374
|
await this.sessionRefresh(session);
|
@@ -2390,19 +2380,19 @@ async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStic
|
|
2390
2380
|
}
|
2391
2381
|
|
2392
2382
|
//**Delete a sticker by ID*/
|
2393
|
-
async deleteClanStickerById(session: Session,id: string) {
|
2383
|
+
async deleteClanStickerById(session: Session, id: string, clan_id: string) {
|
2394
2384
|
if (this.autoRefreshSession && session.refresh_token &&
|
2395
2385
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2396
2386
|
await this.sessionRefresh(session);
|
2397
2387
|
}
|
2398
2388
|
|
2399
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response: any) => {
|
2389
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response: any) => {
|
2400
2390
|
return response !== undefined;
|
2401
2391
|
})
|
2402
2392
|
}
|
2403
2393
|
|
2404
2394
|
//**Update a sticker by ID*/
|
2405
|
-
async updateClanStickerById(session: Session,id: string,request: MezonUpdateClanStickerByIdBody){
|
2395
|
+
async updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody){
|
2406
2396
|
if (this.autoRefreshSession && session.refresh_token &&
|
2407
2397
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2408
2398
|
await this.sessionRefresh(session);
|
@@ -2414,7 +2404,7 @@ async updateClanStickerById(session: Session,id: string,request: MezonUpdateClan
|
|
2414
2404
|
}
|
2415
2405
|
|
2416
2406
|
//** update the category of a channel */
|
2417
|
-
async changeChannelCategory(session: Session,id: string,request: MezonChangeChannelCategoryBody) {
|
2407
|
+
async changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody) {
|
2418
2408
|
if (this.autoRefreshSession && session.refresh_token &&
|
2419
2409
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2420
2410
|
await this.sessionRefresh(session);
|
package/dist/api.gen.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
/** A single user-role pair. */
|
2
2
|
export interface ChannelUserListChannelUser {
|
3
|
-
clan_nick?: string;
|
4
3
|
clan_avatar?: string;
|
4
|
+
clan_id?: string;
|
5
|
+
clan_nick?: string;
|
5
6
|
id?: string;
|
6
7
|
role_id?: Array<string>;
|
7
8
|
thread_id?: string;
|
@@ -9,6 +10,7 @@ export interface ChannelUserListChannelUser {
|
|
9
10
|
}
|
10
11
|
/** A single user-role pair. */
|
11
12
|
export interface ClanUserListClanUser {
|
13
|
+
clan_avatar?: string;
|
12
14
|
clan_nick?: string;
|
13
15
|
role_id?: string;
|
14
16
|
user?: ApiUser;
|
@@ -266,6 +268,7 @@ export interface ApiChannelMessageHeader {
|
|
266
268
|
/** A list of channel messages, usually a result of a list operation. */
|
267
269
|
export interface ApiChannelMessageList {
|
268
270
|
last_seen_message?: ApiChannelMessageHeader;
|
271
|
+
last_sent_message?: ApiChannelMessageHeader;
|
269
272
|
messages?: Array<ApiChannelMessage>;
|
270
273
|
}
|
271
274
|
/** A list of users belonging to a channel, along with their role. */
|
@@ -308,6 +311,7 @@ export interface ApiClanDescProfile {
|
|
308
311
|
export interface ApiClanEmojiCreateRequest {
|
309
312
|
category?: string;
|
310
313
|
clan_id?: string;
|
314
|
+
id?: string;
|
311
315
|
shortname?: string;
|
312
316
|
source?: string;
|
313
317
|
}
|
@@ -344,6 +348,7 @@ export interface ApiClanSticker {
|
|
344
348
|
export interface ApiClanStickerAddRequest {
|
345
349
|
category?: string;
|
346
350
|
clan_id?: string;
|
351
|
+
id?: string;
|
347
352
|
shortname?: string;
|
348
353
|
source?: string;
|
349
354
|
}
|
@@ -414,12 +419,6 @@ export interface ApiCreateRoleRequest {
|
|
414
419
|
role_icon?: string;
|
415
420
|
title?: string;
|
416
421
|
}
|
417
|
-
/** */
|
418
|
-
export interface ApiCreateWebhookRequest {
|
419
|
-
channel_id?: string;
|
420
|
-
clan_id?: string;
|
421
|
-
hook_name?: string;
|
422
|
-
}
|
423
422
|
/** Delete a channel the user has access to. */
|
424
423
|
export interface ApiDeleteChannelDescRequest {
|
425
424
|
channel_id?: string;
|
@@ -915,12 +914,6 @@ export interface ApiWebhookGenerateResponse {
|
|
915
914
|
export interface ApiWebhookListResponse {
|
916
915
|
webhooks?: Array<ApiWebhook>;
|
917
916
|
}
|
918
|
-
/** */
|
919
|
-
export interface ApiWebhookResponse {
|
920
|
-
channel_id?: string;
|
921
|
-
hook_name?: string;
|
922
|
-
hook_url?: string;
|
923
|
-
}
|
924
917
|
/** The object to store. */
|
925
918
|
export interface ApiWriteStorageObject {
|
926
919
|
collection?: string;
|
@@ -1075,7 +1068,7 @@ export declare class MezonApi {
|
|
1075
1068
|
/** Get emoji list by clan id */
|
1076
1069
|
listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
|
1077
1070
|
/** Delete a emoji by ID. */
|
1078
|
-
deleteByIdClanEmoji(bearerToken: string, id: string, options?: any): Promise<any>;
|
1071
|
+
deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1079
1072
|
/** Update ClanEmoj By id */
|
1080
1073
|
updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
|
1081
1074
|
/** Search message from elasticsearch service. */
|
@@ -1183,7 +1176,7 @@ export declare class MezonApi {
|
|
1183
1176
|
/** List stickers by clan ID */
|
1184
1177
|
listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
|
1185
1178
|
/** Delete a sticker by ID */
|
1186
|
-
deleteClanStickerById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1179
|
+
deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1187
1180
|
/** Update a sticker by ID */
|
1188
1181
|
updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
|
1189
1182
|
/** Get storage objects. */
|
@@ -1208,14 +1201,12 @@ export declare class MezonApi {
|
|
1208
1201
|
getUsers(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, facebookIds?: Array<string>, options?: any): Promise<ApiUsers>;
|
1209
1202
|
/** */
|
1210
1203
|
updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
|
1211
|
-
/** Create webhook */
|
1212
|
-
createWebhookLink(bearerToken: string, body: ApiCreateWebhookRequest, options?: any): Promise<ApiWebhookResponse>;
|
1213
1204
|
/** create webhook */
|
1214
1205
|
generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
|
1215
1206
|
/** update webhook name by id */
|
1216
1207
|
updateWebhookById(bearerToken: string, id: string, body: MezonUpdateWebhookByIdBody, options?: any): Promise<any>;
|
1217
1208
|
/** list webhook belong to the channel */
|
1218
|
-
listWebhookByChannelId(bearerToken: string, channelId: string, options?: any): Promise<ApiWebhookListResponse>;
|
1209
|
+
listWebhookByChannelId(bearerToken: string, channelId: string, clanId?: string, options?: any): Promise<ApiWebhookListResponse>;
|
1219
1210
|
/** disabled webhook */
|
1220
1211
|
deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1221
1212
|
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";
|
@@ -122,6 +122,8 @@ export interface ChannelMessageList {
|
|
122
122
|
cacheable_cursor?: string;
|
123
123
|
/**last seen message from user on channel */
|
124
124
|
last_seen_message?: ApiChannelMessageHeader;
|
125
|
+
/**last sent message from channel */
|
126
|
+
last_sent_message?: ApiChannelMessageHeader;
|
125
127
|
/** A list of messages. */
|
126
128
|
messages?: Array<ChannelMessage>;
|
127
129
|
/** The cursor to send when retireving the next page, if any. */
|
@@ -400,8 +402,6 @@ export declare class Client {
|
|
400
402
|
createRole(session: Session, request: ApiCreateRoleRequest): Promise<ApiRole>;
|
401
403
|
/** Create a new event for clan. */
|
402
404
|
createEvent(session: Session, request: ApiCreateEventRequest): Promise<ApiEventManagement>;
|
403
|
-
/** Create a new event for clan. */
|
404
|
-
createWebhook(session: Session, request: ApiCreateWebhookRequest): Promise<ApiWebhookResponse>;
|
405
405
|
/** add role for channel. */
|
406
406
|
addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean>;
|
407
407
|
/** Update action role when delete role */
|
@@ -587,15 +587,15 @@ export declare class Client {
|
|
587
587
|
/** create clan emoji */
|
588
588
|
createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
|
589
589
|
updateClanEmojiById(session: Session, id: string, request: MezonUpdateClanEmojiByIdBody): Promise<boolean>;
|
590
|
-
deleteByIdClanEmoji(session: Session, id: string): Promise<boolean>;
|
590
|
+
deleteByIdClanEmoji(session: Session, id: string, clan_id: string): Promise<boolean>;
|
591
591
|
generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): Promise<ApiWebhookGenerateResponse>;
|
592
|
-
listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse>;
|
592
|
+
listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse>;
|
593
593
|
updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
|
594
594
|
deleteWebhookById(session: Session, id: string): Promise<boolean>;
|
595
595
|
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
596
596
|
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
597
597
|
listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
598
|
-
deleteClanStickerById(session: Session, id: string): Promise<boolean>;
|
598
|
+
deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
599
599
|
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
600
600
|
changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
|
601
601
|
}
|
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);
|
@@ -4822,7 +4796,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4822
4796
|
this.oncustomstatus(message.custom_status_event);
|
4823
4797
|
} else if (message.user_channel_added_event) {
|
4824
4798
|
this.onuserchanneladded(message.user_channel_added_event);
|
4825
|
-
} else if (message.
|
4799
|
+
} else if (message.user_channel_added_event) {
|
4800
|
+
this.onuserprofileupdate(message.user_profile_updated_event);
|
4801
|
+
} else if (message.user_profile_updated_event) {
|
4826
4802
|
this.onuserchannelremoved(message.user_channel_removed_event);
|
4827
4803
|
} else if (message.user_clan_removed_event) {
|
4828
4804
|
this.onuserclanremoved(message.user_clan_removed_event);
|
@@ -4913,6 +4889,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4913
4889
|
console.log(user);
|
4914
4890
|
}
|
4915
4891
|
}
|
4892
|
+
onuserprofileupdate(user) {
|
4893
|
+
if (this.verbose && window && window.console) {
|
4894
|
+
console.log(user);
|
4895
|
+
}
|
4896
|
+
}
|
4916
4897
|
onuserchannelremoved(user) {
|
4917
4898
|
if (this.verbose && window && window.console) {
|
4918
4899
|
console.log(user);
|
@@ -5454,17 +5435,6 @@ var Client = class {
|
|
5454
5435
|
});
|
5455
5436
|
});
|
5456
5437
|
}
|
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
5438
|
/** add role for channel. */
|
5469
5439
|
addRolesChannelDesc(session, request) {
|
5470
5440
|
return __async(this, null, function* () {
|
@@ -5700,7 +5670,8 @@ var Client = class {
|
|
5700
5670
|
return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response) => {
|
5701
5671
|
var result = {
|
5702
5672
|
messages: [],
|
5703
|
-
last_seen_message: response.last_seen_message
|
5673
|
+
last_seen_message: response.last_seen_message,
|
5674
|
+
last_sent_message: response.last_sent_message
|
5704
5675
|
};
|
5705
5676
|
if (response.messages == null) {
|
5706
5677
|
return Promise.resolve(result);
|
@@ -6824,12 +6795,12 @@ var Client = class {
|
|
6824
6795
|
});
|
6825
6796
|
}
|
6826
6797
|
//**delete clan emoji by id */
|
6827
|
-
deleteByIdClanEmoji(session, id) {
|
6798
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6828
6799
|
return __async(this, null, function* () {
|
6829
6800
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6830
6801
|
yield this.sessionRefresh(session);
|
6831
6802
|
}
|
6832
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6803
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6833
6804
|
return response !== void 0;
|
6834
6805
|
});
|
6835
6806
|
});
|
@@ -6846,12 +6817,12 @@ var Client = class {
|
|
6846
6817
|
});
|
6847
6818
|
}
|
6848
6819
|
//**list webhook belong to the channel */
|
6849
|
-
listWebhookByChannelId(session, channel_id) {
|
6820
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6850
6821
|
return __async(this, null, function* () {
|
6851
6822
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6852
6823
|
yield this.sessionRefresh(session);
|
6853
6824
|
}
|
6854
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6825
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6855
6826
|
return Promise.resolve(response);
|
6856
6827
|
});
|
6857
6828
|
});
|
@@ -6912,12 +6883,12 @@ var Client = class {
|
|
6912
6883
|
});
|
6913
6884
|
}
|
6914
6885
|
//**Delete a sticker by ID*/
|
6915
|
-
deleteClanStickerById(session, id) {
|
6886
|
+
deleteClanStickerById(session, id, clan_id) {
|
6916
6887
|
return __async(this, null, function* () {
|
6917
6888
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6918
6889
|
yield this.sessionRefresh(session);
|
6919
6890
|
}
|
6920
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6891
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6921
6892
|
return response !== void 0;
|
6922
6893
|
});
|
6923
6894
|
});
|
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);
|
@@ -4793,7 +4767,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4793
4767
|
this.oncustomstatus(message.custom_status_event);
|
4794
4768
|
} else if (message.user_channel_added_event) {
|
4795
4769
|
this.onuserchanneladded(message.user_channel_added_event);
|
4796
|
-
} else if (message.
|
4770
|
+
} else if (message.user_channel_added_event) {
|
4771
|
+
this.onuserprofileupdate(message.user_profile_updated_event);
|
4772
|
+
} else if (message.user_profile_updated_event) {
|
4797
4773
|
this.onuserchannelremoved(message.user_channel_removed_event);
|
4798
4774
|
} else if (message.user_clan_removed_event) {
|
4799
4775
|
this.onuserclanremoved(message.user_clan_removed_event);
|
@@ -4884,6 +4860,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4884
4860
|
console.log(user);
|
4885
4861
|
}
|
4886
4862
|
}
|
4863
|
+
onuserprofileupdate(user) {
|
4864
|
+
if (this.verbose && window && window.console) {
|
4865
|
+
console.log(user);
|
4866
|
+
}
|
4867
|
+
}
|
4887
4868
|
onuserchannelremoved(user) {
|
4888
4869
|
if (this.verbose && window && window.console) {
|
4889
4870
|
console.log(user);
|
@@ -5425,17 +5406,6 @@ var Client = class {
|
|
5425
5406
|
});
|
5426
5407
|
});
|
5427
5408
|
}
|
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
5409
|
/** add role for channel. */
|
5440
5410
|
addRolesChannelDesc(session, request) {
|
5441
5411
|
return __async(this, null, function* () {
|
@@ -5671,7 +5641,8 @@ var Client = class {
|
|
5671
5641
|
return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response) => {
|
5672
5642
|
var result = {
|
5673
5643
|
messages: [],
|
5674
|
-
last_seen_message: response.last_seen_message
|
5644
|
+
last_seen_message: response.last_seen_message,
|
5645
|
+
last_sent_message: response.last_sent_message
|
5675
5646
|
};
|
5676
5647
|
if (response.messages == null) {
|
5677
5648
|
return Promise.resolve(result);
|
@@ -6795,12 +6766,12 @@ var Client = class {
|
|
6795
6766
|
});
|
6796
6767
|
}
|
6797
6768
|
//**delete clan emoji by id */
|
6798
|
-
deleteByIdClanEmoji(session, id) {
|
6769
|
+
deleteByIdClanEmoji(session, id, clan_id) {
|
6799
6770
|
return __async(this, null, function* () {
|
6800
6771
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6801
6772
|
yield this.sessionRefresh(session);
|
6802
6773
|
}
|
6803
|
-
return this.apiClient.deleteByIdClanEmoji(session.token, id).then((response) => {
|
6774
|
+
return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response) => {
|
6804
6775
|
return response !== void 0;
|
6805
6776
|
});
|
6806
6777
|
});
|
@@ -6817,12 +6788,12 @@ var Client = class {
|
|
6817
6788
|
});
|
6818
6789
|
}
|
6819
6790
|
//**list webhook belong to the channel */
|
6820
|
-
listWebhookByChannelId(session, channel_id) {
|
6791
|
+
listWebhookByChannelId(session, channel_id, clan_id) {
|
6821
6792
|
return __async(this, null, function* () {
|
6822
6793
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6823
6794
|
yield this.sessionRefresh(session);
|
6824
6795
|
}
|
6825
|
-
return this.apiClient.listWebhookByChannelId(session.token, channel_id).then((response) => {
|
6796
|
+
return this.apiClient.listWebhookByChannelId(session.token, channel_id, clan_id).then((response) => {
|
6826
6797
|
return Promise.resolve(response);
|
6827
6798
|
});
|
6828
6799
|
});
|
@@ -6883,12 +6854,12 @@ var Client = class {
|
|
6883
6854
|
});
|
6884
6855
|
}
|
6885
6856
|
//**Delete a sticker by ID*/
|
6886
|
-
deleteClanStickerById(session, id) {
|
6857
|
+
deleteClanStickerById(session, id, clan_id) {
|
6887
6858
|
return __async(this, null, function* () {
|
6888
6859
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6889
6860
|
yield this.sessionRefresh(session);
|
6890
6861
|
}
|
6891
|
-
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
6862
|
+
return this.apiClient.deleteClanStickerById(session.token, id, clan_id).then((response) => {
|
6892
6863
|
return response !== void 0;
|
6893
6864
|
});
|
6894
6865
|
});
|
package/dist/socket.d.ts
CHANGED
@@ -184,6 +184,14 @@ export interface MessageTypingEvent {
|
|
184
184
|
/** Message sender, usually a user ID. */
|
185
185
|
sender_id: string;
|
186
186
|
}
|
187
|
+
export interface UserProfileUpdatedEvent {
|
188
|
+
user_id: string;
|
189
|
+
display_name: string;
|
190
|
+
avatar: string;
|
191
|
+
about_me: string;
|
192
|
+
channel_id: string;
|
193
|
+
clan_id: string;
|
194
|
+
}
|
187
195
|
/** An incoming message on a realtime chat channel. */
|
188
196
|
export interface ChannelMessageEvent {
|
189
197
|
avatar?: string;
|
@@ -351,6 +359,7 @@ export interface ClanProfileUpdatedEvent {
|
|
351
359
|
user_id: string;
|
352
360
|
clan_nick: string;
|
353
361
|
clan_avatar: string;
|
362
|
+
clan_id: string;
|
354
363
|
}
|
355
364
|
/** Stream identifier */
|
356
365
|
export interface StreamId {
|
@@ -497,6 +506,8 @@ export interface Socket {
|
|
497
506
|
onpinmessage: (pin: LastPinMessageEvent) => void;
|
498
507
|
/** Receive added user event */
|
499
508
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
509
|
+
/** Receive update user event */
|
510
|
+
onuserprofileupdate: (user: UserProfileUpdatedEvent) => void;
|
500
511
|
/** Receive channel removed user event */
|
501
512
|
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
502
513
|
/** Receive clan removed user event */
|
@@ -548,6 +559,7 @@ export declare class DefaultSocket implements Socket {
|
|
548
559
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
549
560
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
550
561
|
onuserchanneladded(user: UserChannelAddedEvent): void;
|
562
|
+
onuserprofileupdate(user: UserProfileUpdatedEvent): void;
|
551
563
|
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
552
564
|
onuserclanremoved(user: UserClanRemovedEvent): void;
|
553
565
|
onnotification(notification: Notification): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -251,6 +251,22 @@ export interface MessageTypingEvent {
|
|
251
251
|
sender_id: string;
|
252
252
|
}
|
253
253
|
|
254
|
+
// user profile updated event
|
255
|
+
export interface UserProfileUpdatedEvent{
|
256
|
+
// the user id
|
257
|
+
user_id: string;
|
258
|
+
// the display_name
|
259
|
+
display_name: string;
|
260
|
+
// the avatar
|
261
|
+
avatar: string;
|
262
|
+
// the about_me
|
263
|
+
about_me: string;
|
264
|
+
// the channel_id
|
265
|
+
channel_id: string;
|
266
|
+
// the clan_id
|
267
|
+
clan_id: string;
|
268
|
+
}
|
269
|
+
|
254
270
|
/** An incoming message on a realtime chat channel. */
|
255
271
|
export interface ChannelMessageEvent {
|
256
272
|
avatar?: string;
|
@@ -517,6 +533,8 @@ export interface ClanProfileUpdatedEvent {
|
|
517
533
|
clan_nick: string;
|
518
534
|
// the avatar
|
519
535
|
clan_avatar: string;
|
536
|
+
// the clan_id
|
537
|
+
clan_id: string;
|
520
538
|
}
|
521
539
|
|
522
540
|
/** Stream identifier */
|
@@ -703,6 +721,9 @@ export interface Socket {
|
|
703
721
|
/** Receive added user event */
|
704
722
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
705
723
|
|
724
|
+
/** Receive update user event */
|
725
|
+
onuserprofileupdate: (user: UserProfileUpdatedEvent) => void;
|
726
|
+
|
706
727
|
/** Receive channel removed user event */
|
707
728
|
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
708
729
|
|
@@ -883,7 +904,9 @@ export class DefaultSocket implements Socket {
|
|
883
904
|
this.oncustomstatus(<CustomStatusEvent>message.custom_status_event);
|
884
905
|
} else if (message.user_channel_added_event) {
|
885
906
|
this.onuserchanneladded(<UserChannelAddedEvent>message.user_channel_added_event);
|
886
|
-
} else if (message.
|
907
|
+
} else if (message.user_channel_added_event) {
|
908
|
+
this.onuserprofileupdate(<UserProfileUpdatedEvent>message.user_profile_updated_event);
|
909
|
+
} else if (message.user_profile_updated_event) {
|
887
910
|
this.onuserchannelremoved(<UserChannelRemovedEvent>message.user_channel_removed_event);
|
888
911
|
} else if (message.user_clan_removed_event) {
|
889
912
|
this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
|
@@ -989,7 +1012,11 @@ export class DefaultSocket implements Socket {
|
|
989
1012
|
console.log(user);
|
990
1013
|
}
|
991
1014
|
}
|
992
|
-
|
1015
|
+
onuserprofileupdate(user: UserProfileUpdatedEvent) {
|
1016
|
+
if (this.verbose && window && window.console) {
|
1017
|
+
console.log(user);
|
1018
|
+
}
|
1019
|
+
}
|
993
1020
|
onuserchannelremoved(user: UserChannelRemovedEvent) {
|
994
1021
|
if (this.verbose && window && window.console) {
|
995
1022
|
console.log(user);
|