mezon-js 2.7.87 → 2.7.89
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +195 -0
- package/client.ts +52 -1
- package/dist/api.gen.d.ts +35 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +179 -4
- package/dist/mezon-js.esm.mjs +179 -4
- package/dist/socket.d.ts +24 -6
- package/package.json +1 -1
- package/socket.ts +55 -12
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
|
//
|
@@ -557,6 +567,42 @@ export interface ApiClanProfile {
|
|
557
567
|
user_id?: string;
|
558
568
|
}
|
559
569
|
|
570
|
+
/** */
|
571
|
+
export interface ApiClanSticker {
|
572
|
+
//
|
573
|
+
category?: string;
|
574
|
+
//
|
575
|
+
clan_id?: string;
|
576
|
+
//
|
577
|
+
create_time?: string;
|
578
|
+
//
|
579
|
+
creator_id?: string;
|
580
|
+
//
|
581
|
+
id?: string;
|
582
|
+
//
|
583
|
+
shortname?: string;
|
584
|
+
//
|
585
|
+
source?: string;
|
586
|
+
}
|
587
|
+
|
588
|
+
/** */
|
589
|
+
export interface ApiClanStickerAddRequest {
|
590
|
+
//
|
591
|
+
category?: string;
|
592
|
+
//
|
593
|
+
clan_id?: string;
|
594
|
+
//
|
595
|
+
shortname?: string;
|
596
|
+
//
|
597
|
+
source?: string;
|
598
|
+
}
|
599
|
+
|
600
|
+
/** */
|
601
|
+
export interface ApiClanStickerListByClanIdResponse {
|
602
|
+
//
|
603
|
+
stickers?: Array<ApiClanSticker>;
|
604
|
+
}
|
605
|
+
|
560
606
|
/** A list of users belonging to a clan, along with their role. */
|
561
607
|
export interface ApiClanUserList {
|
562
608
|
//
|
@@ -5745,6 +5791,155 @@ export class MezonApi {
|
|
5745
5791
|
]);
|
5746
5792
|
}
|
5747
5793
|
|
5794
|
+
/** Add a new sticker */
|
5795
|
+
addClanSticker(bearerToken: string,
|
5796
|
+
body:ApiClanStickerAddRequest,
|
5797
|
+
options: any = {}): Promise<any> {
|
5798
|
+
|
5799
|
+
if (body === null || body === undefined) {
|
5800
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
5801
|
+
}
|
5802
|
+
const urlPath = "/v2/sticker";
|
5803
|
+
const queryParams = new Map<string, any>();
|
5804
|
+
|
5805
|
+
let bodyJson : string = "";
|
5806
|
+
bodyJson = JSON.stringify(body || {});
|
5807
|
+
|
5808
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5809
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
5810
|
+
if (bearerToken) {
|
5811
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5812
|
+
}
|
5813
|
+
|
5814
|
+
return Promise.race([
|
5815
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5816
|
+
if (response.status == 204) {
|
5817
|
+
return response;
|
5818
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5819
|
+
return response.json();
|
5820
|
+
} else {
|
5821
|
+
throw response;
|
5822
|
+
}
|
5823
|
+
}),
|
5824
|
+
new Promise((_, reject) =>
|
5825
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5826
|
+
),
|
5827
|
+
]);
|
5828
|
+
}
|
5829
|
+
|
5830
|
+
/** List stickers by clan ID */
|
5831
|
+
listClanStickersByClanId(bearerToken: string,
|
5832
|
+
clanId:string,
|
5833
|
+
options: any = {}): Promise<ApiClanStickerListByClanIdResponse> {
|
5834
|
+
|
5835
|
+
if (clanId === null || clanId === undefined) {
|
5836
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
5837
|
+
}
|
5838
|
+
const urlPath = "/v2/sticker/{clanId}"
|
5839
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
5840
|
+
const queryParams = new Map<string, any>();
|
5841
|
+
|
5842
|
+
let bodyJson : string = "";
|
5843
|
+
|
5844
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5845
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
5846
|
+
if (bearerToken) {
|
5847
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5848
|
+
}
|
5849
|
+
|
5850
|
+
return Promise.race([
|
5851
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5852
|
+
if (response.status == 204) {
|
5853
|
+
return response;
|
5854
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5855
|
+
return response.json();
|
5856
|
+
} else {
|
5857
|
+
throw response;
|
5858
|
+
}
|
5859
|
+
}),
|
5860
|
+
new Promise((_, reject) =>
|
5861
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5862
|
+
),
|
5863
|
+
]);
|
5864
|
+
}
|
5865
|
+
|
5866
|
+
/** Delete a sticker by ID */
|
5867
|
+
deleteClanStickerById(bearerToken: string,
|
5868
|
+
id:string,
|
5869
|
+
options: any = {}): Promise<any> {
|
5870
|
+
|
5871
|
+
if (id === null || id === undefined) {
|
5872
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
5873
|
+
}
|
5874
|
+
const urlPath = "/v2/sticker/{id}"
|
5875
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
5876
|
+
const queryParams = new Map<string, any>();
|
5877
|
+
|
5878
|
+
let bodyJson : string = "";
|
5879
|
+
|
5880
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5881
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
5882
|
+
if (bearerToken) {
|
5883
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5884
|
+
}
|
5885
|
+
|
5886
|
+
return Promise.race([
|
5887
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5888
|
+
if (response.status == 204) {
|
5889
|
+
return response;
|
5890
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5891
|
+
return response.json();
|
5892
|
+
} else {
|
5893
|
+
throw response;
|
5894
|
+
}
|
5895
|
+
}),
|
5896
|
+
new Promise((_, reject) =>
|
5897
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5898
|
+
),
|
5899
|
+
]);
|
5900
|
+
}
|
5901
|
+
|
5902
|
+
/** Update a sticker by ID */
|
5903
|
+
updateClanStickerById(bearerToken: string,
|
5904
|
+
id:string,
|
5905
|
+
body:MezonUpdateClanStickerByIdBody,
|
5906
|
+
options: any = {}): Promise<any> {
|
5907
|
+
|
5908
|
+
if (id === null || id === undefined) {
|
5909
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
5910
|
+
}
|
5911
|
+
if (body === null || body === undefined) {
|
5912
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
5913
|
+
}
|
5914
|
+
const urlPath = "/v2/sticker/{id}"
|
5915
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
5916
|
+
const queryParams = new Map<string, any>();
|
5917
|
+
|
5918
|
+
let bodyJson : string = "";
|
5919
|
+
bodyJson = JSON.stringify(body || {});
|
5920
|
+
|
5921
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5922
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
5923
|
+
if (bearerToken) {
|
5924
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5925
|
+
}
|
5926
|
+
|
5927
|
+
return Promise.race([
|
5928
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5929
|
+
if (response.status == 204) {
|
5930
|
+
return response;
|
5931
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5932
|
+
return response.json();
|
5933
|
+
} else {
|
5934
|
+
throw response;
|
5935
|
+
}
|
5936
|
+
}),
|
5937
|
+
new Promise((_, reject) =>
|
5938
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5939
|
+
),
|
5940
|
+
]);
|
5941
|
+
}
|
5942
|
+
|
5748
5943
|
/** Get storage objects. */
|
5749
5944
|
readStorageObjects(bearerToken: string,
|
5750
5945
|
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;
|
@@ -318,6 +324,27 @@ export interface ApiClanProfile {
|
|
318
324
|
nick_name?: string;
|
319
325
|
user_id?: string;
|
320
326
|
}
|
327
|
+
/** */
|
328
|
+
export interface ApiClanSticker {
|
329
|
+
category?: string;
|
330
|
+
clan_id?: string;
|
331
|
+
create_time?: string;
|
332
|
+
creator_id?: string;
|
333
|
+
id?: string;
|
334
|
+
shortname?: string;
|
335
|
+
source?: string;
|
336
|
+
}
|
337
|
+
/** */
|
338
|
+
export interface ApiClanStickerAddRequest {
|
339
|
+
category?: string;
|
340
|
+
clan_id?: string;
|
341
|
+
shortname?: string;
|
342
|
+
source?: string;
|
343
|
+
}
|
344
|
+
/** */
|
345
|
+
export interface ApiClanStickerListByClanIdResponse {
|
346
|
+
stickers?: Array<ApiClanSticker>;
|
347
|
+
}
|
321
348
|
/** A list of users belonging to a clan, along with their role. */
|
322
349
|
export interface ApiClanUserList {
|
323
350
|
clan_id?: string;
|
@@ -1134,6 +1161,14 @@ export declare class MezonApi {
|
|
1134
1161
|
rpcFunc(bearerToken: string, basicAuthUsername: string, basicAuthPassword: string, id: string, payload: string, httpKey?: string, options?: any): Promise<ApiRpc>;
|
1135
1162
|
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
1136
1163
|
sessionLogout(bearerToken: string, body: ApiSessionLogoutRequest, options?: any): Promise<any>;
|
1164
|
+
/** Add a new sticker */
|
1165
|
+
addClanSticker(bearerToken: string, body: ApiClanStickerAddRequest, options?: any): Promise<any>;
|
1166
|
+
/** List stickers by clan ID */
|
1167
|
+
listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
|
1168
|
+
/** Delete a sticker by ID */
|
1169
|
+
deleteClanStickerById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1170
|
+
/** Update a sticker by ID */
|
1171
|
+
updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
|
1137
1172
|
/** Get storage objects. */
|
1138
1173
|
readStorageObjects(bearerToken: string, body: ApiReadStorageObjectsRequest, options?: any): Promise<ApiStorageObjects>;
|
1139
1174
|
/** 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);
|
@@ -4862,22 +4993,22 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4862
4993
|
return response.clan_join;
|
4863
4994
|
});
|
4864
4995
|
}
|
4865
|
-
joinChat(clan_id, channel_id,
|
4996
|
+
joinChat(clan_id, channel_id, channel_type) {
|
4866
4997
|
return __async(this, null, function* () {
|
4867
4998
|
const response = yield this.send(
|
4868
4999
|
{
|
4869
5000
|
channel_join: {
|
4870
5001
|
clan_id,
|
4871
5002
|
channel_id,
|
4872
|
-
|
5003
|
+
channel_type
|
4873
5004
|
}
|
4874
5005
|
}
|
4875
5006
|
);
|
4876
5007
|
return response.channel;
|
4877
5008
|
});
|
4878
5009
|
}
|
4879
|
-
leaveChat(clan_id, channel_id,
|
4880
|
-
return this.send({ channel_leave: { clan_id, channel_id,
|
5010
|
+
leaveChat(clan_id, channel_id, channel_type) {
|
5011
|
+
return this.send({ channel_leave: { clan_id, channel_id, channel_type } });
|
4881
5012
|
}
|
4882
5013
|
removeChatMessage(clan_id, channel_id, mode, message_id) {
|
4883
5014
|
return __async(this, null, function* () {
|
@@ -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);
|
@@ -4833,22 +4964,22 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4833
4964
|
return response.clan_join;
|
4834
4965
|
});
|
4835
4966
|
}
|
4836
|
-
joinChat(clan_id, channel_id,
|
4967
|
+
joinChat(clan_id, channel_id, channel_type) {
|
4837
4968
|
return __async(this, null, function* () {
|
4838
4969
|
const response = yield this.send(
|
4839
4970
|
{
|
4840
4971
|
channel_join: {
|
4841
4972
|
clan_id,
|
4842
4973
|
channel_id,
|
4843
|
-
|
4974
|
+
channel_type
|
4844
4975
|
}
|
4845
4976
|
}
|
4846
4977
|
);
|
4847
4978
|
return response.channel;
|
4848
4979
|
});
|
4849
4980
|
}
|
4850
|
-
leaveChat(clan_id, channel_id,
|
4851
|
-
return this.send({ channel_leave: { clan_id, channel_id,
|
4981
|
+
leaveChat(clan_id, channel_id, channel_type) {
|
4982
|
+
return this.send({ channel_leave: { clan_id, channel_id, channel_type } });
|
4852
4983
|
}
|
4853
4984
|
removeChatMessage(clan_id, channel_id, mode, message_id) {
|
4854
4985
|
return __async(this, null, function* () {
|
@@ -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,22 @@ 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
|
+
}
|
81
|
+
export interface AddUsers {
|
77
82
|
user_id: string;
|
78
|
-
username: string;
|
79
83
|
avatar: string;
|
80
|
-
|
84
|
+
username: string;
|
85
|
+
}
|
86
|
+
export interface UserChannelRemovedEvent {
|
87
|
+
channel_id: string;
|
88
|
+
user_ids: string[];
|
89
|
+
}
|
90
|
+
export interface UserClanRemovedEvent {
|
91
|
+
clan_id: string;
|
92
|
+
user_ids: string[];
|
81
93
|
}
|
82
94
|
/** Last seen message by user */
|
83
95
|
export interface LastPinMessageEvent {
|
@@ -413,9 +425,9 @@ export interface Socket {
|
|
413
425
|
/** Join clan chat */
|
414
426
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
415
427
|
/** Join a chat channel on the server. */
|
416
|
-
joinChat(clan_id: string, channel_id: string,
|
428
|
+
joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel>;
|
417
429
|
/** Leave a chat channel on the server. */
|
418
|
-
leaveChat(clan_id: string, channel_id: string,
|
430
|
+
leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void>;
|
419
431
|
/** Remove a chat message from a chat channel on the server. */
|
420
432
|
removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
|
421
433
|
/** Execute an RPC function to the server. */
|
@@ -474,6 +486,10 @@ export interface Socket {
|
|
474
486
|
onpinmessage: (pin: LastPinMessageEvent) => void;
|
475
487
|
/** Receive added user event */
|
476
488
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
489
|
+
/** Receive channel removed user event */
|
490
|
+
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
491
|
+
/** Receive clan removed user event */
|
492
|
+
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
477
493
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
478
494
|
onvoiceended: (voice: VoiceEndedEvent) => void;
|
479
495
|
onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
|
@@ -519,6 +535,8 @@ export declare class DefaultSocket implements Socket {
|
|
519
535
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
520
536
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
521
537
|
onuserchanneladded(user: UserChannelAddedEvent): void;
|
538
|
+
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
539
|
+
onuserclanremoved(user: UserClanRemovedEvent): void;
|
522
540
|
onnotification(notification: Notification): void;
|
523
541
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
524
542
|
onpinmessage(pin: LastPinMessageEvent): void;
|
@@ -536,8 +554,8 @@ export declare class DefaultSocket implements Socket {
|
|
536
554
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
537
555
|
followUsers(userIds: string[]): Promise<Status>;
|
538
556
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
539
|
-
joinChat(clan_id: string, channel_id: string,
|
540
|
-
leaveChat(clan_id: string, channel_id: string,
|
557
|
+
joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel>;
|
558
|
+
leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void>;
|
541
559
|
removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck>;
|
542
560
|
removePartyMember(party_id: string, member: Presence): Promise<void>;
|
543
561
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -92,14 +92,35 @@ 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
|
+
}
|
102
|
+
|
103
|
+
export interface AddUsers {
|
104
|
+
// User IDs to follow.
|
105
|
+
user_id: string;
|
106
|
+
// Avatar to follow.
|
107
|
+
avatar: string;
|
108
|
+
// Username to follow.
|
109
|
+
username: string;
|
110
|
+
}
|
111
|
+
|
112
|
+
export interface UserChannelRemovedEvent {
|
113
|
+
// the channel id
|
114
|
+
channel_id: string;
|
115
|
+
// the user_id
|
116
|
+
user_ids: string[];
|
117
|
+
}
|
118
|
+
|
119
|
+
export interface UserClanRemovedEvent {
|
120
|
+
// the clan id
|
121
|
+
clan_id: string;
|
122
|
+
// the user_id
|
123
|
+
user_ids: string[];
|
103
124
|
}
|
104
125
|
|
105
126
|
/** Last seen message by user */
|
@@ -572,10 +593,10 @@ export interface Socket {
|
|
572
593
|
joinClanChat(clan_id: string) : Promise<ClanJoin>;
|
573
594
|
|
574
595
|
/** Join a chat channel on the server. */
|
575
|
-
joinChat(clan_id: string, channel_id: string,
|
596
|
+
joinChat(clan_id: string, channel_id: string, channel_type: number) : Promise<Channel>;
|
576
597
|
|
577
598
|
/** Leave a chat channel on the server. */
|
578
|
-
leaveChat(clan_id: string, channel_id: string,
|
599
|
+
leaveChat(clan_id: string, channel_id: string, channel_type: number) : Promise<void>;
|
579
600
|
|
580
601
|
/** Remove a chat message from a chat channel on the server. */
|
581
602
|
removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string) : Promise<ChannelMessageAck>;
|
@@ -662,6 +683,12 @@ export interface Socket {
|
|
662
683
|
/** Receive added user event */
|
663
684
|
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
664
685
|
|
686
|
+
/** Receive channel removed user event */
|
687
|
+
onuserchannelremoved: (user: UserChannelRemovedEvent) => void;
|
688
|
+
|
689
|
+
/** Receive clan removed user event */
|
690
|
+
onuserclanremoved: (user: UserClanRemovedEvent) => void;
|
691
|
+
|
665
692
|
// when someone start the voice room
|
666
693
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
667
694
|
|
@@ -826,6 +853,10 @@ export class DefaultSocket implements Socket {
|
|
826
853
|
this.oncustomstatus(<CustomStatusEvent>message.custom_status_event);
|
827
854
|
} else if (message.user_channel_added_event) {
|
828
855
|
this.onuserchanneladded(<UserChannelAddedEvent>message.user_channel_added_event);
|
856
|
+
} else if (message.user_channel_removed_event) {
|
857
|
+
this.onuserchannelremoved(<UserChannelRemovedEvent>message.user_channel_removed_event);
|
858
|
+
} else if (message.user_clan_removed_event) {
|
859
|
+
this.onuserclanremoved(<UserClanRemovedEvent>message.user_clan_removed_event);
|
829
860
|
} else {
|
830
861
|
if (this.verbose && window && window.console) {
|
831
862
|
console.log("Unrecognized message received: %o", message);
|
@@ -929,6 +960,18 @@ export class DefaultSocket implements Socket {
|
|
929
960
|
}
|
930
961
|
}
|
931
962
|
|
963
|
+
onuserchannelremoved(user: UserChannelRemovedEvent) {
|
964
|
+
if (this.verbose && window && window.console) {
|
965
|
+
console.log(user);
|
966
|
+
}
|
967
|
+
}
|
968
|
+
|
969
|
+
onuserclanremoved(user: UserClanRemovedEvent) {
|
970
|
+
if (this.verbose && window && window.console) {
|
971
|
+
console.log(user);
|
972
|
+
}
|
973
|
+
}
|
974
|
+
|
932
975
|
onnotification(notification: Notification) {
|
933
976
|
if (this.verbose && window && window.console) {
|
934
977
|
console.log(notification);
|
@@ -1057,13 +1100,13 @@ export class DefaultSocket implements Socket {
|
|
1057
1100
|
return response.clan_join;
|
1058
1101
|
}
|
1059
1102
|
|
1060
|
-
async joinChat(clan_id: string, channel_id: string,
|
1103
|
+
async joinChat(clan_id: string, channel_id: string, channel_type: number): Promise<Channel> {
|
1061
1104
|
|
1062
1105
|
const response = await this.send({
|
1063
1106
|
channel_join: {
|
1064
1107
|
clan_id: clan_id,
|
1065
1108
|
channel_id: channel_id,
|
1066
|
-
|
1109
|
+
channel_type: channel_type,
|
1067
1110
|
}
|
1068
1111
|
}
|
1069
1112
|
);
|
@@ -1071,8 +1114,8 @@ export class DefaultSocket implements Socket {
|
|
1071
1114
|
return response.channel;
|
1072
1115
|
}
|
1073
1116
|
|
1074
|
-
leaveChat(clan_id: string, channel_id: string,
|
1075
|
-
return this.send({channel_leave: {clan_id: clan_id, channel_id: channel_id,
|
1117
|
+
leaveChat(clan_id: string, channel_id: string, channel_type: number): Promise<void> {
|
1118
|
+
return this.send({channel_leave: {clan_id: clan_id, channel_id: channel_id, channel_type: channel_type}});
|
1076
1119
|
}
|
1077
1120
|
|
1078
1121
|
async removeChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck> {
|