mezon-js 2.9.65 → 2.9.66
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 +42 -0
- package/client.ts +17 -0
- package/dist/api.gen.d.ts +6 -0
- package/dist/client.d.ts +2 -1
- package/dist/mezon-js.cjs.js +39 -0
- package/dist/mezon-js.esm.mjs +39 -0
- package/package.json +1 -1
package/api.gen.ts
CHANGED
|
@@ -2389,6 +2389,12 @@ export interface ApiWebhookListResponse {
|
|
|
2389
2389
|
webhooks?: Array<ApiWebhook>;
|
|
2390
2390
|
}
|
|
2391
2391
|
|
|
2392
|
+
/** */
|
|
2393
|
+
export interface ApiWithdrawTokenRequest {
|
|
2394
|
+
//
|
|
2395
|
+
amount?: number;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2392
2398
|
/** Represents an event to be passed through the server to registered event handlers. */
|
|
2393
2399
|
export interface MezonapiEvent {
|
|
2394
2400
|
//True if the event came directly from a client call, false otherwise.
|
|
@@ -9461,6 +9467,42 @@ pushPubKey(bearerToken: string,
|
|
|
9461
9467
|
]);
|
|
9462
9468
|
}
|
|
9463
9469
|
|
|
9470
|
+
/** WithdrawToken */
|
|
9471
|
+
withdrawToken(bearerToken: string,
|
|
9472
|
+
body:ApiWithdrawTokenRequest,
|
|
9473
|
+
options: any = {}): Promise<any> {
|
|
9474
|
+
|
|
9475
|
+
if (body === null || body === undefined) {
|
|
9476
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
9477
|
+
}
|
|
9478
|
+
const urlPath = "/v2/withdrawtoken";
|
|
9479
|
+
const queryParams = new Map<string, any>();
|
|
9480
|
+
|
|
9481
|
+
let bodyJson : string = "";
|
|
9482
|
+
bodyJson = JSON.stringify(body || {});
|
|
9483
|
+
|
|
9484
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
9485
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
9486
|
+
if (bearerToken) {
|
|
9487
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
9488
|
+
}
|
|
9489
|
+
|
|
9490
|
+
return Promise.race([
|
|
9491
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
9492
|
+
if (response.status == 204) {
|
|
9493
|
+
return response;
|
|
9494
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
9495
|
+
return response.json();
|
|
9496
|
+
} else {
|
|
9497
|
+
throw response;
|
|
9498
|
+
}
|
|
9499
|
+
}),
|
|
9500
|
+
new Promise((_, reject) =>
|
|
9501
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
9502
|
+
),
|
|
9503
|
+
]);
|
|
9504
|
+
}
|
|
9505
|
+
|
|
9464
9506
|
/** */
|
|
9465
9507
|
getChannelCanvasDetail(
|
|
9466
9508
|
bearerToken: string,
|
package/client.ts
CHANGED
|
@@ -138,6 +138,7 @@ import {
|
|
|
138
138
|
ApiGetKeyServerResp,
|
|
139
139
|
MezonapiListAuditLog,
|
|
140
140
|
ApiTokenSentEvent,
|
|
141
|
+
ApiWithdrawTokenRequest,
|
|
141
142
|
} from "./api.gen";
|
|
142
143
|
|
|
143
144
|
import { Session } from "./session";
|
|
@@ -3533,6 +3534,22 @@ export class Client {
|
|
|
3533
3534
|
});
|
|
3534
3535
|
}
|
|
3535
3536
|
|
|
3537
|
+
async withdrawToken(session: Session, request: ApiWithdrawTokenRequest) {
|
|
3538
|
+
if (
|
|
3539
|
+
this.autoRefreshSession &&
|
|
3540
|
+
session.refresh_token &&
|
|
3541
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
|
3542
|
+
) {
|
|
3543
|
+
await this.sessionRefresh(session);
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
return this.apiClient
|
|
3547
|
+
.withdrawToken(session.token, request)
|
|
3548
|
+
.then((response: ApiTokenSentEvent) => {
|
|
3549
|
+
return Promise.resolve(response);
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3536
3553
|
async listStreamingChannels(
|
|
3537
3554
|
session: Session,
|
|
3538
3555
|
clanId: string
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -1391,6 +1391,10 @@ export interface ApiWebhookGenerateResponse {
|
|
|
1391
1391
|
export interface ApiWebhookListResponse {
|
|
1392
1392
|
webhooks?: Array<ApiWebhook>;
|
|
1393
1393
|
}
|
|
1394
|
+
/** */
|
|
1395
|
+
export interface ApiWithdrawTokenRequest {
|
|
1396
|
+
amount?: number;
|
|
1397
|
+
}
|
|
1394
1398
|
/** Represents an event to be passed through the server to registered event handlers. */
|
|
1395
1399
|
export interface MezonapiEvent {
|
|
1396
1400
|
external?: boolean;
|
|
@@ -1774,6 +1778,8 @@ export declare class MezonApi {
|
|
|
1774
1778
|
buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
|
|
1775
1779
|
/** Channel canvas editor */
|
|
1776
1780
|
editChannelCanvases(bearerToken: string, body: ApiEditChannelCanvasRequest, options?: any): Promise<ApiEditChannelCanvasResponse>;
|
|
1781
|
+
/** WithdrawToken */
|
|
1782
|
+
withdrawToken(bearerToken: string, body: ApiWithdrawTokenRequest, options?: any): Promise<any>;
|
|
1777
1783
|
/** */
|
|
1778
1784
|
getChannelCanvasDetail(bearerToken: string, id: string, clanId?: string, channelId?: string, options?: any): Promise<ApiChannelCanvasDetailResponse>;
|
|
1779
1785
|
/** */
|
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, ApiWithdrawTokenRequest } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -560,6 +560,7 @@ export declare class Client {
|
|
|
560
560
|
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
|
561
561
|
givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<boolean>;
|
|
562
562
|
updateWallets(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
|
@@ -6183,6 +6183,35 @@ var MezonApi = class {
|
|
|
6183
6183
|
)
|
|
6184
6184
|
]);
|
|
6185
6185
|
}
|
|
6186
|
+
/** WithdrawToken */
|
|
6187
|
+
withdrawToken(bearerToken, body, options = {}) {
|
|
6188
|
+
if (body === null || body === void 0) {
|
|
6189
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
6190
|
+
}
|
|
6191
|
+
const urlPath = "/v2/withdrawtoken";
|
|
6192
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
6193
|
+
let bodyJson = "";
|
|
6194
|
+
bodyJson = JSON.stringify(body || {});
|
|
6195
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6196
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
6197
|
+
if (bearerToken) {
|
|
6198
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6199
|
+
}
|
|
6200
|
+
return Promise.race([
|
|
6201
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
6202
|
+
if (response.status == 204) {
|
|
6203
|
+
return response;
|
|
6204
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
6205
|
+
return response.json();
|
|
6206
|
+
} else {
|
|
6207
|
+
throw response;
|
|
6208
|
+
}
|
|
6209
|
+
}),
|
|
6210
|
+
new Promise(
|
|
6211
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
6212
|
+
)
|
|
6213
|
+
]);
|
|
6214
|
+
}
|
|
6186
6215
|
/** */
|
|
6187
6216
|
getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
|
|
6188
6217
|
if (id === null || id === void 0) {
|
|
@@ -8898,6 +8927,16 @@ var Client = class {
|
|
|
8898
8927
|
});
|
|
8899
8928
|
});
|
|
8900
8929
|
}
|
|
8930
|
+
withdrawToken(session, request) {
|
|
8931
|
+
return __async(this, null, function* () {
|
|
8932
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
8933
|
+
yield this.sessionRefresh(session);
|
|
8934
|
+
}
|
|
8935
|
+
return this.apiClient.withdrawToken(session.token, request).then((response) => {
|
|
8936
|
+
return Promise.resolve(response);
|
|
8937
|
+
});
|
|
8938
|
+
});
|
|
8939
|
+
}
|
|
8901
8940
|
listStreamingChannels(session, clanId) {
|
|
8902
8941
|
return __async(this, null, function* () {
|
|
8903
8942
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -6154,6 +6154,35 @@ var MezonApi = class {
|
|
|
6154
6154
|
)
|
|
6155
6155
|
]);
|
|
6156
6156
|
}
|
|
6157
|
+
/** WithdrawToken */
|
|
6158
|
+
withdrawToken(bearerToken, body, options = {}) {
|
|
6159
|
+
if (body === null || body === void 0) {
|
|
6160
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
6161
|
+
}
|
|
6162
|
+
const urlPath = "/v2/withdrawtoken";
|
|
6163
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
6164
|
+
let bodyJson = "";
|
|
6165
|
+
bodyJson = JSON.stringify(body || {});
|
|
6166
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6167
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
6168
|
+
if (bearerToken) {
|
|
6169
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6170
|
+
}
|
|
6171
|
+
return Promise.race([
|
|
6172
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
6173
|
+
if (response.status == 204) {
|
|
6174
|
+
return response;
|
|
6175
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
6176
|
+
return response.json();
|
|
6177
|
+
} else {
|
|
6178
|
+
throw response;
|
|
6179
|
+
}
|
|
6180
|
+
}),
|
|
6181
|
+
new Promise(
|
|
6182
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
6183
|
+
)
|
|
6184
|
+
]);
|
|
6185
|
+
}
|
|
6157
6186
|
/** */
|
|
6158
6187
|
getChannelCanvasDetail(bearerToken, id, clanId, channelId, options = {}) {
|
|
6159
6188
|
if (id === null || id === void 0) {
|
|
@@ -8869,6 +8898,16 @@ var Client = class {
|
|
|
8869
8898
|
});
|
|
8870
8899
|
});
|
|
8871
8900
|
}
|
|
8901
|
+
withdrawToken(session, request) {
|
|
8902
|
+
return __async(this, null, function* () {
|
|
8903
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
8904
|
+
yield this.sessionRefresh(session);
|
|
8905
|
+
}
|
|
8906
|
+
return this.apiClient.withdrawToken(session.token, request).then((response) => {
|
|
8907
|
+
return Promise.resolve(response);
|
|
8908
|
+
});
|
|
8909
|
+
});
|
|
8910
|
+
}
|
|
8872
8911
|
listStreamingChannels(session, clanId) {
|
|
8873
8912
|
return __async(this, null, function* () {
|
|
8874
8913
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|