mezon-js 2.8.21 → 2.8.22
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 +105 -72
- package/client.ts +26 -26
- package/dist/api.gen.d.ts +25 -4
- package/dist/client.d.ts +5 -4
- package/dist/mezon-js.cjs.js +90 -78
- package/dist/mezon-js.esm.mjs +90 -78
- package/dist/socket.d.ts +5 -1
- package/package.json +1 -1
- package/socket.ts +15 -2
package/api.gen.ts
CHANGED
|
@@ -1111,6 +1111,8 @@ export interface ApiPermission {
|
|
|
1111
1111
|
//
|
|
1112
1112
|
id?: string;
|
|
1113
1113
|
//
|
|
1114
|
+
scope?: number;
|
|
1115
|
+
//
|
|
1114
1116
|
slug?: string;
|
|
1115
1117
|
//
|
|
1116
1118
|
title?: string;
|
|
@@ -1122,6 +1124,28 @@ export interface ApiPermissionList {
|
|
|
1122
1124
|
permissions?: Array<ApiPermission>;
|
|
1123
1125
|
}
|
|
1124
1126
|
|
|
1127
|
+
/** */
|
|
1128
|
+
export interface ApiPermissionRoleChannel {
|
|
1129
|
+
//
|
|
1130
|
+
active?: boolean;
|
|
1131
|
+
//
|
|
1132
|
+
permission_id?: string;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/** A list of permission role channel. */
|
|
1136
|
+
export interface ApiPermissionRoleChannelList {
|
|
1137
|
+
//A list of permission.
|
|
1138
|
+
permission_role_channel?: Array<ApiPermissionRoleChannel>;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/** */
|
|
1142
|
+
export interface ApiPermissionUpdate {
|
|
1143
|
+
//
|
|
1144
|
+
permission_id?: string;
|
|
1145
|
+
//
|
|
1146
|
+
type?: number;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1125
1149
|
/** */
|
|
1126
1150
|
export interface ApiPinMessage {
|
|
1127
1151
|
//
|
|
@@ -1458,6 +1482,16 @@ export interface ApiUpdateCategoryDescRequest {
|
|
|
1458
1482
|
category_name?: string;
|
|
1459
1483
|
}
|
|
1460
1484
|
|
|
1485
|
+
/** */
|
|
1486
|
+
export interface ApiUpdateRoleChannelRequest {
|
|
1487
|
+
//
|
|
1488
|
+
channel_id?: string;
|
|
1489
|
+
//The permissions to add.
|
|
1490
|
+
permission_update?: Array<ApiPermissionUpdate>;
|
|
1491
|
+
//The ID of the role to update.
|
|
1492
|
+
role_id?: string;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1461
1495
|
/** Fetch a batch of zero or more users from the server. */
|
|
1462
1496
|
export interface ApiUpdateUsersRequest {
|
|
1463
1497
|
//The avarar_url of a user.
|
|
@@ -3910,42 +3944,6 @@ export class MezonApi {
|
|
|
3910
3944
|
]);
|
|
3911
3945
|
}
|
|
3912
3946
|
|
|
3913
|
-
/** Get emoji list by clan id */
|
|
3914
|
-
listClanEmojiByClanId(bearerToken: string,
|
|
3915
|
-
clanId:string,
|
|
3916
|
-
options: any = {}): Promise<ApiClanEmojiList> {
|
|
3917
|
-
|
|
3918
|
-
if (clanId === null || clanId === undefined) {
|
|
3919
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3920
|
-
}
|
|
3921
|
-
const urlPath = "/v2/emoji/{clanId}"
|
|
3922
|
-
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3923
|
-
const queryParams = new Map<string, any>();
|
|
3924
|
-
|
|
3925
|
-
let bodyJson : string = "";
|
|
3926
|
-
|
|
3927
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3928
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3929
|
-
if (bearerToken) {
|
|
3930
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
return Promise.race([
|
|
3934
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3935
|
-
if (response.status == 204) {
|
|
3936
|
-
return response;
|
|
3937
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
3938
|
-
return response.json();
|
|
3939
|
-
} else {
|
|
3940
|
-
throw response;
|
|
3941
|
-
}
|
|
3942
|
-
}),
|
|
3943
|
-
new Promise((_, reject) =>
|
|
3944
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3945
|
-
),
|
|
3946
|
-
]);
|
|
3947
|
-
}
|
|
3948
|
-
|
|
3949
3947
|
/** Delete a emoji by ID. */
|
|
3950
3948
|
deleteByIdClanEmoji(bearerToken: string,
|
|
3951
3949
|
id:string,
|
|
@@ -5190,6 +5188,77 @@ export class MezonApi {
|
|
|
5190
5188
|
]);
|
|
5191
5189
|
}
|
|
5192
5190
|
|
|
5191
|
+
/** List permission role channel */
|
|
5192
|
+
getListPermissionRoleChannel(bearerToken: string,
|
|
5193
|
+
roleId?:string,
|
|
5194
|
+
channelId?:string,
|
|
5195
|
+
options: any = {}): Promise<ApiPermissionRoleChannelList> {
|
|
5196
|
+
|
|
5197
|
+
const urlPath = "/v2/permissionrolechannel/get";
|
|
5198
|
+
const queryParams = new Map<string, any>();
|
|
5199
|
+
queryParams.set("role_id", roleId);
|
|
5200
|
+
queryParams.set("channel_id", channelId);
|
|
5201
|
+
|
|
5202
|
+
let bodyJson : string = "";
|
|
5203
|
+
|
|
5204
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5205
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
5206
|
+
if (bearerToken) {
|
|
5207
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5210
|
+
return Promise.race([
|
|
5211
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5212
|
+
if (response.status == 204) {
|
|
5213
|
+
return response;
|
|
5214
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5215
|
+
return response.json();
|
|
5216
|
+
} else {
|
|
5217
|
+
throw response;
|
|
5218
|
+
}
|
|
5219
|
+
}),
|
|
5220
|
+
new Promise((_, reject) =>
|
|
5221
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5222
|
+
),
|
|
5223
|
+
]);
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
/** set permission role channel. */
|
|
5227
|
+
setRoleChannelPermission(bearerToken: string,
|
|
5228
|
+
body:ApiUpdateRoleChannelRequest,
|
|
5229
|
+
options: any = {}): Promise<any> {
|
|
5230
|
+
|
|
5231
|
+
if (body === null || body === undefined) {
|
|
5232
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
5233
|
+
}
|
|
5234
|
+
const urlPath = "/v2/permissionrolechannel/set";
|
|
5235
|
+
const queryParams = new Map<string, any>();
|
|
5236
|
+
|
|
5237
|
+
let bodyJson : string = "";
|
|
5238
|
+
bodyJson = JSON.stringify(body || {});
|
|
5239
|
+
|
|
5240
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5241
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
5242
|
+
if (bearerToken) {
|
|
5243
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5246
|
+
return Promise.race([
|
|
5247
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5248
|
+
if (response.status == 204) {
|
|
5249
|
+
return response;
|
|
5250
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
5251
|
+
return response.json();
|
|
5252
|
+
} else {
|
|
5253
|
+
throw response;
|
|
5254
|
+
}
|
|
5255
|
+
}),
|
|
5256
|
+
new Promise((_, reject) =>
|
|
5257
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5258
|
+
),
|
|
5259
|
+
]);
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5193
5262
|
/** Get permission list */
|
|
5194
5263
|
getListPermission(bearerToken: string,
|
|
5195
5264
|
options: any = {}): Promise<ApiPermissionList> {
|
|
@@ -5906,42 +5975,6 @@ export class MezonApi {
|
|
|
5906
5975
|
]);
|
|
5907
5976
|
}
|
|
5908
5977
|
|
|
5909
|
-
/** List stickers by clan ID */
|
|
5910
|
-
listClanStickersByClanId(bearerToken: string,
|
|
5911
|
-
clanId:string,
|
|
5912
|
-
options: any = {}): Promise<ApiClanStickerListByClanIdResponse> {
|
|
5913
|
-
|
|
5914
|
-
if (clanId === null || clanId === undefined) {
|
|
5915
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
5916
|
-
}
|
|
5917
|
-
const urlPath = "/v2/sticker/{clanId}"
|
|
5918
|
-
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
5919
|
-
const queryParams = new Map<string, any>();
|
|
5920
|
-
|
|
5921
|
-
let bodyJson : string = "";
|
|
5922
|
-
|
|
5923
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
5924
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
5925
|
-
if (bearerToken) {
|
|
5926
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
return Promise.race([
|
|
5930
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
5931
|
-
if (response.status == 204) {
|
|
5932
|
-
return response;
|
|
5933
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
5934
|
-
return response.json();
|
|
5935
|
-
} else {
|
|
5936
|
-
throw response;
|
|
5937
|
-
}
|
|
5938
|
-
}),
|
|
5939
|
-
new Promise((_, reject) =>
|
|
5940
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
5941
|
-
),
|
|
5942
|
-
]);
|
|
5943
|
-
}
|
|
5944
|
-
|
|
5945
5978
|
/** Delete a sticker by ID */
|
|
5946
5979
|
deleteClanStickerById(bearerToken: string,
|
|
5947
5980
|
id:string,
|
package/client.ts
CHANGED
|
@@ -92,7 +92,6 @@ import {
|
|
|
92
92
|
ApiPinMessagesList,
|
|
93
93
|
ApiDeleteChannelDescRequest,
|
|
94
94
|
ApiChangeChannelPrivateRequest,
|
|
95
|
-
ApiClanEmojiList,
|
|
96
95
|
ApiClanEmojiCreateRequest,
|
|
97
96
|
MezonUpdateClanEmojiByIdBody,
|
|
98
97
|
ApiWebhookCreateRequest,
|
|
@@ -101,10 +100,11 @@ import {
|
|
|
101
100
|
ApiWebhookGenerateResponse,
|
|
102
101
|
ApiCheckDuplicateClanNameResponse,
|
|
103
102
|
ApiClanStickerAddRequest,
|
|
104
|
-
ApiClanStickerListByClanIdResponse,
|
|
105
103
|
MezonUpdateClanStickerByIdBody,
|
|
106
104
|
MezonChangeChannelCategoryBody,
|
|
107
105
|
ApiHashtagDmVoiceList,
|
|
106
|
+
ApiPermissionRoleChannelList,
|
|
107
|
+
ApiUpdateRoleChannelRequest,
|
|
108
108
|
} from "./api.gen";
|
|
109
109
|
|
|
110
110
|
import { Session } from "./session";
|
|
@@ -2280,18 +2280,6 @@ async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
|
|
|
2280
2280
|
});
|
|
2281
2281
|
}
|
|
2282
2282
|
|
|
2283
|
-
/** List clan emoji. */
|
|
2284
|
-
async listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList> {
|
|
2285
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
|
2286
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2287
|
-
await this.sessionRefresh(session);
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response: ApiClanEmojiList) => {
|
|
2291
|
-
return Promise.resolve(response);
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
2283
|
/** create clan emoji */
|
|
2296
2284
|
async createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest) {
|
|
2297
2285
|
if (this.autoRefreshSession && session.refresh_token &&
|
|
@@ -2400,18 +2388,6 @@ async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
|
|
|
2400
2388
|
})
|
|
2401
2389
|
}
|
|
2402
2390
|
|
|
2403
|
-
//**List stickers by clan ID */
|
|
2404
|
-
async listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse> {
|
|
2405
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
|
2406
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2407
|
-
await this.sessionRefresh(session);
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
return this.apiClient.listClanStickersByClanId(session.token, id).then((response: any) => {
|
|
2411
|
-
return Promise.resolve(response);
|
|
2412
|
-
})
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
2391
|
//**Delete a sticker by ID*/
|
|
2416
2392
|
async deleteClanStickerById(session: Session, id: string, clan_id: string) {
|
|
2417
2393
|
if (this.autoRefreshSession && session.refresh_token &&
|
|
@@ -2448,4 +2424,28 @@ async changeChannelCategory(session: Session, id: string, request: MezonChangeCh
|
|
|
2448
2424
|
})
|
|
2449
2425
|
}
|
|
2450
2426
|
|
|
2427
|
+
/** */
|
|
2428
|
+
async getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList> {
|
|
2429
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2430
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2431
|
+
await this.sessionRefresh(session);
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response: ApiPermissionRoleChannelList) => {
|
|
2435
|
+
return Promise.resolve(response);
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
/** */
|
|
2440
|
+
async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean> {
|
|
2441
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2442
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2443
|
+
await this.sessionRefresh(session);
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
return this.apiClient.setRoleChannelPermission(session.token, request).then((response: any) => {
|
|
2447
|
+
return response !== undefined;
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
2451
|
};
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -636,6 +636,7 @@ export interface ApiPermission {
|
|
|
636
636
|
active?: number;
|
|
637
637
|
description?: string;
|
|
638
638
|
id?: string;
|
|
639
|
+
scope?: number;
|
|
639
640
|
slug?: string;
|
|
640
641
|
title?: string;
|
|
641
642
|
}
|
|
@@ -644,6 +645,20 @@ export interface ApiPermissionList {
|
|
|
644
645
|
permissions?: Array<ApiPermission>;
|
|
645
646
|
}
|
|
646
647
|
/** */
|
|
648
|
+
export interface ApiPermissionRoleChannel {
|
|
649
|
+
active?: boolean;
|
|
650
|
+
permission_id?: string;
|
|
651
|
+
}
|
|
652
|
+
/** A list of permission role channel. */
|
|
653
|
+
export interface ApiPermissionRoleChannelList {
|
|
654
|
+
permission_role_channel?: Array<ApiPermissionRoleChannel>;
|
|
655
|
+
}
|
|
656
|
+
/** */
|
|
657
|
+
export interface ApiPermissionUpdate {
|
|
658
|
+
permission_id?: string;
|
|
659
|
+
type?: number;
|
|
660
|
+
}
|
|
661
|
+
/** */
|
|
647
662
|
export interface ApiPinMessage {
|
|
648
663
|
avatar?: string;
|
|
649
664
|
channel_id?: string;
|
|
@@ -838,6 +853,12 @@ export interface ApiUpdateCategoryDescRequest {
|
|
|
838
853
|
category_id?: string;
|
|
839
854
|
category_name?: string;
|
|
840
855
|
}
|
|
856
|
+
/** */
|
|
857
|
+
export interface ApiUpdateRoleChannelRequest {
|
|
858
|
+
channel_id?: string;
|
|
859
|
+
permission_update?: Array<ApiPermissionUpdate>;
|
|
860
|
+
role_id?: string;
|
|
861
|
+
}
|
|
841
862
|
/** Fetch a batch of zero or more users from the server. */
|
|
842
863
|
export interface ApiUpdateUsersRequest {
|
|
843
864
|
avatar_url?: string;
|
|
@@ -1071,8 +1092,6 @@ export declare class MezonApi {
|
|
|
1071
1092
|
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
|
1072
1093
|
/** Post clan Emoji /v2/emoji/create */
|
|
1073
1094
|
createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
|
|
1074
|
-
/** Get emoji list by clan id */
|
|
1075
|
-
listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
|
|
1076
1095
|
/** Delete a emoji by ID. */
|
|
1077
1096
|
deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
|
1078
1097
|
/** Update ClanEmoj By id */
|
|
@@ -1143,6 +1162,10 @@ export declare class MezonApi {
|
|
|
1143
1162
|
getNotificationReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotifiReactMessage>;
|
|
1144
1163
|
/** */
|
|
1145
1164
|
setNotificationReactMessage(bearerToken: string, body: ApiNotificationChannel, options?: any): Promise<any>;
|
|
1165
|
+
/** List permission role channel */
|
|
1166
|
+
getListPermissionRoleChannel(bearerToken: string, roleId?: string, channelId?: string, options?: any): Promise<ApiPermissionRoleChannelList>;
|
|
1167
|
+
/** set permission role channel. */
|
|
1168
|
+
setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
|
|
1146
1169
|
/** Get permission list */
|
|
1147
1170
|
getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
|
|
1148
1171
|
/** */
|
|
@@ -1181,8 +1204,6 @@ export declare class MezonApi {
|
|
|
1181
1204
|
sessionLogout(bearerToken: string, body: ApiSessionLogoutRequest, options?: any): Promise<any>;
|
|
1182
1205
|
/** Add a new sticker */
|
|
1183
1206
|
addClanSticker(bearerToken: string, body: ApiClanStickerAddRequest, options?: any): Promise<any>;
|
|
1184
|
-
/** List stickers by clan ID */
|
|
1185
|
-
listClanStickersByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanStickerListByClanIdResponse>;
|
|
1186
1207
|
/** Delete a sticker by ID */
|
|
1187
1208
|
deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
|
1188
1209
|
/** Update a sticker 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, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, 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, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest,
|
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiHashtagDmVoiceList, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -584,8 +584,6 @@ export declare class Client {
|
|
|
584
584
|
pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
|
|
585
585
|
hashtagDmVoiceList(session: Session, userId: Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList>;
|
|
586
586
|
deletePinMessage(session: Session, message_id: string): Promise<boolean>;
|
|
587
|
-
/** List clan emoji. */
|
|
588
|
-
listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList>;
|
|
589
587
|
/** create clan emoji */
|
|
590
588
|
createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
|
|
591
589
|
updateClanEmojiById(session: Session, id: string, request: MezonUpdateClanEmojiByIdBody): Promise<boolean>;
|
|
@@ -596,8 +594,11 @@ export declare class Client {
|
|
|
596
594
|
deleteWebhookById(session: Session, id: string): Promise<boolean>;
|
|
597
595
|
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
|
598
596
|
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
|
599
|
-
listClanStickersByClanId(session: Session, id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
|
600
597
|
deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
|
601
598
|
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
|
602
599
|
changeChannelCategory(session: Session, id: string, request: MezonChangeChannelCategoryBody): Promise<boolean>;
|
|
600
|
+
/** */
|
|
601
|
+
getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
|
|
602
|
+
/** */
|
|
603
|
+
setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
|
|
603
604
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -2417,34 +2417,6 @@ var MezonApi = class {
|
|
|
2417
2417
|
)
|
|
2418
2418
|
]);
|
|
2419
2419
|
}
|
|
2420
|
-
/** Get emoji list by clan id */
|
|
2421
|
-
listClanEmojiByClanId(bearerToken, clanId, options = {}) {
|
|
2422
|
-
if (clanId === null || clanId === void 0) {
|
|
2423
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2424
|
-
}
|
|
2425
|
-
const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2426
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
2427
|
-
let bodyJson = "";
|
|
2428
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2429
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
2430
|
-
if (bearerToken) {
|
|
2431
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2432
|
-
}
|
|
2433
|
-
return Promise.race([
|
|
2434
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2435
|
-
if (response.status == 204) {
|
|
2436
|
-
return response;
|
|
2437
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
2438
|
-
return response.json();
|
|
2439
|
-
} else {
|
|
2440
|
-
throw response;
|
|
2441
|
-
}
|
|
2442
|
-
}),
|
|
2443
|
-
new Promise(
|
|
2444
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2445
|
-
)
|
|
2446
|
-
]);
|
|
2447
|
-
}
|
|
2448
2420
|
/** Delete a emoji by ID. */
|
|
2449
2421
|
deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
|
|
2450
2422
|
if (id === null || id === void 0) {
|
|
@@ -3424,6 +3396,62 @@ var MezonApi = class {
|
|
|
3424
3396
|
)
|
|
3425
3397
|
]);
|
|
3426
3398
|
}
|
|
3399
|
+
/** List permission role channel */
|
|
3400
|
+
getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
|
|
3401
|
+
const urlPath = "/v2/permissionrolechannel/get";
|
|
3402
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3403
|
+
queryParams.set("role_id", roleId);
|
|
3404
|
+
queryParams.set("channel_id", channelId);
|
|
3405
|
+
let bodyJson = "";
|
|
3406
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3407
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3408
|
+
if (bearerToken) {
|
|
3409
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3410
|
+
}
|
|
3411
|
+
return Promise.race([
|
|
3412
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3413
|
+
if (response.status == 204) {
|
|
3414
|
+
return response;
|
|
3415
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3416
|
+
return response.json();
|
|
3417
|
+
} else {
|
|
3418
|
+
throw response;
|
|
3419
|
+
}
|
|
3420
|
+
}),
|
|
3421
|
+
new Promise(
|
|
3422
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3423
|
+
)
|
|
3424
|
+
]);
|
|
3425
|
+
}
|
|
3426
|
+
/** set permission role channel. */
|
|
3427
|
+
setRoleChannelPermission(bearerToken, body, options = {}) {
|
|
3428
|
+
if (body === null || body === void 0) {
|
|
3429
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3430
|
+
}
|
|
3431
|
+
const urlPath = "/v2/permissionrolechannel/set";
|
|
3432
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3433
|
+
let bodyJson = "";
|
|
3434
|
+
bodyJson = JSON.stringify(body || {});
|
|
3435
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3436
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3437
|
+
if (bearerToken) {
|
|
3438
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3439
|
+
}
|
|
3440
|
+
return Promise.race([
|
|
3441
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3442
|
+
if (response.status == 204) {
|
|
3443
|
+
return response;
|
|
3444
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3445
|
+
return response.json();
|
|
3446
|
+
} else {
|
|
3447
|
+
throw response;
|
|
3448
|
+
}
|
|
3449
|
+
}),
|
|
3450
|
+
new Promise(
|
|
3451
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3452
|
+
)
|
|
3453
|
+
]);
|
|
3454
|
+
}
|
|
3427
3455
|
/** Get permission list */
|
|
3428
3456
|
getListPermission(bearerToken, options = {}) {
|
|
3429
3457
|
const urlPath = "/v2/permissions";
|
|
@@ -3984,34 +4012,6 @@ var MezonApi = class {
|
|
|
3984
4012
|
)
|
|
3985
4013
|
]);
|
|
3986
4014
|
}
|
|
3987
|
-
/** List stickers by clan ID */
|
|
3988
|
-
listClanStickersByClanId(bearerToken, clanId, options = {}) {
|
|
3989
|
-
if (clanId === null || clanId === void 0) {
|
|
3990
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3991
|
-
}
|
|
3992
|
-
const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3993
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
3994
|
-
let bodyJson = "";
|
|
3995
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3996
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3997
|
-
if (bearerToken) {
|
|
3998
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3999
|
-
}
|
|
4000
|
-
return Promise.race([
|
|
4001
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
4002
|
-
if (response.status == 204) {
|
|
4003
|
-
return response;
|
|
4004
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
4005
|
-
return response.json();
|
|
4006
|
-
} else {
|
|
4007
|
-
throw response;
|
|
4008
|
-
}
|
|
4009
|
-
}),
|
|
4010
|
-
new Promise(
|
|
4011
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
4012
|
-
)
|
|
4013
|
-
]);
|
|
4014
|
-
}
|
|
4015
4015
|
/** Delete a sticker by ID */
|
|
4016
4016
|
deleteClanStickerById(bearerToken, id, clanId, options = {}) {
|
|
4017
4017
|
if (id === null || id === void 0) {
|
|
@@ -5156,6 +5156,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
5156
5156
|
return response.clan_name_existed_event;
|
|
5157
5157
|
});
|
|
5158
5158
|
}
|
|
5159
|
+
listClanEmojiByClanId(clan_id) {
|
|
5160
|
+
return __async(this, null, function* () {
|
|
5161
|
+
const response = yield this.send({ emojis_by_clan_id_request_event: { clan_id } });
|
|
5162
|
+
return response.clan_emoji_list_event;
|
|
5163
|
+
});
|
|
5164
|
+
}
|
|
5165
|
+
listClanStickersByClanId(clan_id) {
|
|
5166
|
+
return __async(this, null, function* () {
|
|
5167
|
+
const response = yield this.send({ clan_sticker_list_request_event: { clan_id } });
|
|
5168
|
+
return response.clan_sticker_list_response_event;
|
|
5169
|
+
});
|
|
5170
|
+
}
|
|
5159
5171
|
pingPong() {
|
|
5160
5172
|
return __async(this, null, function* () {
|
|
5161
5173
|
if (!this.adapter.isOpen()) {
|
|
@@ -6805,17 +6817,6 @@ var Client = class {
|
|
|
6805
6817
|
});
|
|
6806
6818
|
});
|
|
6807
6819
|
}
|
|
6808
|
-
/** List clan emoji. */
|
|
6809
|
-
listClanEmoji(session, clan_id) {
|
|
6810
|
-
return __async(this, null, function* () {
|
|
6811
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6812
|
-
yield this.sessionRefresh(session);
|
|
6813
|
-
}
|
|
6814
|
-
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
|
|
6815
|
-
return Promise.resolve(response);
|
|
6816
|
-
});
|
|
6817
|
-
});
|
|
6818
|
-
}
|
|
6819
6820
|
/** create clan emoji */
|
|
6820
6821
|
createClanEmoji(session, request) {
|
|
6821
6822
|
return __async(this, null, function* () {
|
|
@@ -6915,17 +6916,6 @@ var Client = class {
|
|
|
6915
6916
|
});
|
|
6916
6917
|
});
|
|
6917
6918
|
}
|
|
6918
|
-
//**List stickers by clan ID */
|
|
6919
|
-
listClanStickersByClanId(session, id) {
|
|
6920
|
-
return __async(this, null, function* () {
|
|
6921
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6922
|
-
yield this.sessionRefresh(session);
|
|
6923
|
-
}
|
|
6924
|
-
return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
|
|
6925
|
-
return Promise.resolve(response);
|
|
6926
|
-
});
|
|
6927
|
-
});
|
|
6928
|
-
}
|
|
6929
6919
|
//**Delete a sticker by ID*/
|
|
6930
6920
|
deleteClanStickerById(session, id, clan_id) {
|
|
6931
6921
|
return __async(this, null, function* () {
|
|
@@ -6959,4 +6949,26 @@ var Client = class {
|
|
|
6959
6949
|
});
|
|
6960
6950
|
});
|
|
6961
6951
|
}
|
|
6952
|
+
/** */
|
|
6953
|
+
getListPermissionRoleChannel(session, roleId, channelId) {
|
|
6954
|
+
return __async(this, null, function* () {
|
|
6955
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6956
|
+
yield this.sessionRefresh(session);
|
|
6957
|
+
}
|
|
6958
|
+
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
|
|
6959
|
+
return Promise.resolve(response);
|
|
6960
|
+
});
|
|
6961
|
+
});
|
|
6962
|
+
}
|
|
6963
|
+
/** */
|
|
6964
|
+
setRoleChannelPermission(session, request) {
|
|
6965
|
+
return __async(this, null, function* () {
|
|
6966
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6967
|
+
yield this.sessionRefresh(session);
|
|
6968
|
+
}
|
|
6969
|
+
return this.apiClient.setRoleChannelPermission(session.token, request).then((response) => {
|
|
6970
|
+
return response !== void 0;
|
|
6971
|
+
});
|
|
6972
|
+
});
|
|
6973
|
+
}
|
|
6962
6974
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -2388,34 +2388,6 @@ var MezonApi = class {
|
|
|
2388
2388
|
)
|
|
2389
2389
|
]);
|
|
2390
2390
|
}
|
|
2391
|
-
/** Get emoji list by clan id */
|
|
2392
|
-
listClanEmojiByClanId(bearerToken, clanId, options = {}) {
|
|
2393
|
-
if (clanId === null || clanId === void 0) {
|
|
2394
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2395
|
-
}
|
|
2396
|
-
const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2397
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
2398
|
-
let bodyJson = "";
|
|
2399
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2400
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
2401
|
-
if (bearerToken) {
|
|
2402
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2403
|
-
}
|
|
2404
|
-
return Promise.race([
|
|
2405
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2406
|
-
if (response.status == 204) {
|
|
2407
|
-
return response;
|
|
2408
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
2409
|
-
return response.json();
|
|
2410
|
-
} else {
|
|
2411
|
-
throw response;
|
|
2412
|
-
}
|
|
2413
|
-
}),
|
|
2414
|
-
new Promise(
|
|
2415
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2416
|
-
)
|
|
2417
|
-
]);
|
|
2418
|
-
}
|
|
2419
2391
|
/** Delete a emoji by ID. */
|
|
2420
2392
|
deleteByIdClanEmoji(bearerToken, id, clanId, options = {}) {
|
|
2421
2393
|
if (id === null || id === void 0) {
|
|
@@ -3395,6 +3367,62 @@ var MezonApi = class {
|
|
|
3395
3367
|
)
|
|
3396
3368
|
]);
|
|
3397
3369
|
}
|
|
3370
|
+
/** List permission role channel */
|
|
3371
|
+
getListPermissionRoleChannel(bearerToken, roleId, channelId, options = {}) {
|
|
3372
|
+
const urlPath = "/v2/permissionrolechannel/get";
|
|
3373
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3374
|
+
queryParams.set("role_id", roleId);
|
|
3375
|
+
queryParams.set("channel_id", channelId);
|
|
3376
|
+
let bodyJson = "";
|
|
3377
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3378
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3379
|
+
if (bearerToken) {
|
|
3380
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3381
|
+
}
|
|
3382
|
+
return Promise.race([
|
|
3383
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3384
|
+
if (response.status == 204) {
|
|
3385
|
+
return response;
|
|
3386
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3387
|
+
return response.json();
|
|
3388
|
+
} else {
|
|
3389
|
+
throw response;
|
|
3390
|
+
}
|
|
3391
|
+
}),
|
|
3392
|
+
new Promise(
|
|
3393
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3394
|
+
)
|
|
3395
|
+
]);
|
|
3396
|
+
}
|
|
3397
|
+
/** set permission role channel. */
|
|
3398
|
+
setRoleChannelPermission(bearerToken, body, options = {}) {
|
|
3399
|
+
if (body === null || body === void 0) {
|
|
3400
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3401
|
+
}
|
|
3402
|
+
const urlPath = "/v2/permissionrolechannel/set";
|
|
3403
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
3404
|
+
let bodyJson = "";
|
|
3405
|
+
bodyJson = JSON.stringify(body || {});
|
|
3406
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3407
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3408
|
+
if (bearerToken) {
|
|
3409
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3410
|
+
}
|
|
3411
|
+
return Promise.race([
|
|
3412
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3413
|
+
if (response.status == 204) {
|
|
3414
|
+
return response;
|
|
3415
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3416
|
+
return response.json();
|
|
3417
|
+
} else {
|
|
3418
|
+
throw response;
|
|
3419
|
+
}
|
|
3420
|
+
}),
|
|
3421
|
+
new Promise(
|
|
3422
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3423
|
+
)
|
|
3424
|
+
]);
|
|
3425
|
+
}
|
|
3398
3426
|
/** Get permission list */
|
|
3399
3427
|
getListPermission(bearerToken, options = {}) {
|
|
3400
3428
|
const urlPath = "/v2/permissions";
|
|
@@ -3955,34 +3983,6 @@ var MezonApi = class {
|
|
|
3955
3983
|
)
|
|
3956
3984
|
]);
|
|
3957
3985
|
}
|
|
3958
|
-
/** List stickers by clan ID */
|
|
3959
|
-
listClanStickersByClanId(bearerToken, clanId, options = {}) {
|
|
3960
|
-
if (clanId === null || clanId === void 0) {
|
|
3961
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3962
|
-
}
|
|
3963
|
-
const urlPath = "/v2/sticker/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3964
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
3965
|
-
let bodyJson = "";
|
|
3966
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3967
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3968
|
-
if (bearerToken) {
|
|
3969
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3970
|
-
}
|
|
3971
|
-
return Promise.race([
|
|
3972
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3973
|
-
if (response.status == 204) {
|
|
3974
|
-
return response;
|
|
3975
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
3976
|
-
return response.json();
|
|
3977
|
-
} else {
|
|
3978
|
-
throw response;
|
|
3979
|
-
}
|
|
3980
|
-
}),
|
|
3981
|
-
new Promise(
|
|
3982
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3983
|
-
)
|
|
3984
|
-
]);
|
|
3985
|
-
}
|
|
3986
3986
|
/** Delete a sticker by ID */
|
|
3987
3987
|
deleteClanStickerById(bearerToken, id, clanId, options = {}) {
|
|
3988
3988
|
if (id === null || id === void 0) {
|
|
@@ -5127,6 +5127,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
5127
5127
|
return response.clan_name_existed_event;
|
|
5128
5128
|
});
|
|
5129
5129
|
}
|
|
5130
|
+
listClanEmojiByClanId(clan_id) {
|
|
5131
|
+
return __async(this, null, function* () {
|
|
5132
|
+
const response = yield this.send({ emojis_by_clan_id_request_event: { clan_id } });
|
|
5133
|
+
return response.clan_emoji_list_event;
|
|
5134
|
+
});
|
|
5135
|
+
}
|
|
5136
|
+
listClanStickersByClanId(clan_id) {
|
|
5137
|
+
return __async(this, null, function* () {
|
|
5138
|
+
const response = yield this.send({ clan_sticker_list_request_event: { clan_id } });
|
|
5139
|
+
return response.clan_sticker_list_response_event;
|
|
5140
|
+
});
|
|
5141
|
+
}
|
|
5130
5142
|
pingPong() {
|
|
5131
5143
|
return __async(this, null, function* () {
|
|
5132
5144
|
if (!this.adapter.isOpen()) {
|
|
@@ -6776,17 +6788,6 @@ var Client = class {
|
|
|
6776
6788
|
});
|
|
6777
6789
|
});
|
|
6778
6790
|
}
|
|
6779
|
-
/** List clan emoji. */
|
|
6780
|
-
listClanEmoji(session, clan_id) {
|
|
6781
|
-
return __async(this, null, function* () {
|
|
6782
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6783
|
-
yield this.sessionRefresh(session);
|
|
6784
|
-
}
|
|
6785
|
-
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
|
|
6786
|
-
return Promise.resolve(response);
|
|
6787
|
-
});
|
|
6788
|
-
});
|
|
6789
|
-
}
|
|
6790
6791
|
/** create clan emoji */
|
|
6791
6792
|
createClanEmoji(session, request) {
|
|
6792
6793
|
return __async(this, null, function* () {
|
|
@@ -6886,17 +6887,6 @@ var Client = class {
|
|
|
6886
6887
|
});
|
|
6887
6888
|
});
|
|
6888
6889
|
}
|
|
6889
|
-
//**List stickers by clan ID */
|
|
6890
|
-
listClanStickersByClanId(session, id) {
|
|
6891
|
-
return __async(this, null, function* () {
|
|
6892
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6893
|
-
yield this.sessionRefresh(session);
|
|
6894
|
-
}
|
|
6895
|
-
return this.apiClient.listClanStickersByClanId(session.token, id).then((response) => {
|
|
6896
|
-
return Promise.resolve(response);
|
|
6897
|
-
});
|
|
6898
|
-
});
|
|
6899
|
-
}
|
|
6900
6890
|
//**Delete a sticker by ID*/
|
|
6901
6891
|
deleteClanStickerById(session, id, clan_id) {
|
|
6902
6892
|
return __async(this, null, function* () {
|
|
@@ -6930,6 +6920,28 @@ var Client = class {
|
|
|
6930
6920
|
});
|
|
6931
6921
|
});
|
|
6932
6922
|
}
|
|
6923
|
+
/** */
|
|
6924
|
+
getListPermissionRoleChannel(session, roleId, channelId) {
|
|
6925
|
+
return __async(this, null, function* () {
|
|
6926
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6927
|
+
yield this.sessionRefresh(session);
|
|
6928
|
+
}
|
|
6929
|
+
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response) => {
|
|
6930
|
+
return Promise.resolve(response);
|
|
6931
|
+
});
|
|
6932
|
+
});
|
|
6933
|
+
}
|
|
6934
|
+
/** */
|
|
6935
|
+
setRoleChannelPermission(session, request) {
|
|
6936
|
+
return __async(this, null, function* () {
|
|
6937
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6938
|
+
yield this.sessionRefresh(session);
|
|
6939
|
+
}
|
|
6940
|
+
return this.apiClient.setRoleChannelPermission(session.token, request).then((response) => {
|
|
6941
|
+
return response !== void 0;
|
|
6942
|
+
});
|
|
6943
|
+
});
|
|
6944
|
+
}
|
|
6933
6945
|
};
|
|
6934
6946
|
export {
|
|
6935
6947
|
ChannelStreamMode,
|
package/dist/socket.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 { ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc } from "./api.gen";
|
|
16
|
+
import { ApiClanEmojiList, ApiClanStickerListByClanIdResponse, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Notification } from "./client";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -533,6 +533,8 @@ export interface Socket {
|
|
|
533
533
|
setHeartbeatTimeoutMs(ms: number): void;
|
|
534
534
|
getHeartbeatTimeoutMs(): number;
|
|
535
535
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
|
536
|
+
listClanEmojiByClanId(clan_id: string): Promise<ApiClanEmojiList>;
|
|
537
|
+
listClanStickersByClanId(clan_id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
|
536
538
|
}
|
|
537
539
|
/** Reports an error received from a socket message. */
|
|
538
540
|
export interface SocketError {
|
|
@@ -609,6 +611,8 @@ export declare class DefaultSocket implements Socket {
|
|
|
609
611
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
|
610
612
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
|
611
613
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
|
614
|
+
listClanEmojiByClanId(clan_id: string): Promise<ApiClanEmojiList>;
|
|
615
|
+
listClanStickersByClanId(clan_id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
|
612
616
|
private pingPong;
|
|
613
617
|
}
|
|
614
618
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
|
17
|
+
import {ApiClanEmojiList, ApiClanStickerListByClanIdResponse, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
|
18
18
|
import {Session} from "./session";
|
|
19
19
|
import {Notification} from "./client";
|
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
|
@@ -773,8 +773,11 @@ export interface Socket {
|
|
|
773
773
|
/* Get the heartbeat timeout used by the socket to detect if it has lost connectivity to the server. */
|
|
774
774
|
getHeartbeatTimeoutMs() : number;
|
|
775
775
|
|
|
776
|
-
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent
|
|
776
|
+
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
|
777
777
|
|
|
778
|
+
listClanEmojiByClanId(clan_id: string): Promise<ApiClanEmojiList>;
|
|
779
|
+
|
|
780
|
+
listClanStickersByClanId(clan_id: string): Promise<ApiClanStickerListByClanIdResponse>;
|
|
778
781
|
}
|
|
779
782
|
|
|
780
783
|
/** Reports an error received from a socket message. */
|
|
@@ -1313,6 +1316,16 @@ export class DefaultSocket implements Socket {
|
|
|
1313
1316
|
return response.clan_name_existed_event
|
|
1314
1317
|
}
|
|
1315
1318
|
|
|
1319
|
+
async listClanEmojiByClanId(clan_id: string): Promise<ApiClanEmojiList>{
|
|
1320
|
+
const response = await this.send({emojis_by_clan_id_request_event: {clan_id: clan_id}});
|
|
1321
|
+
return response.clan_emoji_list_event
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
async listClanStickersByClanId(clan_id: string): Promise<ApiClanStickerListByClanIdResponse>{
|
|
1325
|
+
const response = await this.send({clan_sticker_list_request_event: {clan_id: clan_id}});
|
|
1326
|
+
return response.clan_sticker_list_response_event
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1316
1329
|
private async pingPong() : Promise<void> {
|
|
1317
1330
|
if (!this.adapter.isOpen()) {
|
|
1318
1331
|
return;
|