mezon-js 2.9.4 → 2.9.6
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +92 -35
- package/client.ts +46 -4
- package/dist/api.gen.d.ts +16 -2
- package/dist/client.d.ts +4 -2
- package/dist/mezon-js.cjs.js +86 -30
- package/dist/mezon-js.esm.mjs +86 -30
- package/dist/socket.d.ts +1 -0
- package/package.json +1 -1
- package/socket.ts +2 -0
package/api.gen.ts
CHANGED
@@ -428,6 +428,11 @@ export interface ApiCategoryOrderUpdate {
|
|
428
428
|
order?: number;
|
429
429
|
}
|
430
430
|
|
431
|
+
export interface ApiListChannelAppsResponse {
|
432
|
+
//
|
433
|
+
channel_apps?: Array<ApiChannelAppResponse>;
|
434
|
+
}
|
435
|
+
|
431
436
|
/** Update fields in a given channel. */
|
432
437
|
export interface ApiChangeChannelPrivateRequest {
|
433
438
|
//The ID of the channel to update.
|
@@ -440,6 +445,20 @@ export interface ApiChangeChannelPrivateRequest {
|
|
440
445
|
user_ids?: Array<string>;
|
441
446
|
}
|
442
447
|
|
448
|
+
/** */
|
449
|
+
export interface ApiChannelAppResponse {
|
450
|
+
//
|
451
|
+
app_id?: string;
|
452
|
+
//
|
453
|
+
channel_id?: string;
|
454
|
+
//
|
455
|
+
clan_id?: string;
|
456
|
+
//
|
457
|
+
id?: string;
|
458
|
+
//
|
459
|
+
url?: string;
|
460
|
+
}
|
461
|
+
|
443
462
|
/** */
|
444
463
|
export interface ApiChannelAttachment {
|
445
464
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
|
@@ -732,6 +751,8 @@ export interface ApiCreateCategoryDescRequest {
|
|
732
751
|
|
733
752
|
/** Create a channel within clan. */
|
734
753
|
export interface ApiCreateChannelDescRequest {
|
754
|
+
//
|
755
|
+
app_url?: string;
|
735
756
|
//
|
736
757
|
category_id?: string;
|
737
758
|
//The channel this message belongs to.
|
@@ -3413,6 +3434,39 @@ export class MezonApi {
|
|
3413
3434
|
]);
|
3414
3435
|
}
|
3415
3436
|
|
3437
|
+
/** List channel apps. */
|
3438
|
+
listChannelApps(bearerToken: string,
|
3439
|
+
clanId?:string,
|
3440
|
+
options: any = {}): Promise<ApiListChannelAppsResponse> {
|
3441
|
+
|
3442
|
+
const urlPath = "/v2/channel-apps";
|
3443
|
+
const queryParams = new Map<string, any>();
|
3444
|
+
queryParams.set("clan_id", clanId);
|
3445
|
+
|
3446
|
+
let bodyJson : string = "";
|
3447
|
+
|
3448
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3449
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3450
|
+
if (bearerToken) {
|
3451
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3452
|
+
}
|
3453
|
+
|
3454
|
+
return Promise.race([
|
3455
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3456
|
+
if (response.status == 204) {
|
3457
|
+
return response;
|
3458
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3459
|
+
return response.json();
|
3460
|
+
} else {
|
3461
|
+
throw response;
|
3462
|
+
}
|
3463
|
+
}),
|
3464
|
+
new Promise((_, reject) =>
|
3465
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3466
|
+
),
|
3467
|
+
]);
|
3468
|
+
}
|
3469
|
+
|
3416
3470
|
/** List a channel's message history. */
|
3417
3471
|
listChannelMessages(bearerToken: string,
|
3418
3472
|
channelId:string,
|
@@ -5637,41 +5691,6 @@ export class MezonApi {
|
|
5637
5691
|
]);
|
5638
5692
|
}
|
5639
5693
|
|
5640
|
-
/** */
|
5641
|
-
getPermissionOfUserInTheClan(bearerToken: string,
|
5642
|
-
clanId:string,
|
5643
|
-
options: any = {}): Promise<ApiPermissionList> {
|
5644
|
-
|
5645
|
-
if (clanId === null || clanId === undefined) {
|
5646
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
5647
|
-
}
|
5648
|
-
const urlPath = "/v2/permissionuserinclan/{clanId}"
|
5649
|
-
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
5650
|
-
const queryParams = new Map<string, any>();
|
5651
|
-
|
5652
|
-
let bodyJson : string = "";
|
5653
|
-
|
5654
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5655
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
5656
|
-
if (bearerToken) {
|
5657
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5658
|
-
}
|
5659
|
-
|
5660
|
-
return Promise.race([
|
5661
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
5662
|
-
if (response.status == 204) {
|
5663
|
-
return response;
|
5664
|
-
} else if (response.status >= 200 && response.status < 300) {
|
5665
|
-
return response.json();
|
5666
|
-
} else {
|
5667
|
-
throw response;
|
5668
|
-
}
|
5669
|
-
}),
|
5670
|
-
new Promise((_, reject) =>
|
5671
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
5672
|
-
),
|
5673
|
-
]);
|
5674
|
-
}
|
5675
5694
|
|
5676
5695
|
/** */
|
5677
5696
|
deletePinMessage(bearerToken: string,
|
@@ -6121,6 +6140,44 @@ export class MezonApi {
|
|
6121
6140
|
]);
|
6122
6141
|
}
|
6123
6142
|
|
6143
|
+
/** */
|
6144
|
+
getRoleOfUserInTheClan(bearerToken: string,
|
6145
|
+
clanId:string,
|
6146
|
+
channelId?:string,
|
6147
|
+
options: any = {}): Promise<ApiRoleList> {
|
6148
|
+
|
6149
|
+
if (clanId === null || clanId === undefined) {
|
6150
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
6151
|
+
}
|
6152
|
+
const urlPath = "/v2/roleuserinclan/{clanId}"
|
6153
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
6154
|
+
const queryParams = new Map<string, any>();
|
6155
|
+
queryParams.set("channel_id", channelId);
|
6156
|
+
|
6157
|
+
let bodyJson : string = "";
|
6158
|
+
|
6159
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6160
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6161
|
+
if (bearerToken) {
|
6162
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6163
|
+
}
|
6164
|
+
|
6165
|
+
return Promise.race([
|
6166
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6167
|
+
if (response.status == 204) {
|
6168
|
+
return response;
|
6169
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6170
|
+
return response.json();
|
6171
|
+
} else {
|
6172
|
+
throw response;
|
6173
|
+
}
|
6174
|
+
}),
|
6175
|
+
new Promise((_, reject) =>
|
6176
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6177
|
+
),
|
6178
|
+
]);
|
6179
|
+
}
|
6180
|
+
|
6124
6181
|
/** Execute a Lua function on the server. */
|
6125
6182
|
rpcFunc2(bearerToken: string,basicAuthUsername: string,
|
6126
6183
|
basicAuthPassword: string,
|
package/client.ts
CHANGED
@@ -106,6 +106,8 @@ import {
|
|
106
106
|
ApiStreamingChannelUserList,
|
107
107
|
ApiRegisterStreamingChannelRequest,
|
108
108
|
ApiRegisterStreamingChannelResponse,
|
109
|
+
ApiRoleList,
|
110
|
+
ApiListChannelAppsResponse,
|
109
111
|
} from "./api.gen";
|
110
112
|
|
111
113
|
import { Session } from "./session";
|
@@ -2700,10 +2702,10 @@ export class Client {
|
|
2700
2702
|
}
|
2701
2703
|
|
2702
2704
|
/** Get permission of user in the clan */
|
2703
|
-
async
|
2705
|
+
async GetRoleOfUserInTheClan(
|
2704
2706
|
session: Session,
|
2705
2707
|
clanId: string
|
2706
|
-
): Promise<
|
2708
|
+
): Promise<ApiRoleList> {
|
2707
2709
|
if (
|
2708
2710
|
this.autoRefreshSession &&
|
2709
2711
|
session.refresh_token &&
|
@@ -2713,8 +2715,8 @@ export class Client {
|
|
2713
2715
|
}
|
2714
2716
|
|
2715
2717
|
return this.apiClient
|
2716
|
-
.
|
2717
|
-
.then((response:
|
2718
|
+
.getRoleOfUserInTheClan(session.token, clanId)
|
2719
|
+
.then((response: ApiRoleList) => {
|
2718
2720
|
return Promise.resolve(response);
|
2719
2721
|
});
|
2720
2722
|
}
|
@@ -3554,4 +3556,44 @@ export class Client {
|
|
3554
3556
|
return response !== undefined;
|
3555
3557
|
});
|
3556
3558
|
}
|
3559
|
+
|
3560
|
+
/** List a channel's users. */
|
3561
|
+
async listChannelApps(
|
3562
|
+
session: Session,
|
3563
|
+
clanId: string,
|
3564
|
+
): Promise<ApiListChannelAppsResponse> {
|
3565
|
+
if (
|
3566
|
+
this.autoRefreshSession &&
|
3567
|
+
session.refresh_token &&
|
3568
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3569
|
+
) {
|
3570
|
+
await this.sessionRefresh(session);
|
3571
|
+
}
|
3572
|
+
|
3573
|
+
return this.apiClient
|
3574
|
+
.listChannelApps(
|
3575
|
+
session.token,
|
3576
|
+
clanId,
|
3577
|
+
)
|
3578
|
+
.then((response: ApiListChannelAppsResponse) => {
|
3579
|
+
var result: ApiListChannelAppsResponse = {
|
3580
|
+
channel_apps: [],
|
3581
|
+
};
|
3582
|
+
|
3583
|
+
if (response.channel_apps == null) {
|
3584
|
+
return Promise.resolve(result);
|
3585
|
+
}
|
3586
|
+
|
3587
|
+
response.channel_apps!.forEach((gu) => {
|
3588
|
+
result.channel_apps!.push({
|
3589
|
+
id: gu.id,
|
3590
|
+
channel_id: gu.channel_id,
|
3591
|
+
app_id: gu.app_id,
|
3592
|
+
clan_id: gu.clan_id,
|
3593
|
+
url: gu.url,
|
3594
|
+
});
|
3595
|
+
});
|
3596
|
+
return Promise.resolve(result);
|
3597
|
+
});
|
3598
|
+
}
|
3557
3599
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -249,6 +249,9 @@ export interface ApiCategoryOrderUpdate {
|
|
249
249
|
category_id?: string;
|
250
250
|
order?: number;
|
251
251
|
}
|
252
|
+
export interface ApiListChannelAppsResponse {
|
253
|
+
channel_apps?: Array<ApiChannelAppResponse>;
|
254
|
+
}
|
252
255
|
/** Update fields in a given channel. */
|
253
256
|
export interface ApiChangeChannelPrivateRequest {
|
254
257
|
channel_id?: string;
|
@@ -257,6 +260,14 @@ export interface ApiChangeChannelPrivateRequest {
|
|
257
260
|
user_ids?: Array<string>;
|
258
261
|
}
|
259
262
|
/** */
|
263
|
+
export interface ApiChannelAppResponse {
|
264
|
+
app_id?: string;
|
265
|
+
channel_id?: string;
|
266
|
+
clan_id?: string;
|
267
|
+
id?: string;
|
268
|
+
url?: string;
|
269
|
+
}
|
270
|
+
/** */
|
260
271
|
export interface ApiChannelAttachment {
|
261
272
|
create_time?: string;
|
262
273
|
filename?: string;
|
@@ -420,6 +431,7 @@ export interface ApiCreateCategoryDescRequest {
|
|
420
431
|
}
|
421
432
|
/** Create a channel within clan. */
|
422
433
|
export interface ApiCreateChannelDescRequest {
|
434
|
+
app_url?: string;
|
423
435
|
category_id?: string;
|
424
436
|
channel_id?: string;
|
425
437
|
channel_label?: string;
|
@@ -1137,6 +1149,8 @@ export declare class MezonApi {
|
|
1137
1149
|
updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
|
1138
1150
|
/** */
|
1139
1151
|
listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, categoryOrder?: number, options?: any): Promise<ApiCategoryDescList>;
|
1152
|
+
/** List channel apps. */
|
1153
|
+
listChannelApps(bearerToken: string, clanId?: string, options?: any): Promise<ApiListChannelAppsResponse>;
|
1140
1154
|
/** List a channel's message history. */
|
1141
1155
|
listChannelMessages(bearerToken: string, channelId: string, messageId?: string, direction?: number, limit?: number, options?: any): Promise<ApiChannelMessageList>;
|
1142
1156
|
/** Add users to a channel. */
|
@@ -1258,8 +1272,6 @@ export declare class MezonApi {
|
|
1258
1272
|
/** Get permission list */
|
1259
1273
|
getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
|
1260
1274
|
/** */
|
1261
|
-
getPermissionOfUserInTheClan(bearerToken: string, clanId: string, options?: any): Promise<ApiPermissionList>;
|
1262
|
-
/** */
|
1263
1275
|
deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
|
1264
1276
|
/** */
|
1265
1277
|
getPinMessagesList(bearerToken: string, channelId?: string, options?: any): Promise<ApiPinMessagesList>;
|
@@ -1283,6 +1295,8 @@ export declare class MezonApi {
|
|
1283
1295
|
listRolePermissions(bearerToken: string, roleId: string, options?: any): Promise<ApiPermissionList>;
|
1284
1296
|
/** List role permissions */
|
1285
1297
|
listRoleUsers(bearerToken: string, roleId: string, limit?: number, cursor?: string, options?: any): Promise<ApiRoleUserList>;
|
1298
|
+
/** */
|
1299
|
+
getRoleOfUserInTheClan(bearerToken: string, clanId: string, channelId?: string, options?: any): Promise<ApiRoleList>;
|
1286
1300
|
/** Execute a Lua function on the server. */
|
1287
1301
|
rpcFunc2(bearerToken: string, basicAuthUsername: string, basicAuthPassword: string, id: string, payload?: string, httpKey?: string, options?: any): Promise<ApiRpc>;
|
1288
1302
|
/** Execute a Lua function on the server. */
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -500,7 +500,7 @@ export declare class Client {
|
|
500
500
|
/** Get link invite user */
|
501
501
|
getLinkInvite(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
502
502
|
/** Get permission of user in the clan */
|
503
|
-
|
503
|
+
GetRoleOfUserInTheClan(session: Session, clanId: string): Promise<ApiRoleList>;
|
504
504
|
/** invite user */
|
505
505
|
inviteUser(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
506
506
|
/** Set default notification clan*/
|
@@ -557,4 +557,6 @@ export declare class Client {
|
|
557
557
|
/** List a channel's users. */
|
558
558
|
listStreamingChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiStreamingChannelUserList>;
|
559
559
|
registerStreamingChannel(session: Session, request: ApiRegisterStreamingChannelRequest): Promise<boolean>;
|
560
|
+
/** List a channel's users. */
|
561
|
+
listChannelApps(session: Session, clanId: string): Promise<ApiListChannelAppsResponse>;
|
560
562
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -1946,6 +1946,32 @@ var MezonApi = class {
|
|
1946
1946
|
)
|
1947
1947
|
]);
|
1948
1948
|
}
|
1949
|
+
/** List channel apps. */
|
1950
|
+
listChannelApps(bearerToken, clanId, options = {}) {
|
1951
|
+
const urlPath = "/v2/channel-apps";
|
1952
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1953
|
+
queryParams.set("clan_id", clanId);
|
1954
|
+
let bodyJson = "";
|
1955
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1956
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1957
|
+
if (bearerToken) {
|
1958
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1959
|
+
}
|
1960
|
+
return Promise.race([
|
1961
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1962
|
+
if (response.status == 204) {
|
1963
|
+
return response;
|
1964
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1965
|
+
return response.json();
|
1966
|
+
} else {
|
1967
|
+
throw response;
|
1968
|
+
}
|
1969
|
+
}),
|
1970
|
+
new Promise(
|
1971
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1972
|
+
)
|
1973
|
+
]);
|
1974
|
+
}
|
1949
1975
|
/** List a channel's message history. */
|
1950
1976
|
listChannelMessages(bearerToken, channelId, messageId, direction, limit, options = {}) {
|
1951
1977
|
if (channelId === null || channelId === void 0) {
|
@@ -3681,34 +3707,6 @@ var MezonApi = class {
|
|
3681
3707
|
]);
|
3682
3708
|
}
|
3683
3709
|
/** */
|
3684
|
-
getPermissionOfUserInTheClan(bearerToken, clanId, options = {}) {
|
3685
|
-
if (clanId === null || clanId === void 0) {
|
3686
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
3687
|
-
}
|
3688
|
-
const urlPath = "/v2/permissionuserinclan/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
3689
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3690
|
-
let bodyJson = "";
|
3691
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3692
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3693
|
-
if (bearerToken) {
|
3694
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3695
|
-
}
|
3696
|
-
return Promise.race([
|
3697
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3698
|
-
if (response.status == 204) {
|
3699
|
-
return response;
|
3700
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3701
|
-
return response.json();
|
3702
|
-
} else {
|
3703
|
-
throw response;
|
3704
|
-
}
|
3705
|
-
}),
|
3706
|
-
new Promise(
|
3707
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3708
|
-
)
|
3709
|
-
]);
|
3710
|
-
}
|
3711
|
-
/** */
|
3712
3710
|
deletePinMessage(bearerToken, messageId, options = {}) {
|
3713
3711
|
const urlPath = "/v2/pinmessage/delete";
|
3714
3712
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -4060,6 +4058,35 @@ var MezonApi = class {
|
|
4060
4058
|
)
|
4061
4059
|
]);
|
4062
4060
|
}
|
4061
|
+
/** */
|
4062
|
+
getRoleOfUserInTheClan(bearerToken, clanId, channelId, options = {}) {
|
4063
|
+
if (clanId === null || clanId === void 0) {
|
4064
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4065
|
+
}
|
4066
|
+
const urlPath = "/v2/roleuserinclan/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
4067
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4068
|
+
queryParams.set("channel_id", channelId);
|
4069
|
+
let bodyJson = "";
|
4070
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4071
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4072
|
+
if (bearerToken) {
|
4073
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4074
|
+
}
|
4075
|
+
return Promise.race([
|
4076
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4077
|
+
if (response.status == 204) {
|
4078
|
+
return response;
|
4079
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4080
|
+
return response.json();
|
4081
|
+
} else {
|
4082
|
+
throw response;
|
4083
|
+
}
|
4084
|
+
}),
|
4085
|
+
new Promise(
|
4086
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4087
|
+
)
|
4088
|
+
]);
|
4089
|
+
}
|
4063
4090
|
/** Execute a Lua function on the server. */
|
4064
4091
|
rpcFunc2(bearerToken, basicAuthUsername, basicAuthPassword, id, payload, httpKey, options = {}) {
|
4065
4092
|
if (id === null || id === void 0) {
|
@@ -7015,12 +7042,12 @@ var Client = class {
|
|
7015
7042
|
});
|
7016
7043
|
}
|
7017
7044
|
/** Get permission of user in the clan */
|
7018
|
-
|
7045
|
+
GetRoleOfUserInTheClan(session, clanId) {
|
7019
7046
|
return __async(this, null, function* () {
|
7020
7047
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7021
7048
|
yield this.sessionRefresh(session);
|
7022
7049
|
}
|
7023
|
-
return this.apiClient.
|
7050
|
+
return this.apiClient.getRoleOfUserInTheClan(session.token, clanId).then((response) => {
|
7024
7051
|
return Promise.resolve(response);
|
7025
7052
|
});
|
7026
7053
|
});
|
@@ -7503,4 +7530,33 @@ var Client = class {
|
|
7503
7530
|
});
|
7504
7531
|
});
|
7505
7532
|
}
|
7533
|
+
/** List a channel's users. */
|
7534
|
+
listChannelApps(session, clanId) {
|
7535
|
+
return __async(this, null, function* () {
|
7536
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7537
|
+
yield this.sessionRefresh(session);
|
7538
|
+
}
|
7539
|
+
return this.apiClient.listChannelApps(
|
7540
|
+
session.token,
|
7541
|
+
clanId
|
7542
|
+
).then((response) => {
|
7543
|
+
var result = {
|
7544
|
+
channel_apps: []
|
7545
|
+
};
|
7546
|
+
if (response.channel_apps == null) {
|
7547
|
+
return Promise.resolve(result);
|
7548
|
+
}
|
7549
|
+
response.channel_apps.forEach((gu) => {
|
7550
|
+
result.channel_apps.push({
|
7551
|
+
id: gu.id,
|
7552
|
+
channel_id: gu.channel_id,
|
7553
|
+
app_id: gu.app_id,
|
7554
|
+
clan_id: gu.clan_id,
|
7555
|
+
url: gu.url
|
7556
|
+
});
|
7557
|
+
});
|
7558
|
+
return Promise.resolve(result);
|
7559
|
+
});
|
7560
|
+
});
|
7561
|
+
}
|
7506
7562
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1917,6 +1917,32 @@ var MezonApi = class {
|
|
1917
1917
|
)
|
1918
1918
|
]);
|
1919
1919
|
}
|
1920
|
+
/** List channel apps. */
|
1921
|
+
listChannelApps(bearerToken, clanId, options = {}) {
|
1922
|
+
const urlPath = "/v2/channel-apps";
|
1923
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1924
|
+
queryParams.set("clan_id", clanId);
|
1925
|
+
let bodyJson = "";
|
1926
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1927
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1928
|
+
if (bearerToken) {
|
1929
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1930
|
+
}
|
1931
|
+
return Promise.race([
|
1932
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1933
|
+
if (response.status == 204) {
|
1934
|
+
return response;
|
1935
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1936
|
+
return response.json();
|
1937
|
+
} else {
|
1938
|
+
throw response;
|
1939
|
+
}
|
1940
|
+
}),
|
1941
|
+
new Promise(
|
1942
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1943
|
+
)
|
1944
|
+
]);
|
1945
|
+
}
|
1920
1946
|
/** List a channel's message history. */
|
1921
1947
|
listChannelMessages(bearerToken, channelId, messageId, direction, limit, options = {}) {
|
1922
1948
|
if (channelId === null || channelId === void 0) {
|
@@ -3652,34 +3678,6 @@ var MezonApi = class {
|
|
3652
3678
|
]);
|
3653
3679
|
}
|
3654
3680
|
/** */
|
3655
|
-
getPermissionOfUserInTheClan(bearerToken, clanId, options = {}) {
|
3656
|
-
if (clanId === null || clanId === void 0) {
|
3657
|
-
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
3658
|
-
}
|
3659
|
-
const urlPath = "/v2/permissionuserinclan/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
3660
|
-
const queryParams = /* @__PURE__ */ new Map();
|
3661
|
-
let bodyJson = "";
|
3662
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3663
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3664
|
-
if (bearerToken) {
|
3665
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3666
|
-
}
|
3667
|
-
return Promise.race([
|
3668
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3669
|
-
if (response.status == 204) {
|
3670
|
-
return response;
|
3671
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3672
|
-
return response.json();
|
3673
|
-
} else {
|
3674
|
-
throw response;
|
3675
|
-
}
|
3676
|
-
}),
|
3677
|
-
new Promise(
|
3678
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3679
|
-
)
|
3680
|
-
]);
|
3681
|
-
}
|
3682
|
-
/** */
|
3683
3681
|
deletePinMessage(bearerToken, messageId, options = {}) {
|
3684
3682
|
const urlPath = "/v2/pinmessage/delete";
|
3685
3683
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -4031,6 +4029,35 @@ var MezonApi = class {
|
|
4031
4029
|
)
|
4032
4030
|
]);
|
4033
4031
|
}
|
4032
|
+
/** */
|
4033
|
+
getRoleOfUserInTheClan(bearerToken, clanId, channelId, options = {}) {
|
4034
|
+
if (clanId === null || clanId === void 0) {
|
4035
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4036
|
+
}
|
4037
|
+
const urlPath = "/v2/roleuserinclan/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
4038
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4039
|
+
queryParams.set("channel_id", channelId);
|
4040
|
+
let bodyJson = "";
|
4041
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4042
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4043
|
+
if (bearerToken) {
|
4044
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4045
|
+
}
|
4046
|
+
return Promise.race([
|
4047
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4048
|
+
if (response.status == 204) {
|
4049
|
+
return response;
|
4050
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4051
|
+
return response.json();
|
4052
|
+
} else {
|
4053
|
+
throw response;
|
4054
|
+
}
|
4055
|
+
}),
|
4056
|
+
new Promise(
|
4057
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4058
|
+
)
|
4059
|
+
]);
|
4060
|
+
}
|
4034
4061
|
/** Execute a Lua function on the server. */
|
4035
4062
|
rpcFunc2(bearerToken, basicAuthUsername, basicAuthPassword, id, payload, httpKey, options = {}) {
|
4036
4063
|
if (id === null || id === void 0) {
|
@@ -6986,12 +7013,12 @@ var Client = class {
|
|
6986
7013
|
});
|
6987
7014
|
}
|
6988
7015
|
/** Get permission of user in the clan */
|
6989
|
-
|
7016
|
+
GetRoleOfUserInTheClan(session, clanId) {
|
6990
7017
|
return __async(this, null, function* () {
|
6991
7018
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6992
7019
|
yield this.sessionRefresh(session);
|
6993
7020
|
}
|
6994
|
-
return this.apiClient.
|
7021
|
+
return this.apiClient.getRoleOfUserInTheClan(session.token, clanId).then((response) => {
|
6995
7022
|
return Promise.resolve(response);
|
6996
7023
|
});
|
6997
7024
|
});
|
@@ -7474,6 +7501,35 @@ var Client = class {
|
|
7474
7501
|
});
|
7475
7502
|
});
|
7476
7503
|
}
|
7504
|
+
/** List a channel's users. */
|
7505
|
+
listChannelApps(session, clanId) {
|
7506
|
+
return __async(this, null, function* () {
|
7507
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7508
|
+
yield this.sessionRefresh(session);
|
7509
|
+
}
|
7510
|
+
return this.apiClient.listChannelApps(
|
7511
|
+
session.token,
|
7512
|
+
clanId
|
7513
|
+
).then((response) => {
|
7514
|
+
var result = {
|
7515
|
+
channel_apps: []
|
7516
|
+
};
|
7517
|
+
if (response.channel_apps == null) {
|
7518
|
+
return Promise.resolve(result);
|
7519
|
+
}
|
7520
|
+
response.channel_apps.forEach((gu) => {
|
7521
|
+
result.channel_apps.push({
|
7522
|
+
id: gu.id,
|
7523
|
+
channel_id: gu.channel_id,
|
7524
|
+
app_id: gu.app_id,
|
7525
|
+
clan_id: gu.clan_id,
|
7526
|
+
url: gu.url
|
7527
|
+
});
|
7528
|
+
});
|
7529
|
+
return Promise.resolve(result);
|
7530
|
+
});
|
7531
|
+
});
|
7532
|
+
}
|
7477
7533
|
};
|
7478
7534
|
export {
|
7479
7535
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -560,6 +560,7 @@ export interface NotificationChannelCategorySetting {
|
|
560
560
|
channel_category_label: string;
|
561
561
|
notification_setting_type: number;
|
562
562
|
channel_category_title: string;
|
563
|
+
action: number;
|
563
564
|
}
|
564
565
|
export interface NotificationChannelCategorySettingEvent {
|
565
566
|
clan_id?: string;
|
package/package.json
CHANGED
package/socket.ts
CHANGED