mezon-js 2.9.19 → 2.9.21

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/client.ts CHANGED
@@ -118,6 +118,8 @@ import {
118
118
  ApiAllUsersAddChannelResponse,
119
119
  ApiRoleListEventResponse,
120
120
  ApiAllUserClans,
121
+ ApiUserPermissionInChannelListResponse,
122
+ ApiPermissionRoleChannelListEventResponse,
121
123
  } from "./api.gen";
122
124
 
123
125
  import { Session } from "./session";
@@ -3841,4 +3843,58 @@ export class Client {
3841
3843
  return Promise.resolve(result);
3842
3844
  });
3843
3845
  }
3846
+
3847
+ async listUserPermissionInChannel(
3848
+ session: Session,
3849
+ clanId?: string,
3850
+ channelId?: string
3851
+ ): Promise<ApiUserPermissionInChannelListResponse> {
3852
+ if (
3853
+ this.autoRefreshSession &&
3854
+ session.refresh_token &&
3855
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3856
+ ) {
3857
+ await this.sessionRefresh(session);
3858
+ }
3859
+
3860
+ return this.apiClient
3861
+ .listUserPermissionInChannel(session.token, clanId, channelId)
3862
+ .then((response: ApiUserPermissionInChannelListResponse) => {
3863
+ var result: ApiUserPermissionInChannelListResponse = {
3864
+ clan_id: clanId,
3865
+ channel_id: channelId,
3866
+ permissions: response.permissions,
3867
+ };
3868
+
3869
+ return Promise.resolve(result);
3870
+ });
3871
+ }
3872
+
3873
+ async getPermissionByRoleIdChannelId(
3874
+ session: Session,
3875
+ roleId?: string,
3876
+ channelId?: string,
3877
+ userId?: string
3878
+ ): Promise<ApiPermissionRoleChannelListEventResponse> {
3879
+ if (
3880
+ this.autoRefreshSession &&
3881
+ session.refresh_token &&
3882
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3883
+ ) {
3884
+ await this.sessionRefresh(session);
3885
+ }
3886
+
3887
+ return this.apiClient
3888
+ .getPermissionByRoleIdChannelId(session.token, roleId, channelId, userId)
3889
+ .then((response: ApiPermissionRoleChannelListEventResponse) => {
3890
+ var result: ApiPermissionRoleChannelListEventResponse = {
3891
+ role_id: roleId,
3892
+ channel_id: channelId,
3893
+ permission_role_channel: response.permission_role_channel,
3894
+ user_id: userId,
3895
+ };
3896
+
3897
+ return Promise.resolve(result);
3898
+ });
3899
+ }
3844
3900
  }
package/dist/api.gen.d.ts CHANGED
@@ -411,6 +411,7 @@ export interface ApiClanDesc {
411
411
  creator_id?: string;
412
412
  logo?: string;
413
413
  status?: number;
414
+ badge_count?: number;
414
415
  }
415
416
  /** */
416
417
  export interface ApiClanDescList {
@@ -478,10 +479,6 @@ export interface ApiClanUserList {
478
479
  cursor?: string;
479
480
  }
480
481
  /** */
481
- export interface ApiCountClanBadgeResponse {
482
- badges?: Array<CountClanBadgeResponseBadge>;
483
- }
484
- /** */
485
482
  export interface ApiCreateCategoryDescRequest {
486
483
  category_name?: string;
487
484
  clan_id?: string;
@@ -857,6 +854,18 @@ export interface ApiPermissionList {
857
854
  permissions?: Array<ApiPermission>;
858
855
  }
859
856
  /** */
857
+ export interface ApiPermissionRoleChannel {
858
+ active?: boolean;
859
+ permission_id?: string;
860
+ }
861
+ /** */
862
+ export interface ApiPermissionRoleChannelListEventResponse {
863
+ channel_id?: string;
864
+ permission_role_channel?: Array<ApiPermissionRoleChannel>;
865
+ role_id?: string;
866
+ user_id?: string;
867
+ }
868
+ /** */
860
869
  export interface ApiPermissionUpdate {
861
870
  permission_id?: string;
862
871
  slug?: string;
@@ -1132,6 +1141,12 @@ export interface ApiUser {
1132
1141
  update_time?: string;
1133
1142
  username?: string;
1134
1143
  }
1144
+ /** */
1145
+ export interface ApiUserPermissionInChannelListResponse {
1146
+ channel_id?: string;
1147
+ clan_id?: string;
1148
+ permissions?: ApiPermissionList;
1149
+ }
1135
1150
  /** A collection of zero or more users. */
1136
1151
  export interface ApiUsers {
1137
1152
  users?: Array<ApiUser>;
@@ -1281,8 +1296,6 @@ export declare class MezonApi {
1281
1296
  banApp(bearerToken: string, id: string, options?: any): Promise<any>;
1282
1297
  /** Unban an app. */
1283
1298
  unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
1284
- /** count clan badge */
1285
- countClanBadge(bearerToken: string, options?: any): Promise<ApiCountClanBadgeResponse>;
1286
1299
  /** */
1287
1300
  updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
1288
1301
  /** */
@@ -1429,6 +1442,8 @@ export declare class MezonApi {
1429
1442
  setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
1430
1443
  /** Get permission list */
1431
1444
  getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
1445
+ /** GetPermissionByRoleIdChannelId */
1446
+ getPermissionByRoleIdChannelId(bearerToken: string, roleId?: string, channelId?: string, userId?: string, options?: any): Promise<ApiPermissionRoleChannelListEventResponse>;
1432
1447
  /** */
1433
1448
  deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
1434
1449
  /** */
@@ -1501,6 +1516,8 @@ export declare class MezonApi {
1501
1516
  updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
1502
1517
  /** ListUserClansByUserId */
1503
1518
  listUserClansByUserId(bearerToken: string, options?: any): Promise<ApiAllUserClans>;
1519
+ /** ListUserPermissionInChannel */
1520
+ listUserPermissionInChannel(bearerToken: string, clanId?: string, channelId?: string, options?: any): Promise<ApiUserPermissionInChannelListResponse>;
1504
1521
  /** create webhook */
1505
1522
  generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
1506
1523
  /** update webhook name by id */
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, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -572,4 +572,6 @@ export declare class Client {
572
572
  getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
573
573
  listUserClansByUserId(session: Session): Promise<ApiAllUserClans>;
574
574
  listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
575
+ listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
576
+ getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
575
577
  }