mezon-js 2.7.88 → 2.7.91
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 +205 -0
- package/client.ts +52 -1
- package/dist/api.gen.d.ts +40 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +175 -0
- package/dist/mezon-js.esm.mjs +175 -0
- package/dist/socket.d.ts +21 -2
- package/package.json +1 -1
- package/socket.ts +51 -6
package/api.gen.ts
CHANGED
|
@@ -75,6 +75,16 @@ export interface MezonUpdateClanEmojiByIdBody {
|
|
|
75
75
|
source?: string;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/** */
|
|
79
|
+
export interface MezonUpdateClanStickerByIdBody {
|
|
80
|
+
//
|
|
81
|
+
category?: string;
|
|
82
|
+
//
|
|
83
|
+
shortname?: string;
|
|
84
|
+
//
|
|
85
|
+
source?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
78
88
|
/** update a event within clan. */
|
|
79
89
|
export interface MezonUpdateEventBody {
|
|
80
90
|
//
|
|
@@ -133,6 +143,10 @@ export interface MezonUpdateUserProfileByClanBody {
|
|
|
133
143
|
|
|
134
144
|
/** */
|
|
135
145
|
export interface MezonUpdateWebhookByIdBody {
|
|
146
|
+
//
|
|
147
|
+
avatar?: string;
|
|
148
|
+
//
|
|
149
|
+
channel_id?: string;
|
|
136
150
|
//
|
|
137
151
|
webhook_name?: string;
|
|
138
152
|
}
|
|
@@ -557,6 +571,42 @@ export interface ApiClanProfile {
|
|
|
557
571
|
user_id?: string;
|
|
558
572
|
}
|
|
559
573
|
|
|
574
|
+
/** */
|
|
575
|
+
export interface ApiClanSticker {
|
|
576
|
+
//
|
|
577
|
+
category?: string;
|
|
578
|
+
//
|
|
579
|
+
clan_id?: string;
|
|
580
|
+
//
|
|
581
|
+
create_time?: string;
|
|
582
|
+
//
|
|
583
|
+
creator_id?: string;
|
|
584
|
+
//
|
|
585
|
+
id?: string;
|
|
586
|
+
//
|
|
587
|
+
shortname?: string;
|
|
588
|
+
//
|
|
589
|
+
source?: string;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** */
|
|
593
|
+
export interface ApiClanStickerAddRequest {
|
|
594
|
+
//
|
|
595
|
+
category?: string;
|
|
596
|
+
//
|
|
597
|
+
clan_id?: string;
|
|
598
|
+
//
|
|
599
|
+
shortname?: string;
|
|
600
|
+
//
|
|
601
|
+
source?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/** */
|
|
605
|
+
export interface ApiClanStickerListByClanIdResponse {
|
|
606
|
+
//
|
|
607
|
+
stickers?: Array<ApiClanSticker>;
|
|
608
|
+
}
|
|
609
|
+
|
|
560
610
|
/** A list of users belonging to a clan, along with their role. */
|
|
561
611
|
export interface ApiClanUserList {
|
|
562
612
|
//
|
|
@@ -1475,6 +1525,8 @@ export interface ApiWebhook {
|
|
|
1475
1525
|
//
|
|
1476
1526
|
active?: number;
|
|
1477
1527
|
//
|
|
1528
|
+
avatar?: string;
|
|
1529
|
+
//
|
|
1478
1530
|
channel_id?: string;
|
|
1479
1531
|
//
|
|
1480
1532
|
create_time?: string;
|
|
@@ -1492,6 +1544,8 @@ export interface ApiWebhook {
|
|
|
1492
1544
|
|
|
1493
1545
|
/** */
|
|
1494
1546
|
export interface ApiWebhookCreateRequest {
|
|
1547
|
+
//
|
|
1548
|
+
avatar?: string;
|
|
1495
1549
|
//
|
|
1496
1550
|
channel_id?: string;
|
|
1497
1551
|
//
|
|
@@ -1500,6 +1554,8 @@ export interface ApiWebhookCreateRequest {
|
|
|
1500
1554
|
|
|
1501
1555
|
/** */
|
|
1502
1556
|
export interface ApiWebhookGenerateResponse {
|
|
1557
|
+
//
|
|
1558
|
+
avatar?: string;
|
|
1503
1559
|
//
|
|
1504
1560
|
channel_id?: string;
|
|
1505
1561
|
//
|
|
@@ -5745,6 +5801,155 @@ export class MezonApi {
|
|
|
5745
5801
|
]);
|
|
5746
5802
|
}
|
|
5747
5803
|
|
|
5804
|
+
/** Add a new sticker */
|
|
5805
|
+
addClanSticker(bearerToken: string,
|
|
5806
|
+
body:ApiClanStickerAddRequest,
|
|
5807
|
+
options: any = {}): Promise<any> {
|
|
5808
|
+
|
|
5809
|
+
if (body === null || body === undefined) {
|
|
5810
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
5811
|
+
}
|
|
5812
|
+
const urlPath = "/v2/sticker";
|
|
5813
|
+
const queryParams = new Map<string, any>();
|
|
5814
|
+
|
|
5815
|
+
let bodyJson : string = "";
|
|
5816
|
+
bodyJson = JSON.stringify(body || {});
|
|
5817
|
+
|
|
5818
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5819
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5820
|
+
if (bearerToken) {
|
|
5821
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5822
|
+
}
|
|
5823
|
+
|
|
5824
|
+
return Promise.race([
|
|
5825
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5826
|
+
if (response.status == 204) {
|
|
5827
|
+
return response;
|
|
5828
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5829
|
+
return response.json();
|
|
5830
|
+
} else {
|
|
5831
|
+
throw response;
|
|
5832
|
+
}
|
|
5833
|
+
}),
|
|
5834
|
+
new Promise((_, reject) =>
|
|
5835
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5836
|
+
),
|
|
5837
|
+
]);
|
|
5838
|
+
}
|
|
5839
|
+
|
|
5840
|
+
/** List stickers by clan ID */
|
|
5841
|
+
listClanStickersByClanId(bearerToken: string,
|
|
5842
|
+
clanId:string,
|
|
5843
|
+
options: any = {}): Promise<ApiClanStickerListByClanIdResponse> {
|
|
5844
|
+
|
|
5845
|
+
if (clanId === null || clanId === undefined) {
|
|
5846
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5847
|
+
}
|
|
5848
|
+
const urlPath = "/v2/sticker/{clanId}"
|
|
5849
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5850
|
+
const queryParams = new Map<string, any>();
|
|
5851
|
+
|
|
5852
|
+
let bodyJson : string = "";
|
|
5853
|
+
|
|
5854
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5855
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
5856
|
+
if (bearerToken) {
|
|
5857
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5858
|
+
}
|
|
5859
|
+
|
|
5860
|
+
return Promise.race([
|
|
5861
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5862
|
+
if (response.status == 204) {
|
|
5863
|
+
return response;
|
|
5864
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5865
|
+
return response.json();
|
|
5866
|
+
} else {
|
|
5867
|
+
throw response;
|
|
5868
|
+
}
|
|
5869
|
+
}),
|
|
5870
|
+
new Promise((_, reject) =>
|
|
5871
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5872
|
+
),
|
|
5873
|
+
]);
|
|
5874
|
+
}
|
|
5875
|
+
|
|
5876
|
+
/** Delete a sticker by ID */
|
|
5877
|
+
deleteClanStickerById(bearerToken: string,
|
|
5878
|
+
id:string,
|
|
5879
|
+
options: any = {}): Promise<any> {
|
|
5880
|
+
|
|
5881
|
+
if (id === null || id === undefined) {
|
|
5882
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
5883
|
+
}
|
|
5884
|
+
const urlPath = "/v2/sticker/{id}"
|
|
5885
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
|
5886
|
+
const queryParams = new Map<string, any>();
|
|
5887
|
+
|
|
5888
|
+
let bodyJson : string = "";
|
|
5889
|
+
|
|
5890
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5891
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
5892
|
+
if (bearerToken) {
|
|
5893
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5894
|
+
}
|
|
5895
|
+
|
|
5896
|
+
return Promise.race([
|
|
5897
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5898
|
+
if (response.status == 204) {
|
|
5899
|
+
return response;
|
|
5900
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5901
|
+
return response.json();
|
|
5902
|
+
} else {
|
|
5903
|
+
throw response;
|
|
5904
|
+
}
|
|
5905
|
+
}),
|
|
5906
|
+
new Promise((_, reject) =>
|
|
5907
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5908
|
+
),
|
|
5909
|
+
]);
|
|
5910
|
+
}
|
|
5911
|
+
|
|
5912
|
+
/** Update a sticker by ID */
|
|
5913
|
+
updateClanStickerById(bearerToken: string,
|
|
5914
|
+
id:string,
|
|
5915
|
+
body:MezonUpdateClanStickerByIdBody,
|
|
5916
|
+
options: any = {}): Promise<any> {
|
|
5917
|
+
|
|
5918
|
+
if (id === null || id === undefined) {
|
|
5919
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
5920
|
+
}
|
|
5921
|
+
if (body === null || body === undefined) {
|
|
5922
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
5923
|
+
}
|
|
5924
|
+
const urlPath = "/v2/sticker/{id}"
|
|
5925
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
|
5926
|
+
const queryParams = new Map<string, any>();
|
|
5927
|
+
|
|
5928
|
+
let bodyJson : string = "";
|
|
5929
|
+
bodyJson = JSON.stringify(body || {});
|
|
5930
|
+
|
|
5931
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5932
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
5933
|
+
if (bearerToken) {
|
|
5934
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5935
|
+
}
|
|
5936
|
+
|
|
5937
|
+
return Promise.race([
|
|
5938
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5939
|
+
if (response.status == 204) {
|
|
5940
|
+
return response;
|
|
5941
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5942
|
+
return response.json();
|
|
5943
|
+
} else {
|
|
5944
|
+
throw response;
|
|
5945
|
+
}
|
|
5946
|
+
}),
|
|
5947
|
+
new Promise((_, reject) =>
|
|
5948
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5949
|
+
),
|
|
5950
|
+
]);
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5748
5953
|
/** Get storage objects. */
|
|
5749
5954
|
readStorageObjects(bearerToken: string,
|
|
5750
5955
|
body:ApiReadStorageObjectsRequest,
|
package/client.ts
CHANGED
|
@@ -103,6 +103,9 @@ import {
|
|
|
103
103
|
MezonUpdateWebhookByIdBody,
|
|
104
104
|
ApiWebhookGenerateResponse,
|
|
105
105
|
ApiCheckDuplicateClanNameResponse,
|
|
106
|
+
ApiClanStickerAddRequest,
|
|
107
|
+
ApiClanStickerListByClanIdResponse,
|
|
108
|
+
MezonUpdateClanStickerByIdBody,
|
|
106
109
|
} from "./api.gen";
|
|
107
110
|
|
|
108
111
|
import { Session } from "./session";
|
|
@@ -2346,7 +2349,7 @@ async deleteWebhookById(session: Session, id: string) {
|
|
|
2346
2349
|
}
|
|
2347
2350
|
|
|
2348
2351
|
//**check duplicate clan name */
|
|
2349
|
-
async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>{
|
|
2352
|
+
async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse> {
|
|
2350
2353
|
if (this.autoRefreshSession && session.refresh_token &&
|
|
2351
2354
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2352
2355
|
await this.sessionRefresh(session);
|
|
@@ -2357,4 +2360,52 @@ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCh
|
|
|
2357
2360
|
})
|
|
2358
2361
|
}
|
|
2359
2362
|
|
|
2363
|
+
//**Add a new sticker */
|
|
2364
|
+
async addClanSticker(session: Session,request: ApiClanStickerAddRequest) {
|
|
2365
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2366
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2367
|
+
await this.sessionRefresh(session);
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
return this.apiClient.addClanSticker(session.token, request).then((response: any) => {
|
|
2371
|
+
return response !== undefined;
|
|
2372
|
+
})
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
//**List stickers by clan ID */
|
|
2376
|
+
async listClanStickersByClanId(session: Session,id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
|
2377
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2378
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2379
|
+
await this.sessionRefresh(session);
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
return this.apiClient.listClanStickersByClanId(session.token, id).then((response: any) => {
|
|
2383
|
+
return Promise.resolve(response);
|
|
2384
|
+
})
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
//**Delete a sticker by ID*/
|
|
2388
|
+
async deleteClanStickerById(session: Session,id: string) {
|
|
2389
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2390
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2391
|
+
await this.sessionRefresh(session);
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
return this.apiClient.deleteClanStickerById(session.token, id).then((response: any) => {
|
|
2395
|
+
return response !== undefined;
|
|
2396
|
+
})
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
//**Update a sticker by ID*/
|
|
2400
|
+
async updateClanStickerById(session: Session,id: string,request: MezonUpdateClanStickerByIdBody){
|
|
2401
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2402
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2403
|
+
await this.sessionRefresh(session);
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
return this.apiClient.updateClanStickerById(session.token, id,request).then((response: any) => {
|
|
2407
|
+
return response !== undefined;
|
|
2408
|
+
})
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2360
2411
|
};
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -39,6 +39,12 @@ export interface MezonUpdateClanEmojiByIdBody {
|
|
|
39
39
|
shortname?: string;
|
|
40
40
|
source?: string;
|
|
41
41
|
}
|
|
42
|
+
/** */
|
|
43
|
+
export interface MezonUpdateClanStickerByIdBody {
|
|
44
|
+
category?: string;
|
|
45
|
+
shortname?: string;
|
|
46
|
+
source?: string;
|
|
47
|
+
}
|
|
42
48
|
/** update a event within clan. */
|
|
43
49
|
export interface MezonUpdateEventBody {
|
|
44
50
|
address?: string;
|
|
@@ -73,6 +79,8 @@ export interface MezonUpdateUserProfileByClanBody {
|
|
|
73
79
|
}
|
|
74
80
|
/** */
|
|
75
81
|
export interface MezonUpdateWebhookByIdBody {
|
|
82
|
+
avatar?: string;
|
|
83
|
+
channel_id?: string;
|
|
76
84
|
webhook_name?: string;
|
|
77
85
|
}
|
|
78
86
|
/** A single user-role pair. */
|
|
@@ -318,6 +326,27 @@ export interface ApiClanProfile {
|
|
|
318
326
|
nick_name?: string;
|
|
319
327
|
user_id?: string;
|
|
320
328
|
}
|
|
329
|
+
/** */
|
|
330
|
+
export interface ApiClanSticker {
|
|
331
|
+
category?: string;
|
|
332
|
+
clan_id?: string;
|
|
333
|
+
create_time?: string;
|
|
334
|
+
creator_id?: string;
|
|
335
|
+
id?: string;
|
|
336
|
+
shortname?: string;
|
|
337
|
+
source?: string;
|
|
338
|
+
}
|
|
339
|
+
/** */
|
|
340
|
+
export interface ApiClanStickerAddRequest {
|
|
341
|
+
category?: string;
|
|
342
|
+
clan_id?: string;
|
|
343
|
+
shortname?: string;
|
|
344
|
+
source?: string;
|
|
345
|
+
}
|
|
346
|
+
/** */
|
|
347
|
+
export interface ApiClanStickerListByClanIdResponse {
|
|
348
|
+
stickers?: Array<ApiClanSticker>;
|
|
349
|
+
}
|
|
321
350
|
/** A list of users belonging to a clan, along with their role. */
|
|
322
351
|
export interface ApiClanUserList {
|
|
323
352
|
clan_id?: string;
|
|
@@ -850,6 +879,7 @@ export interface ApiVoiceChannelUserList {
|
|
|
850
879
|
/** */
|
|
851
880
|
export interface ApiWebhook {
|
|
852
881
|
active?: number;
|
|
882
|
+
avatar?: string;
|
|
853
883
|
channel_id?: string;
|
|
854
884
|
create_time?: string;
|
|
855
885
|
creator_id?: string;
|
|
@@ -860,11 +890,13 @@ export interface ApiWebhook {
|
|
|
860
890
|
}
|
|
861
891
|
/** */
|
|
862
892
|
export interface ApiWebhookCreateRequest {
|
|
893
|
+
avatar?: string;
|
|
863
894
|
channel_id?: string;
|
|
864
895
|
webhook_name?: string;
|
|
865
896
|
}
|
|
866
897
|
/** */
|
|
867
898
|
export interface ApiWebhookGenerateResponse {
|
|
899
|
+
avatar?: string;
|
|
868
900
|
channel_id?: string;
|
|
869
901
|
hook_name?: string;
|
|
870
902
|
url?: string;
|
|
@@ -1134,6 +1166,14 @@ export declare class MezonApi {
|
|
|
1134
1166
|
rpcFunc(bearerToken: string, basicAuthUsername: string, basicAuthPassword: string, id: string, payload: string, httpKey?: string, options?: any): Promise<ApiRpc>;
|
|
1135
1167
|
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
|
1136
1168
|
sessionLogout(bearerToken: string, body: ApiSessionLogoutRequest, options?: any): Promise<any>;
|
|
1169
|
+
/** Add a new sticker */
|
|
1170
|
+
addClanSticker(bearerToken: string, body: ApiClanStickerAddRequest, options?: any): Promise<any>;
|
|
1171
|
+
/** List stickers by clan ID */
|
|
1172
|
+
listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
|
|
1173
|
+
/** Delete a sticker by ID */
|
|
1174
|
+
deleteClanStickerById(bearerToken: string, id: string, options?: any): Promise<any>;
|
|
1175
|
+
/** Update a sticker by ID */
|
|
1176
|
+
updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
|
|
1137
1177
|
/** Get storage objects. */
|
|
1138
1178
|
readStorageObjects(bearerToken: string, body: ApiReadStorageObjectsRequest, options?: any): Promise<ApiStorageObjects>;
|
|
1139
1179
|
/** Write objects into the storage engine. */
|
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, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse } from "./api.gen";
|
|
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, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, ApiClanStickerListByClanIdResponse, MezonUpdateClanStickerByIdBody } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -592,4 +592,8 @@ export declare class Client {
|
|
|
592
592
|
updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
|
|
593
593
|
deleteWebhookById(session: Session, id: string): Promise<boolean>;
|
|
594
594
|
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
|
595
|
+
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
|
596
|
+
listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
|
597
|
+
deleteClanStickerById(session: Session, id: string): Promise<boolean>;
|
|
598
|
+
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
|
595
599
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -3921,6 +3921,123 @@ var MezonApi = class {
|
|
|
3921
3921
|
)
|
|
3922
3922
|
]);
|
|
3923
3923
|
}
|
|
3924
|
+
/** Add a new sticker */
|
|
3925
|
+
addClanSticker(bearerToken, body, options = {}) {
|
|
3926
|
+
if (body === null || body === void 0) {
|
|
3927
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3928
|
+
}
|
|
3929
|
+
const urlPath = "/v2/sticker";
|
|
3930
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3931
|
+
let bodyJson = "";
|
|
3932
|
+
bodyJson = JSON.stringify(body || {});
|
|
3933
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3934
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3935
|
+
if (bearerToken) {
|
|
3936
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3937
|
+
}
|
|
3938
|
+
return Promise.race([
|
|
3939
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3940
|
+
if (response.status == 204) {
|
|
3941
|
+
return response;
|
|
3942
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3943
|
+
return response.json();
|
|
3944
|
+
} else {
|
|
3945
|
+
throw response;
|
|
3946
|
+
}
|
|
3947
|
+
}),
|
|
3948
|
+
new Promise(
|
|
3949
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3950
|
+
)
|
|
3951
|
+
]);
|
|
3952
|
+
}
|
|
3953
|
+
/** List stickers by clan ID */
|
|
3954
|
+
listClanStickersByClanId(bearerToken, clanId, options = {}) {
|
|
3955
|
+
if (clanId === null || clanId === void 0) {
|
|
3956
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3957
|
+
}
|
|
3958
|
+
const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3959
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3960
|
+
let bodyJson = "";
|
|
3961
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3962
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3963
|
+
if (bearerToken) {
|
|
3964
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3965
|
+
}
|
|
3966
|
+
return Promise.race([
|
|
3967
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3968
|
+
if (response.status == 204) {
|
|
3969
|
+
return response;
|
|
3970
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3971
|
+
return response.json();
|
|
3972
|
+
} else {
|
|
3973
|
+
throw response;
|
|
3974
|
+
}
|
|
3975
|
+
}),
|
|
3976
|
+
new Promise(
|
|
3977
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3978
|
+
)
|
|
3979
|
+
]);
|
|
3980
|
+
}
|
|
3981
|
+
/** Delete a sticker by ID */
|
|
3982
|
+
deleteClanStickerById(bearerToken, id, options = {}) {
|
|
3983
|
+
if (id === null || id === void 0) {
|
|
3984
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
3985
|
+
}
|
|
3986
|
+
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
3987
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3988
|
+
let bodyJson = "";
|
|
3989
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3990
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
3991
|
+
if (bearerToken) {
|
|
3992
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3993
|
+
}
|
|
3994
|
+
return Promise.race([
|
|
3995
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3996
|
+
if (response.status == 204) {
|
|
3997
|
+
return response;
|
|
3998
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3999
|
+
return response.json();
|
|
4000
|
+
} else {
|
|
4001
|
+
throw response;
|
|
4002
|
+
}
|
|
4003
|
+
}),
|
|
4004
|
+
new Promise(
|
|
4005
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
4006
|
+
)
|
|
4007
|
+
]);
|
|
4008
|
+
}
|
|
4009
|
+
/** Update a sticker by ID */
|
|
4010
|
+
updateClanStickerById(bearerToken, id, body, options = {}) {
|
|
4011
|
+
if (id === null || id === void 0) {
|
|
4012
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
4013
|
+
}
|
|
4014
|
+
if (body === null || body === void 0) {
|
|
4015
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
4016
|
+
}
|
|
4017
|
+
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
4018
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
4019
|
+
let bodyJson = "";
|
|
4020
|
+
bodyJson = JSON.stringify(body || {});
|
|
4021
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
4022
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
4023
|
+
if (bearerToken) {
|
|
4024
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
4025
|
+
}
|
|
4026
|
+
return Promise.race([
|
|
4027
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
4028
|
+
if (response.status == 204) {
|
|
4029
|
+
return response;
|
|
4030
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
4031
|
+
return response.json();
|
|
4032
|
+
} else {
|
|
4033
|
+
throw response;
|
|
4034
|
+
}
|
|
4035
|
+
}),
|
|
4036
|
+
new Promise(
|
|
4037
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
4038
|
+
)
|
|
4039
|
+
]);
|
|
4040
|
+
}
|
|
3924
4041
|
/** Get storage objects. */
|
|
3925
4042
|
readStorageObjects(bearerToken, body, options = {}) {
|
|
3926
4043
|
if (body === null || body === void 0) {
|
|
@@ -4668,6 +4785,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
4668
4785
|
this.oncustomstatus(message.custom_status_event);
|
|
4669
4786
|
} else if (message.user_channel_added_event) {
|
|
4670
4787
|
this.onuserchanneladded(message.user_channel_added_event);
|
|
4788
|
+
} else if (message.user_channel_removed_event) {
|
|
4789
|
+
this.onuserchannelremoved(message.user_channel_removed_event);
|
|
4790
|
+
} else if (message.user_clan_removed_event) {
|
|
4791
|
+
this.onuserclanremoved(message.user_clan_removed_event);
|
|
4671
4792
|
} else {
|
|
4672
4793
|
if (this.verbose && window && window.console) {
|
|
4673
4794
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -4755,6 +4876,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
4755
4876
|
console.log(user);
|
|
4756
4877
|
}
|
|
4757
4878
|
}
|
|
4879
|
+
onuserchannelremoved(user) {
|
|
4880
|
+
if (this.verbose && window && window.console) {
|
|
4881
|
+
console.log(user);
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
onuserclanremoved(user) {
|
|
4885
|
+
if (this.verbose && window && window.console) {
|
|
4886
|
+
console.log(user);
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4758
4889
|
onnotification(notification) {
|
|
4759
4890
|
if (this.verbose && window && window.console) {
|
|
4760
4891
|
console.log(notification);
|
|
@@ -6707,4 +6838,48 @@ var Client = class {
|
|
|
6707
6838
|
});
|
|
6708
6839
|
});
|
|
6709
6840
|
}
|
|
6841
|
+
//**Add a new sticker */
|
|
6842
|
+
addClanSticker(session, request) {
|
|
6843
|
+
return __async(this, null, function* () {
|
|
6844
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6845
|
+
yield this.sessionRefresh(session);
|
|
6846
|
+
}
|
|
6847
|
+
return this.apiClient.addClanSticker(session.token, request).then((response) => {
|
|
6848
|
+
return response !== void 0;
|
|
6849
|
+
});
|
|
6850
|
+
});
|
|
6851
|
+
}
|
|
6852
|
+
//**List stickers by clan ID */
|
|
6853
|
+
listClanStickersByClanId(session, id) {
|
|
6854
|
+
return __async(this, null, function* () {
|
|
6855
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6856
|
+
yield this.sessionRefresh(session);
|
|
6857
|
+
}
|
|
6858
|
+
return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
|
|
6859
|
+
return Promise.resolve(response);
|
|
6860
|
+
});
|
|
6861
|
+
});
|
|
6862
|
+
}
|
|
6863
|
+
//**Delete a sticker by ID*/
|
|
6864
|
+
deleteClanStickerById(session, id) {
|
|
6865
|
+
return __async(this, null, function* () {
|
|
6866
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6867
|
+
yield this.sessionRefresh(session);
|
|
6868
|
+
}
|
|
6869
|
+
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
|
6870
|
+
return response !== void 0;
|
|
6871
|
+
});
|
|
6872
|
+
});
|
|
6873
|
+
}
|
|
6874
|
+
//**Update a sticker by ID*/
|
|
6875
|
+
updateClanStickerById(session, id, request) {
|
|
6876
|
+
return __async(this, null, function* () {
|
|
6877
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6878
|
+
yield this.sessionRefresh(session);
|
|
6879
|
+
}
|
|
6880
|
+
return this.apiClient.updateClanStickerById(session.token, id, request).then((response) => {
|
|
6881
|
+
return response !== void 0;
|
|
6882
|
+
});
|
|
6883
|
+
});
|
|
6884
|
+
}
|
|
6710
6885
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -3892,6 +3892,123 @@ var MezonApi = class {
|
|
|
3892
3892
|
)
|
|
3893
3893
|
]);
|
|
3894
3894
|
}
|
|
3895
|
+
/** Add a new sticker */
|
|
3896
|
+
addClanSticker(bearerToken, body, options = {}) {
|
|
3897
|
+
if (body === null || body === void 0) {
|
|
3898
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3899
|
+
}
|
|
3900
|
+
const urlPath = "/v2/sticker";
|
|
3901
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3902
|
+
let bodyJson = "";
|
|
3903
|
+
bodyJson = JSON.stringify(body || {});
|
|
3904
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3905
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3906
|
+
if (bearerToken) {
|
|
3907
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3908
|
+
}
|
|
3909
|
+
return Promise.race([
|
|
3910
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3911
|
+
if (response.status == 204) {
|
|
3912
|
+
return response;
|
|
3913
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3914
|
+
return response.json();
|
|
3915
|
+
} else {
|
|
3916
|
+
throw response;
|
|
3917
|
+
}
|
|
3918
|
+
}),
|
|
3919
|
+
new Promise(
|
|
3920
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3921
|
+
)
|
|
3922
|
+
]);
|
|
3923
|
+
}
|
|
3924
|
+
/** List stickers by clan ID */
|
|
3925
|
+
listClanStickersByClanId(bearerToken, clanId, options = {}) {
|
|
3926
|
+
if (clanId === null || clanId === void 0) {
|
|
3927
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3928
|
+
}
|
|
3929
|
+
const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3930
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3931
|
+
let bodyJson = "";
|
|
3932
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3933
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3934
|
+
if (bearerToken) {
|
|
3935
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3936
|
+
}
|
|
3937
|
+
return Promise.race([
|
|
3938
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3939
|
+
if (response.status == 204) {
|
|
3940
|
+
return response;
|
|
3941
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3942
|
+
return response.json();
|
|
3943
|
+
} else {
|
|
3944
|
+
throw response;
|
|
3945
|
+
}
|
|
3946
|
+
}),
|
|
3947
|
+
new Promise(
|
|
3948
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3949
|
+
)
|
|
3950
|
+
]);
|
|
3951
|
+
}
|
|
3952
|
+
/** Delete a sticker by ID */
|
|
3953
|
+
deleteClanStickerById(bearerToken, id, options = {}) {
|
|
3954
|
+
if (id === null || id === void 0) {
|
|
3955
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
3956
|
+
}
|
|
3957
|
+
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
3958
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3959
|
+
let bodyJson = "";
|
|
3960
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3961
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
3962
|
+
if (bearerToken) {
|
|
3963
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3964
|
+
}
|
|
3965
|
+
return Promise.race([
|
|
3966
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3967
|
+
if (response.status == 204) {
|
|
3968
|
+
return response;
|
|
3969
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3970
|
+
return response.json();
|
|
3971
|
+
} else {
|
|
3972
|
+
throw response;
|
|
3973
|
+
}
|
|
3974
|
+
}),
|
|
3975
|
+
new Promise(
|
|
3976
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3977
|
+
)
|
|
3978
|
+
]);
|
|
3979
|
+
}
|
|
3980
|
+
/** Update a sticker by ID */
|
|
3981
|
+
updateClanStickerById(bearerToken, id, body, options = {}) {
|
|
3982
|
+
if (id === null || id === void 0) {
|
|
3983
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
3984
|
+
}
|
|
3985
|
+
if (body === null || body === void 0) {
|
|
3986
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3987
|
+
}
|
|
3988
|
+
const urlPath = "/v2/sticker/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
3989
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3990
|
+
let bodyJson = "";
|
|
3991
|
+
bodyJson = JSON.stringify(body || {});
|
|
3992
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3993
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
3994
|
+
if (bearerToken) {
|
|
3995
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3996
|
+
}
|
|
3997
|
+
return Promise.race([
|
|
3998
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3999
|
+
if (response.status == 204) {
|
|
4000
|
+
return response;
|
|
4001
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
4002
|
+
return response.json();
|
|
4003
|
+
} else {
|
|
4004
|
+
throw response;
|
|
4005
|
+
}
|
|
4006
|
+
}),
|
|
4007
|
+
new Promise(
|
|
4008
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
4009
|
+
)
|
|
4010
|
+
]);
|
|
4011
|
+
}
|
|
3895
4012
|
/** Get storage objects. */
|
|
3896
4013
|
readStorageObjects(bearerToken, body, options = {}) {
|
|
3897
4014
|
if (body === null || body === void 0) {
|
|
@@ -4639,6 +4756,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
4639
4756
|
this.oncustomstatus(message.custom_status_event);
|
|
4640
4757
|
} else if (message.user_channel_added_event) {
|
|
4641
4758
|
this.onuserchanneladded(message.user_channel_added_event);
|
|
4759
|
+
} else if (message.user_channel_removed_event) {
|
|
4760
|
+
this.onuserchannelremoved(message.user_channel_removed_event);
|
|
4761
|
+
} else if (message.user_clan_removed_event) {
|
|
4762
|
+
this.onuserclanremoved(message.user_clan_removed_event);
|
|
4642
4763
|
} else {
|
|
4643
4764
|
if (this.verbose && window && window.console) {
|
|
4644
4765
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -4726,6 +4847,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
4726
4847
|
console.log(user);
|
|
4727
4848
|
}
|
|
4728
4849
|
}
|
|
4850
|
+
onuserchannelremoved(user) {
|
|
4851
|
+
if (this.verbose && window && window.console) {
|
|
4852
|
+
console.log(user);
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
onuserclanremoved(user) {
|
|
4856
|
+
if (this.verbose && window && window.console) {
|
|
4857
|
+
console.log(user);
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4729
4860
|
onnotification(notification) {
|
|
4730
4861
|
if (this.verbose && window && window.console) {
|
|
4731
4862
|
console.log(notification);
|
|
@@ -6678,6 +6809,50 @@ var Client = class {
|
|
|
6678
6809
|
});
|
|
6679
6810
|
});
|
|
6680
6811
|
}
|
|
6812
|
+
//**Add a new sticker */
|
|
6813
|
+
addClanSticker(session, request) {
|
|
6814
|
+
return __async(this, null, function* () {
|
|
6815
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6816
|
+
yield this.sessionRefresh(session);
|
|
6817
|
+
}
|
|
6818
|
+
return this.apiClient.addClanSticker(session.token, request).then((response) => {
|
|
6819
|
+
return response !== void 0;
|
|
6820
|
+
});
|
|
6821
|
+
});
|
|
6822
|
+
}
|
|
6823
|
+
//**List stickers by clan ID */
|
|
6824
|
+
listClanStickersByClanId(session, id) {
|
|
6825
|
+
return __async(this, null, function* () {
|
|
6826
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6827
|
+
yield this.sessionRefresh(session);
|
|
6828
|
+
}
|
|
6829
|
+
return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
|
|
6830
|
+
return Promise.resolve(response);
|
|
6831
|
+
});
|
|
6832
|
+
});
|
|
6833
|
+
}
|
|
6834
|
+
//**Delete a sticker by ID*/
|
|
6835
|
+
deleteClanStickerById(session, id) {
|
|
6836
|
+
return __async(this, null, function* () {
|
|
6837
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6838
|
+
yield this.sessionRefresh(session);
|
|
6839
|
+
}
|
|
6840
|
+
return this.apiClient.deleteClanStickerById(session.token, id).then((response) => {
|
|
6841
|
+
return response !== void 0;
|
|
6842
|
+
});
|
|
6843
|
+
});
|
|
6844
|
+
}
|
|
6845
|
+
//**Update a sticker by ID*/
|
|
6846
|
+
updateClanStickerById(session, id, request) {
|
|
6847
|
+
return __async(this, null, function* () {
|
|
6848
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6849
|
+
yield this.sessionRefresh(session);
|
|
6850
|
+
}
|
|
6851
|
+
return this.apiClient.updateClanStickerById(session.token, id, request).then((response) => {
|
|
6852
|
+
return response !== void 0;
|
|
6853
|
+
});
|
|
6854
|
+
});
|
|
6855
|
+
}
|
|
6681
6856
|
};
|
|
6682
6857
|
export {
|
|
6683
6858
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
|
@@ -74,10 +74,23 @@ interface ChannelLeave {
|
|
|
74
74
|
/** UserChannelAddedEvent */
|
|
75
75
|
export interface UserChannelAddedEvent {
|
|
76
76
|
channel_id: string;
|
|
77
|
+
users: AddUsers[];
|
|
78
|
+
status: string;
|
|
79
|
+
clan_id: string;
|
|
80
|
+
channel_type: number;
|
|
81
|
+
}
|
|
82
|
+
export interface AddUsers {
|
|
77
83
|
user_id: string;
|
|
78
|
-
username: string;
|
|
79
84
|
avatar: string;
|
|
80
|
-
|
|
85
|
+
username: string;
|
|
86
|
+
}
|
|
87
|
+
export interface UserChannelRemovedEvent {
|
|
88
|
+
channel_id: string;
|
|
89
|
+
user_ids: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface UserClanRemovedEvent {
|
|
92
|
+
clan_id: string;
|
|
93
|
+
user_ids: string[];
|
|
81
94
|
}
|
|
82
95
|
/** Last seen message by user */
|
|
83
96
|
export interface LastPinMessageEvent {
|
|
@@ -474,6 +487,10 @@ export interface Socket {
|
|
|
474
487
|
onpinmessage: (pin: LastPinMessageEvent) => void;
|
|
475
488
|
/** Receive added user event */
|
|
476
489
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
|
490
|
+
/** Receive channel removed user event */
|
|
491
|
+
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
|
492
|
+
/** Receive clan removed user event */
|
|
493
|
+
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
|
477
494
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
|
478
495
|
onvoiceended: (voice: VoiceEndedEvent) => void;
|
|
479
496
|
onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
|
|
@@ -519,6 +536,8 @@ export declare class DefaultSocket implements Socket {
|
|
|
519
536
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
|
520
537
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
|
521
538
|
onuserchanneladded(user: UserChannelAddedEvent): void;
|
|
539
|
+
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
|
540
|
+
onuserclanremoved(user: UserClanRemovedEvent): void;
|
|
522
541
|
onnotification(notification: Notification): void;
|
|
523
542
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
|
524
543
|
onpinmessage(pin: LastPinMessageEvent): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -92,14 +92,37 @@ interface ChannelLeave {
|
|
|
92
92
|
export interface UserChannelAddedEvent {
|
|
93
93
|
// the channel id
|
|
94
94
|
channel_id: string;
|
|
95
|
-
// the
|
|
96
|
-
|
|
97
|
-
// the username
|
|
98
|
-
username: string;
|
|
99
|
-
// the avatar
|
|
100
|
-
avatar: string;
|
|
95
|
+
// the user
|
|
96
|
+
users: AddUsers[];
|
|
101
97
|
// the custom status
|
|
102
98
|
status: string;
|
|
99
|
+
// the clan id
|
|
100
|
+
clan_id: string;
|
|
101
|
+
// the channel type
|
|
102
|
+
channel_type: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AddUsers {
|
|
106
|
+
// User IDs to follow.
|
|
107
|
+
user_id: string;
|
|
108
|
+
// Avatar to follow.
|
|
109
|
+
avatar: string;
|
|
110
|
+
// Username to follow.
|
|
111
|
+
username: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface UserChannelRemovedEvent {
|
|
115
|
+
// the channel id
|
|
116
|
+
channel_id: string;
|
|
117
|
+
// the user_id
|
|
118
|
+
user_ids: string[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface UserClanRemovedEvent {
|
|
122
|
+
// the clan id
|
|
123
|
+
clan_id: string;
|
|
124
|
+
// the user_id
|
|
125
|
+
user_ids: string[];
|
|
103
126
|
}
|
|
104
127
|
|
|
105
128
|
/** Last seen message by user */
|
|
@@ -662,6 +685,12 @@ export interface Socket {
|
|
|
662
685
|
/** Receive added user event */
|
|
663
686
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
|
664
687
|
|
|
688
|
+
/** Receive channel removed user event */
|
|
689
|
+
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
|
690
|
+
|
|
691
|
+
/** Receive clan removed user event */
|
|
692
|
+
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
|
693
|
+
|
|
665
694
|
// when someone start the voice room
|
|
666
695
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
|
667
696
|
|
|
@@ -826,6 +855,10 @@ export class DefaultSocket implements Socket {
|
|
|
826
855
|
this.oncustomstatus(<CustomStatusEvent>message.custom_status_event);
|
|
827
856
|
} else if (message.user_channel_added_event) {
|
|
828
857
|
this.onuserchanneladded(<UserChannelAddedEvent>message.user_channel_added_event);
|
|
858
|
+
} else if (message.user_channel_removed_event) {
|
|
859
|
+
this.onuserchannelremoved(<UserChannelRemovedEvent>message.user_channel_removed_event);
|
|
860
|
+
} else if (message.user_clan_removed_event) {
|
|
861
|
+
this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
|
|
829
862
|
} else {
|
|
830
863
|
if (this.verbose && window && window.console) {
|
|
831
864
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -929,6 +962,18 @@ export class DefaultSocket implements Socket {
|
|
|
929
962
|
}
|
|
930
963
|
}
|
|
931
964
|
|
|
965
|
+
onuserchannelremoved(user: UserChannelRemovedEvent) {
|
|
966
|
+
if (this.verbose && window && window.console) {
|
|
967
|
+
console.log(user);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
onuserclanremoved(user: UserClanRemovedEvent) {
|
|
972
|
+
if (this.verbose && window && window.console) {
|
|
973
|
+
console.log(user);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
932
977
|
onnotification(notification: Notification) {
|
|
933
978
|
if (this.verbose && window && window.console) {
|
|
934
979
|
console.log(notification);
|