mezon-js 2.13.23 → 2.13.25
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 +131 -6
- package/client.ts +68 -1
- package/dist/api.gen.d.ts +13 -3
- package/dist/client.d.ts +7 -1
- package/dist/mezon-js.cjs.js +133 -1
- package/dist/mezon-js.esm.mjs +133 -1
- package/dist/socket.d.ts +7 -0
- package/package.json +1 -1
- package/socket.ts +16 -0
package/api.gen.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface ChannelUserListChannelUser {
|
|
|
22
22
|
user_id?: string;
|
|
23
23
|
//Added by
|
|
24
24
|
added_by?: string;
|
|
25
|
+
// is banned
|
|
26
|
+
is_banned?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/** A single user-role pair. */
|
|
@@ -569,6 +571,12 @@ export interface ApiCategoryDescList {
|
|
|
569
571
|
categorydesc?: Array<ApiCategoryDesc>;
|
|
570
572
|
}
|
|
571
573
|
|
|
574
|
+
/** */
|
|
575
|
+
export interface ApiUpdateUsernameRequest {
|
|
576
|
+
//
|
|
577
|
+
username?: string;
|
|
578
|
+
}
|
|
579
|
+
|
|
572
580
|
/** */
|
|
573
581
|
export interface ApiCategoryOrderUpdate {
|
|
574
582
|
//
|
|
@@ -2604,11 +2612,13 @@ export interface ApiUpdateAccountRequest {
|
|
|
2604
2612
|
about_me?: string;
|
|
2605
2613
|
//A URL for an avatar image.
|
|
2606
2614
|
avatar_url?: string;
|
|
2607
|
-
//
|
|
2608
|
-
dob?: string;
|
|
2609
2615
|
//The display name of the user.
|
|
2610
2616
|
display_name?: string;
|
|
2611
2617
|
//
|
|
2618
|
+
dob?: string;
|
|
2619
|
+
//The email of the user's account.
|
|
2620
|
+
email?: string;
|
|
2621
|
+
//
|
|
2612
2622
|
encrypt_private_key?: string;
|
|
2613
2623
|
//The language expected to be a tag which follows the BCP-47 spec.
|
|
2614
2624
|
lang_tag?: string;
|
|
@@ -2620,10 +2630,6 @@ export interface ApiUpdateAccountRequest {
|
|
|
2620
2630
|
splash_screen?: string;
|
|
2621
2631
|
//The timezone set by the user.
|
|
2622
2632
|
timezone?: string;
|
|
2623
|
-
//The username of the user's account.
|
|
2624
|
-
username?: string;
|
|
2625
|
-
//The email of the user's account.
|
|
2626
|
-
email?: string;
|
|
2627
2633
|
}
|
|
2628
2634
|
|
|
2629
2635
|
/** */
|
|
@@ -5757,6 +5763,90 @@ export class MezonApi {
|
|
|
5757
5763
|
]);
|
|
5758
5764
|
}
|
|
5759
5765
|
|
|
5766
|
+
/** Ban a set of users from a channel. */
|
|
5767
|
+
unbanClanUsers(bearerToken: string,
|
|
5768
|
+
clanId:string,
|
|
5769
|
+
channelId?:string,
|
|
5770
|
+
userIds?:Array<string>,
|
|
5771
|
+
banTime?:number,
|
|
5772
|
+
options: any = {}): Promise<any> {
|
|
5773
|
+
|
|
5774
|
+
if (clanId === null || clanId === undefined) {
|
|
5775
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5776
|
+
}
|
|
5777
|
+
const urlPath = "/v2/clandesc/{clanId}/unban"
|
|
5778
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5779
|
+
const queryParams = new Map<string, any>();
|
|
5780
|
+
queryParams.set("channel_id", channelId);
|
|
5781
|
+
queryParams.set("user_ids", userIds);
|
|
5782
|
+
queryParams.set("ban_time", banTime);
|
|
5783
|
+
|
|
5784
|
+
let bodyJson : string = "";
|
|
5785
|
+
|
|
5786
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5787
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5788
|
+
if (bearerToken) {
|
|
5789
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
return Promise.race([
|
|
5793
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5794
|
+
if (response.status == 204) {
|
|
5795
|
+
return response;
|
|
5796
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5797
|
+
return response.json();
|
|
5798
|
+
} else {
|
|
5799
|
+
throw response;
|
|
5800
|
+
}
|
|
5801
|
+
}),
|
|
5802
|
+
new Promise((_, reject) =>
|
|
5803
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5804
|
+
),
|
|
5805
|
+
]);
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5808
|
+
/** Ban a set of users from a channel. */
|
|
5809
|
+
banClanUsers(bearerToken: string,
|
|
5810
|
+
clanId:string,
|
|
5811
|
+
channelId?:string,
|
|
5812
|
+
userIds?:Array<string>,
|
|
5813
|
+
banTime?:number,
|
|
5814
|
+
options: any = {}): Promise<any> {
|
|
5815
|
+
|
|
5816
|
+
if (clanId === null || clanId === undefined) {
|
|
5817
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5818
|
+
}
|
|
5819
|
+
const urlPath = "/v2/clandesc/{clanId}/ban"
|
|
5820
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5821
|
+
const queryParams = new Map<string, any>();
|
|
5822
|
+
queryParams.set("channel_id", channelId);
|
|
5823
|
+
queryParams.set("user_ids", userIds);
|
|
5824
|
+
queryParams.set("ban_time", banTime);
|
|
5825
|
+
|
|
5826
|
+
let bodyJson : string = "";
|
|
5827
|
+
|
|
5828
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5829
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5830
|
+
if (bearerToken) {
|
|
5831
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5834
|
+
return Promise.race([
|
|
5835
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5836
|
+
if (response.status == 204) {
|
|
5837
|
+
return response;
|
|
5838
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5839
|
+
return response.json();
|
|
5840
|
+
} else {
|
|
5841
|
+
throw response;
|
|
5842
|
+
}
|
|
5843
|
+
}),
|
|
5844
|
+
new Promise((_, reject) =>
|
|
5845
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5846
|
+
),
|
|
5847
|
+
]);
|
|
5848
|
+
}
|
|
5849
|
+
|
|
5760
5850
|
/** List all users that are part of a clan. */
|
|
5761
5851
|
listClanUsers(
|
|
5762
5852
|
bearerToken: string,
|
|
@@ -11523,4 +11613,39 @@ export class MezonApi {
|
|
|
11523
11613
|
]);
|
|
11524
11614
|
}
|
|
11525
11615
|
|
|
11616
|
+
/** Update username */
|
|
11617
|
+
updateUsername(bearerToken: string,
|
|
11618
|
+
body:ApiUpdateUsernameRequest,
|
|
11619
|
+
options: any = {}): Promise<ApiSession> {
|
|
11620
|
+
|
|
11621
|
+
if (body === null || body === undefined) {
|
|
11622
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
11623
|
+
}
|
|
11624
|
+
const urlPath = "/v2/username";
|
|
11625
|
+
const queryParams = new Map<string, any>();
|
|
11626
|
+
|
|
11627
|
+
let bodyJson : string = "";
|
|
11628
|
+
bodyJson = JSON.stringify(body || {});
|
|
11629
|
+
|
|
11630
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
11631
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
11632
|
+
if (bearerToken) {
|
|
11633
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
11634
|
+
}
|
|
11635
|
+
|
|
11636
|
+
return Promise.race([
|
|
11637
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
11638
|
+
if (response.status == 204) {
|
|
11639
|
+
return response;
|
|
11640
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
11641
|
+
return response.json();
|
|
11642
|
+
} else {
|
|
11643
|
+
throw response;
|
|
11644
|
+
}
|
|
11645
|
+
}),
|
|
11646
|
+
new Promise((_, reject) =>
|
|
11647
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
11648
|
+
),
|
|
11649
|
+
]);
|
|
11650
|
+
}
|
|
11526
11651
|
}
|
package/client.ts
CHANGED
|
@@ -178,6 +178,7 @@ import {
|
|
|
178
178
|
ApiFriend,
|
|
179
179
|
ApiListClanUnreadMsgIndicatorResponse,
|
|
180
180
|
ApiAddFriendsResponse,
|
|
181
|
+
ApiUpdateUsernameRequest,
|
|
181
182
|
} from "./api.gen";
|
|
182
183
|
|
|
183
184
|
import { Session } from "./session";
|
|
@@ -1127,6 +1128,51 @@ export class Client {
|
|
|
1127
1128
|
});
|
|
1128
1129
|
}
|
|
1129
1130
|
|
|
1131
|
+
/** Ban a set of users from a clan. */
|
|
1132
|
+
async unbanClanUsers(
|
|
1133
|
+
session: Session,
|
|
1134
|
+
clanId:string,
|
|
1135
|
+
channelId?:string,
|
|
1136
|
+
userIds?:Array<string>
|
|
1137
|
+
): Promise<boolean> {
|
|
1138
|
+
if (
|
|
1139
|
+
this.autoRefreshSession &&
|
|
1140
|
+
session.refresh_token &&
|
|
1141
|
+
session.isexpired(Date.now() / 1000)
|
|
1142
|
+
) {
|
|
1143
|
+
await this.sessionRefresh(session);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
return this.apiClient
|
|
1147
|
+
.unbanClanUsers(session.token, clanId, channelId, userIds)
|
|
1148
|
+
.then((response: any) => {
|
|
1149
|
+
return Promise.resolve(response != undefined);
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/** Ban a set of users from a clan. */
|
|
1154
|
+
async banClanUsers(
|
|
1155
|
+
session: Session,
|
|
1156
|
+
clanId:string,
|
|
1157
|
+
channelId?:string,
|
|
1158
|
+
userIds?:Array<string>,
|
|
1159
|
+
banTime?:number
|
|
1160
|
+
): Promise<boolean> {
|
|
1161
|
+
if (
|
|
1162
|
+
this.autoRefreshSession &&
|
|
1163
|
+
session.refresh_token &&
|
|
1164
|
+
session.isexpired(Date.now() / 1000)
|
|
1165
|
+
) {
|
|
1166
|
+
await this.sessionRefresh(session);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return this.apiClient
|
|
1170
|
+
.banClanUsers(session.token, clanId, channelId, userIds, banTime)
|
|
1171
|
+
.then((response: any) => {
|
|
1172
|
+
return Promise.resolve(response != undefined);
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1130
1176
|
/** Kick users from a channel, or decline their join requests. */
|
|
1131
1177
|
async removeChannelUsers(
|
|
1132
1178
|
session: Session,
|
|
@@ -1340,7 +1386,8 @@ export class Client {
|
|
|
1340
1386
|
clan_nick: gu.clan_nick,
|
|
1341
1387
|
id: gu.id,
|
|
1342
1388
|
clan_id: gu.clan_id,
|
|
1343
|
-
added_by: gu.added_by
|
|
1389
|
+
added_by: gu.added_by,
|
|
1390
|
+
is_banned: gu.is_banned
|
|
1344
1391
|
});
|
|
1345
1392
|
});
|
|
1346
1393
|
return Promise.resolve(result);
|
|
@@ -2100,6 +2147,26 @@ export class Client {
|
|
|
2100
2147
|
});
|
|
2101
2148
|
}
|
|
2102
2149
|
|
|
2150
|
+
/** Update fields in the current user's account. */
|
|
2151
|
+
async updateUsername(
|
|
2152
|
+
session: Session,
|
|
2153
|
+
request: ApiUpdateUsernameRequest
|
|
2154
|
+
): Promise<ApiSession> {
|
|
2155
|
+
if (
|
|
2156
|
+
this.autoRefreshSession &&
|
|
2157
|
+
session.refresh_token &&
|
|
2158
|
+
session.isexpired(Date.now() / 1000)
|
|
2159
|
+
) {
|
|
2160
|
+
await this.sessionRefresh(session);
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
return this.apiClient
|
|
2164
|
+
.updateUsername(session.token, request)
|
|
2165
|
+
.then((response: ApiSession) => {
|
|
2166
|
+
return Promise.resolve(response);
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2103
2170
|
/** Update fields in the current user's account. */
|
|
2104
2171
|
async updateAccount(
|
|
2105
2172
|
session: Session,
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface ChannelUserListChannelUser {
|
|
|
8
8
|
thread_id?: string;
|
|
9
9
|
user_id?: string;
|
|
10
10
|
added_by?: string;
|
|
11
|
+
is_banned?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/** A single user-role pair. */
|
|
13
14
|
export interface ClanUserListClanUser {
|
|
@@ -328,6 +329,10 @@ export interface ApiCategoryDescList {
|
|
|
328
329
|
categorydesc?: Array<ApiCategoryDesc>;
|
|
329
330
|
}
|
|
330
331
|
/** */
|
|
332
|
+
export interface ApiUpdateUsernameRequest {
|
|
333
|
+
username?: string;
|
|
334
|
+
}
|
|
335
|
+
/** */
|
|
331
336
|
export interface ApiCategoryOrderUpdate {
|
|
332
337
|
category_id?: string;
|
|
333
338
|
order?: number;
|
|
@@ -1490,16 +1495,15 @@ export interface ApiTransactionDetail {
|
|
|
1490
1495
|
export interface ApiUpdateAccountRequest {
|
|
1491
1496
|
about_me?: string;
|
|
1492
1497
|
avatar_url?: string;
|
|
1493
|
-
dob?: string;
|
|
1494
1498
|
display_name?: string;
|
|
1499
|
+
dob?: string;
|
|
1500
|
+
email?: string;
|
|
1495
1501
|
encrypt_private_key?: string;
|
|
1496
1502
|
lang_tag?: string;
|
|
1497
1503
|
location?: string;
|
|
1498
1504
|
logo?: string;
|
|
1499
1505
|
splash_screen?: string;
|
|
1500
1506
|
timezone?: string;
|
|
1501
|
-
username?: string;
|
|
1502
|
-
email?: string;
|
|
1503
1507
|
}
|
|
1504
1508
|
/** */
|
|
1505
1509
|
export interface ApiUpdateCategoryDescRequest {
|
|
@@ -2078,6 +2082,10 @@ export declare class MezonApi {
|
|
|
2078
2082
|
updateClanDesc(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
|
|
2079
2083
|
/** Kick a set of users from a clan. */
|
|
2080
2084
|
removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
|
|
2085
|
+
/** Ban a set of users from a channel. */
|
|
2086
|
+
unbanClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
|
|
2087
|
+
/** Ban a set of users from a channel. */
|
|
2088
|
+
banClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
|
|
2081
2089
|
/** List all users that are part of a clan. */
|
|
2082
2090
|
listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
|
|
2083
2091
|
/** check duplicate clan name */
|
|
@@ -2373,4 +2381,6 @@ export declare class MezonApi {
|
|
|
2373
2381
|
isFollower(bearerToken: string, body: ApiIsFollowerRequest, options?: any): Promise<ApiIsFollowerResponse>;
|
|
2374
2382
|
/** */
|
|
2375
2383
|
transferOwnership(bearerToken: string, body: ApiTransferOwnershipRequest, options?: any): Promise<any>;
|
|
2384
|
+
/** Update username */
|
|
2385
|
+
updateUsername(bearerToken: string, body: ApiUpdateUsernameRequest, options?: any): Promise<ApiSession>;
|
|
2376
2386
|
}
|
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, ApiAccountMezon, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, 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, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse } from "./api.gen";
|
|
16
|
+
import { ApiAccount, ApiAccountMezon, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, 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, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiUnlockedItemRequest, ApiForSaleItemList, ApiUnlockedItemResponse, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiStoreWalletKeyRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -300,6 +300,10 @@ export declare class Client {
|
|
|
300
300
|
getAccount(session: Session): Promise<ApiAccount>;
|
|
301
301
|
/** Kick a set of users from a clan. */
|
|
302
302
|
removeClanUsers(session: Session, clanId: string, ids?: Array<string>): Promise<boolean>;
|
|
303
|
+
/** Ban a set of users from a clan. */
|
|
304
|
+
unbanClanUsers(session: Session, clanId: string, channelId?: string, userIds?: Array<string>): Promise<boolean>;
|
|
305
|
+
/** Ban a set of users from a clan. */
|
|
306
|
+
banClanUsers(session: Session, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number): Promise<boolean>;
|
|
303
307
|
/** Kick users from a channel, or decline their join requests. */
|
|
304
308
|
removeChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
|
305
309
|
/** List a channel's message history. */
|
|
@@ -355,6 +359,8 @@ export declare class Client {
|
|
|
355
359
|
/** Remove an email+password from the social profiles on the current user's account. */
|
|
356
360
|
unlinkEmail(session: Session, request: ApiAccountEmail): Promise<boolean>;
|
|
357
361
|
/** Update fields in the current user's account. */
|
|
362
|
+
updateUsername(session: Session, request: ApiUpdateUsernameRequest): Promise<ApiSession>;
|
|
363
|
+
/** Update fields in the current user's account. */
|
|
358
364
|
updateAccount(session: Session, request: ApiUpdateAccountRequest): Promise<boolean>;
|
|
359
365
|
/** Update fields in a given channel */
|
|
360
366
|
updateChannelDesc(session: Session, channelId: string, request: ApiUpdateChannelDescRequest): Promise<boolean>;
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -2549,6 +2549,68 @@ var MezonApi = class {
|
|
|
2549
2549
|
)
|
|
2550
2550
|
]);
|
|
2551
2551
|
}
|
|
2552
|
+
/** Ban a set of users from a channel. */
|
|
2553
|
+
unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2554
|
+
if (clanId === null || clanId === void 0) {
|
|
2555
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2556
|
+
}
|
|
2557
|
+
const urlPath = "/v2/clandesc/{clanId}/unban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2558
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2559
|
+
queryParams.set("channel_id", channelId);
|
|
2560
|
+
queryParams.set("user_ids", userIds);
|
|
2561
|
+
queryParams.set("ban_time", banTime);
|
|
2562
|
+
let bodyJson = "";
|
|
2563
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2564
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2565
|
+
if (bearerToken) {
|
|
2566
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2567
|
+
}
|
|
2568
|
+
return Promise.race([
|
|
2569
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2570
|
+
if (response.status == 204) {
|
|
2571
|
+
return response;
|
|
2572
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2573
|
+
return response.json();
|
|
2574
|
+
} else {
|
|
2575
|
+
throw response;
|
|
2576
|
+
}
|
|
2577
|
+
}),
|
|
2578
|
+
new Promise(
|
|
2579
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2580
|
+
)
|
|
2581
|
+
]);
|
|
2582
|
+
}
|
|
2583
|
+
/** Ban a set of users from a channel. */
|
|
2584
|
+
banClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2585
|
+
if (clanId === null || clanId === void 0) {
|
|
2586
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2587
|
+
}
|
|
2588
|
+
const urlPath = "/v2/clandesc/{clanId}/ban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2589
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2590
|
+
queryParams.set("channel_id", channelId);
|
|
2591
|
+
queryParams.set("user_ids", userIds);
|
|
2592
|
+
queryParams.set("ban_time", banTime);
|
|
2593
|
+
let bodyJson = "";
|
|
2594
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2595
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2596
|
+
if (bearerToken) {
|
|
2597
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2598
|
+
}
|
|
2599
|
+
return Promise.race([
|
|
2600
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2601
|
+
if (response.status == 204) {
|
|
2602
|
+
return response;
|
|
2603
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2604
|
+
return response.json();
|
|
2605
|
+
} else {
|
|
2606
|
+
throw response;
|
|
2607
|
+
}
|
|
2608
|
+
}),
|
|
2609
|
+
new Promise(
|
|
2610
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2611
|
+
)
|
|
2612
|
+
]);
|
|
2613
|
+
}
|
|
2552
2614
|
/** List all users that are part of a clan. */
|
|
2553
2615
|
listClanUsers(bearerToken, clanId, options = {}) {
|
|
2554
2616
|
if (clanId === null || clanId === void 0) {
|
|
@@ -7056,6 +7118,35 @@ var MezonApi = class {
|
|
|
7056
7118
|
)
|
|
7057
7119
|
]);
|
|
7058
7120
|
}
|
|
7121
|
+
/** Update username */
|
|
7122
|
+
updateUsername(bearerToken, body, options = {}) {
|
|
7123
|
+
if (body === null || body === void 0) {
|
|
7124
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
7125
|
+
}
|
|
7126
|
+
const urlPath = "/v2/username";
|
|
7127
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
7128
|
+
let bodyJson = "";
|
|
7129
|
+
bodyJson = JSON.stringify(body || {});
|
|
7130
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7131
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
7132
|
+
if (bearerToken) {
|
|
7133
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
7134
|
+
}
|
|
7135
|
+
return Promise.race([
|
|
7136
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7137
|
+
if (response.status == 204) {
|
|
7138
|
+
return response;
|
|
7139
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
7140
|
+
return response.json();
|
|
7141
|
+
} else {
|
|
7142
|
+
throw response;
|
|
7143
|
+
}
|
|
7144
|
+
}),
|
|
7145
|
+
new Promise(
|
|
7146
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
7147
|
+
)
|
|
7148
|
+
]);
|
|
7149
|
+
}
|
|
7059
7150
|
};
|
|
7060
7151
|
|
|
7061
7152
|
// session.ts
|
|
@@ -7505,6 +7596,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7505
7596
|
this.onmeetparticipantevent(message.meet_participant_event);
|
|
7506
7597
|
} else if (message.transfer_ownership_event) {
|
|
7507
7598
|
this.ontransferownership(message.transfer_ownership_event);
|
|
7599
|
+
} else if (message.ban_user_event) {
|
|
7600
|
+
this.onbanneduser(message.ban_user_event);
|
|
7508
7601
|
} else {
|
|
7509
7602
|
if (this.verbose && window && window.console) {
|
|
7510
7603
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -7892,6 +7985,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7892
7985
|
console.log(event);
|
|
7893
7986
|
}
|
|
7894
7987
|
}
|
|
7988
|
+
onbanneduser(event) {
|
|
7989
|
+
if (this.verbose && window && window.console) {
|
|
7990
|
+
console.log(event);
|
|
7991
|
+
}
|
|
7992
|
+
}
|
|
7895
7993
|
onmeetparticipantevent(event) {
|
|
7896
7994
|
if (this.verbose && window && window.console) {
|
|
7897
7995
|
console.log(event);
|
|
@@ -8780,6 +8878,28 @@ var Client = class {
|
|
|
8780
8878
|
});
|
|
8781
8879
|
});
|
|
8782
8880
|
}
|
|
8881
|
+
/** Ban a set of users from a clan. */
|
|
8882
|
+
unbanClanUsers(session, clanId, channelId, userIds) {
|
|
8883
|
+
return __async(this, null, function* () {
|
|
8884
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8885
|
+
yield this.sessionRefresh(session);
|
|
8886
|
+
}
|
|
8887
|
+
return this.apiClient.unbanClanUsers(session.token, clanId, channelId, userIds).then((response) => {
|
|
8888
|
+
return Promise.resolve(response != void 0);
|
|
8889
|
+
});
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
/** Ban a set of users from a clan. */
|
|
8893
|
+
banClanUsers(session, clanId, channelId, userIds, banTime) {
|
|
8894
|
+
return __async(this, null, function* () {
|
|
8895
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8896
|
+
yield this.sessionRefresh(session);
|
|
8897
|
+
}
|
|
8898
|
+
return this.apiClient.banClanUsers(session.token, clanId, channelId, userIds, banTime).then((response) => {
|
|
8899
|
+
return Promise.resolve(response != void 0);
|
|
8900
|
+
});
|
|
8901
|
+
});
|
|
8902
|
+
}
|
|
8783
8903
|
/** Kick users from a channel, or decline their join requests. */
|
|
8784
8904
|
removeChannelUsers(session, channelId, ids) {
|
|
8785
8905
|
return __async(this, null, function* () {
|
|
@@ -8936,7 +9056,8 @@ var Client = class {
|
|
|
8936
9056
|
clan_nick: gu.clan_nick,
|
|
8937
9057
|
id: gu.id,
|
|
8938
9058
|
clan_id: gu.clan_id,
|
|
8939
|
-
added_by: gu.added_by
|
|
9059
|
+
added_by: gu.added_by,
|
|
9060
|
+
is_banned: gu.is_banned
|
|
8940
9061
|
});
|
|
8941
9062
|
});
|
|
8942
9063
|
return Promise.resolve(result);
|
|
@@ -9425,6 +9546,17 @@ var Client = class {
|
|
|
9425
9546
|
});
|
|
9426
9547
|
}
|
|
9427
9548
|
/** Update fields in the current user's account. */
|
|
9549
|
+
updateUsername(session, request) {
|
|
9550
|
+
return __async(this, null, function* () {
|
|
9551
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
9552
|
+
yield this.sessionRefresh(session);
|
|
9553
|
+
}
|
|
9554
|
+
return this.apiClient.updateUsername(session.token, request).then((response) => {
|
|
9555
|
+
return Promise.resolve(response);
|
|
9556
|
+
});
|
|
9557
|
+
});
|
|
9558
|
+
}
|
|
9559
|
+
/** Update fields in the current user's account. */
|
|
9428
9560
|
updateAccount(session, request) {
|
|
9429
9561
|
return __async(this, null, function* () {
|
|
9430
9562
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -2515,6 +2515,68 @@ var MezonApi = class {
|
|
|
2515
2515
|
)
|
|
2516
2516
|
]);
|
|
2517
2517
|
}
|
|
2518
|
+
/** Ban a set of users from a channel. */
|
|
2519
|
+
unbanClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2520
|
+
if (clanId === null || clanId === void 0) {
|
|
2521
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2522
|
+
}
|
|
2523
|
+
const urlPath = "/v2/clandesc/{clanId}/unban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2524
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2525
|
+
queryParams.set("channel_id", channelId);
|
|
2526
|
+
queryParams.set("user_ids", userIds);
|
|
2527
|
+
queryParams.set("ban_time", banTime);
|
|
2528
|
+
let bodyJson = "";
|
|
2529
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2530
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2531
|
+
if (bearerToken) {
|
|
2532
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2533
|
+
}
|
|
2534
|
+
return Promise.race([
|
|
2535
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2536
|
+
if (response.status == 204) {
|
|
2537
|
+
return response;
|
|
2538
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2539
|
+
return response.json();
|
|
2540
|
+
} else {
|
|
2541
|
+
throw response;
|
|
2542
|
+
}
|
|
2543
|
+
}),
|
|
2544
|
+
new Promise(
|
|
2545
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2546
|
+
)
|
|
2547
|
+
]);
|
|
2548
|
+
}
|
|
2549
|
+
/** Ban a set of users from a channel. */
|
|
2550
|
+
banClanUsers(bearerToken, clanId, channelId, userIds, banTime, options = {}) {
|
|
2551
|
+
if (clanId === null || clanId === void 0) {
|
|
2552
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2553
|
+
}
|
|
2554
|
+
const urlPath = "/v2/clandesc/{clanId}/ban".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2555
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2556
|
+
queryParams.set("channel_id", channelId);
|
|
2557
|
+
queryParams.set("user_ids", userIds);
|
|
2558
|
+
queryParams.set("ban_time", banTime);
|
|
2559
|
+
let bodyJson = "";
|
|
2560
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2561
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2562
|
+
if (bearerToken) {
|
|
2563
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2564
|
+
}
|
|
2565
|
+
return Promise.race([
|
|
2566
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2567
|
+
if (response.status == 204) {
|
|
2568
|
+
return response;
|
|
2569
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2570
|
+
return response.json();
|
|
2571
|
+
} else {
|
|
2572
|
+
throw response;
|
|
2573
|
+
}
|
|
2574
|
+
}),
|
|
2575
|
+
new Promise(
|
|
2576
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2577
|
+
)
|
|
2578
|
+
]);
|
|
2579
|
+
}
|
|
2518
2580
|
/** List all users that are part of a clan. */
|
|
2519
2581
|
listClanUsers(bearerToken, clanId, options = {}) {
|
|
2520
2582
|
if (clanId === null || clanId === void 0) {
|
|
@@ -7022,6 +7084,35 @@ var MezonApi = class {
|
|
|
7022
7084
|
)
|
|
7023
7085
|
]);
|
|
7024
7086
|
}
|
|
7087
|
+
/** Update username */
|
|
7088
|
+
updateUsername(bearerToken, body, options = {}) {
|
|
7089
|
+
if (body === null || body === void 0) {
|
|
7090
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
7091
|
+
}
|
|
7092
|
+
const urlPath = "/v2/username";
|
|
7093
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
7094
|
+
let bodyJson = "";
|
|
7095
|
+
bodyJson = JSON.stringify(body || {});
|
|
7096
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7097
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
|
7098
|
+
if (bearerToken) {
|
|
7099
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
7100
|
+
}
|
|
7101
|
+
return Promise.race([
|
|
7102
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7103
|
+
if (response.status == 204) {
|
|
7104
|
+
return response;
|
|
7105
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
7106
|
+
return response.json();
|
|
7107
|
+
} else {
|
|
7108
|
+
throw response;
|
|
7109
|
+
}
|
|
7110
|
+
}),
|
|
7111
|
+
new Promise(
|
|
7112
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
7113
|
+
)
|
|
7114
|
+
]);
|
|
7115
|
+
}
|
|
7025
7116
|
};
|
|
7026
7117
|
|
|
7027
7118
|
// session.ts
|
|
@@ -7471,6 +7562,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7471
7562
|
this.onmeetparticipantevent(message.meet_participant_event);
|
|
7472
7563
|
} else if (message.transfer_ownership_event) {
|
|
7473
7564
|
this.ontransferownership(message.transfer_ownership_event);
|
|
7565
|
+
} else if (message.ban_user_event) {
|
|
7566
|
+
this.onbanneduser(message.ban_user_event);
|
|
7474
7567
|
} else {
|
|
7475
7568
|
if (this.verbose && window && window.console) {
|
|
7476
7569
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -7858,6 +7951,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7858
7951
|
console.log(event);
|
|
7859
7952
|
}
|
|
7860
7953
|
}
|
|
7954
|
+
onbanneduser(event) {
|
|
7955
|
+
if (this.verbose && window && window.console) {
|
|
7956
|
+
console.log(event);
|
|
7957
|
+
}
|
|
7958
|
+
}
|
|
7861
7959
|
onmeetparticipantevent(event) {
|
|
7862
7960
|
if (this.verbose && window && window.console) {
|
|
7863
7961
|
console.log(event);
|
|
@@ -8746,6 +8844,28 @@ var Client = class {
|
|
|
8746
8844
|
});
|
|
8747
8845
|
});
|
|
8748
8846
|
}
|
|
8847
|
+
/** Ban a set of users from a clan. */
|
|
8848
|
+
unbanClanUsers(session, clanId, channelId, userIds) {
|
|
8849
|
+
return __async(this, null, function* () {
|
|
8850
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8851
|
+
yield this.sessionRefresh(session);
|
|
8852
|
+
}
|
|
8853
|
+
return this.apiClient.unbanClanUsers(session.token, clanId, channelId, userIds).then((response) => {
|
|
8854
|
+
return Promise.resolve(response != void 0);
|
|
8855
|
+
});
|
|
8856
|
+
});
|
|
8857
|
+
}
|
|
8858
|
+
/** Ban a set of users from a clan. */
|
|
8859
|
+
banClanUsers(session, clanId, channelId, userIds, banTime) {
|
|
8860
|
+
return __async(this, null, function* () {
|
|
8861
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
8862
|
+
yield this.sessionRefresh(session);
|
|
8863
|
+
}
|
|
8864
|
+
return this.apiClient.banClanUsers(session.token, clanId, channelId, userIds, banTime).then((response) => {
|
|
8865
|
+
return Promise.resolve(response != void 0);
|
|
8866
|
+
});
|
|
8867
|
+
});
|
|
8868
|
+
}
|
|
8749
8869
|
/** Kick users from a channel, or decline their join requests. */
|
|
8750
8870
|
removeChannelUsers(session, channelId, ids) {
|
|
8751
8871
|
return __async(this, null, function* () {
|
|
@@ -8902,7 +9022,8 @@ var Client = class {
|
|
|
8902
9022
|
clan_nick: gu.clan_nick,
|
|
8903
9023
|
id: gu.id,
|
|
8904
9024
|
clan_id: gu.clan_id,
|
|
8905
|
-
added_by: gu.added_by
|
|
9025
|
+
added_by: gu.added_by,
|
|
9026
|
+
is_banned: gu.is_banned
|
|
8906
9027
|
});
|
|
8907
9028
|
});
|
|
8908
9029
|
return Promise.resolve(result);
|
|
@@ -9391,6 +9512,17 @@ var Client = class {
|
|
|
9391
9512
|
});
|
|
9392
9513
|
}
|
|
9393
9514
|
/** Update fields in the current user's account. */
|
|
9515
|
+
updateUsername(session, request) {
|
|
9516
|
+
return __async(this, null, function* () {
|
|
9517
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
9518
|
+
yield this.sessionRefresh(session);
|
|
9519
|
+
}
|
|
9520
|
+
return this.apiClient.updateUsername(session.token, request).then((response) => {
|
|
9521
|
+
return Promise.resolve(response);
|
|
9522
|
+
});
|
|
9523
|
+
});
|
|
9524
|
+
}
|
|
9525
|
+
/** Update fields in the current user's account. */
|
|
9394
9526
|
updateAccount(session, request) {
|
|
9395
9527
|
return __async(this, null, function* () {
|
|
9396
9528
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/socket.d.ts
CHANGED
|
@@ -100,6 +100,11 @@ export interface AddClanUserEvent {
|
|
|
100
100
|
user: UserProfileRedis;
|
|
101
101
|
invitor: string;
|
|
102
102
|
}
|
|
103
|
+
export interface BannedUserEvent {
|
|
104
|
+
user_ids: Array<string>;
|
|
105
|
+
action: number;
|
|
106
|
+
banner_id: string;
|
|
107
|
+
}
|
|
103
108
|
export interface UserProfileRedis {
|
|
104
109
|
/** User IDs to follow. */
|
|
105
110
|
user_id: string;
|
|
@@ -1053,6 +1058,7 @@ export interface Socket {
|
|
|
1053
1058
|
onunpinmessageevent: (unpin_message_event: UnpinMessageEvent) => void;
|
|
1054
1059
|
onquickmenuevent: (event: QuickMenuEvent) => void;
|
|
1055
1060
|
ontransferownership: (event: TransferOwnershipEvent) => void;
|
|
1061
|
+
onbanneduser: (event: BannedUserEvent) => void;
|
|
1056
1062
|
}
|
|
1057
1063
|
/** Reports an error received from a socket message. */
|
|
1058
1064
|
export interface SocketError {
|
|
@@ -1149,6 +1155,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
1149
1155
|
onunpinmessageevent(unpin_message_event: UnpinMessageEvent): void;
|
|
1150
1156
|
onquickmenuevent(event: QuickMenuEvent): void;
|
|
1151
1157
|
ontransferownership(event: TransferOwnershipEvent): void;
|
|
1158
|
+
onbanneduser(event: BannedUserEvent): void;
|
|
1152
1159
|
onmeetparticipantevent(event: MeetParticipantEvent): void;
|
|
1153
1160
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | IncomingCallPush | MessageButtonClicked | DropdownBoxSelected | ChannelAppEvent | EphemeralMessageSend | VoiceReactionSend | ListDataSocket | QuickMenuEvent, sendTimeout?: number): Promise<any>;
|
|
1154
1161
|
followUsers(userIds: string[]): Promise<Status>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -178,6 +178,12 @@ export interface AddClanUserEvent {
|
|
|
178
178
|
invitor: string;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
export interface BannedUserEvent {
|
|
182
|
+
user_ids: Array<string>;
|
|
183
|
+
action: number;
|
|
184
|
+
banner_id: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
export interface UserProfileRedis {
|
|
182
188
|
/** User IDs to follow. */
|
|
183
189
|
user_id: string;
|
|
@@ -1825,6 +1831,8 @@ export interface Socket {
|
|
|
1825
1831
|
onquickmenuevent: (event: QuickMenuEvent) => void;
|
|
1826
1832
|
|
|
1827
1833
|
ontransferownership: (event: TransferOwnershipEvent) => void;
|
|
1834
|
+
|
|
1835
|
+
onbanneduser: (event: BannedUserEvent) => void;
|
|
1828
1836
|
}
|
|
1829
1837
|
|
|
1830
1838
|
/** Reports an error received from a socket message. */
|
|
@@ -2078,6 +2086,8 @@ export class DefaultSocket implements Socket {
|
|
|
2078
2086
|
this.onmeetparticipantevent(<MeetParticipantEvent>message.meet_participant_event);
|
|
2079
2087
|
} else if (message.transfer_ownership_event) {
|
|
2080
2088
|
this.ontransferownership(<TransferOwnershipEvent>message.transfer_ownership_event);
|
|
2089
|
+
} else if (message.ban_user_event) {
|
|
2090
|
+
this.onbanneduser(<BannedUserEvent>message.ban_user_event);
|
|
2081
2091
|
} else {
|
|
2082
2092
|
if (this.verbose && window && window.console) {
|
|
2083
2093
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -2541,6 +2551,12 @@ export class DefaultSocket implements Socket {
|
|
|
2541
2551
|
}
|
|
2542
2552
|
}
|
|
2543
2553
|
|
|
2554
|
+
onbanneduser(event: BannedUserEvent) {
|
|
2555
|
+
if (this.verbose && window && window.console) {
|
|
2556
|
+
console.log(event)
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2544
2560
|
onmeetparticipantevent(event: MeetParticipantEvent) {
|
|
2545
2561
|
if (this.verbose && window && window.console) {
|
|
2546
2562
|
console.log(event);
|