mezon-js 2.8.38 → 2.8.40
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 +8 -51
- package/client.ts +4 -14
- package/dist/api.gen.d.ts +5 -13
- package/dist/client.d.ts +3 -4
- package/dist/mezon-js.cjs.js +8 -40
- package/dist/mezon-js.esm.mjs +8 -40
- package/dist/socket.d.ts +12 -1
- package/package.json +1 -1
- package/socket.ts +26 -2
package/api.gen.ts
CHANGED
|
@@ -165,6 +165,8 @@ export interface MezonUpdateRoleBody {
|
|
|
165
165
|
//
|
|
166
166
|
allow_mention?: number;
|
|
167
167
|
//
|
|
168
|
+
clan_id?: string;
|
|
169
|
+
//
|
|
168
170
|
color?: string;
|
|
169
171
|
//
|
|
170
172
|
description?: string;
|
|
@@ -183,7 +185,7 @@ export interface MezonUpdateRoleBody {
|
|
|
183
185
|
/** Delete a role the user has access to. */
|
|
184
186
|
export interface MezonUpdateRoleDeleteBody {
|
|
185
187
|
//
|
|
186
|
-
|
|
188
|
+
clan_id?: string;
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
/** */
|
|
@@ -532,6 +534,8 @@ export interface ApiChannelMessage {
|
|
|
532
534
|
username?: string;
|
|
533
535
|
// channel mode
|
|
534
536
|
mode?: number;
|
|
537
|
+
// hide editted
|
|
538
|
+
hideEditted?: boolean;
|
|
535
539
|
}
|
|
536
540
|
|
|
537
541
|
/** */
|
|
@@ -786,6 +790,8 @@ export interface ApiDeleteEventRequest {
|
|
|
786
790
|
export interface ApiDeleteRoleRequest {
|
|
787
791
|
//
|
|
788
792
|
channel_id?: string;
|
|
793
|
+
//
|
|
794
|
+
clan_id?: string;
|
|
789
795
|
//The id of a role.
|
|
790
796
|
role_id?: string;
|
|
791
797
|
}
|
|
@@ -1165,20 +1171,6 @@ export interface ApiPermissionList {
|
|
|
1165
1171
|
permissions?: Array<ApiPermission>;
|
|
1166
1172
|
}
|
|
1167
1173
|
|
|
1168
|
-
/** */
|
|
1169
|
-
export interface ApiPermissionRoleChannel {
|
|
1170
|
-
//
|
|
1171
|
-
active?: boolean;
|
|
1172
|
-
//
|
|
1173
|
-
permission_id?: string;
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
/** A list of permission role channel. */
|
|
1177
|
-
export interface ApiPermissionRoleChannelList {
|
|
1178
|
-
//A list of permission.
|
|
1179
|
-
permission_role_channel?: Array<ApiPermissionRoleChannel>;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
1174
|
/** */
|
|
1183
1175
|
export interface ApiPermissionUpdate {
|
|
1184
1176
|
//
|
|
@@ -5300,41 +5292,6 @@ export class MezonApi {
|
|
|
5300
5292
|
]);
|
|
5301
5293
|
}
|
|
5302
5294
|
|
|
5303
|
-
/** List permission role channel */
|
|
5304
|
-
getListPermissionRoleChannel(bearerToken: string,
|
|
5305
|
-
roleId?:string,
|
|
5306
|
-
channelId?:string,
|
|
5307
|
-
options: any = {}): Promise<ApiPermissionRoleChannelList> {
|
|
5308
|
-
|
|
5309
|
-
const urlPath = "/v2/permissionrolechannel/get";
|
|
5310
|
-
const queryParams = new Map<string, any>();
|
|
5311
|
-
queryParams.set("role_id", roleId);
|
|
5312
|
-
queryParams.set("channel_id", channelId);
|
|
5313
|
-
|
|
5314
|
-
let bodyJson : string = "";
|
|
5315
|
-
|
|
5316
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5317
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
5318
|
-
if (bearerToken) {
|
|
5319
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5320
|
-
}
|
|
5321
|
-
|
|
5322
|
-
return Promise.race([
|
|
5323
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5324
|
-
if (response.status == 204) {
|
|
5325
|
-
return response;
|
|
5326
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
5327
|
-
return response.json();
|
|
5328
|
-
} else {
|
|
5329
|
-
throw response;
|
|
5330
|
-
}
|
|
5331
|
-
}),
|
|
5332
|
-
new Promise((_, reject) =>
|
|
5333
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5334
|
-
),
|
|
5335
|
-
]);
|
|
5336
|
-
}
|
|
5337
|
-
|
|
5338
5295
|
/** set permission role channel. */
|
|
5339
5296
|
setRoleChannelPermission(bearerToken: string,
|
|
5340
5297
|
body:ApiUpdateRoleChannelRequest,
|
|
@@ -5810,7 +5767,7 @@ export class MezonApi {
|
|
|
5810
5767
|
/** Update fields in a given role. */
|
|
5811
5768
|
updateRole(bearerToken: string,
|
|
5812
5769
|
roleId:string,
|
|
5813
|
-
body:
|
|
5770
|
+
body:MezonUpdateRoleBody,
|
|
5814
5771
|
options: any = {}): Promise<any> {
|
|
5815
5772
|
|
|
5816
5773
|
if (roleId === null || roleId === undefined) {
|
package/client.ts
CHANGED
|
@@ -93,11 +93,11 @@ import {
|
|
|
93
93
|
ApiClanStickerAddRequest,
|
|
94
94
|
MezonUpdateClanStickerByIdBody,
|
|
95
95
|
MezonChangeChannelCategoryBody,
|
|
96
|
-
ApiPermissionRoleChannelList,
|
|
97
96
|
ApiUpdateRoleChannelRequest,
|
|
98
97
|
ApiAddAppRequest,
|
|
99
98
|
ApiAppList,
|
|
100
99
|
ApiApp,
|
|
100
|
+
MezonUpdateRoleDeleteBody,
|
|
101
101
|
} from "./api.gen";
|
|
102
102
|
|
|
103
103
|
import { Session } from "./session";
|
|
@@ -453,6 +453,8 @@ export interface ApiUpdateRoleRequest {
|
|
|
453
453
|
remove_user_ids: string[];
|
|
454
454
|
/** The permissions to remove. */
|
|
455
455
|
remove_permission_ids: string[];
|
|
456
|
+
//
|
|
457
|
+
clan_id: string
|
|
456
458
|
}
|
|
457
459
|
|
|
458
460
|
/** A client for Mezon server. */
|
|
@@ -1310,7 +1312,7 @@ export class Client {
|
|
|
1310
1312
|
}
|
|
1311
1313
|
|
|
1312
1314
|
/** Update action role when delete role */
|
|
1313
|
-
async updateRoleDelete(session: Session, roleId:string, request:
|
|
1315
|
+
async updateRoleDelete(session: Session, roleId:string, request:MezonUpdateRoleDeleteBody): Promise<boolean> {
|
|
1314
1316
|
if (this.autoRefreshSession && session.refresh_token &&
|
|
1315
1317
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
1316
1318
|
await this.sessionRefresh(session);
|
|
@@ -2212,18 +2214,6 @@ async changeChannelCategory(session: Session, id: string, request: MezonChangeCh
|
|
|
2212
2214
|
})
|
|
2213
2215
|
}
|
|
2214
2216
|
|
|
2215
|
-
/** */
|
|
2216
|
-
async getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList> {
|
|
2217
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
|
2218
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2219
|
-
await this.sessionRefresh(session);
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response: ApiPermissionRoleChannelList) => {
|
|
2223
|
-
return Promise.resolve(response);
|
|
2224
|
-
});
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
2217
|
/** */
|
|
2228
2218
|
async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean> {
|
|
2229
2219
|
if (this.autoRefreshSession && session.refresh_token &&
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export interface MezonUpdateRoleBody {
|
|
|
94
94
|
active_permission_ids?: Array<string>;
|
|
95
95
|
add_user_ids?: Array<string>;
|
|
96
96
|
allow_mention?: number;
|
|
97
|
+
clan_id?: string;
|
|
97
98
|
color?: string;
|
|
98
99
|
description?: string;
|
|
99
100
|
display_online?: number;
|
|
@@ -104,7 +105,7 @@ export interface MezonUpdateRoleBody {
|
|
|
104
105
|
}
|
|
105
106
|
/** Delete a role the user has access to. */
|
|
106
107
|
export interface MezonUpdateRoleDeleteBody {
|
|
107
|
-
|
|
108
|
+
clan_id?: string;
|
|
108
109
|
}
|
|
109
110
|
/** */
|
|
110
111
|
export interface MezonUpdateUserProfileByClanBody {
|
|
@@ -304,6 +305,7 @@ export interface ApiChannelMessage {
|
|
|
304
305
|
update_time_ms?: number;
|
|
305
306
|
username?: string;
|
|
306
307
|
mode?: number;
|
|
308
|
+
hideEditted?: boolean;
|
|
307
309
|
}
|
|
308
310
|
/** */
|
|
309
311
|
export interface ApiChannelMessageHeader {
|
|
@@ -451,6 +453,7 @@ export interface ApiDeleteEventRequest {
|
|
|
451
453
|
/** Delete a role the user has access to. */
|
|
452
454
|
export interface ApiDeleteRoleRequest {
|
|
453
455
|
channel_id?: string;
|
|
456
|
+
clan_id?: string;
|
|
454
457
|
role_id?: string;
|
|
455
458
|
}
|
|
456
459
|
/** Storage objects to delete. */
|
|
@@ -677,15 +680,6 @@ export interface ApiPermissionList {
|
|
|
677
680
|
permissions?: Array<ApiPermission>;
|
|
678
681
|
}
|
|
679
682
|
/** */
|
|
680
|
-
export interface ApiPermissionRoleChannel {
|
|
681
|
-
active?: boolean;
|
|
682
|
-
permission_id?: string;
|
|
683
|
-
}
|
|
684
|
-
/** A list of permission role channel. */
|
|
685
|
-
export interface ApiPermissionRoleChannelList {
|
|
686
|
-
permission_role_channel?: Array<ApiPermissionRoleChannel>;
|
|
687
|
-
}
|
|
688
|
-
/** */
|
|
689
683
|
export interface ApiPermissionUpdate {
|
|
690
684
|
permission_id?: string;
|
|
691
685
|
type?: number;
|
|
@@ -1185,8 +1179,6 @@ export declare class MezonApi {
|
|
|
1185
1179
|
deleteNotiReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<any>;
|
|
1186
1180
|
/** */
|
|
1187
1181
|
setNotificationReactMessage(bearerToken: string, body: ApiNotificationChannel, options?: any): Promise<any>;
|
|
1188
|
-
/** List permission role channel */
|
|
1189
|
-
getListPermissionRoleChannel(bearerToken: string, roleId?: string, channelId?: string, options?: any): Promise<ApiPermissionRoleChannelList>;
|
|
1190
1182
|
/** set permission role channel. */
|
|
1191
1183
|
setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
|
|
1192
1184
|
/** Get permission list */
|
|
@@ -1214,7 +1206,7 @@ export declare class MezonApi {
|
|
|
1214
1206
|
/** Delete a role by ID. */
|
|
1215
1207
|
deleteRole(bearerToken: string, roleId: string, channelId?: string, options?: any): Promise<any>;
|
|
1216
1208
|
/** Update fields in a given role. */
|
|
1217
|
-
updateRole(bearerToken: string, roleId: string, body:
|
|
1209
|
+
updateRole(bearerToken: string, roleId: string, body: MezonUpdateRoleBody, options?: any): Promise<any>;
|
|
1218
1210
|
/** List role permissions */
|
|
1219
1211
|
listRolePermissions(bearerToken: string, roleId: string, options?: any): Promise<ApiPermissionList>;
|
|
1220
1212
|
/** List role permissions */
|
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, ApiEvent, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody,
|
|
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, ApiEvent, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateRoleDeleteBody } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -308,6 +308,7 @@ export interface ApiUpdateRoleRequest {
|
|
|
308
308
|
remove_user_ids: string[];
|
|
309
309
|
/** The permissions to remove. */
|
|
310
310
|
remove_permission_ids: string[];
|
|
311
|
+
clan_id: string;
|
|
311
312
|
}
|
|
312
313
|
/** A client for Mezon server. */
|
|
313
314
|
export declare class Client {
|
|
@@ -417,7 +418,7 @@ export declare class Client {
|
|
|
417
418
|
/** List permission */
|
|
418
419
|
getListPermission(session: Session): Promise<ApiPermissionList>;
|
|
419
420
|
/** Update action role when delete role */
|
|
420
|
-
updateRoleDelete(session: Session, roleId: string, request:
|
|
421
|
+
updateRoleDelete(session: Session, roleId: string, request: MezonUpdateRoleDeleteBody): Promise<boolean>;
|
|
421
422
|
/** List user roles */
|
|
422
423
|
listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
|
|
423
424
|
/** List user roles */
|
|
@@ -535,8 +536,6 @@ export declare class Client {
|
|
|
535
536
|
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
|
536
537
|
changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
|
|
537
538
|
/** */
|
|
538
|
-
getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
|
|
539
|
-
/** */
|
|
540
539
|
setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
|
|
541
540
|
addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
|
|
542
541
|
getApp(session: Session, id: string): Promise<ApiApp>;
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -3468,33 +3468,6 @@ var MezonApi = class {
|
|
|
3468
3468
|
)
|
|
3469
3469
|
]);
|
|
3470
3470
|
}
|
|
3471
|
-
/** List permission role channel */
|
|
3472
|
-
getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
|
|
3473
|
-
const urlPath = "/v2/permissionrolechannel/get";
|
|
3474
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
3475
|
-
queryParams.set("role_id", roleId);
|
|
3476
|
-
queryParams.set("channel_id", channelId);
|
|
3477
|
-
let bodyJson = "";
|
|
3478
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3479
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3480
|
-
if (bearerToken) {
|
|
3481
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3482
|
-
}
|
|
3483
|
-
return Promise.race([
|
|
3484
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3485
|
-
if (response.status == 204) {
|
|
3486
|
-
return response;
|
|
3487
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
3488
|
-
return response.json();
|
|
3489
|
-
} else {
|
|
3490
|
-
throw response;
|
|
3491
|
-
}
|
|
3492
|
-
}),
|
|
3493
|
-
new Promise(
|
|
3494
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3495
|
-
)
|
|
3496
|
-
]);
|
|
3497
|
-
}
|
|
3498
3471
|
/** set permission role channel. */
|
|
3499
3472
|
setRoleChannelPermission(bearerToken, body, options = {}) {
|
|
3500
3473
|
if (body === null || body === void 0) {
|
|
@@ -5015,9 +4988,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
5015
4988
|
unfollowUsers(user_ids) {
|
|
5016
4989
|
return this.send({ status_unfollow: { user_ids } });
|
|
5017
4990
|
}
|
|
5018
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments,
|
|
4991
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
|
|
5019
4992
|
return __async(this, null, function* () {
|
|
5020
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode,
|
|
4993
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hideEditted } });
|
|
5021
4994
|
return response.channel_message_ack;
|
|
5022
4995
|
});
|
|
5023
4996
|
}
|
|
@@ -5096,6 +5069,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
5096
5069
|
return response.hashtag_dm_list_event;
|
|
5097
5070
|
});
|
|
5098
5071
|
}
|
|
5072
|
+
GetPermissionByRoleIdChannelId(role_id, channel_id) {
|
|
5073
|
+
return __async(this, null, function* () {
|
|
5074
|
+
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
|
|
5075
|
+
return response.permission_role_channel_list_event;
|
|
5076
|
+
});
|
|
5077
|
+
}
|
|
5099
5078
|
listClanStickersByClanId(clan_id) {
|
|
5100
5079
|
return __async(this, null, function* () {
|
|
5101
5080
|
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
|
@@ -6764,17 +6743,6 @@ var Client = class {
|
|
|
6764
6743
|
});
|
|
6765
6744
|
}
|
|
6766
6745
|
/** */
|
|
6767
|
-
getListPermissionRoleChannel(session, roleId, channelId) {
|
|
6768
|
-
return __async(this, null, function* () {
|
|
6769
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6770
|
-
yield this.sessionRefresh(session);
|
|
6771
|
-
}
|
|
6772
|
-
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
|
|
6773
|
-
return Promise.resolve(response);
|
|
6774
|
-
});
|
|
6775
|
-
});
|
|
6776
|
-
}
|
|
6777
|
-
/** */
|
|
6778
6746
|
setRoleChannelPermission(session, request) {
|
|
6779
6747
|
return __async(this, null, function* () {
|
|
6780
6748
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -3439,33 +3439,6 @@ var MezonApi = class {
|
|
|
3439
3439
|
)
|
|
3440
3440
|
]);
|
|
3441
3441
|
}
|
|
3442
|
-
/** List permission role channel */
|
|
3443
|
-
getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
|
|
3444
|
-
const urlPath = "/v2/permissionrolechannel/get";
|
|
3445
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
3446
|
-
queryParams.set("role_id", roleId);
|
|
3447
|
-
queryParams.set("channel_id", channelId);
|
|
3448
|
-
let bodyJson = "";
|
|
3449
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3450
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3451
|
-
if (bearerToken) {
|
|
3452
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3453
|
-
}
|
|
3454
|
-
return Promise.race([
|
|
3455
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3456
|
-
if (response.status == 204) {
|
|
3457
|
-
return response;
|
|
3458
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
3459
|
-
return response.json();
|
|
3460
|
-
} else {
|
|
3461
|
-
throw response;
|
|
3462
|
-
}
|
|
3463
|
-
}),
|
|
3464
|
-
new Promise(
|
|
3465
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3466
|
-
)
|
|
3467
|
-
]);
|
|
3468
|
-
}
|
|
3469
3442
|
/** set permission role channel. */
|
|
3470
3443
|
setRoleChannelPermission(bearerToken, body, options = {}) {
|
|
3471
3444
|
if (body === null || body === void 0) {
|
|
@@ -4986,9 +4959,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
4986
4959
|
unfollowUsers(user_ids) {
|
|
4987
4960
|
return this.send({ status_unfollow: { user_ids } });
|
|
4988
4961
|
}
|
|
4989
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments,
|
|
4962
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
|
|
4990
4963
|
return __async(this, null, function* () {
|
|
4991
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode,
|
|
4964
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hideEditted } });
|
|
4992
4965
|
return response.channel_message_ack;
|
|
4993
4966
|
});
|
|
4994
4967
|
}
|
|
@@ -5067,6 +5040,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
5067
5040
|
return response.hashtag_dm_list_event;
|
|
5068
5041
|
});
|
|
5069
5042
|
}
|
|
5043
|
+
GetPermissionByRoleIdChannelId(role_id, channel_id) {
|
|
5044
|
+
return __async(this, null, function* () {
|
|
5045
|
+
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id } });
|
|
5046
|
+
return response.permission_role_channel_list_event;
|
|
5047
|
+
});
|
|
5048
|
+
}
|
|
5070
5049
|
listClanStickersByClanId(clan_id) {
|
|
5071
5050
|
return __async(this, null, function* () {
|
|
5072
5051
|
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
|
@@ -6735,17 +6714,6 @@ var Client = class {
|
|
|
6735
6714
|
});
|
|
6736
6715
|
}
|
|
6737
6716
|
/** */
|
|
6738
|
-
getListPermissionRoleChannel(session, roleId, channelId) {
|
|
6739
|
-
return __async(this, null, function* () {
|
|
6740
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6741
|
-
yield this.sessionRefresh(session);
|
|
6742
|
-
}
|
|
6743
|
-
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
|
|
6744
|
-
return Promise.resolve(response);
|
|
6745
|
-
});
|
|
6746
|
-
});
|
|
6747
|
-
}
|
|
6748
|
-
/** */
|
|
6749
6717
|
setRoleChannelPermission(session, request) {
|
|
6750
6718
|
return __async(this, null, function* () {
|
|
6751
6719
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/socket.d.ts
CHANGED
|
@@ -267,6 +267,15 @@ export interface ChannelDeletedEvent {
|
|
|
267
267
|
channel_id: string;
|
|
268
268
|
deletor: string;
|
|
269
269
|
}
|
|
270
|
+
export interface PermissionRoleChannelListEvent {
|
|
271
|
+
role_id?: string;
|
|
272
|
+
channel_id?: string;
|
|
273
|
+
permission_role_channel?: Array<PermissionRoleChannel>;
|
|
274
|
+
}
|
|
275
|
+
export interface PermissionRoleChannel {
|
|
276
|
+
permission_id?: string;
|
|
277
|
+
active?: boolean;
|
|
278
|
+
}
|
|
270
279
|
export interface ClanUpdatedEvent {
|
|
271
280
|
clan_id: string;
|
|
272
281
|
clan_name: string;
|
|
@@ -542,6 +551,7 @@ export interface Socket {
|
|
|
542
551
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
|
543
552
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
|
544
553
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
|
554
|
+
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
|
545
555
|
}
|
|
546
556
|
/** Reports an error received from a socket message. */
|
|
547
557
|
export interface SocketError {
|
|
@@ -607,7 +617,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
607
617
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
|
608
618
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
|
609
619
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
|
610
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>,
|
|
620
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
|
|
611
621
|
updateStatus(status?: string): Promise<void>;
|
|
612
622
|
writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string): Promise<ChannelMessageAck>;
|
|
613
623
|
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
|
|
@@ -621,6 +631,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
621
631
|
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
|
622
632
|
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
|
623
633
|
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
|
634
|
+
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
|
624
635
|
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
|
625
636
|
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
|
626
637
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -385,6 +385,24 @@ export interface ChannelDeletedEvent {
|
|
|
385
385
|
deletor: string;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
// A list of permission role channel.
|
|
389
|
+
export interface PermissionRoleChannelListEvent {
|
|
390
|
+
//
|
|
391
|
+
role_id?: string;
|
|
392
|
+
//
|
|
393
|
+
channel_id?: string;
|
|
394
|
+
// A list of permission.
|
|
395
|
+
permission_role_channel?: Array<PermissionRoleChannel>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Permission role channel
|
|
399
|
+
export interface PermissionRoleChannel {
|
|
400
|
+
// Permission id
|
|
401
|
+
permission_id?: string;
|
|
402
|
+
// active
|
|
403
|
+
active?: boolean;
|
|
404
|
+
}
|
|
405
|
+
|
|
388
406
|
// clan updated event
|
|
389
407
|
export interface ClanUpdatedEvent {
|
|
390
408
|
// the clan id
|
|
@@ -814,6 +832,7 @@ export interface Socket {
|
|
|
814
832
|
|
|
815
833
|
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
|
816
834
|
|
|
835
|
+
GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent>;
|
|
817
836
|
}
|
|
818
837
|
|
|
819
838
|
/** Reports an error received from a socket message. */
|
|
@@ -1301,8 +1320,8 @@ export class DefaultSocket implements Socket {
|
|
|
1301
1320
|
return this.send({status_unfollow: {user_ids: user_ids}});
|
|
1302
1321
|
}
|
|
1303
1322
|
|
|
1304
|
-
async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>,
|
|
1305
|
-
const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode,
|
|
1323
|
+
async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck> {
|
|
1324
|
+
const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode, hideEditted: hideEditted}});
|
|
1306
1325
|
return response.channel_message_ack;
|
|
1307
1326
|
}
|
|
1308
1327
|
|
|
@@ -1370,6 +1389,11 @@ export class DefaultSocket implements Socket {
|
|
|
1370
1389
|
return response.hashtag_dm_list_event
|
|
1371
1390
|
}
|
|
1372
1391
|
|
|
1392
|
+
async GetPermissionByRoleIdChannelId(role_id: string, channel_id: string): Promise<PermissionRoleChannelListEvent> {
|
|
1393
|
+
const response = await this.send({permission_role_channel_list_event: {role_id: role_id, channel_id: channel_id }});
|
|
1394
|
+
return response.permission_role_channel_list_event
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1373
1397
|
async listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent> {
|
|
1374
1398
|
const response = await this.send({sticker_listed_event: {clan_id: clan_id}});
|
|
1375
1399
|
return response.sticker_listed_event
|