mezon-js 2.11.32 → 2.11.33
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 +87 -3
- package/client.ts +18 -1
- package/dist/api.gen.d.ts +13 -2
- package/dist/client.d.ts +3 -2
- package/dist/mezon-js.cjs.js +67 -0
- package/dist/mezon-js.esm.mjs +67 -0
- package/dist/socket.d.ts +2 -2
- package/package.json +1 -1
- package/socket.ts +2 -2
package/api.gen.ts
CHANGED
@@ -721,6 +721,20 @@ export interface ApiChannelDescList {
|
|
721
721
|
prev_cursor?: string;
|
722
722
|
}
|
723
723
|
|
724
|
+
/** */
|
725
|
+
export interface ApiAddChannelAppRequest {
|
726
|
+
//App url.
|
727
|
+
app_url?: string;
|
728
|
+
//The appname.
|
729
|
+
appname?: string;
|
730
|
+
//Creator of the app.
|
731
|
+
creator_id?: string;
|
732
|
+
//Role of this app.
|
733
|
+
role?: number;
|
734
|
+
//The password.
|
735
|
+
token?: string;
|
736
|
+
}
|
737
|
+
|
724
738
|
/** */
|
725
739
|
export interface ApiChannelDescription {
|
726
740
|
//
|
@@ -728,8 +742,6 @@ export interface ApiChannelDescription {
|
|
728
742
|
//
|
729
743
|
age_restricted?: number;
|
730
744
|
//
|
731
|
-
app_url?: string;
|
732
|
-
//
|
733
745
|
category_id?: string;
|
734
746
|
//
|
735
747
|
category_name?: string;
|
@@ -1112,7 +1124,7 @@ export interface ApiCreateCategoryDescRequest {
|
|
1112
1124
|
/** Create a channel within clan. */
|
1113
1125
|
export interface ApiCreateChannelDescRequest {
|
1114
1126
|
//
|
1115
|
-
|
1127
|
+
app_id?: string;
|
1116
1128
|
//
|
1117
1129
|
category_id?: string;
|
1118
1130
|
//The channel this message belongs to.
|
@@ -11593,4 +11605,76 @@ export class MezonApi {
|
|
11593
11605
|
),
|
11594
11606
|
]);
|
11595
11607
|
}
|
11608
|
+
|
11609
|
+
/** List channels detail */
|
11610
|
+
listChannelDetail(bearerToken: string,
|
11611
|
+
channelId:string,
|
11612
|
+
options: any = {}): Promise<ApiChannelDescription> {
|
11613
|
+
|
11614
|
+
if (channelId === null || channelId === undefined) {
|
11615
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
11616
|
+
}
|
11617
|
+
const urlPath = "/v2/channeldesc/{channelId}"
|
11618
|
+
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
11619
|
+
const queryParams = new Map<string, any>();
|
11620
|
+
|
11621
|
+
let bodyJson : string = "";
|
11622
|
+
|
11623
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11624
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
11625
|
+
if (bearerToken) {
|
11626
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11627
|
+
}
|
11628
|
+
|
11629
|
+
return Promise.race([
|
11630
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11631
|
+
if (response.status == 204) {
|
11632
|
+
return response;
|
11633
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11634
|
+
return response.json();
|
11635
|
+
} else {
|
11636
|
+
throw response;
|
11637
|
+
}
|
11638
|
+
}),
|
11639
|
+
new Promise((_, reject) =>
|
11640
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11641
|
+
),
|
11642
|
+
]);
|
11643
|
+
}
|
11644
|
+
|
11645
|
+
/** Add a new apps. */
|
11646
|
+
addChannelApp(bearerToken: string,
|
11647
|
+
body:ApiAddChannelAppRequest,
|
11648
|
+
options: any = {}): Promise<any> {
|
11649
|
+
|
11650
|
+
if (body === null || body === undefined) {
|
11651
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
11652
|
+
}
|
11653
|
+
const urlPath = "/v2/channelapp/add";
|
11654
|
+
const queryParams = new Map<string, any>();
|
11655
|
+
|
11656
|
+
let bodyJson : string = "";
|
11657
|
+
bodyJson = JSON.stringify(body || {});
|
11658
|
+
|
11659
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11660
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
11661
|
+
if (bearerToken) {
|
11662
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11663
|
+
}
|
11664
|
+
|
11665
|
+
return Promise.race([
|
11666
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11667
|
+
if (response.status == 204) {
|
11668
|
+
return response;
|
11669
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11670
|
+
return response.json();
|
11671
|
+
} else {
|
11672
|
+
throw response;
|
11673
|
+
}
|
11674
|
+
}),
|
11675
|
+
new Promise((_, reject) =>
|
11676
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11677
|
+
),
|
11678
|
+
]);
|
11679
|
+
}
|
11596
11680
|
}
|
package/client.ts
CHANGED
@@ -169,6 +169,7 @@ import {
|
|
169
169
|
ApiUpdateRoleOrderRequest,
|
170
170
|
ApiGenerateMezonMeetResponse,
|
171
171
|
ApiGenerateMeetTokenExternalResponse,
|
172
|
+
ApiAddChannelAppRequest,
|
172
173
|
} from "./api.gen";
|
173
174
|
|
174
175
|
import { Session } from "./session";
|
@@ -466,7 +467,7 @@ export interface ApiUpdateChannelDescRequest {
|
|
466
467
|
/** The category of channel */
|
467
468
|
category_id: string | undefined;
|
468
469
|
/** The app url of channel */
|
469
|
-
|
470
|
+
app_id: string | undefined;
|
470
471
|
//
|
471
472
|
e2ee?: number;
|
472
473
|
//
|
@@ -3506,6 +3507,22 @@ export class Client {
|
|
3506
3507
|
});
|
3507
3508
|
}
|
3508
3509
|
|
3510
|
+
async addChannelApp(session: Session, request: ApiAddChannelAppRequest): Promise<boolean> {
|
3511
|
+
if (
|
3512
|
+
this.autoRefreshSession &&
|
3513
|
+
session.refresh_token &&
|
3514
|
+
session.isexpired(Date.now() / 1000)
|
3515
|
+
) {
|
3516
|
+
await this.sessionRefresh(session);
|
3517
|
+
}
|
3518
|
+
|
3519
|
+
return this.apiClient
|
3520
|
+
.addChannelApp(session.token, request)
|
3521
|
+
.then((response: any) => {
|
3522
|
+
return response !== undefined;
|
3523
|
+
});
|
3524
|
+
}
|
3525
|
+
|
3509
3526
|
async getSystemMessagesList(
|
3510
3527
|
session: Session
|
3511
3528
|
): Promise<ApiSystemMessagesList> {
|
package/dist/api.gen.d.ts
CHANGED
@@ -420,10 +420,17 @@ export interface ApiChannelDescList {
|
|
420
420
|
prev_cursor?: string;
|
421
421
|
}
|
422
422
|
/** */
|
423
|
+
export interface ApiAddChannelAppRequest {
|
424
|
+
app_url?: string;
|
425
|
+
appname?: string;
|
426
|
+
creator_id?: string;
|
427
|
+
role?: number;
|
428
|
+
token?: string;
|
429
|
+
}
|
430
|
+
/** */
|
423
431
|
export interface ApiChannelDescription {
|
424
432
|
active?: number;
|
425
433
|
age_restricted?: number;
|
426
|
-
app_url?: string;
|
427
434
|
category_id?: string;
|
428
435
|
category_name?: string;
|
429
436
|
channel_avatar?: Array<string>;
|
@@ -635,7 +642,7 @@ export interface ApiCreateCategoryDescRequest {
|
|
635
642
|
}
|
636
643
|
/** Create a channel within clan. */
|
637
644
|
export interface ApiCreateChannelDescRequest {
|
638
|
-
|
645
|
+
app_id?: string;
|
639
646
|
category_id?: string;
|
640
647
|
channel_id?: string;
|
641
648
|
channel_label?: string;
|
@@ -2245,4 +2252,8 @@ export declare class MezonApi {
|
|
2245
2252
|
createExternalMezonMeet(bearerToken: string, options?: any): Promise<ApiGenerateMezonMeetResponse>;
|
2246
2253
|
/** handler external mezon meet */
|
2247
2254
|
generateMeetTokenExternal(bearerToken: string, token: string, displayName?: string, isGuest?: boolean, options?: any): Promise<ApiGenerateMeetTokenExternalResponse>;
|
2255
|
+
/** List channels detail */
|
2256
|
+
listChannelDetail(bearerToken: string, channelId: string, options?: any): Promise<ApiChannelDescription>;
|
2257
|
+
/** Add a new apps. */
|
2258
|
+
addChannelApp(bearerToken: string, body: ApiAddChannelAppRequest, options?: any): Promise<any>;
|
2248
2259
|
}
|
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, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, 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, ApiWithdrawTokenRequest, 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, MezonapiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountMezon, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, 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, ApiWithdrawTokenRequest, 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, MezonapiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiAddChannelAppRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -257,7 +257,7 @@ export interface ApiUpdateChannelDescRequest {
|
|
257
257
|
/** The category of channel */
|
258
258
|
category_id: string | undefined;
|
259
259
|
/** The app url of channel */
|
260
|
-
|
260
|
+
app_id: string | undefined;
|
261
261
|
e2ee?: number;
|
262
262
|
topic?: string;
|
263
263
|
age_restricted?: number;
|
@@ -566,6 +566,7 @@ export declare class Client {
|
|
566
566
|
getApp(session: Session, id: string): Promise<ApiApp>;
|
567
567
|
listApps(session: Session): Promise<ApiAppList>;
|
568
568
|
addAppToClan(session: Session, appId: string, clanId: string): Promise<boolean>;
|
569
|
+
addChannelApp(session: Session, request: ApiAddChannelAppRequest): Promise<boolean>;
|
569
570
|
getSystemMessagesList(session: Session): Promise<ApiSystemMessagesList>;
|
570
571
|
getSystemMessageByClanId(session: Session, clanId: string): Promise<ApiSystemMessage>;
|
571
572
|
createSystemMessage(session: Session, request: ApiSystemMessageRequest): Promise<any>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -7308,6 +7308,63 @@ var MezonApi = class {
|
|
7308
7308
|
)
|
7309
7309
|
]);
|
7310
7310
|
}
|
7311
|
+
/** List channels detail */
|
7312
|
+
listChannelDetail(bearerToken, channelId, options = {}) {
|
7313
|
+
if (channelId === null || channelId === void 0) {
|
7314
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
7315
|
+
}
|
7316
|
+
const urlPath = "/v2/channeldesc/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
|
7317
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7318
|
+
let bodyJson = "";
|
7319
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7320
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7321
|
+
if (bearerToken) {
|
7322
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7323
|
+
}
|
7324
|
+
return Promise.race([
|
7325
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7326
|
+
if (response.status == 204) {
|
7327
|
+
return response;
|
7328
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7329
|
+
return response.json();
|
7330
|
+
} else {
|
7331
|
+
throw response;
|
7332
|
+
}
|
7333
|
+
}),
|
7334
|
+
new Promise(
|
7335
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7336
|
+
)
|
7337
|
+
]);
|
7338
|
+
}
|
7339
|
+
/** Add a new apps. */
|
7340
|
+
addChannelApp(bearerToken, body, options = {}) {
|
7341
|
+
if (body === null || body === void 0) {
|
7342
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
7343
|
+
}
|
7344
|
+
const urlPath = "/v2/channelapp/add";
|
7345
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7346
|
+
let bodyJson = "";
|
7347
|
+
bodyJson = JSON.stringify(body || {});
|
7348
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7349
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
7350
|
+
if (bearerToken) {
|
7351
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7352
|
+
}
|
7353
|
+
return Promise.race([
|
7354
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7355
|
+
if (response.status == 204) {
|
7356
|
+
return response;
|
7357
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7358
|
+
return response.json();
|
7359
|
+
} else {
|
7360
|
+
throw response;
|
7361
|
+
}
|
7362
|
+
}),
|
7363
|
+
new Promise(
|
7364
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7365
|
+
)
|
7366
|
+
]);
|
7367
|
+
}
|
7311
7368
|
};
|
7312
7369
|
|
7313
7370
|
// session.ts
|
@@ -10302,6 +10359,16 @@ var Client = class {
|
|
10302
10359
|
});
|
10303
10360
|
});
|
10304
10361
|
}
|
10362
|
+
addChannelApp(session, request) {
|
10363
|
+
return __async(this, null, function* () {
|
10364
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10365
|
+
yield this.sessionRefresh(session);
|
10366
|
+
}
|
10367
|
+
return this.apiClient.addChannelApp(session.token, request).then((response) => {
|
10368
|
+
return response !== void 0;
|
10369
|
+
});
|
10370
|
+
});
|
10371
|
+
}
|
10305
10372
|
getSystemMessagesList(session) {
|
10306
10373
|
return __async(this, null, function* () {
|
10307
10374
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -7274,6 +7274,63 @@ var MezonApi = class {
|
|
7274
7274
|
)
|
7275
7275
|
]);
|
7276
7276
|
}
|
7277
|
+
/** List channels detail */
|
7278
|
+
listChannelDetail(bearerToken, channelId, options = {}) {
|
7279
|
+
if (channelId === null || channelId === void 0) {
|
7280
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
7281
|
+
}
|
7282
|
+
const urlPath = "/v2/channeldesc/{channelId}".replace("{channelId}", encodeURIComponent(String(channelId)));
|
7283
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7284
|
+
let bodyJson = "";
|
7285
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7286
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7287
|
+
if (bearerToken) {
|
7288
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7289
|
+
}
|
7290
|
+
return Promise.race([
|
7291
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7292
|
+
if (response.status == 204) {
|
7293
|
+
return response;
|
7294
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7295
|
+
return response.json();
|
7296
|
+
} else {
|
7297
|
+
throw response;
|
7298
|
+
}
|
7299
|
+
}),
|
7300
|
+
new Promise(
|
7301
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7302
|
+
)
|
7303
|
+
]);
|
7304
|
+
}
|
7305
|
+
/** Add a new apps. */
|
7306
|
+
addChannelApp(bearerToken, body, options = {}) {
|
7307
|
+
if (body === null || body === void 0) {
|
7308
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
7309
|
+
}
|
7310
|
+
const urlPath = "/v2/channelapp/add";
|
7311
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7312
|
+
let bodyJson = "";
|
7313
|
+
bodyJson = JSON.stringify(body || {});
|
7314
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7315
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
7316
|
+
if (bearerToken) {
|
7317
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7318
|
+
}
|
7319
|
+
return Promise.race([
|
7320
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7321
|
+
if (response.status == 204) {
|
7322
|
+
return response;
|
7323
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7324
|
+
return response.json();
|
7325
|
+
} else {
|
7326
|
+
throw response;
|
7327
|
+
}
|
7328
|
+
}),
|
7329
|
+
new Promise(
|
7330
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7331
|
+
)
|
7332
|
+
]);
|
7333
|
+
}
|
7277
7334
|
};
|
7278
7335
|
|
7279
7336
|
// session.ts
|
@@ -10268,6 +10325,16 @@ var Client = class {
|
|
10268
10325
|
});
|
10269
10326
|
});
|
10270
10327
|
}
|
10328
|
+
addChannelApp(session, request) {
|
10329
|
+
return __async(this, null, function* () {
|
10330
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
10331
|
+
yield this.sessionRefresh(session);
|
10332
|
+
}
|
10333
|
+
return this.apiClient.addChannelApp(session.token, request).then((response) => {
|
10334
|
+
return response !== void 0;
|
10335
|
+
});
|
10336
|
+
});
|
10337
|
+
}
|
10271
10338
|
getSystemMessagesList(session) {
|
10272
10339
|
return __async(this, null, function* () {
|
10273
10340
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/socket.d.ts
CHANGED
@@ -331,7 +331,7 @@ export interface ChannelUpdatedEvent {
|
|
331
331
|
meeting_code: string;
|
332
332
|
channel_private: number;
|
333
333
|
is_error: boolean;
|
334
|
-
|
334
|
+
app_id: string;
|
335
335
|
e2ee: number;
|
336
336
|
topic: string;
|
337
337
|
age_restricted: number;
|
@@ -351,7 +351,7 @@ export interface ChannelCreatedEvent {
|
|
351
351
|
channel_private: number;
|
352
352
|
channel_type: number;
|
353
353
|
status: number;
|
354
|
-
|
354
|
+
app_id: string;
|
355
355
|
clan_name: string;
|
356
356
|
}
|
357
357
|
export interface CategoryEvent {
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -487,7 +487,7 @@ export interface ChannelUpdatedEvent {
|
|
487
487
|
// is error
|
488
488
|
is_error: boolean;
|
489
489
|
// app url
|
490
|
-
|
490
|
+
app_id: string;
|
491
491
|
// e2ee
|
492
492
|
e2ee: number;
|
493
493
|
//
|
@@ -525,7 +525,7 @@ export interface ChannelCreatedEvent {
|
|
525
525
|
// status
|
526
526
|
status: number;
|
527
527
|
// app url
|
528
|
-
|
528
|
+
app_id: string;
|
529
529
|
// clan_name
|
530
530
|
clan_name: string;
|
531
531
|
}
|