mezon-js 2.9.77 → 2.9.78
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +213 -0
- package/client.ts +86 -0
- package/dist/api.gen.d.ts +44 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +162 -0
- package/dist/mezon-js.esm.mjs +162 -0
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -2528,6 +2528,68 @@ export interface ApiOnboardingItem {
|
|
2528
2528
|
update_time?: string;
|
2529
2529
|
}
|
2530
2530
|
|
2531
|
+
/** */
|
2532
|
+
export interface MezonUpdateClanWebhookByIdBody {
|
2533
|
+
//avatar.
|
2534
|
+
avatar?: string;
|
2535
|
+
//clan id.
|
2536
|
+
clan_id?: string;
|
2537
|
+
//reset token.
|
2538
|
+
reset_token?: boolean;
|
2539
|
+
//webhook name.
|
2540
|
+
webhook_name?: string;
|
2541
|
+
}
|
2542
|
+
|
2543
|
+
/** */
|
2544
|
+
export interface ApiClanWebhook {
|
2545
|
+
//active.
|
2546
|
+
active?: number;
|
2547
|
+
//
|
2548
|
+
avatar?: string;
|
2549
|
+
//clan id.
|
2550
|
+
clan_id?: string;
|
2551
|
+
//create time.
|
2552
|
+
create_time?: string;
|
2553
|
+
//creator id.
|
2554
|
+
creator_id?: string;
|
2555
|
+
//id.
|
2556
|
+
id?: string;
|
2557
|
+
//update time.
|
2558
|
+
update_time?: string;
|
2559
|
+
//URL of the webhook, which is automatically generated and different from the avatar.
|
2560
|
+
url?: string;
|
2561
|
+
//webhook name.
|
2562
|
+
webhook_name?: string;
|
2563
|
+
}
|
2564
|
+
|
2565
|
+
/** */
|
2566
|
+
export interface ApiGenerateClanWebhookRequest {
|
2567
|
+
//avatar.
|
2568
|
+
avatar?: string;
|
2569
|
+
//clan id.
|
2570
|
+
clan_id?: string;
|
2571
|
+
//webhook name.
|
2572
|
+
webhook_name?: string;
|
2573
|
+
}
|
2574
|
+
|
2575
|
+
/** */
|
2576
|
+
export interface ApiGenerateClanWebhookResponse {
|
2577
|
+
//avatar.
|
2578
|
+
avatar?: string;
|
2579
|
+
//clan id.
|
2580
|
+
clan_id?: string;
|
2581
|
+
//url.
|
2582
|
+
url?: string;
|
2583
|
+
//webhook name.
|
2584
|
+
webhook_name?: string;
|
2585
|
+
}
|
2586
|
+
|
2587
|
+
/** */
|
2588
|
+
export interface ApiListClanWebhookResponse {
|
2589
|
+
//list clan webhook.
|
2590
|
+
list_clan_webhooks?: Array<ApiClanWebhook>;
|
2591
|
+
}
|
2592
|
+
|
2531
2593
|
export class MezonApi {
|
2532
2594
|
constructor(
|
2533
2595
|
readonly serverKey: string,
|
@@ -9874,4 +9936,155 @@ pushPubKey(bearerToken: string,
|
|
9874
9936
|
),
|
9875
9937
|
]);
|
9876
9938
|
}
|
9939
|
+
|
9940
|
+
/** Generate clan webhook. */
|
9941
|
+
generateClanWebhook(bearerToken: string,
|
9942
|
+
body:ApiGenerateClanWebhookRequest,
|
9943
|
+
options: any = {}): Promise<ApiGenerateClanWebhookResponse> {
|
9944
|
+
|
9945
|
+
if (body === null || body === undefined) {
|
9946
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
9947
|
+
}
|
9948
|
+
const urlPath = "/v2/clanwebhooks";
|
9949
|
+
const queryParams = new Map<string, any>();
|
9950
|
+
|
9951
|
+
let bodyJson : string = "";
|
9952
|
+
bodyJson = JSON.stringify(body || {});
|
9953
|
+
|
9954
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9955
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
9956
|
+
if (bearerToken) {
|
9957
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9958
|
+
}
|
9959
|
+
|
9960
|
+
return Promise.race([
|
9961
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9962
|
+
if (response.status == 204) {
|
9963
|
+
return response;
|
9964
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9965
|
+
return response.json();
|
9966
|
+
} else {
|
9967
|
+
throw response;
|
9968
|
+
}
|
9969
|
+
}),
|
9970
|
+
new Promise((_, reject) =>
|
9971
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9972
|
+
),
|
9973
|
+
]);
|
9974
|
+
}
|
9975
|
+
|
9976
|
+
/** List clan webhook. */
|
9977
|
+
listClanWebhook(bearerToken: string,
|
9978
|
+
clanId:string,
|
9979
|
+
options: any = {}): Promise<ApiListClanWebhookResponse> {
|
9980
|
+
|
9981
|
+
if (clanId === null || clanId === undefined) {
|
9982
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
9983
|
+
}
|
9984
|
+
const urlPath = "/v2/clanwebhooks/{clanId}"
|
9985
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
9986
|
+
const queryParams = new Map<string, any>();
|
9987
|
+
|
9988
|
+
let bodyJson : string = "";
|
9989
|
+
|
9990
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9991
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
9992
|
+
if (bearerToken) {
|
9993
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9994
|
+
}
|
9995
|
+
|
9996
|
+
return Promise.race([
|
9997
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9998
|
+
if (response.status == 204) {
|
9999
|
+
return response;
|
10000
|
+
} else if (response.status >= 200 && response.status < 300) {
|
10001
|
+
return response.json();
|
10002
|
+
} else {
|
10003
|
+
throw response;
|
10004
|
+
}
|
10005
|
+
}),
|
10006
|
+
new Promise((_, reject) =>
|
10007
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
10008
|
+
),
|
10009
|
+
]);
|
10010
|
+
}
|
10011
|
+
|
10012
|
+
/** Disabled clan webhook. */
|
10013
|
+
deleteClanWebhookById(bearerToken: string,
|
10014
|
+
id:string,
|
10015
|
+
clanId?:string,
|
10016
|
+
options: any = {}): Promise<any> {
|
10017
|
+
|
10018
|
+
if (id === null || id === undefined) {
|
10019
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
10020
|
+
}
|
10021
|
+
const urlPath = "/v2/clanwebhooks/{id}"
|
10022
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
10023
|
+
const queryParams = new Map<string, any>();
|
10024
|
+
queryParams.set("clan_id", clanId);
|
10025
|
+
|
10026
|
+
let bodyJson : string = "";
|
10027
|
+
|
10028
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
10029
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
10030
|
+
if (bearerToken) {
|
10031
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
10032
|
+
}
|
10033
|
+
|
10034
|
+
return Promise.race([
|
10035
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
10036
|
+
if (response.status == 204) {
|
10037
|
+
return response;
|
10038
|
+
} else if (response.status >= 200 && response.status < 300) {
|
10039
|
+
return response.json();
|
10040
|
+
} else {
|
10041
|
+
throw response;
|
10042
|
+
}
|
10043
|
+
}),
|
10044
|
+
new Promise((_, reject) =>
|
10045
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
10046
|
+
),
|
10047
|
+
]);
|
10048
|
+
}
|
10049
|
+
|
10050
|
+
/** Update clan webhook by id. */
|
10051
|
+
updateClanWebhookById(bearerToken: string,
|
10052
|
+
id:string,
|
10053
|
+
body:MezonUpdateClanWebhookByIdBody,
|
10054
|
+
options: any = {}): Promise<any> {
|
10055
|
+
|
10056
|
+
if (id === null || id === undefined) {
|
10057
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
10058
|
+
}
|
10059
|
+
if (body === null || body === undefined) {
|
10060
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
10061
|
+
}
|
10062
|
+
const urlPath = "/v2/clanwebhooks/{id}"
|
10063
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
10064
|
+
const queryParams = new Map<string, any>();
|
10065
|
+
|
10066
|
+
let bodyJson : string = "";
|
10067
|
+
bodyJson = JSON.stringify(body || {});
|
10068
|
+
|
10069
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
10070
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
10071
|
+
if (bearerToken) {
|
10072
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
10073
|
+
}
|
10074
|
+
|
10075
|
+
return Promise.race([
|
10076
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
10077
|
+
if (response.status == 204) {
|
10078
|
+
return response;
|
10079
|
+
} else if (response.status >= 200 && response.status < 300) {
|
10080
|
+
return response.json();
|
10081
|
+
} else {
|
10082
|
+
throw response;
|
10083
|
+
}
|
10084
|
+
}),
|
10085
|
+
new Promise((_, reject) =>
|
10086
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
10087
|
+
),
|
10088
|
+
]);
|
10089
|
+
}
|
9877
10090
|
}
|
package/client.ts
CHANGED
@@ -144,6 +144,10 @@ import {
|
|
144
144
|
ApiCreateOnboardingRequest,
|
145
145
|
MezonUpdateOnboardingBody,
|
146
146
|
ApiOnboardingItem,
|
147
|
+
ApiGenerateClanWebhookRequest,
|
148
|
+
ApiGenerateClanWebhookResponse,
|
149
|
+
ApiListClanWebhookResponse,
|
150
|
+
MezonUpdateClanWebhookByIdBody,
|
147
151
|
} from "./api.gen";
|
148
152
|
|
149
153
|
import { Session } from "./session";
|
@@ -4528,4 +4532,86 @@ export class Client {
|
|
4528
4532
|
return response !== undefined;
|
4529
4533
|
});
|
4530
4534
|
}
|
4535
|
+
|
4536
|
+
//**create webhook for clan */
|
4537
|
+
async generateClanWebhook(
|
4538
|
+
session: Session,
|
4539
|
+
request: ApiGenerateClanWebhookRequest
|
4540
|
+
): Promise<ApiGenerateClanWebhookResponse> {
|
4541
|
+
if (
|
4542
|
+
this.autoRefreshSession &&
|
4543
|
+
session.refresh_token &&
|
4544
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4545
|
+
) {
|
4546
|
+
await this.sessionRefresh(session);
|
4547
|
+
}
|
4548
|
+
|
4549
|
+
return this.apiClient
|
4550
|
+
.generateWebhook(session.token, request)
|
4551
|
+
.then((response: any) => {
|
4552
|
+
return Promise.resolve(response);
|
4553
|
+
});
|
4554
|
+
}
|
4555
|
+
|
4556
|
+
//**list webhook belong to the clan */
|
4557
|
+
async listClanWebhook(
|
4558
|
+
session: Session,
|
4559
|
+
clan_id: string
|
4560
|
+
): Promise<ApiListClanWebhookResponse> {
|
4561
|
+
if (
|
4562
|
+
this.autoRefreshSession &&
|
4563
|
+
session.refresh_token &&
|
4564
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4565
|
+
) {
|
4566
|
+
await this.sessionRefresh(session);
|
4567
|
+
}
|
4568
|
+
|
4569
|
+
return this.apiClient
|
4570
|
+
.listClanWebhook(session.token, clan_id)
|
4571
|
+
.then((response: ApiListClanWebhookResponse) => {
|
4572
|
+
return Promise.resolve(response);
|
4573
|
+
});
|
4574
|
+
}
|
4575
|
+
|
4576
|
+
//**disabled webhook by id */
|
4577
|
+
async deleteClanWebhookById(
|
4578
|
+
session: Session,
|
4579
|
+
id: string,
|
4580
|
+
clan_id: string
|
4581
|
+
) {
|
4582
|
+
if (
|
4583
|
+
this.autoRefreshSession &&
|
4584
|
+
session.refresh_token &&
|
4585
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4586
|
+
) {
|
4587
|
+
await this.sessionRefresh(session);
|
4588
|
+
}
|
4589
|
+
|
4590
|
+
return this.apiClient
|
4591
|
+
.deleteClanWebhookById(session.token, id, clan_id)
|
4592
|
+
.then((response: any) => {
|
4593
|
+
return response !== undefined;
|
4594
|
+
});
|
4595
|
+
}
|
4596
|
+
|
4597
|
+
//**update webhook name by id */
|
4598
|
+
async updateClanWebhookById(
|
4599
|
+
session: Session,
|
4600
|
+
id: string,
|
4601
|
+
request: MezonUpdateClanWebhookByIdBody
|
4602
|
+
) {
|
4603
|
+
if (
|
4604
|
+
this.autoRefreshSession &&
|
4605
|
+
session.refresh_token &&
|
4606
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4607
|
+
) {
|
4608
|
+
await this.sessionRefresh(session);
|
4609
|
+
}
|
4610
|
+
|
4611
|
+
return this.apiClient
|
4612
|
+
.updateClanWebhookById(session.token, id, request)
|
4613
|
+
.then((response: any) => {
|
4614
|
+
return response !== undefined;
|
4615
|
+
});
|
4616
|
+
}
|
4531
4617
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -1470,6 +1470,42 @@ export interface ApiOnboardingItem {
|
|
1470
1470
|
title?: string;
|
1471
1471
|
update_time?: string;
|
1472
1472
|
}
|
1473
|
+
/** */
|
1474
|
+
export interface MezonUpdateClanWebhookByIdBody {
|
1475
|
+
avatar?: string;
|
1476
|
+
clan_id?: string;
|
1477
|
+
reset_token?: boolean;
|
1478
|
+
webhook_name?: string;
|
1479
|
+
}
|
1480
|
+
/** */
|
1481
|
+
export interface ApiClanWebhook {
|
1482
|
+
active?: number;
|
1483
|
+
avatar?: string;
|
1484
|
+
clan_id?: string;
|
1485
|
+
create_time?: string;
|
1486
|
+
creator_id?: string;
|
1487
|
+
id?: string;
|
1488
|
+
update_time?: string;
|
1489
|
+
url?: string;
|
1490
|
+
webhook_name?: string;
|
1491
|
+
}
|
1492
|
+
/** */
|
1493
|
+
export interface ApiGenerateClanWebhookRequest {
|
1494
|
+
avatar?: string;
|
1495
|
+
clan_id?: string;
|
1496
|
+
webhook_name?: string;
|
1497
|
+
}
|
1498
|
+
/** */
|
1499
|
+
export interface ApiGenerateClanWebhookResponse {
|
1500
|
+
avatar?: string;
|
1501
|
+
clan_id?: string;
|
1502
|
+
url?: string;
|
1503
|
+
webhook_name?: string;
|
1504
|
+
}
|
1505
|
+
/** */
|
1506
|
+
export interface ApiListClanWebhookResponse {
|
1507
|
+
list_clan_webhooks?: Array<ApiClanWebhook>;
|
1508
|
+
}
|
1473
1509
|
export declare class MezonApi {
|
1474
1510
|
readonly serverKey: string;
|
1475
1511
|
readonly basePath: string;
|
@@ -1844,4 +1880,12 @@ export declare class MezonApi {
|
|
1844
1880
|
getOnboardingDetail(bearerToken: string, id: string, clanId?: string, options?: any): Promise<ApiOnboardingItem>;
|
1845
1881
|
/** update onboarding. */
|
1846
1882
|
updateOnboarding(bearerToken: string, id: string, body: MezonUpdateOnboardingBody, options?: any): Promise<any>;
|
1883
|
+
/** Generate clan webhook. */
|
1884
|
+
generateClanWebhook(bearerToken: string, body: ApiGenerateClanWebhookRequest, options?: any): Promise<ApiGenerateClanWebhookResponse>;
|
1885
|
+
/** List clan webhook. */
|
1886
|
+
listClanWebhook(bearerToken: string, clanId: string, options?: any): Promise<ApiListClanWebhookResponse>;
|
1887
|
+
/** Disabled clan webhook. */
|
1888
|
+
deleteClanWebhookById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
|
1889
|
+
/** Update clan webhook by id. */
|
1890
|
+
updateClanWebhookById(bearerToken: string, id: string, body: MezonUpdateClanWebhookByIdBody, options?: any): Promise<any>;
|
1847
1891
|
}
|
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, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem } 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, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, 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 } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -615,4 +615,8 @@ export declare class Client {
|
|
615
615
|
createOnboarding(session: Session, request: ApiCreateOnboardingRequest): Promise<any>;
|
616
616
|
updateOnboarding(session: Session, id: string, request: MezonUpdateOnboardingBody): Promise<boolean>;
|
617
617
|
deleteOnboarding(session: Session, id: string, clanId?: string): Promise<any>;
|
618
|
+
generateClanWebhook(session: Session, request: ApiGenerateClanWebhookRequest): Promise<ApiGenerateClanWebhookResponse>;
|
619
|
+
listClanWebhook(session: Session, clan_id: string): Promise<ApiListClanWebhookResponse>;
|
620
|
+
deleteClanWebhookById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
621
|
+
updateClanWebhookById(session: Session, id: string, request: MezonUpdateClanWebhookByIdBody): Promise<boolean>;
|
618
622
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -6430,6 +6430,124 @@ var MezonApi = class {
|
|
6430
6430
|
)
|
6431
6431
|
]);
|
6432
6432
|
}
|
6433
|
+
/** Generate clan webhook. */
|
6434
|
+
generateClanWebhook(bearerToken, body, options = {}) {
|
6435
|
+
if (body === null || body === void 0) {
|
6436
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6437
|
+
}
|
6438
|
+
const urlPath = "/v2/clanwebhooks";
|
6439
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6440
|
+
let bodyJson = "";
|
6441
|
+
bodyJson = JSON.stringify(body || {});
|
6442
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6443
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6444
|
+
if (bearerToken) {
|
6445
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6446
|
+
}
|
6447
|
+
return Promise.race([
|
6448
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6449
|
+
if (response.status == 204) {
|
6450
|
+
return response;
|
6451
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6452
|
+
return response.json();
|
6453
|
+
} else {
|
6454
|
+
throw response;
|
6455
|
+
}
|
6456
|
+
}),
|
6457
|
+
new Promise(
|
6458
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6459
|
+
)
|
6460
|
+
]);
|
6461
|
+
}
|
6462
|
+
/** List clan webhook. */
|
6463
|
+
listClanWebhook(bearerToken, clanId, options = {}) {
|
6464
|
+
if (clanId === null || clanId === void 0) {
|
6465
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
6466
|
+
}
|
6467
|
+
const urlPath = "/v2/clanwebhooks/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
6468
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6469
|
+
let bodyJson = "";
|
6470
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6471
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6472
|
+
if (bearerToken) {
|
6473
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6474
|
+
}
|
6475
|
+
return Promise.race([
|
6476
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6477
|
+
if (response.status == 204) {
|
6478
|
+
return response;
|
6479
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6480
|
+
return response.json();
|
6481
|
+
} else {
|
6482
|
+
throw response;
|
6483
|
+
}
|
6484
|
+
}),
|
6485
|
+
new Promise(
|
6486
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6487
|
+
)
|
6488
|
+
]);
|
6489
|
+
}
|
6490
|
+
/** Disabled clan webhook. */
|
6491
|
+
deleteClanWebhookById(bearerToken, id, clanId, options = {}) {
|
6492
|
+
if (id === null || id === void 0) {
|
6493
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
6494
|
+
}
|
6495
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6496
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6497
|
+
queryParams.set("clan_id", clanId);
|
6498
|
+
let bodyJson = "";
|
6499
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6500
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
6501
|
+
if (bearerToken) {
|
6502
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6503
|
+
}
|
6504
|
+
return Promise.race([
|
6505
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6506
|
+
if (response.status == 204) {
|
6507
|
+
return response;
|
6508
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6509
|
+
return response.json();
|
6510
|
+
} else {
|
6511
|
+
throw response;
|
6512
|
+
}
|
6513
|
+
}),
|
6514
|
+
new Promise(
|
6515
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6516
|
+
)
|
6517
|
+
]);
|
6518
|
+
}
|
6519
|
+
/** Update clan webhook by id. */
|
6520
|
+
updateClanWebhookById(bearerToken, id, body, options = {}) {
|
6521
|
+
if (id === null || id === void 0) {
|
6522
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
6523
|
+
}
|
6524
|
+
if (body === null || body === void 0) {
|
6525
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6526
|
+
}
|
6527
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6528
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6529
|
+
let bodyJson = "";
|
6530
|
+
bodyJson = JSON.stringify(body || {});
|
6531
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6532
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
6533
|
+
if (bearerToken) {
|
6534
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6535
|
+
}
|
6536
|
+
return Promise.race([
|
6537
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6538
|
+
if (response.status == 204) {
|
6539
|
+
return response;
|
6540
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6541
|
+
return response.json();
|
6542
|
+
} else {
|
6543
|
+
throw response;
|
6544
|
+
}
|
6545
|
+
}),
|
6546
|
+
new Promise(
|
6547
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6548
|
+
)
|
6549
|
+
]);
|
6550
|
+
}
|
6433
6551
|
};
|
6434
6552
|
|
6435
6553
|
// session.ts
|
@@ -9832,4 +9950,48 @@ var Client = class {
|
|
9832
9950
|
});
|
9833
9951
|
});
|
9834
9952
|
}
|
9953
|
+
//**create webhook for clan */
|
9954
|
+
generateClanWebhook(session, request) {
|
9955
|
+
return __async(this, null, function* () {
|
9956
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9957
|
+
yield this.sessionRefresh(session);
|
9958
|
+
}
|
9959
|
+
return this.apiClient.generateWebhook(session.token, request).then((response) => {
|
9960
|
+
return Promise.resolve(response);
|
9961
|
+
});
|
9962
|
+
});
|
9963
|
+
}
|
9964
|
+
//**list webhook belong to the clan */
|
9965
|
+
listClanWebhook(session, clan_id) {
|
9966
|
+
return __async(this, null, function* () {
|
9967
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9968
|
+
yield this.sessionRefresh(session);
|
9969
|
+
}
|
9970
|
+
return this.apiClient.listClanWebhook(session.token, clan_id).then((response) => {
|
9971
|
+
return Promise.resolve(response);
|
9972
|
+
});
|
9973
|
+
});
|
9974
|
+
}
|
9975
|
+
//**disabled webhook by id */
|
9976
|
+
deleteClanWebhookById(session, id, clan_id) {
|
9977
|
+
return __async(this, null, function* () {
|
9978
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9979
|
+
yield this.sessionRefresh(session);
|
9980
|
+
}
|
9981
|
+
return this.apiClient.deleteClanWebhookById(session.token, id, clan_id).then((response) => {
|
9982
|
+
return response !== void 0;
|
9983
|
+
});
|
9984
|
+
});
|
9985
|
+
}
|
9986
|
+
//**update webhook name by id */
|
9987
|
+
updateClanWebhookById(session, id, request) {
|
9988
|
+
return __async(this, null, function* () {
|
9989
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9990
|
+
yield this.sessionRefresh(session);
|
9991
|
+
}
|
9992
|
+
return this.apiClient.updateClanWebhookById(session.token, id, request).then((response) => {
|
9993
|
+
return response !== void 0;
|
9994
|
+
});
|
9995
|
+
});
|
9996
|
+
}
|
9835
9997
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6400,6 +6400,124 @@ var MezonApi = class {
|
|
6400
6400
|
)
|
6401
6401
|
]);
|
6402
6402
|
}
|
6403
|
+
/** Generate clan webhook. */
|
6404
|
+
generateClanWebhook(bearerToken, body, options = {}) {
|
6405
|
+
if (body === null || body === void 0) {
|
6406
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6407
|
+
}
|
6408
|
+
const urlPath = "/v2/clanwebhooks";
|
6409
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6410
|
+
let bodyJson = "";
|
6411
|
+
bodyJson = JSON.stringify(body || {});
|
6412
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6413
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6414
|
+
if (bearerToken) {
|
6415
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6416
|
+
}
|
6417
|
+
return Promise.race([
|
6418
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6419
|
+
if (response.status == 204) {
|
6420
|
+
return response;
|
6421
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6422
|
+
return response.json();
|
6423
|
+
} else {
|
6424
|
+
throw response;
|
6425
|
+
}
|
6426
|
+
}),
|
6427
|
+
new Promise(
|
6428
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6429
|
+
)
|
6430
|
+
]);
|
6431
|
+
}
|
6432
|
+
/** List clan webhook. */
|
6433
|
+
listClanWebhook(bearerToken, clanId, options = {}) {
|
6434
|
+
if (clanId === null || clanId === void 0) {
|
6435
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
6436
|
+
}
|
6437
|
+
const urlPath = "/v2/clanwebhooks/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
6438
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6439
|
+
let bodyJson = "";
|
6440
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6441
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6442
|
+
if (bearerToken) {
|
6443
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6444
|
+
}
|
6445
|
+
return Promise.race([
|
6446
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6447
|
+
if (response.status == 204) {
|
6448
|
+
return response;
|
6449
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6450
|
+
return response.json();
|
6451
|
+
} else {
|
6452
|
+
throw response;
|
6453
|
+
}
|
6454
|
+
}),
|
6455
|
+
new Promise(
|
6456
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6457
|
+
)
|
6458
|
+
]);
|
6459
|
+
}
|
6460
|
+
/** Disabled clan webhook. */
|
6461
|
+
deleteClanWebhookById(bearerToken, id, clanId, options = {}) {
|
6462
|
+
if (id === null || id === void 0) {
|
6463
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
6464
|
+
}
|
6465
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6466
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6467
|
+
queryParams.set("clan_id", clanId);
|
6468
|
+
let bodyJson = "";
|
6469
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6470
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
6471
|
+
if (bearerToken) {
|
6472
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6473
|
+
}
|
6474
|
+
return Promise.race([
|
6475
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6476
|
+
if (response.status == 204) {
|
6477
|
+
return response;
|
6478
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6479
|
+
return response.json();
|
6480
|
+
} else {
|
6481
|
+
throw response;
|
6482
|
+
}
|
6483
|
+
}),
|
6484
|
+
new Promise(
|
6485
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6486
|
+
)
|
6487
|
+
]);
|
6488
|
+
}
|
6489
|
+
/** Update clan webhook by id. */
|
6490
|
+
updateClanWebhookById(bearerToken, id, body, options = {}) {
|
6491
|
+
if (id === null || id === void 0) {
|
6492
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
6493
|
+
}
|
6494
|
+
if (body === null || body === void 0) {
|
6495
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6496
|
+
}
|
6497
|
+
const urlPath = "/v2/clanwebhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6498
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6499
|
+
let bodyJson = "";
|
6500
|
+
bodyJson = JSON.stringify(body || {});
|
6501
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6502
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
6503
|
+
if (bearerToken) {
|
6504
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6505
|
+
}
|
6506
|
+
return Promise.race([
|
6507
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6508
|
+
if (response.status == 204) {
|
6509
|
+
return response;
|
6510
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6511
|
+
return response.json();
|
6512
|
+
} else {
|
6513
|
+
throw response;
|
6514
|
+
}
|
6515
|
+
}),
|
6516
|
+
new Promise(
|
6517
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6518
|
+
)
|
6519
|
+
]);
|
6520
|
+
}
|
6403
6521
|
};
|
6404
6522
|
|
6405
6523
|
// session.ts
|
@@ -9802,6 +9920,50 @@ var Client = class {
|
|
9802
9920
|
});
|
9803
9921
|
});
|
9804
9922
|
}
|
9923
|
+
//**create webhook for clan */
|
9924
|
+
generateClanWebhook(session, request) {
|
9925
|
+
return __async(this, null, function* () {
|
9926
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9927
|
+
yield this.sessionRefresh(session);
|
9928
|
+
}
|
9929
|
+
return this.apiClient.generateWebhook(session.token, request).then((response) => {
|
9930
|
+
return Promise.resolve(response);
|
9931
|
+
});
|
9932
|
+
});
|
9933
|
+
}
|
9934
|
+
//**list webhook belong to the clan */
|
9935
|
+
listClanWebhook(session, clan_id) {
|
9936
|
+
return __async(this, null, function* () {
|
9937
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9938
|
+
yield this.sessionRefresh(session);
|
9939
|
+
}
|
9940
|
+
return this.apiClient.listClanWebhook(session.token, clan_id).then((response) => {
|
9941
|
+
return Promise.resolve(response);
|
9942
|
+
});
|
9943
|
+
});
|
9944
|
+
}
|
9945
|
+
//**disabled webhook by id */
|
9946
|
+
deleteClanWebhookById(session, id, clan_id) {
|
9947
|
+
return __async(this, null, function* () {
|
9948
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9949
|
+
yield this.sessionRefresh(session);
|
9950
|
+
}
|
9951
|
+
return this.apiClient.deleteClanWebhookById(session.token, id, clan_id).then((response) => {
|
9952
|
+
return response !== void 0;
|
9953
|
+
});
|
9954
|
+
});
|
9955
|
+
}
|
9956
|
+
//**update webhook name by id */
|
9957
|
+
updateClanWebhookById(session, id, request) {
|
9958
|
+
return __async(this, null, function* () {
|
9959
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
9960
|
+
yield this.sessionRefresh(session);
|
9961
|
+
}
|
9962
|
+
return this.apiClient.updateClanWebhookById(session.token, id, request).then((response) => {
|
9963
|
+
return response !== void 0;
|
9964
|
+
});
|
9965
|
+
});
|
9966
|
+
}
|
9805
9967
|
};
|
9806
9968
|
export {
|
9807
9969
|
ChannelStreamMode,
|