mezon-js 2.9.24 → 2.9.26
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 +90 -7
- package/client.ts +39 -1
- package/dist/api.gen.d.ts +20 -0
- package/dist/client.d.ts +1 -0
- package/dist/mezon-js.cjs.js +57 -0
- package/dist/mezon-js.esm.mjs +57 -0
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -686,6 +686,38 @@ export interface ApiChannelMessageList {
|
|
686
686
|
messages?: Array<ApiChannelMessage>;
|
687
687
|
}
|
688
688
|
|
689
|
+
/** */
|
690
|
+
export interface ApiChannelSettingItem {
|
691
|
+
//
|
692
|
+
active?: number;
|
693
|
+
//
|
694
|
+
category_id?: string;
|
695
|
+
//
|
696
|
+
channel_label?: string;
|
697
|
+
//
|
698
|
+
channel_private?: number;
|
699
|
+
//
|
700
|
+
channel_type?: number;
|
701
|
+
//
|
702
|
+
creator_id?: string;
|
703
|
+
//
|
704
|
+
id?: string;
|
705
|
+
//
|
706
|
+
meeting_code?: string;
|
707
|
+
//
|
708
|
+
parent_id?: string;
|
709
|
+
//
|
710
|
+
user_ids?: Array<string>;
|
711
|
+
}
|
712
|
+
|
713
|
+
/** */
|
714
|
+
export interface ApiChannelSettingListResponse {
|
715
|
+
//
|
716
|
+
channel_setting_list?: Array<ApiChannelSettingItem>;
|
717
|
+
//
|
718
|
+
clan_id?: string;
|
719
|
+
}
|
720
|
+
|
689
721
|
/** A list of users belonging to a channel, along with their role. */
|
690
722
|
export interface ApiChannelUserList {
|
691
723
|
//
|
@@ -4340,6 +4372,58 @@ export class MezonApi {
|
|
4340
4372
|
]);
|
4341
4373
|
}
|
4342
4374
|
|
4375
|
+
/** List channel setting */
|
4376
|
+
listChannelSetting(bearerToken: string,
|
4377
|
+
clanId:string,
|
4378
|
+
parentId?:string,
|
4379
|
+
categoryId?:string,
|
4380
|
+
privateChannel?:number,
|
4381
|
+
active?:number,
|
4382
|
+
status?:number,
|
4383
|
+
type?:number,
|
4384
|
+
limit?:number,
|
4385
|
+
page?:number,
|
4386
|
+
options: any = {}): Promise<ApiChannelSettingListResponse> {
|
4387
|
+
|
4388
|
+
if (clanId === null || clanId === undefined) {
|
4389
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4390
|
+
}
|
4391
|
+
const urlPath = "/v2/channelsetting/{clanId}"
|
4392
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
4393
|
+
const queryParams = new Map<string, any>();
|
4394
|
+
queryParams.set("parent_id", parentId);
|
4395
|
+
queryParams.set("category_id", categoryId);
|
4396
|
+
queryParams.set("private_channel", privateChannel);
|
4397
|
+
queryParams.set("active", active);
|
4398
|
+
queryParams.set("status", status);
|
4399
|
+
queryParams.set("type", type);
|
4400
|
+
queryParams.set("limit", limit);
|
4401
|
+
queryParams.set("page", page);
|
4402
|
+
|
4403
|
+
let bodyJson : string = "";
|
4404
|
+
|
4405
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4406
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4407
|
+
if (bearerToken) {
|
4408
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4409
|
+
}
|
4410
|
+
|
4411
|
+
return Promise.race([
|
4412
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4413
|
+
if (response.status == 204) {
|
4414
|
+
return response;
|
4415
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4416
|
+
return response.json();
|
4417
|
+
} else {
|
4418
|
+
throw response;
|
4419
|
+
}
|
4420
|
+
}),
|
4421
|
+
new Promise((_, reject) =>
|
4422
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4423
|
+
),
|
4424
|
+
]);
|
4425
|
+
}
|
4426
|
+
|
4343
4427
|
/** List all users that are part of a channel. */
|
4344
4428
|
listChannelVoiceUsers(
|
4345
4429
|
bearerToken: string,
|
@@ -8188,18 +8272,17 @@ export class MezonApi {
|
|
8188
8272
|
}
|
8189
8273
|
|
8190
8274
|
/** ListUserPermissionInChannel */
|
8191
|
-
listUserPermissionInChannel(
|
8192
|
-
|
8193
|
-
|
8194
|
-
|
8195
|
-
|
8196
|
-
): Promise<ApiUserPermissionInChannelListResponse> {
|
8275
|
+
listUserPermissionInChannel(bearerToken: string,
|
8276
|
+
clanId?:string,
|
8277
|
+
channelId?:string,
|
8278
|
+
options: any = {}): Promise<ApiUserPermissionInChannelListResponse> {
|
8279
|
+
|
8197
8280
|
const urlPath = "/v2/users/clans/channels";
|
8198
8281
|
const queryParams = new Map<string, any>();
|
8199
8282
|
queryParams.set("clan_id", clanId);
|
8200
8283
|
queryParams.set("channel_id", channelId);
|
8201
8284
|
|
8202
|
-
let bodyJson: string = "";
|
8285
|
+
let bodyJson : string = "";
|
8203
8286
|
|
8204
8287
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
8205
8288
|
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
package/client.ts
CHANGED
@@ -3001,7 +3001,7 @@ export class Client {
|
|
3001
3001
|
session: Session,
|
3002
3002
|
messageId: string,
|
3003
3003
|
channelId: string,
|
3004
|
-
clanId: string
|
3004
|
+
clanId: string
|
3005
3005
|
): Promise<ApiPinMessagesList> {
|
3006
3006
|
if (
|
3007
3007
|
this.autoRefreshSession &&
|
@@ -3919,4 +3919,42 @@ export class Client {
|
|
3919
3919
|
return Promise.resolve(response);
|
3920
3920
|
});
|
3921
3921
|
}
|
3922
|
+
|
3923
|
+
async getChannelSettingInClan(
|
3924
|
+
session: Session,
|
3925
|
+
clanId: string,
|
3926
|
+
parentId?: string,
|
3927
|
+
categoryId?: string,
|
3928
|
+
privateChannel?: number,
|
3929
|
+
active?: number,
|
3930
|
+
status?: number,
|
3931
|
+
type?: number,
|
3932
|
+
limit?: number,
|
3933
|
+
page?: number
|
3934
|
+
): Promise<any> {
|
3935
|
+
if (
|
3936
|
+
this.autoRefreshSession &&
|
3937
|
+
session.refresh_token &&
|
3938
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3939
|
+
) {
|
3940
|
+
await this.sessionRefresh(session);
|
3941
|
+
}
|
3942
|
+
|
3943
|
+
return this.apiClient
|
3944
|
+
.listChannelSetting(
|
3945
|
+
session.token,
|
3946
|
+
clanId,
|
3947
|
+
parentId,
|
3948
|
+
categoryId,
|
3949
|
+
privateChannel,
|
3950
|
+
active,
|
3951
|
+
status,
|
3952
|
+
type,
|
3953
|
+
limit,
|
3954
|
+
page
|
3955
|
+
)
|
3956
|
+
.then((response: any) => {
|
3957
|
+
return Promise.resolve(response);
|
3958
|
+
});
|
3959
|
+
}
|
3922
3960
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -395,6 +395,24 @@ export interface ApiChannelMessageList {
|
|
395
395
|
last_sent_message?: ApiChannelMessageHeader;
|
396
396
|
messages?: Array<ApiChannelMessage>;
|
397
397
|
}
|
398
|
+
/** */
|
399
|
+
export interface ApiChannelSettingItem {
|
400
|
+
active?: number;
|
401
|
+
category_id?: string;
|
402
|
+
channel_label?: string;
|
403
|
+
channel_private?: number;
|
404
|
+
channel_type?: number;
|
405
|
+
creator_id?: string;
|
406
|
+
id?: string;
|
407
|
+
meeting_code?: string;
|
408
|
+
parent_id?: string;
|
409
|
+
user_ids?: Array<string>;
|
410
|
+
}
|
411
|
+
/** */
|
412
|
+
export interface ApiChannelSettingListResponse {
|
413
|
+
channel_setting_list?: Array<ApiChannelSettingItem>;
|
414
|
+
clan_id?: string;
|
415
|
+
}
|
398
416
|
/** A list of users belonging to a channel, along with their role. */
|
399
417
|
export interface ApiChannelUserList {
|
400
418
|
channel_id?: string;
|
@@ -1332,6 +1350,8 @@ export declare class MezonApi {
|
|
1332
1350
|
deleteChannelDesc(bearerToken: string, channelId: string, options?: any): Promise<any>;
|
1333
1351
|
/** Update fields in a given channel. */
|
1334
1352
|
updateChannelDesc(bearerToken: string, channelId: string, body: {}, options?: any): Promise<any>;
|
1353
|
+
/** List channel setting */
|
1354
|
+
listChannelSetting(bearerToken: string, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number, options?: any): Promise<ApiChannelSettingListResponse>;
|
1335
1355
|
/** List all users that are part of a channel. */
|
1336
1356
|
listChannelVoiceUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiVoiceChannelUserList>;
|
1337
1357
|
/** List clans */
|
package/dist/client.d.ts
CHANGED
@@ -577,4 +577,5 @@ export declare class Client {
|
|
577
577
|
listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
|
578
578
|
getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
|
579
579
|
markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
|
580
|
+
getChannelSettingInClan(session: Session, clanId: string, parentId?: string, categoryId?: string, privateChannel?: number, active?: number, status?: number, type?: number, limit?: number, page?: number): Promise<any>;
|
580
581
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2436,6 +2436,42 @@ var MezonApi = class {
|
|
2436
2436
|
)
|
2437
2437
|
]);
|
2438
2438
|
}
|
2439
|
+
/** List channel setting */
|
2440
|
+
listChannelSetting(bearerToken, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page, options = {}) {
|
2441
|
+
if (clanId === null || clanId === void 0) {
|
2442
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2443
|
+
}
|
2444
|
+
const urlPath = "/v2/channelsetting/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2445
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2446
|
+
queryParams.set("parent_id", parentId);
|
2447
|
+
queryParams.set("category_id", categoryId);
|
2448
|
+
queryParams.set("private_channel", privateChannel);
|
2449
|
+
queryParams.set("active", active);
|
2450
|
+
queryParams.set("status", status);
|
2451
|
+
queryParams.set("type", type);
|
2452
|
+
queryParams.set("limit", limit);
|
2453
|
+
queryParams.set("page", page);
|
2454
|
+
let bodyJson = "";
|
2455
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2456
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2457
|
+
if (bearerToken) {
|
2458
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2459
|
+
}
|
2460
|
+
return Promise.race([
|
2461
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2462
|
+
if (response.status == 204) {
|
2463
|
+
return response;
|
2464
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2465
|
+
return response.json();
|
2466
|
+
} else {
|
2467
|
+
throw response;
|
2468
|
+
}
|
2469
|
+
}),
|
2470
|
+
new Promise(
|
2471
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2472
|
+
)
|
2473
|
+
]);
|
2474
|
+
}
|
2439
2475
|
/** List all users that are part of a channel. */
|
2440
2476
|
listChannelVoiceUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
|
2441
2477
|
const urlPath = "/v2/channelvoice";
|
@@ -8473,4 +8509,25 @@ var Client = class {
|
|
8473
8509
|
});
|
8474
8510
|
});
|
8475
8511
|
}
|
8512
|
+
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
|
8513
|
+
return __async(this, null, function* () {
|
8514
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8515
|
+
yield this.sessionRefresh(session);
|
8516
|
+
}
|
8517
|
+
return this.apiClient.listChannelSetting(
|
8518
|
+
session.token,
|
8519
|
+
clanId,
|
8520
|
+
parentId,
|
8521
|
+
categoryId,
|
8522
|
+
privateChannel,
|
8523
|
+
active,
|
8524
|
+
status,
|
8525
|
+
type,
|
8526
|
+
limit,
|
8527
|
+
page
|
8528
|
+
).then((response) => {
|
8529
|
+
return Promise.resolve(response);
|
8530
|
+
});
|
8531
|
+
});
|
8532
|
+
}
|
8476
8533
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2407,6 +2407,42 @@ var MezonApi = class {
|
|
2407
2407
|
)
|
2408
2408
|
]);
|
2409
2409
|
}
|
2410
|
+
/** List channel setting */
|
2411
|
+
listChannelSetting(bearerToken, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page, options = {}) {
|
2412
|
+
if (clanId === null || clanId === void 0) {
|
2413
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
2414
|
+
}
|
2415
|
+
const urlPath = "/v2/channelsetting/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
2416
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2417
|
+
queryParams.set("parent_id", parentId);
|
2418
|
+
queryParams.set("category_id", categoryId);
|
2419
|
+
queryParams.set("private_channel", privateChannel);
|
2420
|
+
queryParams.set("active", active);
|
2421
|
+
queryParams.set("status", status);
|
2422
|
+
queryParams.set("type", type);
|
2423
|
+
queryParams.set("limit", limit);
|
2424
|
+
queryParams.set("page", page);
|
2425
|
+
let bodyJson = "";
|
2426
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2427
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2428
|
+
if (bearerToken) {
|
2429
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2430
|
+
}
|
2431
|
+
return Promise.race([
|
2432
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2433
|
+
if (response.status == 204) {
|
2434
|
+
return response;
|
2435
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2436
|
+
return response.json();
|
2437
|
+
} else {
|
2438
|
+
throw response;
|
2439
|
+
}
|
2440
|
+
}),
|
2441
|
+
new Promise(
|
2442
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2443
|
+
)
|
2444
|
+
]);
|
2445
|
+
}
|
2410
2446
|
/** List all users that are part of a channel. */
|
2411
2447
|
listChannelVoiceUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
|
2412
2448
|
const urlPath = "/v2/channelvoice";
|
@@ -8444,6 +8480,27 @@ var Client = class {
|
|
8444
8480
|
});
|
8445
8481
|
});
|
8446
8482
|
}
|
8483
|
+
getChannelSettingInClan(session, clanId, parentId, categoryId, privateChannel, active, status, type, limit, page) {
|
8484
|
+
return __async(this, null, function* () {
|
8485
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8486
|
+
yield this.sessionRefresh(session);
|
8487
|
+
}
|
8488
|
+
return this.apiClient.listChannelSetting(
|
8489
|
+
session.token,
|
8490
|
+
clanId,
|
8491
|
+
parentId,
|
8492
|
+
categoryId,
|
8493
|
+
privateChannel,
|
8494
|
+
active,
|
8495
|
+
status,
|
8496
|
+
type,
|
8497
|
+
limit,
|
8498
|
+
page
|
8499
|
+
).then((response) => {
|
8500
|
+
return Promise.resolve(response);
|
8501
|
+
});
|
8502
|
+
});
|
8503
|
+
}
|
8447
8504
|
};
|
8448
8505
|
export {
|
8449
8506
|
ChannelStreamMode,
|