mezon-js 2.11.16 → 2.11.18
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 -0
- package/client.ts +65 -0
- package/dist/api.gen.d.ts +11 -0
- package/dist/client.d.ts +6 -1
- package/dist/mezon-js.cjs.js +91 -0
- package/dist/mezon-js.esm.mjs +91 -0
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -1165,6 +1165,8 @@ export interface ApiCreateEventRequest {
|
|
1165
1165
|
repeat_type?: number;
|
1166
1166
|
//
|
1167
1167
|
creator_id?: number;
|
1168
|
+
//
|
1169
|
+
user_id?: string;
|
1168
1170
|
}
|
1169
1171
|
|
1170
1172
|
/** Create a event within clan. */
|
@@ -1521,6 +1523,8 @@ export interface ApiMessageAttachment {
|
|
1521
1523
|
url?: string;
|
1522
1524
|
//
|
1523
1525
|
width?: number;
|
1526
|
+
//
|
1527
|
+
thumbnail?: string;
|
1524
1528
|
/** The channel this message belongs to. */
|
1525
1529
|
channel_id?: string;
|
1526
1530
|
// The mode
|
@@ -3111,6 +3115,14 @@ export interface ApiCreateHashChannelAppsResponse {
|
|
3111
3115
|
web_app_data?: string;
|
3112
3116
|
}
|
3113
3117
|
|
3118
|
+
/** */
|
3119
|
+
export interface ApiUserEventRequest {
|
3120
|
+
// The ID of the clan to be updated.
|
3121
|
+
clan_id?: string;
|
3122
|
+
//The ID of the event to be updated.
|
3123
|
+
event_id?: string;
|
3124
|
+
}
|
3125
|
+
|
3114
3126
|
export class MezonApi {
|
3115
3127
|
constructor(
|
3116
3128
|
readonly serverKey: string,
|
@@ -11397,4 +11409,79 @@ export class MezonApi {
|
|
11397
11409
|
),
|
11398
11410
|
]);
|
11399
11411
|
}
|
11412
|
+
|
11413
|
+
/** Add user event */
|
11414
|
+
addUserEvent(
|
11415
|
+
bearerToken: string,
|
11416
|
+
body:ApiUserEventRequest,
|
11417
|
+
options: any = {}
|
11418
|
+
): Promise<any> {
|
11419
|
+
|
11420
|
+
if (body === null || body === undefined) {
|
11421
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
11422
|
+
}
|
11423
|
+
const urlPath = "/v2/userevent";
|
11424
|
+
const queryParams = new Map<string, any>();
|
11425
|
+
|
11426
|
+
let bodyJson : string = "";
|
11427
|
+
bodyJson = JSON.stringify(body || {});
|
11428
|
+
|
11429
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11430
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
11431
|
+
if (bearerToken) {
|
11432
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11433
|
+
}
|
11434
|
+
|
11435
|
+
return Promise.race([
|
11436
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11437
|
+
if (response.status == 204) {
|
11438
|
+
return response;
|
11439
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11440
|
+
return response.json();
|
11441
|
+
} else {
|
11442
|
+
throw response;
|
11443
|
+
}
|
11444
|
+
}),
|
11445
|
+
new Promise((_, reject) =>
|
11446
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11447
|
+
),
|
11448
|
+
]);
|
11449
|
+
}
|
11450
|
+
|
11451
|
+
/** Delete user event */
|
11452
|
+
deleteUserEvent(
|
11453
|
+
bearerToken: string,
|
11454
|
+
clanId?:string,
|
11455
|
+
eventId?:string,
|
11456
|
+
options: any = {}
|
11457
|
+
): Promise<any> {
|
11458
|
+
|
11459
|
+
const urlPath = "/v2/userevent";
|
11460
|
+
const queryParams = new Map<string, any>();
|
11461
|
+
queryParams.set("clan_id", clanId);
|
11462
|
+
queryParams.set("event_id", eventId);
|
11463
|
+
|
11464
|
+
let bodyJson : string = "";
|
11465
|
+
|
11466
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11467
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
11468
|
+
if (bearerToken) {
|
11469
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11470
|
+
}
|
11471
|
+
|
11472
|
+
return Promise.race([
|
11473
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11474
|
+
if (response.status == 204) {
|
11475
|
+
return response;
|
11476
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11477
|
+
return response.json();
|
11478
|
+
} else {
|
11479
|
+
throw response;
|
11480
|
+
}
|
11481
|
+
}),
|
11482
|
+
new Promise((_, reject) =>
|
11483
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11484
|
+
),
|
11485
|
+
]);
|
11486
|
+
}
|
11400
11487
|
}
|
package/client.ts
CHANGED
@@ -166,6 +166,7 @@ import {
|
|
166
166
|
ApiMezonOauthClient,
|
167
167
|
ApiCreateHashChannelAppsResponse,
|
168
168
|
MezonapiEmojiRecentList,
|
169
|
+
ApiUserEventRequest,
|
169
170
|
} from "./api.gen";
|
170
171
|
|
171
172
|
import { Session } from "./session";
|
@@ -5090,4 +5091,68 @@ export class Client {
|
|
5090
5091
|
return Promise.resolve(response);
|
5091
5092
|
});
|
5092
5093
|
}
|
5094
|
+
|
5095
|
+
async registrationPassword(
|
5096
|
+
session: Session,
|
5097
|
+
email?: string,
|
5098
|
+
password?: string
|
5099
|
+
): Promise<ApiSession> {
|
5100
|
+
if (
|
5101
|
+
this.autoRefreshSession &&
|
5102
|
+
session.refresh_token &&
|
5103
|
+
session.isexpired(Date.now() / 1000)
|
5104
|
+
) {
|
5105
|
+
await this.sessionRefresh(session);
|
5106
|
+
}
|
5107
|
+
|
5108
|
+
return this.apiClient
|
5109
|
+
.registrationEmail(session.token, {
|
5110
|
+
email: email,
|
5111
|
+
password: password
|
5112
|
+
})
|
5113
|
+
.then((response: ApiSession) => {
|
5114
|
+
return Promise.resolve(response);
|
5115
|
+
});
|
5116
|
+
}
|
5117
|
+
|
5118
|
+
/** Add user event */
|
5119
|
+
async addUserEvent(
|
5120
|
+
session: Session,
|
5121
|
+
request: ApiUserEventRequest
|
5122
|
+
): Promise<any> {
|
5123
|
+
if (
|
5124
|
+
this.autoRefreshSession &&
|
5125
|
+
session.refresh_token &&
|
5126
|
+
session.isexpired(Date.now() / 1000)
|
5127
|
+
) {
|
5128
|
+
await this.sessionRefresh(session);
|
5129
|
+
}
|
5130
|
+
|
5131
|
+
return this.apiClient
|
5132
|
+
.addUserEvent(session.token, request)
|
5133
|
+
.then((response: any) => {
|
5134
|
+
return response !== undefined;
|
5135
|
+
});
|
5136
|
+
}
|
5137
|
+
|
5138
|
+
/** Delete user event */
|
5139
|
+
async deleteUserEvent(
|
5140
|
+
session: Session,
|
5141
|
+
clanId?:string,
|
5142
|
+
eventId?:string,
|
5143
|
+
): Promise<any> {
|
5144
|
+
if (
|
5145
|
+
this.autoRefreshSession &&
|
5146
|
+
session.refresh_token &&
|
5147
|
+
session.isexpired(Date.now() / 1000)
|
5148
|
+
) {
|
5149
|
+
await this.sessionRefresh(session);
|
5150
|
+
}
|
5151
|
+
|
5152
|
+
return this.apiClient
|
5153
|
+
.deleteUserEvent(session.token, clanId, eventId)
|
5154
|
+
.then((response: any) => {
|
5155
|
+
return response !== undefined;
|
5156
|
+
});
|
5157
|
+
}
|
5093
5158
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -664,6 +664,7 @@ export interface ApiCreateEventRequest {
|
|
664
664
|
event_status?: number;
|
665
665
|
repeat_type?: number;
|
666
666
|
creator_id?: number;
|
667
|
+
user_id?: string;
|
667
668
|
}
|
668
669
|
/** Create a event within clan. */
|
669
670
|
export interface ApiUpdateEventRequest {
|
@@ -871,6 +872,7 @@ export interface ApiMessageAttachment {
|
|
871
872
|
size?: number;
|
872
873
|
url?: string;
|
873
874
|
width?: number;
|
875
|
+
thumbnail?: string;
|
874
876
|
/** The channel this message belongs to. */
|
875
877
|
channel_id?: string;
|
876
878
|
mode?: number;
|
@@ -1786,6 +1788,11 @@ export interface ApiMezonOauthClient {
|
|
1786
1788
|
export interface ApiCreateHashChannelAppsResponse {
|
1787
1789
|
web_app_data?: string;
|
1788
1790
|
}
|
1791
|
+
/** */
|
1792
|
+
export interface ApiUserEventRequest {
|
1793
|
+
clan_id?: string;
|
1794
|
+
event_id?: string;
|
1795
|
+
}
|
1789
1796
|
export declare class MezonApi {
|
1790
1797
|
readonly serverKey: string;
|
1791
1798
|
readonly basePath: string;
|
@@ -2204,4 +2211,8 @@ export declare class MezonApi {
|
|
2204
2211
|
updateMezonOauthClient(bearerToken: string, body: ApiMezonOauthClient, options?: any): Promise<ApiMezonOauthClient>;
|
2205
2212
|
/** */
|
2206
2213
|
generateHashChannelApps(bearerToken: string, appId?: string, options?: any): Promise<ApiCreateHashChannelAppsResponse>;
|
2214
|
+
/** Add user event */
|
2215
|
+
addUserEvent(bearerToken: string, body: ApiUserEventRequest, options?: any): Promise<any>;
|
2216
|
+
/** Delete user event */
|
2217
|
+
deleteUserEvent(bearerToken: string, clanId?: string, eventId?: string, options?: any): Promise<any>;
|
2207
2218
|
}
|
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, 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, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, MezonapiEmojiRecentList } 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, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, MezonapiEmojiRecentList, ApiUserEventRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -650,4 +650,9 @@ export declare class Client {
|
|
650
650
|
updateMezonOauthClient(session: Session, body: ApiMezonOauthClient): Promise<ApiMezonOauthClient>;
|
651
651
|
searchThread(session: Session, clanId?: string, channelId?: string, label?: string): Promise<ApiChannelDescList>;
|
652
652
|
generateHashChannelApps(session: Session, appId?: string): Promise<ApiCreateHashChannelAppsResponse>;
|
653
|
+
registrationPassword(session: Session, email?: string, password?: string): Promise<ApiSession>;
|
654
|
+
/** Add user event */
|
655
|
+
addUserEvent(session: Session, request: ApiUserEventRequest): Promise<any>;
|
656
|
+
/** Delete user event */
|
657
|
+
deleteUserEvent(session: Session, clanId?: string, eventId?: string): Promise<any>;
|
653
658
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -7200,6 +7200,62 @@ var MezonApi = class {
|
|
7200
7200
|
)
|
7201
7201
|
]);
|
7202
7202
|
}
|
7203
|
+
/** Add user event */
|
7204
|
+
addUserEvent(bearerToken, body, options = {}) {
|
7205
|
+
if (body === null || body === void 0) {
|
7206
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
7207
|
+
}
|
7208
|
+
const urlPath = "/v2/userevent";
|
7209
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7210
|
+
let bodyJson = "";
|
7211
|
+
bodyJson = JSON.stringify(body || {});
|
7212
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7213
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
7214
|
+
if (bearerToken) {
|
7215
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7216
|
+
}
|
7217
|
+
return Promise.race([
|
7218
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7219
|
+
if (response.status == 204) {
|
7220
|
+
return response;
|
7221
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7222
|
+
return response.json();
|
7223
|
+
} else {
|
7224
|
+
throw response;
|
7225
|
+
}
|
7226
|
+
}),
|
7227
|
+
new Promise(
|
7228
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7229
|
+
)
|
7230
|
+
]);
|
7231
|
+
}
|
7232
|
+
/** Delete user event */
|
7233
|
+
deleteUserEvent(bearerToken, clanId, eventId, options = {}) {
|
7234
|
+
const urlPath = "/v2/userevent";
|
7235
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7236
|
+
queryParams.set("clan_id", clanId);
|
7237
|
+
queryParams.set("event_id", eventId);
|
7238
|
+
let bodyJson = "";
|
7239
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7240
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
7241
|
+
if (bearerToken) {
|
7242
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7243
|
+
}
|
7244
|
+
return Promise.race([
|
7245
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7246
|
+
if (response.status == 204) {
|
7247
|
+
return response;
|
7248
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7249
|
+
return response.json();
|
7250
|
+
} else {
|
7251
|
+
throw response;
|
7252
|
+
}
|
7253
|
+
}),
|
7254
|
+
new Promise(
|
7255
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7256
|
+
)
|
7257
|
+
]);
|
7258
|
+
}
|
7203
7259
|
};
|
7204
7260
|
|
7205
7261
|
// session.ts
|
@@ -11069,4 +11125,39 @@ var Client = class {
|
|
11069
11125
|
});
|
11070
11126
|
});
|
11071
11127
|
}
|
11128
|
+
registrationPassword(session, email, password) {
|
11129
|
+
return __async(this, null, function* () {
|
11130
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11131
|
+
yield this.sessionRefresh(session);
|
11132
|
+
}
|
11133
|
+
return this.apiClient.registrationEmail(session.token, {
|
11134
|
+
email,
|
11135
|
+
password
|
11136
|
+
}).then((response) => {
|
11137
|
+
return Promise.resolve(response);
|
11138
|
+
});
|
11139
|
+
});
|
11140
|
+
}
|
11141
|
+
/** Add user event */
|
11142
|
+
addUserEvent(session, request) {
|
11143
|
+
return __async(this, null, function* () {
|
11144
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11145
|
+
yield this.sessionRefresh(session);
|
11146
|
+
}
|
11147
|
+
return this.apiClient.addUserEvent(session.token, request).then((response) => {
|
11148
|
+
return response !== void 0;
|
11149
|
+
});
|
11150
|
+
});
|
11151
|
+
}
|
11152
|
+
/** Delete user event */
|
11153
|
+
deleteUserEvent(session, clanId, eventId) {
|
11154
|
+
return __async(this, null, function* () {
|
11155
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11156
|
+
yield this.sessionRefresh(session);
|
11157
|
+
}
|
11158
|
+
return this.apiClient.deleteUserEvent(session.token, clanId, eventId).then((response) => {
|
11159
|
+
return response !== void 0;
|
11160
|
+
});
|
11161
|
+
});
|
11162
|
+
}
|
11072
11163
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -7166,6 +7166,62 @@ var MezonApi = class {
|
|
7166
7166
|
)
|
7167
7167
|
]);
|
7168
7168
|
}
|
7169
|
+
/** Add user event */
|
7170
|
+
addUserEvent(bearerToken, body, options = {}) {
|
7171
|
+
if (body === null || body === void 0) {
|
7172
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
7173
|
+
}
|
7174
|
+
const urlPath = "/v2/userevent";
|
7175
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7176
|
+
let bodyJson = "";
|
7177
|
+
bodyJson = JSON.stringify(body || {});
|
7178
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7179
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
7180
|
+
if (bearerToken) {
|
7181
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7182
|
+
}
|
7183
|
+
return Promise.race([
|
7184
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7185
|
+
if (response.status == 204) {
|
7186
|
+
return response;
|
7187
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7188
|
+
return response.json();
|
7189
|
+
} else {
|
7190
|
+
throw response;
|
7191
|
+
}
|
7192
|
+
}),
|
7193
|
+
new Promise(
|
7194
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7195
|
+
)
|
7196
|
+
]);
|
7197
|
+
}
|
7198
|
+
/** Delete user event */
|
7199
|
+
deleteUserEvent(bearerToken, clanId, eventId, options = {}) {
|
7200
|
+
const urlPath = "/v2/userevent";
|
7201
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7202
|
+
queryParams.set("clan_id", clanId);
|
7203
|
+
queryParams.set("event_id", eventId);
|
7204
|
+
let bodyJson = "";
|
7205
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7206
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
7207
|
+
if (bearerToken) {
|
7208
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7209
|
+
}
|
7210
|
+
return Promise.race([
|
7211
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7212
|
+
if (response.status == 204) {
|
7213
|
+
return response;
|
7214
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7215
|
+
return response.json();
|
7216
|
+
} else {
|
7217
|
+
throw response;
|
7218
|
+
}
|
7219
|
+
}),
|
7220
|
+
new Promise(
|
7221
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7222
|
+
)
|
7223
|
+
]);
|
7224
|
+
}
|
7169
7225
|
};
|
7170
7226
|
|
7171
7227
|
// session.ts
|
@@ -11035,6 +11091,41 @@ var Client = class {
|
|
11035
11091
|
});
|
11036
11092
|
});
|
11037
11093
|
}
|
11094
|
+
registrationPassword(session, email, password) {
|
11095
|
+
return __async(this, null, function* () {
|
11096
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11097
|
+
yield this.sessionRefresh(session);
|
11098
|
+
}
|
11099
|
+
return this.apiClient.registrationEmail(session.token, {
|
11100
|
+
email,
|
11101
|
+
password
|
11102
|
+
}).then((response) => {
|
11103
|
+
return Promise.resolve(response);
|
11104
|
+
});
|
11105
|
+
});
|
11106
|
+
}
|
11107
|
+
/** Add user event */
|
11108
|
+
addUserEvent(session, request) {
|
11109
|
+
return __async(this, null, function* () {
|
11110
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11111
|
+
yield this.sessionRefresh(session);
|
11112
|
+
}
|
11113
|
+
return this.apiClient.addUserEvent(session.token, request).then((response) => {
|
11114
|
+
return response !== void 0;
|
11115
|
+
});
|
11116
|
+
});
|
11117
|
+
}
|
11118
|
+
/** Delete user event */
|
11119
|
+
deleteUserEvent(session, clanId, eventId) {
|
11120
|
+
return __async(this, null, function* () {
|
11121
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
11122
|
+
yield this.sessionRefresh(session);
|
11123
|
+
}
|
11124
|
+
return this.apiClient.deleteUserEvent(session.token, clanId, eventId).then((response) => {
|
11125
|
+
return response !== void 0;
|
11126
|
+
});
|
11127
|
+
});
|
11128
|
+
}
|
11038
11129
|
};
|
11039
11130
|
export {
|
11040
11131
|
ChannelStreamMode,
|