mezon-js 2.9.65 → 2.9.67
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +89 -39
- package/client.ts +21 -3
- package/dist/api.gen.d.ts +12 -4
- package/dist/client.d.ts +4 -3
- package/dist/mezon-js.cjs.js +48 -8
- package/dist/mezon-js.esm.mjs +48 -8
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -65,10 +65,6 @@ export interface MezonChangeChannelCategoryBody {
|
|
65
65
|
channel_id?: string;
|
66
66
|
}
|
67
67
|
|
68
|
-
/** */
|
69
|
-
export interface MezonDeleteWebhookByIdBody {
|
70
|
-
}
|
71
|
-
|
72
68
|
/** */
|
73
69
|
export interface MezonSetChanEncryptionMethodBody {
|
74
70
|
//
|
@@ -76,7 +72,12 @@ export interface MezonSetChanEncryptionMethodBody {
|
|
76
72
|
}
|
77
73
|
|
78
74
|
/** */
|
79
|
-
export interface MezonDeleteWebhookByIdBody {
|
75
|
+
export interface MezonDeleteWebhookByIdBody {
|
76
|
+
//
|
77
|
+
channel_id?: string;
|
78
|
+
//
|
79
|
+
clan_id?: string;
|
80
|
+
}
|
80
81
|
|
81
82
|
/** Update app information. */
|
82
83
|
export interface MezonUpdateAppBody {
|
@@ -273,6 +274,10 @@ export interface MezonUpdateWebhookByIdBody {
|
|
273
274
|
//
|
274
275
|
channel_id?: string;
|
275
276
|
//
|
277
|
+
channel_id_update?: string;
|
278
|
+
//
|
279
|
+
clan_id?: string;
|
280
|
+
//
|
276
281
|
webhook_name?: string;
|
277
282
|
}
|
278
283
|
|
@@ -2368,6 +2373,8 @@ export interface ApiWebhookCreateRequest {
|
|
2368
2373
|
//
|
2369
2374
|
channel_id?: string;
|
2370
2375
|
//
|
2376
|
+
clan_id?: string;
|
2377
|
+
//
|
2371
2378
|
webhook_name?: string;
|
2372
2379
|
}
|
2373
2380
|
|
@@ -2389,6 +2396,12 @@ export interface ApiWebhookListResponse {
|
|
2389
2396
|
webhooks?: Array<ApiWebhook>;
|
2390
2397
|
}
|
2391
2398
|
|
2399
|
+
/** */
|
2400
|
+
export interface ApiWithdrawTokenRequest {
|
2401
|
+
//
|
2402
|
+
amount?: number;
|
2403
|
+
}
|
2404
|
+
|
2392
2405
|
/** Represents an event to be passed through the server to registered event handlers. */
|
2393
2406
|
export interface MezonapiEvent {
|
2394
2407
|
//True if the event came directly from a client call, false otherwise.
|
@@ -9359,45 +9372,46 @@ pushPubKey(bearerToken: string,
|
|
9359
9372
|
}
|
9360
9373
|
|
9361
9374
|
/** disabled webhook */
|
9362
|
-
deleteWebhookById(
|
9363
|
-
|
9364
|
-
|
9365
|
-
options: any = {}
|
9366
|
-
|
9367
|
-
|
9368
|
-
|
9369
|
-
|
9370
|
-
|
9371
|
-
|
9372
|
-
|
9373
|
-
|
9374
|
-
|
9375
|
-
|
9375
|
+
deleteWebhookById(bearerToken: string,
|
9376
|
+
id:string,
|
9377
|
+
body:MezonDeleteWebhookByIdBody,
|
9378
|
+
options: any = {}): Promise<any> {
|
9379
|
+
|
9380
|
+
if (id === null || id === undefined) {
|
9381
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
9382
|
+
}
|
9383
|
+
if (body === null || body === undefined) {
|
9384
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
9385
|
+
}
|
9386
|
+
const urlPath = "/v2/webhooks/{id}"
|
9387
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
9388
|
+
const queryParams = new Map<string, any>();
|
9376
9389
|
|
9377
|
-
|
9390
|
+
let bodyJson : string = "";
|
9391
|
+
bodyJson = JSON.stringify(body || {});
|
9378
9392
|
|
9379
|
-
|
9380
|
-
|
9381
|
-
|
9393
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9394
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
9395
|
+
if (bearerToken) {
|
9382
9396
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9383
|
-
}
|
9384
|
-
|
9385
|
-
return Promise.race([
|
9386
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
9387
|
-
if (response.status == 204) {
|
9388
|
-
return response;
|
9389
|
-
} else if (response.status >= 200 && response.status < 300) {
|
9390
|
-
return response.json();
|
9391
|
-
} else {
|
9392
|
-
throw response;
|
9393
|
-
}
|
9394
|
-
}),
|
9395
|
-
new Promise((_, reject) =>
|
9396
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9397
|
-
),
|
9398
|
-
]);
|
9399
9397
|
}
|
9400
9398
|
|
9399
|
+
return Promise.race([
|
9400
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9401
|
+
if (response.status == 204) {
|
9402
|
+
return response;
|
9403
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9404
|
+
return response.json();
|
9405
|
+
} else {
|
9406
|
+
throw response;
|
9407
|
+
}
|
9408
|
+
}),
|
9409
|
+
new Promise((_, reject) =>
|
9410
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9411
|
+
),
|
9412
|
+
]);
|
9413
|
+
}
|
9414
|
+
|
9401
9415
|
buildFullUrl(
|
9402
9416
|
basePath: string,
|
9403
9417
|
fragment: string,
|
@@ -9461,6 +9475,42 @@ pushPubKey(bearerToken: string,
|
|
9461
9475
|
]);
|
9462
9476
|
}
|
9463
9477
|
|
9478
|
+
/** WithdrawToken */
|
9479
|
+
withdrawToken(bearerToken: string,
|
9480
|
+
body:ApiWithdrawTokenRequest,
|
9481
|
+
options: any = {}): Promise<any> {
|
9482
|
+
|
9483
|
+
if (body === null || body === undefined) {
|
9484
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
9485
|
+
}
|
9486
|
+
const urlPath = "/v2/withdrawtoken";
|
9487
|
+
const queryParams = new Map<string, any>();
|
9488
|
+
|
9489
|
+
let bodyJson : string = "";
|
9490
|
+
bodyJson = JSON.stringify(body || {});
|
9491
|
+
|
9492
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9493
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
9494
|
+
if (bearerToken) {
|
9495
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9496
|
+
}
|
9497
|
+
|
9498
|
+
return Promise.race([
|
9499
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9500
|
+
if (response.status == 204) {
|
9501
|
+
return response;
|
9502
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9503
|
+
return response.json();
|
9504
|
+
} else {
|
9505
|
+
throw response;
|
9506
|
+
}
|
9507
|
+
}),
|
9508
|
+
new Promise((_, reject) =>
|
9509
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9510
|
+
),
|
9511
|
+
]);
|
9512
|
+
}
|
9513
|
+
|
9464
9514
|
/** */
|
9465
9515
|
getChannelCanvasDetail(
|
9466
9516
|
bearerToken: string,
|
package/client.ts
CHANGED
@@ -138,6 +138,8 @@ import {
|
|
138
138
|
ApiGetKeyServerResp,
|
139
139
|
MezonapiListAuditLog,
|
140
140
|
ApiTokenSentEvent,
|
141
|
+
MezonDeleteWebhookByIdBody,
|
142
|
+
ApiWithdrawTokenRequest,
|
141
143
|
} from "./api.gen";
|
142
144
|
|
143
145
|
import { Session } from "./session";
|
@@ -3180,7 +3182,7 @@ export class Client {
|
|
3180
3182
|
}
|
3181
3183
|
|
3182
3184
|
//**disabled webhook by id */
|
3183
|
-
async deleteWebhookById(session: Session, id: string) {
|
3185
|
+
async deleteWebhookById(session: Session, id: string, request: MezonDeleteWebhookByIdBody) {
|
3184
3186
|
if (
|
3185
3187
|
this.autoRefreshSession &&
|
3186
3188
|
session.refresh_token &&
|
@@ -3190,7 +3192,7 @@ export class Client {
|
|
3190
3192
|
}
|
3191
3193
|
|
3192
3194
|
return this.apiClient
|
3193
|
-
.deleteWebhookById(session.token, id)
|
3195
|
+
.deleteWebhookById(session.token, id, request)
|
3194
3196
|
.then((response: any) => {
|
3195
3197
|
return response !== undefined;
|
3196
3198
|
});
|
@@ -3517,7 +3519,7 @@ export class Client {
|
|
3517
3519
|
});
|
3518
3520
|
}
|
3519
3521
|
|
3520
|
-
async
|
3522
|
+
async sendToken(session: Session, request: ApiTokenSentEvent) {
|
3521
3523
|
if (
|
3522
3524
|
this.autoRefreshSession &&
|
3523
3525
|
session.refresh_token &&
|
@@ -3533,6 +3535,22 @@ export class Client {
|
|
3533
3535
|
});
|
3534
3536
|
}
|
3535
3537
|
|
3538
|
+
async withdrawToken(session: Session, request: ApiWithdrawTokenRequest) {
|
3539
|
+
if (
|
3540
|
+
this.autoRefreshSession &&
|
3541
|
+
session.refresh_token &&
|
3542
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
3543
|
+
) {
|
3544
|
+
await this.sessionRefresh(session);
|
3545
|
+
}
|
3546
|
+
|
3547
|
+
return this.apiClient
|
3548
|
+
.withdrawToken(session.token, request)
|
3549
|
+
.then((response: ApiTokenSentEvent) => {
|
3550
|
+
return Promise.resolve(response);
|
3551
|
+
});
|
3552
|
+
}
|
3553
|
+
|
3536
3554
|
async listStreamingChannels(
|
3537
3555
|
session: Session,
|
3538
3556
|
clanId: string
|
package/dist/api.gen.d.ts
CHANGED
@@ -35,14 +35,13 @@ export interface MezonChangeChannelCategoryBody {
|
|
35
35
|
channel_id?: string;
|
36
36
|
}
|
37
37
|
/** */
|
38
|
-
export interface MezonDeleteWebhookByIdBody {
|
39
|
-
}
|
40
|
-
/** */
|
41
38
|
export interface MezonSetChanEncryptionMethodBody {
|
42
39
|
method?: string;
|
43
40
|
}
|
44
41
|
/** */
|
45
42
|
export interface MezonDeleteWebhookByIdBody {
|
43
|
+
channel_id?: string;
|
44
|
+
clan_id?: string;
|
46
45
|
}
|
47
46
|
/** Update app information. */
|
48
47
|
export interface MezonUpdateAppBody {
|
@@ -160,6 +159,8 @@ export interface MezonUpdateUserProfileByClanBody {
|
|
160
159
|
export interface MezonUpdateWebhookByIdBody {
|
161
160
|
avatar?: string;
|
162
161
|
channel_id?: string;
|
162
|
+
channel_id_update?: string;
|
163
|
+
clan_id?: string;
|
163
164
|
webhook_name?: string;
|
164
165
|
}
|
165
166
|
/** A single user-role pair. */
|
@@ -1378,6 +1379,7 @@ export interface ApiWebhook {
|
|
1378
1379
|
export interface ApiWebhookCreateRequest {
|
1379
1380
|
avatar?: string;
|
1380
1381
|
channel_id?: string;
|
1382
|
+
clan_id?: string;
|
1381
1383
|
webhook_name?: string;
|
1382
1384
|
}
|
1383
1385
|
/** */
|
@@ -1391,6 +1393,10 @@ export interface ApiWebhookGenerateResponse {
|
|
1391
1393
|
export interface ApiWebhookListResponse {
|
1392
1394
|
webhooks?: Array<ApiWebhook>;
|
1393
1395
|
}
|
1396
|
+
/** */
|
1397
|
+
export interface ApiWithdrawTokenRequest {
|
1398
|
+
amount?: number;
|
1399
|
+
}
|
1394
1400
|
/** Represents an event to be passed through the server to registered event handlers. */
|
1395
1401
|
export interface MezonapiEvent {
|
1396
1402
|
external?: boolean;
|
@@ -1770,10 +1776,12 @@ export declare class MezonApi {
|
|
1770
1776
|
/** list webhook belong to the channel */
|
1771
1777
|
listWebhookByChannelId(bearerToken: string, channelId: string, clanId?: string, options?: any): Promise<ApiWebhookListResponse>;
|
1772
1778
|
/** disabled webhook */
|
1773
|
-
deleteWebhookById(bearerToken: string, id: string, options?: any): Promise<any>;
|
1779
|
+
deleteWebhookById(bearerToken: string, id: string, body: MezonDeleteWebhookByIdBody, options?: any): Promise<any>;
|
1774
1780
|
buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
|
1775
1781
|
/** Channel canvas editor */
|
1776
1782
|
editChannelCanvases(bearerToken: string, body: ApiEditChannelCanvasRequest, options?: any): Promise<ApiEditChannelCanvasResponse>;
|
1783
|
+
/** WithdrawToken */
|
1784
|
+
withdrawToken(bearerToken: string, body: ApiWithdrawTokenRequest, options?: any): Promise<any>;
|
1777
1785
|
/** */
|
1778
1786
|
getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
|
1779
1787
|
/** */
|
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 } 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 } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -539,7 +539,7 @@ export declare class Client {
|
|
539
539
|
generateWebhookLink(session: Session, request: ApiWebhookCreateRequest): Promise<ApiWebhookGenerateResponse>;
|
540
540
|
listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse>;
|
541
541
|
updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
|
542
|
-
deleteWebhookById(session: Session, id: string): Promise<boolean>;
|
542
|
+
deleteWebhookById(session: Session, id: string, request: MezonDeleteWebhookByIdBody): Promise<boolean>;
|
543
543
|
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
544
544
|
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
545
545
|
deleteClanStickerById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
@@ -559,7 +559,8 @@ export declare class Client {
|
|
559
559
|
updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
|
560
560
|
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
561
561
|
givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
|
562
|
-
|
562
|
+
sendToken(session: Session, request: ApiTokenSentEvent): Promise<ApiTokenSentEvent>;
|
563
|
+
withdrawToken(session: Session, request: ApiWithdrawTokenRequest): Promise<ApiTokenSentEvent>;
|
563
564
|
listStreamingChannels(session: Session, clanId: string): Promise<ApiListStreamingChannelsResponse>;
|
564
565
|
/** List a channel's users. */
|
565
566
|
listStreamingChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiStreamingChannelUserList>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -6107,16 +6107,17 @@ var MezonApi = class {
|
|
6107
6107
|
]);
|
6108
6108
|
}
|
6109
6109
|
/** disabled webhook */
|
6110
|
-
deleteWebhookById(bearerToken, id, options = {}) {
|
6110
|
+
deleteWebhookById(bearerToken, id, body, options = {}) {
|
6111
6111
|
if (id === null || id === void 0) {
|
6112
6112
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6113
6113
|
}
|
6114
|
-
|
6115
|
-
"
|
6116
|
-
|
6117
|
-
);
|
6114
|
+
if (body === null || body === void 0) {
|
6115
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6116
|
+
}
|
6117
|
+
const urlPath = "/v2/webhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6118
6118
|
const queryParams = /* @__PURE__ */ new Map();
|
6119
6119
|
let bodyJson = "";
|
6120
|
+
bodyJson = JSON.stringify(body || {});
|
6120
6121
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6121
6122
|
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
6122
6123
|
if (bearerToken) {
|
@@ -6183,6 +6184,35 @@ var MezonApi = class {
|
|
6183
6184
|
)
|
6184
6185
|
]);
|
6185
6186
|
}
|
6187
|
+
/** WithdrawToken */
|
6188
|
+
withdrawToken(bearerToken, body, options = {}) {
|
6189
|
+
if (body === null || body === void 0) {
|
6190
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6191
|
+
}
|
6192
|
+
const urlPath = "/v2/withdrawtoken";
|
6193
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6194
|
+
let bodyJson = "";
|
6195
|
+
bodyJson = JSON.stringify(body || {});
|
6196
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6197
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6198
|
+
if (bearerToken) {
|
6199
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6200
|
+
}
|
6201
|
+
return Promise.race([
|
6202
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6203
|
+
if (response.status == 204) {
|
6204
|
+
return response;
|
6205
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6206
|
+
return response.json();
|
6207
|
+
} else {
|
6208
|
+
throw response;
|
6209
|
+
}
|
6210
|
+
}),
|
6211
|
+
new Promise(
|
6212
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6213
|
+
)
|
6214
|
+
]);
|
6215
|
+
}
|
6186
6216
|
/** */
|
6187
6217
|
getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
|
6188
6218
|
if (id === null || id === void 0) {
|
@@ -8692,12 +8722,12 @@ var Client = class {
|
|
8692
8722
|
});
|
8693
8723
|
}
|
8694
8724
|
//**disabled webhook by id */
|
8695
|
-
deleteWebhookById(session, id) {
|
8725
|
+
deleteWebhookById(session, id, request) {
|
8696
8726
|
return __async(this, null, function* () {
|
8697
8727
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8698
8728
|
yield this.sessionRefresh(session);
|
8699
8729
|
}
|
8700
|
-
return this.apiClient.deleteWebhookById(session.token, id).then((response) => {
|
8730
|
+
return this.apiClient.deleteWebhookById(session.token, id, request).then((response) => {
|
8701
8731
|
return response !== void 0;
|
8702
8732
|
});
|
8703
8733
|
});
|
@@ -8888,7 +8918,7 @@ var Client = class {
|
|
8888
8918
|
});
|
8889
8919
|
});
|
8890
8920
|
}
|
8891
|
-
|
8921
|
+
sendToken(session, request) {
|
8892
8922
|
return __async(this, null, function* () {
|
8893
8923
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8894
8924
|
yield this.sessionRefresh(session);
|
@@ -8898,6 +8928,16 @@ var Client = class {
|
|
8898
8928
|
});
|
8899
8929
|
});
|
8900
8930
|
}
|
8931
|
+
withdrawToken(session, request) {
|
8932
|
+
return __async(this, null, function* () {
|
8933
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8934
|
+
yield this.sessionRefresh(session);
|
8935
|
+
}
|
8936
|
+
return this.apiClient.withdrawToken(session.token, request).then((response) => {
|
8937
|
+
return Promise.resolve(response);
|
8938
|
+
});
|
8939
|
+
});
|
8940
|
+
}
|
8901
8941
|
listStreamingChannels(session, clanId) {
|
8902
8942
|
return __async(this, null, function* () {
|
8903
8943
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6078,16 +6078,17 @@ var MezonApi = class {
|
|
6078
6078
|
]);
|
6079
6079
|
}
|
6080
6080
|
/** disabled webhook */
|
6081
|
-
deleteWebhookById(bearerToken, id, options = {}) {
|
6081
|
+
deleteWebhookById(bearerToken, id, body, options = {}) {
|
6082
6082
|
if (id === null || id === void 0) {
|
6083
6083
|
throw new Error("'id' is a required parameter but is null or undefined.");
|
6084
6084
|
}
|
6085
|
-
|
6086
|
-
"
|
6087
|
-
|
6088
|
-
);
|
6085
|
+
if (body === null || body === void 0) {
|
6086
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6087
|
+
}
|
6088
|
+
const urlPath = "/v2/webhooks/{id}".replace("{id}", encodeURIComponent(String(id)));
|
6089
6089
|
const queryParams = /* @__PURE__ */ new Map();
|
6090
6090
|
let bodyJson = "";
|
6091
|
+
bodyJson = JSON.stringify(body || {});
|
6091
6092
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6092
6093
|
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
6093
6094
|
if (bearerToken) {
|
@@ -6154,6 +6155,35 @@ var MezonApi = class {
|
|
6154
6155
|
)
|
6155
6156
|
]);
|
6156
6157
|
}
|
6158
|
+
/** WithdrawToken */
|
6159
|
+
withdrawToken(bearerToken, body, options = {}) {
|
6160
|
+
if (body === null || body === void 0) {
|
6161
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6162
|
+
}
|
6163
|
+
const urlPath = "/v2/withdrawtoken";
|
6164
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6165
|
+
let bodyJson = "";
|
6166
|
+
bodyJson = JSON.stringify(body || {});
|
6167
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6168
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
6169
|
+
if (bearerToken) {
|
6170
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6171
|
+
}
|
6172
|
+
return Promise.race([
|
6173
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6174
|
+
if (response.status == 204) {
|
6175
|
+
return response;
|
6176
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6177
|
+
return response.json();
|
6178
|
+
} else {
|
6179
|
+
throw response;
|
6180
|
+
}
|
6181
|
+
}),
|
6182
|
+
new Promise(
|
6183
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6184
|
+
)
|
6185
|
+
]);
|
6186
|
+
}
|
6157
6187
|
/** */
|
6158
6188
|
getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
|
6159
6189
|
if (id === null || id === void 0) {
|
@@ -8663,12 +8693,12 @@ var Client = class {
|
|
8663
8693
|
});
|
8664
8694
|
}
|
8665
8695
|
//**disabled webhook by id */
|
8666
|
-
deleteWebhookById(session, id) {
|
8696
|
+
deleteWebhookById(session, id, request) {
|
8667
8697
|
return __async(this, null, function* () {
|
8668
8698
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8669
8699
|
yield this.sessionRefresh(session);
|
8670
8700
|
}
|
8671
|
-
return this.apiClient.deleteWebhookById(session.token, id).then((response) => {
|
8701
|
+
return this.apiClient.deleteWebhookById(session.token, id, request).then((response) => {
|
8672
8702
|
return response !== void 0;
|
8673
8703
|
});
|
8674
8704
|
});
|
@@ -8859,7 +8889,7 @@ var Client = class {
|
|
8859
8889
|
});
|
8860
8890
|
});
|
8861
8891
|
}
|
8862
|
-
|
8892
|
+
sendToken(session, request) {
|
8863
8893
|
return __async(this, null, function* () {
|
8864
8894
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8865
8895
|
yield this.sessionRefresh(session);
|
@@ -8869,6 +8899,16 @@ var Client = class {
|
|
8869
8899
|
});
|
8870
8900
|
});
|
8871
8901
|
}
|
8902
|
+
withdrawToken(session, request) {
|
8903
|
+
return __async(this, null, function* () {
|
8904
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
8905
|
+
yield this.sessionRefresh(session);
|
8906
|
+
}
|
8907
|
+
return this.apiClient.withdrawToken(session.token, request).then((response) => {
|
8908
|
+
return Promise.resolve(response);
|
8909
|
+
});
|
8910
|
+
});
|
8911
|
+
}
|
8872
8912
|
listStreamingChannels(session, clanId) {
|
8873
8913
|
return __async(this, null, function* () {
|
8874
8914
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|