mezon-js 2.7.2 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.gen.ts +92 -0
- package/client.ts +26 -0
- package/dist/api.gen.d.ts +16 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +82 -2
- package/dist/mezon-js.esm.mjs +82 -2
- package/dist/socket.d.ts +5 -1
- package/package.json +1 -1
- package/socket.ts +7 -3
package/api.gen.ts
CHANGED
|
@@ -146,6 +146,14 @@ export interface ApiAccountSteam {
|
|
|
146
146
|
vars?: Record<string, string>;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/** Add a role for channel. */
|
|
150
|
+
export interface ApiAddRoleChannelDescRequest {
|
|
151
|
+
//
|
|
152
|
+
channel_id?: string;
|
|
153
|
+
//
|
|
154
|
+
role_ids?: Array<string>;
|
|
155
|
+
}
|
|
156
|
+
|
|
149
157
|
/** */
|
|
150
158
|
export interface ApiCategoryDesc {
|
|
151
159
|
//
|
|
@@ -398,6 +406,14 @@ export interface ApiCreateRoleRequest {
|
|
|
398
406
|
title?: string;
|
|
399
407
|
}
|
|
400
408
|
|
|
409
|
+
/** Delete a role the user has access to. */
|
|
410
|
+
export interface ApiDeleteRoleRequest {
|
|
411
|
+
//
|
|
412
|
+
channel_id?: string;
|
|
413
|
+
//The id of a role.
|
|
414
|
+
role_id?: string;
|
|
415
|
+
}
|
|
416
|
+
|
|
401
417
|
/** Storage objects to delete. */
|
|
402
418
|
export interface ApiDeleteStorageObjectId {
|
|
403
419
|
//The collection which stores the object.
|
|
@@ -654,6 +670,10 @@ export interface ApiRole {
|
|
|
654
670
|
slug?: string;
|
|
655
671
|
//
|
|
656
672
|
title?: string;
|
|
673
|
+
//
|
|
674
|
+
role_channel_active?: string;
|
|
675
|
+
//
|
|
676
|
+
channel_id?: string;
|
|
657
677
|
}
|
|
658
678
|
|
|
659
679
|
/** A list of role description, usually a result of a list operation. */
|
|
@@ -3462,6 +3482,78 @@ export class MezonApi {
|
|
|
3462
3482
|
]);
|
|
3463
3483
|
}
|
|
3464
3484
|
|
|
3485
|
+
/** */
|
|
3486
|
+
addRolesChannelDesc(bearerToken: string,
|
|
3487
|
+
body:ApiAddRoleChannelDescRequest,
|
|
3488
|
+
options: any = {}): Promise<any> {
|
|
3489
|
+
|
|
3490
|
+
if (body === null || body === undefined) {
|
|
3491
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3492
|
+
}
|
|
3493
|
+
const urlPath = "/v2/rolechannel/addrole";
|
|
3494
|
+
const queryParams = new Map<string, any>();
|
|
3495
|
+
|
|
3496
|
+
let bodyJson : string = "";
|
|
3497
|
+
bodyJson = JSON.stringify(body || {});
|
|
3498
|
+
|
|
3499
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3500
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3501
|
+
if (bearerToken) {
|
|
3502
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
return Promise.race([
|
|
3506
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3507
|
+
if (response.status == 204) {
|
|
3508
|
+
return response;
|
|
3509
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3510
|
+
return response.json();
|
|
3511
|
+
} else {
|
|
3512
|
+
throw response;
|
|
3513
|
+
}
|
|
3514
|
+
}),
|
|
3515
|
+
new Promise((_, reject) =>
|
|
3516
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3517
|
+
),
|
|
3518
|
+
]);
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
/** Update a role when Delete a role by ID. */
|
|
3522
|
+
deleteRoleChannelDesc(bearerToken: string,
|
|
3523
|
+
body:ApiDeleteRoleRequest,
|
|
3524
|
+
options: any = {}): Promise<any> {
|
|
3525
|
+
|
|
3526
|
+
if (body === null || body === undefined) {
|
|
3527
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3528
|
+
}
|
|
3529
|
+
const urlPath = "/v2/rolechannel/delete";
|
|
3530
|
+
const queryParams = new Map<string, any>();
|
|
3531
|
+
|
|
3532
|
+
let bodyJson : string = "";
|
|
3533
|
+
bodyJson = JSON.stringify(body || {});
|
|
3534
|
+
|
|
3535
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3536
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
3537
|
+
if (bearerToken) {
|
|
3538
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
return Promise.race([
|
|
3542
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3543
|
+
if (response.status == 204) {
|
|
3544
|
+
return response;
|
|
3545
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3546
|
+
return response.json();
|
|
3547
|
+
} else {
|
|
3548
|
+
throw response;
|
|
3549
|
+
}
|
|
3550
|
+
}),
|
|
3551
|
+
new Promise((_, reject) =>
|
|
3552
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3553
|
+
),
|
|
3554
|
+
]);
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3465
3557
|
/** List user roles */
|
|
3466
3558
|
listRoles(bearerToken: string,
|
|
3467
3559
|
limit?:number,
|
package/client.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
ApiChannelDescList,
|
|
29
29
|
ApiChannelDescription,
|
|
30
30
|
ApiCreateChannelDescRequest,
|
|
31
|
+
ApiDeleteRoleRequest,
|
|
31
32
|
ApiClanDescList,
|
|
32
33
|
ApiCreateClanDescRequest,
|
|
33
34
|
ApiClanDesc,
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
ApiRoleUserList,
|
|
39
40
|
ApiRole,
|
|
40
41
|
ApiCreateRoleRequest,
|
|
42
|
+
ApiAddRoleChannelDescRequest,
|
|
41
43
|
ApiCreateCategoryDescRequest,
|
|
42
44
|
ApiUpdateCategoryDescRequest,
|
|
43
45
|
ApiDeleteStorageObjectsRequest,
|
|
@@ -733,6 +735,30 @@ export class Client {
|
|
|
733
735
|
});
|
|
734
736
|
}
|
|
735
737
|
|
|
738
|
+
/** add role for channel. */
|
|
739
|
+
async addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean> {
|
|
740
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
741
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
742
|
+
await this.sessionRefresh(session);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
return this.apiClient.addRolesChannelDesc(session.token, request).then((response: ApiRole) => {
|
|
746
|
+
return response !== undefined;
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/** Update action role when delete role */
|
|
751
|
+
async deleteRoleChannelDesc(session: Session, request:ApiDeleteRoleRequest): Promise<boolean> {
|
|
752
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
753
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
754
|
+
await this.sessionRefresh(session);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
return this.apiClient.deleteRoleChannelDesc(session.token, request).then((response: any) => {
|
|
758
|
+
return response !== undefined;
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
|
|
736
762
|
/** A socket created with the client's configuration. */
|
|
737
763
|
createSocket(useSSL = false, verbose: boolean = false, adapter : WebSocketAdapter = new WebSocketAdapterText(), sendTimeoutMs : number = DefaultSocket.DefaultSendTimeoutMs): Socket {
|
|
738
764
|
return new DefaultSocket(this.host, this.port, useSSL, verbose, adapter, sendTimeoutMs);
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -83,6 +83,11 @@ export interface ApiAccountSteam {
|
|
|
83
83
|
token?: string;
|
|
84
84
|
vars?: Record<string, string>;
|
|
85
85
|
}
|
|
86
|
+
/** Add a role for channel. */
|
|
87
|
+
export interface ApiAddRoleChannelDescRequest {
|
|
88
|
+
channel_id?: string;
|
|
89
|
+
role_ids?: Array<string>;
|
|
90
|
+
}
|
|
86
91
|
/** */
|
|
87
92
|
export interface ApiCategoryDesc {
|
|
88
93
|
category_id?: string;
|
|
@@ -226,6 +231,11 @@ export interface ApiCreateRoleRequest {
|
|
|
226
231
|
role_icon?: string;
|
|
227
232
|
title?: string;
|
|
228
233
|
}
|
|
234
|
+
/** Delete a role the user has access to. */
|
|
235
|
+
export interface ApiDeleteRoleRequest {
|
|
236
|
+
channel_id?: string;
|
|
237
|
+
role_id?: string;
|
|
238
|
+
}
|
|
229
239
|
/** Storage objects to delete. */
|
|
230
240
|
export interface ApiDeleteStorageObjectId {
|
|
231
241
|
collection?: string;
|
|
@@ -375,6 +385,8 @@ export interface ApiRole {
|
|
|
375
385
|
role_user_list?: ApiRoleUserList;
|
|
376
386
|
slug?: string;
|
|
377
387
|
title?: string;
|
|
388
|
+
role_channel_active?: string;
|
|
389
|
+
channel_id?: string;
|
|
378
390
|
}
|
|
379
391
|
/** A list of role description, usually a result of a list operation. */
|
|
380
392
|
export interface ApiRoleList {
|
|
@@ -675,6 +687,10 @@ export declare class MezonApi {
|
|
|
675
687
|
listNotifications(bearerToken: string, limit?: number, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
|
|
676
688
|
/** */
|
|
677
689
|
GetPermissionOfUserInTheClan(bearerToken: string, clanId: string, options?: any): Promise<ApiPermissionList>;
|
|
690
|
+
/** */
|
|
691
|
+
addRolesChannelDesc(bearerToken: string, body: ApiAddRoleChannelDescRequest, options?: any): Promise<any>;
|
|
692
|
+
/** Update a role when Delete a role by ID. */
|
|
693
|
+
deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
|
|
678
694
|
/** List user roles */
|
|
679
695
|
listRoles(bearerToken: string, limit?: number, state?: number, cursor?: string, clanId?: string, options?: any): Promise<ApiRoleList>;
|
|
680
696
|
/** Create a new role for clan. */
|
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, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList } 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, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -389,6 +389,10 @@ export declare class Client {
|
|
|
389
389
|
createCategoryDesc(session: Session, request: ApiCreateCategoryDescRequest): Promise<ApiCategoryDesc>;
|
|
390
390
|
/** Create a new role for clan. */
|
|
391
391
|
createRole(session: Session, request: ApiCreateRoleRequest): Promise<ApiRole>;
|
|
392
|
+
/** add role for channel. */
|
|
393
|
+
addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean>;
|
|
394
|
+
/** Update action role when delete role */
|
|
395
|
+
deleteRoleChannelDesc(session: Session, request: ApiDeleteRoleRequest): Promise<boolean>;
|
|
392
396
|
/** A socket created with the client's configuration. */
|
|
393
397
|
createSocket(useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number): Socket;
|
|
394
398
|
/** Delete one or more users by ID or username. */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -2643,6 +2643,64 @@ var MezonApi = class {
|
|
|
2643
2643
|
)
|
|
2644
2644
|
]);
|
|
2645
2645
|
}
|
|
2646
|
+
/** */
|
|
2647
|
+
addRolesChannelDesc(bearerToken, body, options = {}) {
|
|
2648
|
+
if (body === null || body === void 0) {
|
|
2649
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2650
|
+
}
|
|
2651
|
+
const urlPath = "/v2/rolechannel/addrole";
|
|
2652
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2653
|
+
let bodyJson = "";
|
|
2654
|
+
bodyJson = JSON.stringify(body || {});
|
|
2655
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2656
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2657
|
+
if (bearerToken) {
|
|
2658
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2659
|
+
}
|
|
2660
|
+
return Promise.race([
|
|
2661
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2662
|
+
if (response.status == 204) {
|
|
2663
|
+
return response;
|
|
2664
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2665
|
+
return response.json();
|
|
2666
|
+
} else {
|
|
2667
|
+
throw response;
|
|
2668
|
+
}
|
|
2669
|
+
}),
|
|
2670
|
+
new Promise(
|
|
2671
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2672
|
+
)
|
|
2673
|
+
]);
|
|
2674
|
+
}
|
|
2675
|
+
/** Update a role when Delete a role by ID. */
|
|
2676
|
+
deleteRoleChannelDesc(bearerToken, body, options = {}) {
|
|
2677
|
+
if (body === null || body === void 0) {
|
|
2678
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2679
|
+
}
|
|
2680
|
+
const urlPath = "/v2/rolechannel/delete";
|
|
2681
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2682
|
+
let bodyJson = "";
|
|
2683
|
+
bodyJson = JSON.stringify(body || {});
|
|
2684
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2685
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
2686
|
+
if (bearerToken) {
|
|
2687
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2688
|
+
}
|
|
2689
|
+
return Promise.race([
|
|
2690
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2691
|
+
if (response.status == 204) {
|
|
2692
|
+
return response;
|
|
2693
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2694
|
+
return response.json();
|
|
2695
|
+
} else {
|
|
2696
|
+
throw response;
|
|
2697
|
+
}
|
|
2698
|
+
}),
|
|
2699
|
+
new Promise(
|
|
2700
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2701
|
+
)
|
|
2702
|
+
]);
|
|
2703
|
+
}
|
|
2646
2704
|
/** List user roles */
|
|
2647
2705
|
listRoles(bearerToken, limit, state, cursor, clanId, options = {}) {
|
|
2648
2706
|
const urlPath = "/v2/roles";
|
|
@@ -3806,9 +3864,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
3806
3864
|
unfollowUsers(user_ids) {
|
|
3807
3865
|
return this.send({ status_unfollow: { user_ids } });
|
|
3808
3866
|
}
|
|
3809
|
-
updateChatMessage(channel_id, message_id, content) {
|
|
3867
|
+
updateChatMessage(channel_id, channel_label, mode, message_id, content) {
|
|
3810
3868
|
return __async(this, null, function* () {
|
|
3811
|
-
const response = yield this.send({ channel_message_update: { channel_id, message_id, content } });
|
|
3869
|
+
const response = yield this.send({ channel_message_update: { channel_id, channel_label, message_id, content, mode } });
|
|
3812
3870
|
return response.channel_message_ack;
|
|
3813
3871
|
});
|
|
3814
3872
|
}
|
|
@@ -4136,6 +4194,28 @@ var Client = class {
|
|
|
4136
4194
|
});
|
|
4137
4195
|
});
|
|
4138
4196
|
}
|
|
4197
|
+
/** add role for channel. */
|
|
4198
|
+
addRolesChannelDesc(session, request) {
|
|
4199
|
+
return __async(this, null, function* () {
|
|
4200
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
4201
|
+
yield this.sessionRefresh(session);
|
|
4202
|
+
}
|
|
4203
|
+
return this.apiClient.addRolesChannelDesc(session.token, request).then((response) => {
|
|
4204
|
+
return response !== void 0;
|
|
4205
|
+
});
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
/** Update action role when delete role */
|
|
4209
|
+
deleteRoleChannelDesc(session, request) {
|
|
4210
|
+
return __async(this, null, function* () {
|
|
4211
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
4212
|
+
yield this.sessionRefresh(session);
|
|
4213
|
+
}
|
|
4214
|
+
return this.apiClient.deleteRoleChannelDesc(session.token, request).then((response) => {
|
|
4215
|
+
return response !== void 0;
|
|
4216
|
+
});
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4139
4219
|
/** A socket created with the client's configuration. */
|
|
4140
4220
|
createSocket(useSSL = false, verbose = false, adapter = new WebSocketAdapterText(), sendTimeoutMs = DefaultSocket.DefaultSendTimeoutMs) {
|
|
4141
4221
|
return new DefaultSocket(this.host, this.port, useSSL, verbose, adapter, sendTimeoutMs);
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -2615,6 +2615,64 @@ var MezonApi = class {
|
|
|
2615
2615
|
)
|
|
2616
2616
|
]);
|
|
2617
2617
|
}
|
|
2618
|
+
/** */
|
|
2619
|
+
addRolesChannelDesc(bearerToken, body, options = {}) {
|
|
2620
|
+
if (body === null || body === void 0) {
|
|
2621
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2622
|
+
}
|
|
2623
|
+
const urlPath = "/v2/rolechannel/addrole";
|
|
2624
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2625
|
+
let bodyJson = "";
|
|
2626
|
+
bodyJson = JSON.stringify(body || {});
|
|
2627
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2628
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2629
|
+
if (bearerToken) {
|
|
2630
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2631
|
+
}
|
|
2632
|
+
return Promise.race([
|
|
2633
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2634
|
+
if (response.status == 204) {
|
|
2635
|
+
return response;
|
|
2636
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2637
|
+
return response.json();
|
|
2638
|
+
} else {
|
|
2639
|
+
throw response;
|
|
2640
|
+
}
|
|
2641
|
+
}),
|
|
2642
|
+
new Promise(
|
|
2643
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2644
|
+
)
|
|
2645
|
+
]);
|
|
2646
|
+
}
|
|
2647
|
+
/** Update a role when Delete a role by ID. */
|
|
2648
|
+
deleteRoleChannelDesc(bearerToken, body, options = {}) {
|
|
2649
|
+
if (body === null || body === void 0) {
|
|
2650
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2651
|
+
}
|
|
2652
|
+
const urlPath = "/v2/rolechannel/delete";
|
|
2653
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2654
|
+
let bodyJson = "";
|
|
2655
|
+
bodyJson = JSON.stringify(body || {});
|
|
2656
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2657
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
2658
|
+
if (bearerToken) {
|
|
2659
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2660
|
+
}
|
|
2661
|
+
return Promise.race([
|
|
2662
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2663
|
+
if (response.status == 204) {
|
|
2664
|
+
return response;
|
|
2665
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2666
|
+
return response.json();
|
|
2667
|
+
} else {
|
|
2668
|
+
throw response;
|
|
2669
|
+
}
|
|
2670
|
+
}),
|
|
2671
|
+
new Promise(
|
|
2672
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2673
|
+
)
|
|
2674
|
+
]);
|
|
2675
|
+
}
|
|
2618
2676
|
/** List user roles */
|
|
2619
2677
|
listRoles(bearerToken, limit, state, cursor, clanId, options = {}) {
|
|
2620
2678
|
const urlPath = "/v2/roles";
|
|
@@ -3778,9 +3836,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
3778
3836
|
unfollowUsers(user_ids) {
|
|
3779
3837
|
return this.send({ status_unfollow: { user_ids } });
|
|
3780
3838
|
}
|
|
3781
|
-
updateChatMessage(channel_id, message_id, content) {
|
|
3839
|
+
updateChatMessage(channel_id, channel_label, mode, message_id, content) {
|
|
3782
3840
|
return __async(this, null, function* () {
|
|
3783
|
-
const response = yield this.send({ channel_message_update: { channel_id, message_id, content } });
|
|
3841
|
+
const response = yield this.send({ channel_message_update: { channel_id, channel_label, message_id, content, mode } });
|
|
3784
3842
|
return response.channel_message_ack;
|
|
3785
3843
|
});
|
|
3786
3844
|
}
|
|
@@ -4108,6 +4166,28 @@ var Client = class {
|
|
|
4108
4166
|
});
|
|
4109
4167
|
});
|
|
4110
4168
|
}
|
|
4169
|
+
/** add role for channel. */
|
|
4170
|
+
addRolesChannelDesc(session, request) {
|
|
4171
|
+
return __async(this, null, function* () {
|
|
4172
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
4173
|
+
yield this.sessionRefresh(session);
|
|
4174
|
+
}
|
|
4175
|
+
return this.apiClient.addRolesChannelDesc(session.token, request).then((response) => {
|
|
4176
|
+
return response !== void 0;
|
|
4177
|
+
});
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
/** Update action role when delete role */
|
|
4181
|
+
deleteRoleChannelDesc(session, request) {
|
|
4182
|
+
return __async(this, null, function* () {
|
|
4183
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
4184
|
+
yield this.sessionRefresh(session);
|
|
4185
|
+
}
|
|
4186
|
+
return this.apiClient.deleteRoleChannelDesc(session.token, request).then((response) => {
|
|
4187
|
+
return response !== void 0;
|
|
4188
|
+
});
|
|
4189
|
+
});
|
|
4190
|
+
}
|
|
4111
4191
|
/** A socket created with the client's configuration. */
|
|
4112
4192
|
createSocket(useSSL = false, verbose = false, adapter = new WebSocketAdapterText(), sendTimeoutMs = DefaultSocket.DefaultSendTimeoutMs) {
|
|
4113
4193
|
return new DefaultSocket(this.host, this.port, useSSL, verbose, adapter, sendTimeoutMs);
|
package/dist/socket.d.ts
CHANGED
|
@@ -215,10 +215,14 @@ interface ChannelMessageUpdate {
|
|
|
215
215
|
channel_message_update: {
|
|
216
216
|
/** The server-assigned channel ID. */
|
|
217
217
|
channel_id: string;
|
|
218
|
+
/** The server-assigned channel label. */
|
|
219
|
+
channel_label: string;
|
|
218
220
|
/** A unique ID for the chat message to be updated. */
|
|
219
221
|
message_id: string;
|
|
220
222
|
/** The content payload. */
|
|
221
223
|
content: any;
|
|
224
|
+
/** The mode payload. */
|
|
225
|
+
mode: number;
|
|
222
226
|
};
|
|
223
227
|
}
|
|
224
228
|
/** Remove a message previously sent to a realtime chat channel. */
|
|
@@ -655,7 +659,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
655
659
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
|
656
660
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
|
657
661
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
|
658
|
-
updateChatMessage(channel_id: string, message_id: string, content: any): Promise<ChannelMessageAck>;
|
|
662
|
+
updateChatMessage(channel_id: string, channel_label: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
|
659
663
|
updateStatus(status?: string): Promise<void>;
|
|
660
664
|
writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>): Promise<ChannelMessageAck>;
|
|
661
665
|
writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -295,10 +295,14 @@ interface ChannelMessageUpdate {
|
|
|
295
295
|
channel_message_update: {
|
|
296
296
|
/** The server-assigned channel ID. */
|
|
297
297
|
channel_id: string,
|
|
298
|
+
/** The server-assigned channel label. */
|
|
299
|
+
channel_label: string,
|
|
298
300
|
/** A unique ID for the chat message to be updated. */
|
|
299
301
|
message_id: string,
|
|
300
302
|
/** The content payload. */
|
|
301
|
-
content: any
|
|
303
|
+
content: any,
|
|
304
|
+
/** The mode payload. */
|
|
305
|
+
mode: number;
|
|
302
306
|
};
|
|
303
307
|
}
|
|
304
308
|
|
|
@@ -1229,8 +1233,8 @@ export class DefaultSocket implements Socket {
|
|
|
1229
1233
|
return this.send({status_unfollow: {user_ids: user_ids}});
|
|
1230
1234
|
}
|
|
1231
1235
|
|
|
1232
|
-
async updateChatMessage(channel_id: string, message_id : string, content: any): Promise<ChannelMessageAck> {
|
|
1233
|
-
const response = await this.send({channel_message_update: {channel_id: channel_id, message_id: message_id, content: content}});
|
|
1236
|
+
async updateChatMessage(channel_id: string, channel_label: string, mode: number, message_id : string, content: any): Promise<ChannelMessageAck> {
|
|
1237
|
+
const response = await this.send({channel_message_update: {channel_id: channel_id,channel_label:channel_label, message_id: message_id, content: content, mode: mode}});
|
|
1234
1238
|
return response.channel_message_ack;
|
|
1235
1239
|
}
|
|
1236
1240
|
|