mezon-js 2.9.20 → 2.9.22
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +2073 -1515
- package/client.ts +45 -5
- package/dist/api.gen.d.ts +25 -6
- package/dist/client.d.ts +5 -2
- package/dist/mezon-js.cjs.js +631 -196
- package/dist/mezon-js.esm.mjs +631 -196
- package/dist/socket.d.ts +3 -0
- package/package.json +1 -1
- package/socket.ts +6 -0
package/client.ts
CHANGED
@@ -118,7 +118,8 @@ import {
|
|
118
118
|
ApiAllUsersAddChannelResponse,
|
119
119
|
ApiRoleListEventResponse,
|
120
120
|
ApiAllUserClans,
|
121
|
-
|
121
|
+
ApiUserPermissionInChannelListResponse,
|
122
|
+
ApiPermissionRoleChannelListEventResponse,
|
122
123
|
} from "./api.gen";
|
123
124
|
|
124
125
|
import { Session } from "./session";
|
@@ -400,6 +401,8 @@ export interface ApiUpdateChannelDescRequest {
|
|
400
401
|
channel_label: string | undefined;
|
401
402
|
/** The category of channel */
|
402
403
|
category_id: string | undefined;
|
404
|
+
/** The app url of channel */
|
405
|
+
app_url: string | undefined;
|
403
406
|
}
|
404
407
|
|
405
408
|
/** Add users to a channel. */
|
@@ -3843,7 +3846,11 @@ export class Client {
|
|
3843
3846
|
});
|
3844
3847
|
}
|
3845
3848
|
|
3846
|
-
async
|
3849
|
+
async listUserPermissionInChannel(
|
3850
|
+
session: Session,
|
3851
|
+
clanId?: string,
|
3852
|
+
channelId?: string
|
3853
|
+
): Promise<ApiUserPermissionInChannelListResponse> {
|
3847
3854
|
if (
|
3848
3855
|
this.autoRefreshSession &&
|
3849
3856
|
session.refresh_token &&
|
@@ -3853,10 +3860,43 @@ export class Client {
|
|
3853
3860
|
}
|
3854
3861
|
|
3855
3862
|
return this.apiClient
|
3856
|
-
.
|
3857
|
-
.then((response:
|
3858
|
-
|
3863
|
+
.listUserPermissionInChannel(session.token, clanId, channelId)
|
3864
|
+
.then((response: ApiUserPermissionInChannelListResponse) => {
|
3865
|
+
var result: ApiUserPermissionInChannelListResponse = {
|
3866
|
+
clan_id: clanId,
|
3867
|
+
channel_id: channelId,
|
3868
|
+
permissions: response.permissions,
|
3869
|
+
};
|
3870
|
+
|
3871
|
+
return Promise.resolve(result);
|
3859
3872
|
});
|
3860
3873
|
}
|
3861
3874
|
|
3875
|
+
async getPermissionByRoleIdChannelId(
|
3876
|
+
session: Session,
|
3877
|
+
roleId?: string,
|
3878
|
+
channelId?: string,
|
3879
|
+
userId?: string
|
3880
|
+
): Promise<ApiPermissionRoleChannelListEventResponse> {
|
3881
|
+
if (
|
3882
|
+
this.autoRefreshSession &&
|
3883
|
+
session.refresh_token &&
|
3884
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3885
|
+
) {
|
3886
|
+
await this.sessionRefresh(session);
|
3887
|
+
}
|
3888
|
+
|
3889
|
+
return this.apiClient
|
3890
|
+
.getPermissionByRoleIdChannelId(session.token, roleId, channelId, userId)
|
3891
|
+
.then((response: ApiPermissionRoleChannelListEventResponse) => {
|
3892
|
+
var result: ApiPermissionRoleChannelListEventResponse = {
|
3893
|
+
role_id: roleId,
|
3894
|
+
channel_id: channelId,
|
3895
|
+
permission_role_channel: response.permission_role_channel,
|
3896
|
+
user_id: userId,
|
3897
|
+
};
|
3898
|
+
|
3899
|
+
return Promise.resolve(result);
|
3900
|
+
});
|
3901
|
+
}
|
3862
3902
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -63,6 +63,7 @@ export declare enum ApiAppRole {
|
|
63
63
|
}
|
64
64
|
/** Update fields in a given channel. */
|
65
65
|
export interface MezonUpdateChannelDescBody {
|
66
|
+
app_url?: string;
|
66
67
|
category_id?: string;
|
67
68
|
channel_label?: string;
|
68
69
|
}
|
@@ -320,6 +321,7 @@ export interface ApiChannelDescList {
|
|
320
321
|
/** */
|
321
322
|
export interface ApiChannelDescription {
|
322
323
|
active?: number;
|
324
|
+
app_url?: string;
|
323
325
|
category_id?: string;
|
324
326
|
category_name?: string;
|
325
327
|
channel_avatar?: Array<string>;
|
@@ -411,6 +413,7 @@ export interface ApiClanDesc {
|
|
411
413
|
creator_id?: string;
|
412
414
|
logo?: string;
|
413
415
|
status?: number;
|
416
|
+
badge_count?: number;
|
414
417
|
}
|
415
418
|
/** */
|
416
419
|
export interface ApiClanDescList {
|
@@ -478,10 +481,6 @@ export interface ApiClanUserList {
|
|
478
481
|
cursor?: string;
|
479
482
|
}
|
480
483
|
/** */
|
481
|
-
export interface ApiCountClanBadgeResponse {
|
482
|
-
badges?: Array<CountClanBadgeResponseBadge>;
|
483
|
-
}
|
484
|
-
/** */
|
485
484
|
export interface ApiCreateCategoryDescRequest {
|
486
485
|
category_name?: string;
|
487
486
|
clan_id?: string;
|
@@ -857,6 +856,18 @@ export interface ApiPermissionList {
|
|
857
856
|
permissions?: Array<ApiPermission>;
|
858
857
|
}
|
859
858
|
/** */
|
859
|
+
export interface ApiPermissionRoleChannel {
|
860
|
+
active?: boolean;
|
861
|
+
permission_id?: string;
|
862
|
+
}
|
863
|
+
/** */
|
864
|
+
export interface ApiPermissionRoleChannelListEventResponse {
|
865
|
+
channel_id?: string;
|
866
|
+
permission_role_channel?: Array<ApiPermissionRoleChannel>;
|
867
|
+
role_id?: string;
|
868
|
+
user_id?: string;
|
869
|
+
}
|
870
|
+
/** */
|
860
871
|
export interface ApiPermissionUpdate {
|
861
872
|
permission_id?: string;
|
862
873
|
slug?: string;
|
@@ -1132,6 +1143,12 @@ export interface ApiUser {
|
|
1132
1143
|
update_time?: string;
|
1133
1144
|
username?: string;
|
1134
1145
|
}
|
1146
|
+
/** */
|
1147
|
+
export interface ApiUserPermissionInChannelListResponse {
|
1148
|
+
channel_id?: string;
|
1149
|
+
clan_id?: string;
|
1150
|
+
permissions?: ApiPermissionList;
|
1151
|
+
}
|
1135
1152
|
/** A collection of zero or more users. */
|
1136
1153
|
export interface ApiUsers {
|
1137
1154
|
users?: Array<ApiUser>;
|
@@ -1281,8 +1298,6 @@ export declare class MezonApi {
|
|
1281
1298
|
banApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1282
1299
|
/** Unban an app. */
|
1283
1300
|
unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1284
|
-
/** count clan badge */
|
1285
|
-
countClanBadge(bearerToken: string, options?: any): Promise<ApiCountClanBadgeResponse>;
|
1286
1301
|
/** */
|
1287
1302
|
updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
|
1288
1303
|
/** */
|
@@ -1429,6 +1444,8 @@ export declare class MezonApi {
|
|
1429
1444
|
setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
|
1430
1445
|
/** Get permission list */
|
1431
1446
|
getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
|
1447
|
+
/** GetPermissionByRoleIdChannelId */
|
1448
|
+
getPermissionByRoleIdChannelId(bearerToken: string, roleId?: string, channelId?: string, userId?: string, options?: any): Promise<ApiPermissionRoleChannelListEventResponse>;
|
1432
1449
|
/** */
|
1433
1450
|
deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
|
1434
1451
|
/** */
|
@@ -1501,6 +1518,8 @@ export declare class MezonApi {
|
|
1501
1518
|
updateUser(bearerToken: string, body: ApiUpdateUsersRequest, options?: any): Promise<any>;
|
1502
1519
|
/** ListUserClansByUserId */
|
1503
1520
|
listUserClansByUserId(bearerToken: string, options?: any): Promise<ApiAllUserClans>;
|
1521
|
+
/** ListUserPermissionInChannel */
|
1522
|
+
listUserPermissionInChannel(bearerToken: string, clanId?: string, channelId?: string, options?: any): Promise<ApiUserPermissionInChannelListResponse>;
|
1504
1523
|
/** create webhook */
|
1505
1524
|
generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
|
1506
1525
|
/** 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,
|
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";
|
@@ -241,6 +241,8 @@ export interface ApiUpdateChannelDescRequest {
|
|
241
241
|
channel_label: string | undefined;
|
242
242
|
/** The category of channel */
|
243
243
|
category_id: string | undefined;
|
244
|
+
/** The app url of channel */
|
245
|
+
app_url: string | undefined;
|
244
246
|
}
|
245
247
|
/** Add users to a channel. */
|
246
248
|
export interface ApiAddChannelUsersRequest {
|
@@ -572,5 +574,6 @@ export declare class Client {
|
|
572
574
|
getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
|
573
575
|
listUserClansByUserId(session: Session): Promise<ApiAllUserClans>;
|
574
576
|
listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
|
575
|
-
|
577
|
+
listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
|
578
|
+
getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
|
576
579
|
}
|