mezon-js 2.7.15 → 2.7.17

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -406,6 +406,46 @@ export interface ApiCreateClanDescRequest {
406
406
  logo?: string;
407
407
  }
408
408
 
409
+ /** Create a event within clan. */
410
+ export interface ApiCreateEventRequest {
411
+ //
412
+ address?: string;
413
+ //
414
+ channel_id?: string;
415
+ //
416
+ clan_id?: string;
417
+ //
418
+ description?: string;
419
+ //
420
+ end_time?: string;
421
+ //
422
+ logo?: string;
423
+ //
424
+ start_time?: string;
425
+ //
426
+ title?: string;
427
+ }
428
+
429
+ /** Create a event within clan. */
430
+ export interface ApiUpdateEventRequest {
431
+ //
432
+ address?: string;
433
+ //
434
+ channel_id?: string;
435
+ //
436
+ event_id?: string;
437
+ //
438
+ description?: string;
439
+ //
440
+ end_time?: string;
441
+ //
442
+ logo?: string;
443
+ //
444
+ start_time?: string;
445
+ //
446
+ title?: string;
447
+ }
448
+
409
449
  /** Create a role within clan. */
410
450
  export interface ApiCreateRoleRequest {
411
451
  //The permissions to add.
@@ -428,6 +468,12 @@ export interface ApiCreateRoleRequest {
428
468
  title?: string;
429
469
  }
430
470
 
471
+ /** */
472
+ export interface ApiDeleteEventRequest {
473
+ //The id of a event.
474
+ event_id?: string;
475
+ }
476
+
431
477
  /** Delete a role the user has access to. */
432
478
  export interface ApiDeleteRoleRequest {
433
479
  //
@@ -464,6 +510,42 @@ export interface ApiEvent {
464
510
  timestamp?: string;
465
511
  }
466
512
 
513
+ /** */
514
+ export interface ApiEventList {
515
+ //A list of event.
516
+ events?: Array<ApiEventManagement>;
517
+ }
518
+
519
+ /** */
520
+ export interface ApiEventManagement {
521
+ //
522
+ active?: number;
523
+ //
524
+ address?: string;
525
+ //
526
+ channel_id?: string;
527
+ //
528
+ clan_id?: string;
529
+ //
530
+ creator_id?: string;
531
+ //
532
+ description?: string;
533
+ //
534
+ end_time?: string;
535
+ //
536
+ id?: string;
537
+ //
538
+ logo?: string;
539
+ //
540
+ start_event?: number;
541
+ //
542
+ start_time?: string;
543
+ //
544
+ title?: string;
545
+ //
546
+ user_ids?: Array<string>;
547
+ }
548
+
467
549
  /** A friend of a user. */
468
550
  export interface ApiFriend {
469
551
  //The friend status. one of "Friend.State".
@@ -3059,6 +3141,188 @@ return Promise.race([
3059
3141
  ]);
3060
3142
  }
3061
3143
 
3144
+ /** List user events */
3145
+ listEvents(bearerToken: string,
3146
+ clanId?:string,
3147
+ options: any = {}): Promise<ApiEventList> {
3148
+
3149
+ const urlPath = "/v2/eventmanagement";
3150
+ const queryParams = new Map<string, any>();
3151
+ queryParams.set("clan_id", clanId);
3152
+
3153
+ let bodyJson : string = "";
3154
+
3155
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3156
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3157
+ if (bearerToken) {
3158
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3159
+ }
3160
+
3161
+ return Promise.race([
3162
+ fetch(fullUrl, fetchOptions).then((response) => {
3163
+ if (response.status == 204) {
3164
+ return response;
3165
+ } else if (response.status >= 200 && response.status < 300) {
3166
+ return response.json();
3167
+ } else {
3168
+ throw response;
3169
+ }
3170
+ }),
3171
+ new Promise((_, reject) =>
3172
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3173
+ ),
3174
+ ]);
3175
+ }
3176
+
3177
+ /** Create a new event for clan. */
3178
+ createEvent(bearerToken: string,
3179
+ body:ApiCreateEventRequest,
3180
+ options: any = {}): Promise<ApiEventManagement> {
3181
+
3182
+ if (body === null || body === undefined) {
3183
+ throw new Error("'body' is a required parameter but is null or undefined.");
3184
+ }
3185
+ const urlPath = "/v2/eventmanagement/create";
3186
+ const queryParams = new Map<string, any>();
3187
+
3188
+ let bodyJson : string = "";
3189
+ bodyJson = JSON.stringify(body || {});
3190
+
3191
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3192
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3193
+ if (bearerToken) {
3194
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3195
+ }
3196
+
3197
+ return Promise.race([
3198
+ fetch(fullUrl, fetchOptions).then((response) => {
3199
+ if (response.status == 204) {
3200
+ return response;
3201
+ } else if (response.status >= 200 && response.status < 300) {
3202
+ return response.json();
3203
+ } else {
3204
+ throw response;
3205
+ }
3206
+ }),
3207
+ new Promise((_, reject) =>
3208
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3209
+ ),
3210
+ ]);
3211
+ }
3212
+
3213
+ /** Update fields in a given event. */
3214
+ updateEventUser(bearerToken: string,
3215
+ body:ApiDeleteEventRequest,
3216
+ options: any = {}): Promise<any> {
3217
+
3218
+ if (body === null || body === undefined) {
3219
+ throw new Error("'body' is a required parameter but is null or undefined.");
3220
+ }
3221
+ const urlPath = "/v2/eventmanagement/user";
3222
+ const queryParams = new Map<string, any>();
3223
+
3224
+ let bodyJson : string = "";
3225
+ bodyJson = JSON.stringify(body || {});
3226
+
3227
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3228
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3229
+ if (bearerToken) {
3230
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3231
+ }
3232
+
3233
+ return Promise.race([
3234
+ fetch(fullUrl, fetchOptions).then((response) => {
3235
+ if (response.status == 204) {
3236
+ return response;
3237
+ } else if (response.status >= 200 && response.status < 300) {
3238
+ return response.json();
3239
+ } else {
3240
+ throw response;
3241
+ }
3242
+ }),
3243
+ new Promise((_, reject) =>
3244
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3245
+ ),
3246
+ ]);
3247
+ }
3248
+
3249
+ /** Delete a event by ID. */
3250
+ deleteEvent(bearerToken: string,
3251
+ eventId:string,
3252
+ options: any = {}): Promise<any> {
3253
+
3254
+ if (eventId === null || eventId === undefined) {
3255
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
3256
+ }
3257
+ const urlPath = "/v2/eventmanagement/{eventId}"
3258
+ .replace("{eventId}", encodeURIComponent(String(eventId)));
3259
+ const queryParams = new Map<string, any>();
3260
+
3261
+ let bodyJson : string = "";
3262
+
3263
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3264
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3265
+ if (bearerToken) {
3266
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3267
+ }
3268
+
3269
+ return Promise.race([
3270
+ fetch(fullUrl, fetchOptions).then((response) => {
3271
+ if (response.status == 204) {
3272
+ return response;
3273
+ } else if (response.status >= 200 && response.status < 300) {
3274
+ return response.json();
3275
+ } else {
3276
+ throw response;
3277
+ }
3278
+ }),
3279
+ new Promise((_, reject) =>
3280
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3281
+ ),
3282
+ ]);
3283
+ }
3284
+
3285
+ /** Update fields in a given event. */
3286
+ updateEvent(bearerToken: string,
3287
+ eventId:string,
3288
+ body:{},
3289
+ options: any = {}): Promise<any> {
3290
+
3291
+ if (eventId === null || eventId === undefined) {
3292
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
3293
+ }
3294
+ if (body === null || body === undefined) {
3295
+ throw new Error("'body' is a required parameter but is null or undefined.");
3296
+ }
3297
+ const urlPath = "/v2/eventmanagement/{eventId}"
3298
+ .replace("{eventId}", encodeURIComponent(String(eventId)));
3299
+ const queryParams = new Map<string, any>();
3300
+
3301
+ let bodyJson : string = "";
3302
+ bodyJson = JSON.stringify(body || {});
3303
+
3304
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3305
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3306
+ if (bearerToken) {
3307
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3308
+ }
3309
+
3310
+ return Promise.race([
3311
+ fetch(fullUrl, fetchOptions).then((response) => {
3312
+ if (response.status == 204) {
3313
+ return response;
3314
+ } else if (response.status >= 200 && response.status < 300) {
3315
+ return response.json();
3316
+ } else {
3317
+ throw response;
3318
+ }
3319
+ }),
3320
+ new Promise((_, reject) =>
3321
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3322
+ ),
3323
+ ]);
3324
+ }
3325
+
3062
3326
  /** Delete one or more users by ID or username. */
3063
3327
  deleteFriends(bearerToken: string,
3064
3328
  ids?:Array<string>,
package/client.ts CHANGED
@@ -63,6 +63,7 @@ import {
63
63
  ApiChannelUserList,
64
64
  ApiClanUserList,
65
65
  ApiLinkInviteUserRequest,
66
+ ApiUpdateEventRequest,
66
67
  ApiLinkInviteUser,
67
68
  ApiInviteUserRes,
68
69
  ApiUploadAttachmentRequest,
@@ -74,6 +75,10 @@ import {
74
75
  ApiChannelMessageHeader,
75
76
  ApiVoiceChannelUserList,
76
77
  ApiChannelAttachmentList,
78
+ ApiCreateEventRequest,
79
+ ApiEventManagement,
80
+ ApiEventList,
81
+ ApiDeleteEventRequest,
77
82
  } from "./api.gen";
78
83
 
79
84
  import { Session } from "./session";
@@ -736,6 +741,18 @@ export class Client {
736
741
  });
737
742
  }
738
743
 
744
+ /** Create a new event for clan. */
745
+ async createEvent(session: Session, request: ApiCreateEventRequest): Promise<ApiEventManagement> {
746
+ if (this.autoRefreshSession && session.refresh_token &&
747
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
748
+ await this.sessionRefresh(session);
749
+ }
750
+
751
+ return this.apiClient.createEvent(session.token, request).then((response: ApiEventManagement) => {
752
+ return Promise.resolve(response);
753
+ });
754
+ }
755
+
739
756
  /** add role for channel. */
740
757
  async addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean> {
741
758
  if (this.autoRefreshSession && session.refresh_token &&
@@ -849,6 +866,30 @@ export class Client {
849
866
  });
850
867
  }
851
868
 
869
+ /** Delete a event by ID. */
870
+ async deleteEvent(session: Session, roleId: string): Promise<boolean> {
871
+ if (this.autoRefreshSession && session.refresh_token &&
872
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
873
+ await this.sessionRefresh(session);
874
+ }
875
+
876
+ return this.apiClient.deleteEvent(session.token, roleId).then((response: any) => {
877
+ return response !== undefined;
878
+ });
879
+ }
880
+
881
+ /** update user a event by ID. */
882
+ async updateEventUser(session: Session, request: ApiDeleteEventRequest): Promise<boolean> {
883
+ if (this.autoRefreshSession && session.refresh_token &&
884
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
885
+ await this.sessionRefresh(session);
886
+ }
887
+
888
+ return this.apiClient.updateEventUser(session.token, request).then((response: any) => {
889
+ return response !== undefined;
890
+ });
891
+ }
892
+
852
893
  /** Submit an event for processing in the server's registered runtime custom events handler. */
853
894
  async emitEvent(session: Session, request: ApiEvent): Promise<boolean> {
854
895
  if (this.autoRefreshSession && session.refresh_token &&
@@ -1217,6 +1258,18 @@ export class Client {
1217
1258
  });
1218
1259
  }
1219
1260
 
1261
+ /** List event */
1262
+ async listEvents(session: Session, clanId?:string): Promise<ApiEventList> {
1263
+ if (this.autoRefreshSession && session.refresh_token &&
1264
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1265
+ await this.sessionRefresh(session);
1266
+ }
1267
+
1268
+ return this.apiClient.listEvents(session.token, clanId).then((response: ApiEventList) => {
1269
+ return Promise.resolve(response);
1270
+ });
1271
+ }
1272
+
1220
1273
  /** List permission */
1221
1274
  async getListPermission(session: Session): Promise<ApiPermissionList> {
1222
1275
  if (this.autoRefreshSession && session.refresh_token &&
@@ -1802,6 +1855,18 @@ export class Client {
1802
1855
  });
1803
1856
  }
1804
1857
 
1858
+ /** Update fields in a given event. */
1859
+ async updateEvent(session: Session, roleId: string, request: ApiUpdateEventRequest): Promise<boolean> {
1860
+ if (this.autoRefreshSession && session.refresh_token &&
1861
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1862
+ await this.sessionRefresh(session);
1863
+ }
1864
+
1865
+ return this.apiClient.updateEvent(session.token, roleId, request).then((response: any) => {
1866
+ return response !== undefined;
1867
+ });
1868
+ }
1869
+
1805
1870
  /** Update fields in a given clan profile. */
1806
1871
  async createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser> {
1807
1872
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -232,6 +232,28 @@ export interface ApiCreateClanDescRequest {
232
232
  creator_id?: string;
233
233
  logo?: string;
234
234
  }
235
+ /** Create a event within clan. */
236
+ export interface ApiCreateEventRequest {
237
+ address?: string;
238
+ channel_id?: string;
239
+ clan_id?: string;
240
+ description?: string;
241
+ end_time?: string;
242
+ logo?: string;
243
+ start_time?: string;
244
+ title?: string;
245
+ }
246
+ /** Create a event within clan. */
247
+ export interface ApiUpdateEventRequest {
248
+ address?: string;
249
+ channel_id?: string;
250
+ event_id?: string;
251
+ description?: string;
252
+ end_time?: string;
253
+ logo?: string;
254
+ start_time?: string;
255
+ title?: string;
256
+ }
235
257
  /** Create a role within clan. */
236
258
  export interface ApiCreateRoleRequest {
237
259
  active_permission_ids?: Array<string>;
@@ -244,6 +266,10 @@ export interface ApiCreateRoleRequest {
244
266
  role_icon?: string;
245
267
  title?: string;
246
268
  }
269
+ /** */
270
+ export interface ApiDeleteEventRequest {
271
+ event_id?: string;
272
+ }
247
273
  /** Delete a role the user has access to. */
248
274
  export interface ApiDeleteRoleRequest {
249
275
  channel_id?: string;
@@ -266,6 +292,26 @@ export interface ApiEvent {
266
292
  properties?: Record<string, string>;
267
293
  timestamp?: string;
268
294
  }
295
+ /** */
296
+ export interface ApiEventList {
297
+ events?: Array<ApiEventManagement>;
298
+ }
299
+ /** */
300
+ export interface ApiEventManagement {
301
+ active?: number;
302
+ address?: string;
303
+ channel_id?: string;
304
+ clan_id?: string;
305
+ creator_id?: string;
306
+ description?: string;
307
+ end_time?: string;
308
+ id?: string;
309
+ logo?: string;
310
+ start_event?: number;
311
+ start_time?: string;
312
+ title?: string;
313
+ user_ids?: Array<string>;
314
+ }
269
315
  /** A friend of a user. */
270
316
  export interface ApiFriend {
271
317
  state?: number;
@@ -677,6 +723,16 @@ export declare class MezonApi {
677
723
  registFCMDeviceToken(bearerToken: string, token?: string, options?: any): Promise<any>;
678
724
  /** Submit an event for processing in the server's registered runtime custom events handler. */
679
725
  event(bearerToken: string, body: ApiEvent, options?: any): Promise<any>;
726
+ /** List user events */
727
+ listEvents(bearerToken: string, clanId?: string, options?: any): Promise<ApiEventList>;
728
+ /** Create a new event for clan. */
729
+ createEvent(bearerToken: string, body: ApiCreateEventRequest, options?: any): Promise<ApiEventManagement>;
730
+ /** Update fields in a given event. */
731
+ updateEventUser(bearerToken: string, body: ApiDeleteEventRequest, options?: any): Promise<any>;
732
+ /** Delete a event by ID. */
733
+ deleteEvent(bearerToken: string, eventId: string, options?: any): Promise<any>;
734
+ /** Update fields in a given event. */
735
+ updateEvent(bearerToken: string, eventId: string, body: {}, options?: any): Promise<any>;
680
736
  /** Delete one or more users by ID or username. */
681
737
  deleteFriends(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, options?: any): Promise<any>;
682
738
  /** List all friends for the current user. */
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, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -389,6 +389,8 @@ export declare class Client {
389
389
  createCategoryDesc(session: Session, request: ApiCreateCategoryDescRequest): Promise<ApiCategoryDesc>;
390
390
  /** Create a new role for clan. */
391
391
  createRole(session: Session, request: ApiCreateRoleRequest): Promise<ApiRole>;
392
+ /** Create a new event for clan. */
393
+ createEvent(session: Session, request: ApiCreateEventRequest): Promise<ApiEventManagement>;
392
394
  /** add role for channel. */
393
395
  addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean>;
394
396
  /** Update action role when delete role */
@@ -409,6 +411,10 @@ export declare class Client {
409
411
  deleteStorageObjects(session: Session, request: ApiDeleteStorageObjectsRequest): Promise<boolean>;
410
412
  /** Delete a role by ID. */
411
413
  deleteRole(session: Session, roleId: string): Promise<boolean>;
414
+ /** Delete a event by ID. */
415
+ deleteEvent(session: Session, roleId: string): Promise<boolean>;
416
+ /** update user a event by ID. */
417
+ updateEventUser(session: Session, request: ApiDeleteEventRequest): Promise<boolean>;
412
418
  /** Submit an event for processing in the server's registered runtime custom events handler. */
413
419
  emitEvent(session: Session, request: ApiEvent): Promise<boolean>;
414
420
  /** Fetch the current user's account. */
@@ -439,6 +445,8 @@ export declare class Client {
439
445
  listCategoryDescs(session: Session, clanId: string, creatorId?: string, categoryName?: string): Promise<ApiCategoryDescList>;
440
446
  /** List user roles */
441
447
  listRoles(session: Session, limit?: number, state?: number, cursor?: string, clanId?: string): Promise<ApiRoleList>;
448
+ /** List event */
449
+ listEvents(session: Session, clanId?: string): Promise<ApiEventList>;
442
450
  /** List permission */
443
451
  getListPermission(session: Session): Promise<ApiPermissionList>;
444
452
  /** Update action role when delete role */
@@ -516,6 +524,8 @@ export declare class Client {
516
524
  updateUserProfileByClan(session: Session, clanId: string, request: ApiUpdateClanProfileRequest): Promise<boolean>;
517
525
  /** Update fields in a given role. */
518
526
  updateRole(session: Session, roleId: string, request: ApiUpdateRoleRequest): Promise<boolean>;
527
+ /** Update fields in a given event. */
528
+ updateEvent(session: Session, roleId: string, request: ApiUpdateEventRequest): Promise<boolean>;
519
529
  /** Update fields in a given clan profile. */
520
530
  createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser>;
521
531
  /** Get link invite user */
@@ -2288,6 +2288,150 @@ var MezonApi = class {
2288
2288
  )
2289
2289
  ]);
2290
2290
  }
2291
+ /** List user events */
2292
+ listEvents(bearerToken, clanId, options = {}) {
2293
+ const urlPath = "/v2/eventmanagement";
2294
+ const queryParams = /* @__PURE__ */ new Map();
2295
+ queryParams.set("clan_id", clanId);
2296
+ let bodyJson = "";
2297
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2298
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2299
+ if (bearerToken) {
2300
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2301
+ }
2302
+ return Promise.race([
2303
+ fetch(fullUrl, fetchOptions).then((response) => {
2304
+ if (response.status == 204) {
2305
+ return response;
2306
+ } else if (response.status >= 200 && response.status < 300) {
2307
+ return response.json();
2308
+ } else {
2309
+ throw response;
2310
+ }
2311
+ }),
2312
+ new Promise(
2313
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2314
+ )
2315
+ ]);
2316
+ }
2317
+ /** Create a new event for clan. */
2318
+ createEvent(bearerToken, body, options = {}) {
2319
+ if (body === null || body === void 0) {
2320
+ throw new Error("'body' is a required parameter but is null or undefined.");
2321
+ }
2322
+ const urlPath = "/v2/eventmanagement/create";
2323
+ const queryParams = /* @__PURE__ */ new Map();
2324
+ let bodyJson = "";
2325
+ bodyJson = JSON.stringify(body || {});
2326
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2327
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2328
+ if (bearerToken) {
2329
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2330
+ }
2331
+ return Promise.race([
2332
+ fetch(fullUrl, fetchOptions).then((response) => {
2333
+ if (response.status == 204) {
2334
+ return response;
2335
+ } else if (response.status >= 200 && response.status < 300) {
2336
+ return response.json();
2337
+ } else {
2338
+ throw response;
2339
+ }
2340
+ }),
2341
+ new Promise(
2342
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2343
+ )
2344
+ ]);
2345
+ }
2346
+ /** Update fields in a given event. */
2347
+ updateEventUser(bearerToken, body, options = {}) {
2348
+ if (body === null || body === void 0) {
2349
+ throw new Error("'body' is a required parameter but is null or undefined.");
2350
+ }
2351
+ const urlPath = "/v2/eventmanagement/user";
2352
+ const queryParams = /* @__PURE__ */ new Map();
2353
+ let bodyJson = "";
2354
+ bodyJson = JSON.stringify(body || {});
2355
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2356
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2357
+ if (bearerToken) {
2358
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2359
+ }
2360
+ return Promise.race([
2361
+ fetch(fullUrl, fetchOptions).then((response) => {
2362
+ if (response.status == 204) {
2363
+ return response;
2364
+ } else if (response.status >= 200 && response.status < 300) {
2365
+ return response.json();
2366
+ } else {
2367
+ throw response;
2368
+ }
2369
+ }),
2370
+ new Promise(
2371
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2372
+ )
2373
+ ]);
2374
+ }
2375
+ /** Delete a event by ID. */
2376
+ deleteEvent(bearerToken, eventId, options = {}) {
2377
+ if (eventId === null || eventId === void 0) {
2378
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
2379
+ }
2380
+ const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
2381
+ const queryParams = /* @__PURE__ */ new Map();
2382
+ let bodyJson = "";
2383
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2384
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2385
+ if (bearerToken) {
2386
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2387
+ }
2388
+ return Promise.race([
2389
+ fetch(fullUrl, fetchOptions).then((response) => {
2390
+ if (response.status == 204) {
2391
+ return response;
2392
+ } else if (response.status >= 200 && response.status < 300) {
2393
+ return response.json();
2394
+ } else {
2395
+ throw response;
2396
+ }
2397
+ }),
2398
+ new Promise(
2399
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2400
+ )
2401
+ ]);
2402
+ }
2403
+ /** Update fields in a given event. */
2404
+ updateEvent(bearerToken, eventId, body, options = {}) {
2405
+ if (eventId === null || eventId === void 0) {
2406
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
2407
+ }
2408
+ if (body === null || body === void 0) {
2409
+ throw new Error("'body' is a required parameter but is null or undefined.");
2410
+ }
2411
+ const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
2412
+ const queryParams = /* @__PURE__ */ new Map();
2413
+ let bodyJson = "";
2414
+ bodyJson = JSON.stringify(body || {});
2415
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2416
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2417
+ if (bearerToken) {
2418
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2419
+ }
2420
+ return Promise.race([
2421
+ fetch(fullUrl, fetchOptions).then((response) => {
2422
+ if (response.status == 204) {
2423
+ return response;
2424
+ } else if (response.status >= 200 && response.status < 300) {
2425
+ return response.json();
2426
+ } else {
2427
+ throw response;
2428
+ }
2429
+ }),
2430
+ new Promise(
2431
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2432
+ )
2433
+ ]);
2434
+ }
2291
2435
  /** Delete one or more users by ID or username. */
2292
2436
  deleteFriends(bearerToken, ids, usernames, options = {}) {
2293
2437
  const urlPath = "/v2/friend";
@@ -3949,9 +4093,9 @@ var _DefaultSocket = class _DefaultSocket {
3949
4093
  return response.voice_joined_event;
3950
4094
  });
3951
4095
  }
3952
- writeVoiceLeaved(id, clanId, voiceChannelId, lastParticipant) {
4096
+ writeVoiceLeaved(id, clanId, voiceChannelId, voiceUserId) {
3953
4097
  return __async(this, null, function* () {
3954
- const response = yield this.send({ voice_leaved_event: { id, clan_id: clanId, voice_channel_id: voiceChannelId, last_participant: lastParticipant } });
4098
+ const response = yield this.send({ voice_leaved_event: { id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId } });
3955
4099
  return response.voice_leaved_event;
3956
4100
  });
3957
4101
  }
@@ -4234,6 +4378,17 @@ var Client = class {
4234
4378
  });
4235
4379
  });
4236
4380
  }
4381
+ /** Create a new event for clan. */
4382
+ createEvent(session, request) {
4383
+ return __async(this, null, function* () {
4384
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4385
+ yield this.sessionRefresh(session);
4386
+ }
4387
+ return this.apiClient.createEvent(session.token, request).then((response) => {
4388
+ return Promise.resolve(response);
4389
+ });
4390
+ });
4391
+ }
4237
4392
  /** add role for channel. */
4238
4393
  addRolesChannelDesc(session, request) {
4239
4394
  return __async(this, null, function* () {
@@ -4337,6 +4492,28 @@ var Client = class {
4337
4492
  });
4338
4493
  });
4339
4494
  }
4495
+ /** Delete a event by ID. */
4496
+ deleteEvent(session, roleId) {
4497
+ return __async(this, null, function* () {
4498
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4499
+ yield this.sessionRefresh(session);
4500
+ }
4501
+ return this.apiClient.deleteEvent(session.token, roleId).then((response) => {
4502
+ return response !== void 0;
4503
+ });
4504
+ });
4505
+ }
4506
+ /** update user a event by ID. */
4507
+ updateEventUser(session, request) {
4508
+ return __async(this, null, function* () {
4509
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4510
+ yield this.sessionRefresh(session);
4511
+ }
4512
+ return this.apiClient.updateEventUser(session.token, request).then((response) => {
4513
+ return response !== void 0;
4514
+ });
4515
+ });
4516
+ }
4340
4517
  /** Submit an event for processing in the server's registered runtime custom events handler. */
4341
4518
  emitEvent(session, request) {
4342
4519
  return __async(this, null, function* () {
@@ -4672,6 +4849,17 @@ var Client = class {
4672
4849
  });
4673
4850
  });
4674
4851
  }
4852
+ /** List event */
4853
+ listEvents(session, clanId) {
4854
+ return __async(this, null, function* () {
4855
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4856
+ yield this.sessionRefresh(session);
4857
+ }
4858
+ return this.apiClient.listEvents(session.token, clanId).then((response) => {
4859
+ return Promise.resolve(response);
4860
+ });
4861
+ });
4862
+ }
4675
4863
  /** List permission */
4676
4864
  getListPermission(session) {
4677
4865
  return __async(this, null, function* () {
@@ -5206,6 +5394,17 @@ var Client = class {
5206
5394
  });
5207
5395
  });
5208
5396
  }
5397
+ /** Update fields in a given event. */
5398
+ updateEvent(session, roleId, request) {
5399
+ return __async(this, null, function* () {
5400
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5401
+ yield this.sessionRefresh(session);
5402
+ }
5403
+ return this.apiClient.updateEvent(session.token, roleId, request).then((response) => {
5404
+ return response !== void 0;
5405
+ });
5406
+ });
5407
+ }
5209
5408
  /** Update fields in a given clan profile. */
5210
5409
  createLinkInviteUser(session, request) {
5211
5410
  return __async(this, null, function* () {
@@ -2260,6 +2260,150 @@ var MezonApi = class {
2260
2260
  )
2261
2261
  ]);
2262
2262
  }
2263
+ /** List user events */
2264
+ listEvents(bearerToken, clanId, options = {}) {
2265
+ const urlPath = "/v2/eventmanagement";
2266
+ const queryParams = /* @__PURE__ */ new Map();
2267
+ queryParams.set("clan_id", clanId);
2268
+ let bodyJson = "";
2269
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2270
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2271
+ if (bearerToken) {
2272
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2273
+ }
2274
+ return Promise.race([
2275
+ fetch(fullUrl, fetchOptions).then((response) => {
2276
+ if (response.status == 204) {
2277
+ return response;
2278
+ } else if (response.status >= 200 && response.status < 300) {
2279
+ return response.json();
2280
+ } else {
2281
+ throw response;
2282
+ }
2283
+ }),
2284
+ new Promise(
2285
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2286
+ )
2287
+ ]);
2288
+ }
2289
+ /** Create a new event for clan. */
2290
+ createEvent(bearerToken, body, options = {}) {
2291
+ if (body === null || body === void 0) {
2292
+ throw new Error("'body' is a required parameter but is null or undefined.");
2293
+ }
2294
+ const urlPath = "/v2/eventmanagement/create";
2295
+ const queryParams = /* @__PURE__ */ new Map();
2296
+ let bodyJson = "";
2297
+ bodyJson = JSON.stringify(body || {});
2298
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2299
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2300
+ if (bearerToken) {
2301
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2302
+ }
2303
+ return Promise.race([
2304
+ fetch(fullUrl, fetchOptions).then((response) => {
2305
+ if (response.status == 204) {
2306
+ return response;
2307
+ } else if (response.status >= 200 && response.status < 300) {
2308
+ return response.json();
2309
+ } else {
2310
+ throw response;
2311
+ }
2312
+ }),
2313
+ new Promise(
2314
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2315
+ )
2316
+ ]);
2317
+ }
2318
+ /** Update fields in a given event. */
2319
+ updateEventUser(bearerToken, body, options = {}) {
2320
+ if (body === null || body === void 0) {
2321
+ throw new Error("'body' is a required parameter but is null or undefined.");
2322
+ }
2323
+ const urlPath = "/v2/eventmanagement/user";
2324
+ const queryParams = /* @__PURE__ */ new Map();
2325
+ let bodyJson = "";
2326
+ bodyJson = JSON.stringify(body || {});
2327
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2328
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2329
+ if (bearerToken) {
2330
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2331
+ }
2332
+ return Promise.race([
2333
+ fetch(fullUrl, fetchOptions).then((response) => {
2334
+ if (response.status == 204) {
2335
+ return response;
2336
+ } else if (response.status >= 200 && response.status < 300) {
2337
+ return response.json();
2338
+ } else {
2339
+ throw response;
2340
+ }
2341
+ }),
2342
+ new Promise(
2343
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2344
+ )
2345
+ ]);
2346
+ }
2347
+ /** Delete a event by ID. */
2348
+ deleteEvent(bearerToken, eventId, options = {}) {
2349
+ if (eventId === null || eventId === void 0) {
2350
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
2351
+ }
2352
+ const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
2353
+ const queryParams = /* @__PURE__ */ new Map();
2354
+ let bodyJson = "";
2355
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2356
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2357
+ if (bearerToken) {
2358
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2359
+ }
2360
+ return Promise.race([
2361
+ fetch(fullUrl, fetchOptions).then((response) => {
2362
+ if (response.status == 204) {
2363
+ return response;
2364
+ } else if (response.status >= 200 && response.status < 300) {
2365
+ return response.json();
2366
+ } else {
2367
+ throw response;
2368
+ }
2369
+ }),
2370
+ new Promise(
2371
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2372
+ )
2373
+ ]);
2374
+ }
2375
+ /** Update fields in a given event. */
2376
+ updateEvent(bearerToken, eventId, body, options = {}) {
2377
+ if (eventId === null || eventId === void 0) {
2378
+ throw new Error("'eventId' is a required parameter but is null or undefined.");
2379
+ }
2380
+ if (body === null || body === void 0) {
2381
+ throw new Error("'body' is a required parameter but is null or undefined.");
2382
+ }
2383
+ const urlPath = "/v2/eventmanagement/{eventId}".replace("{eventId}", encodeURIComponent(String(eventId)));
2384
+ const queryParams = /* @__PURE__ */ new Map();
2385
+ let bodyJson = "";
2386
+ bodyJson = JSON.stringify(body || {});
2387
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2388
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2389
+ if (bearerToken) {
2390
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2391
+ }
2392
+ return Promise.race([
2393
+ fetch(fullUrl, fetchOptions).then((response) => {
2394
+ if (response.status == 204) {
2395
+ return response;
2396
+ } else if (response.status >= 200 && response.status < 300) {
2397
+ return response.json();
2398
+ } else {
2399
+ throw response;
2400
+ }
2401
+ }),
2402
+ new Promise(
2403
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2404
+ )
2405
+ ]);
2406
+ }
2263
2407
  /** Delete one or more users by ID or username. */
2264
2408
  deleteFriends(bearerToken, ids, usernames, options = {}) {
2265
2409
  const urlPath = "/v2/friend";
@@ -3921,9 +4065,9 @@ var _DefaultSocket = class _DefaultSocket {
3921
4065
  return response.voice_joined_event;
3922
4066
  });
3923
4067
  }
3924
- writeVoiceLeaved(id, clanId, voiceChannelId, lastParticipant) {
4068
+ writeVoiceLeaved(id, clanId, voiceChannelId, voiceUserId) {
3925
4069
  return __async(this, null, function* () {
3926
- const response = yield this.send({ voice_leaved_event: { id, clan_id: clanId, voice_channel_id: voiceChannelId, last_participant: lastParticipant } });
4070
+ const response = yield this.send({ voice_leaved_event: { id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId } });
3927
4071
  return response.voice_leaved_event;
3928
4072
  });
3929
4073
  }
@@ -4206,6 +4350,17 @@ var Client = class {
4206
4350
  });
4207
4351
  });
4208
4352
  }
4353
+ /** Create a new event for clan. */
4354
+ createEvent(session, request) {
4355
+ return __async(this, null, function* () {
4356
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4357
+ yield this.sessionRefresh(session);
4358
+ }
4359
+ return this.apiClient.createEvent(session.token, request).then((response) => {
4360
+ return Promise.resolve(response);
4361
+ });
4362
+ });
4363
+ }
4209
4364
  /** add role for channel. */
4210
4365
  addRolesChannelDesc(session, request) {
4211
4366
  return __async(this, null, function* () {
@@ -4309,6 +4464,28 @@ var Client = class {
4309
4464
  });
4310
4465
  });
4311
4466
  }
4467
+ /** Delete a event by ID. */
4468
+ deleteEvent(session, roleId) {
4469
+ return __async(this, null, function* () {
4470
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4471
+ yield this.sessionRefresh(session);
4472
+ }
4473
+ return this.apiClient.deleteEvent(session.token, roleId).then((response) => {
4474
+ return response !== void 0;
4475
+ });
4476
+ });
4477
+ }
4478
+ /** update user a event by ID. */
4479
+ updateEventUser(session, request) {
4480
+ return __async(this, null, function* () {
4481
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4482
+ yield this.sessionRefresh(session);
4483
+ }
4484
+ return this.apiClient.updateEventUser(session.token, request).then((response) => {
4485
+ return response !== void 0;
4486
+ });
4487
+ });
4488
+ }
4312
4489
  /** Submit an event for processing in the server's registered runtime custom events handler. */
4313
4490
  emitEvent(session, request) {
4314
4491
  return __async(this, null, function* () {
@@ -4644,6 +4821,17 @@ var Client = class {
4644
4821
  });
4645
4822
  });
4646
4823
  }
4824
+ /** List event */
4825
+ listEvents(session, clanId) {
4826
+ return __async(this, null, function* () {
4827
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
4828
+ yield this.sessionRefresh(session);
4829
+ }
4830
+ return this.apiClient.listEvents(session.token, clanId).then((response) => {
4831
+ return Promise.resolve(response);
4832
+ });
4833
+ });
4834
+ }
4647
4835
  /** List permission */
4648
4836
  getListPermission(session) {
4649
4837
  return __async(this, null, function* () {
@@ -5178,6 +5366,17 @@ var Client = class {
5178
5366
  });
5179
5367
  });
5180
5368
  }
5369
+ /** Update fields in a given event. */
5370
+ updateEvent(session, roleId, request) {
5371
+ return __async(this, null, function* () {
5372
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5373
+ yield this.sessionRefresh(session);
5374
+ }
5375
+ return this.apiClient.updateEvent(session.token, roleId, request).then((response) => {
5376
+ return response !== void 0;
5377
+ });
5378
+ });
5379
+ }
5181
5380
  /** Update fields in a given clan profile. */
5182
5381
  createLinkInviteUser(session, request) {
5183
5382
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -241,7 +241,7 @@ export interface VoiceLeavedEvent {
241
241
  id: string;
242
242
  clan_id: string;
243
243
  voice_channel_id: string;
244
- last_participant: boolean;
244
+ voice_user_id: string;
245
245
  }
246
246
  export interface VoiceJoinedEvent {
247
247
  /** The unique identifier of the chat channel. */
@@ -550,7 +550,7 @@ export interface Socket {
550
550
  /** send voice joined */
551
551
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
552
552
  /** send voice leaved */
553
- writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, lastParticipant: boolean): Promise<VoiceLeavedEvent>;
553
+ writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
554
554
  /** Handle disconnect events received from the socket. */
555
555
  ondisconnect: (evt: Event) => void;
556
556
  /** Handle error events received from the socket. */
@@ -670,7 +670,7 @@ export declare class DefaultSocket implements Socket {
670
670
  writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
671
671
  writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
672
672
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
673
- writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, lastParticipant: boolean): Promise<VoiceLeavedEvent>;
673
+ writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
674
674
  private pingPong;
675
675
  }
676
676
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.15",
3
+ "version": "2.7.17",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -328,8 +328,8 @@ export interface VoiceLeavedEvent {
328
328
  clan_id: string;
329
329
  // voice channel name
330
330
  voice_channel_id: string;
331
- // last participant
332
- last_participant: boolean;
331
+ // voice user id
332
+ voice_user_id: string;
333
333
  }
334
334
 
335
335
  export interface VoiceJoinedEvent {
@@ -709,7 +709,7 @@ export interface Socket {
709
709
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent>;
710
710
 
711
711
  /** send voice leaved */
712
- writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, lastParticipant: boolean) : Promise<VoiceLeavedEvent>;
712
+ writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string) : Promise<VoiceLeavedEvent>;
713
713
 
714
714
  /** Handle disconnect events received from the socket. */
715
715
  ondisconnect: (evt: Event) => void;
@@ -1298,8 +1298,8 @@ export class DefaultSocket implements Socket {
1298
1298
  return response.voice_joined_event
1299
1299
  }
1300
1300
 
1301
- async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, lastParticipant: boolean) : Promise<VoiceLeavedEvent> {
1302
- const response = await this.send({voice_leaved_event: {id: id, clan_id: clanId, voice_channel_id: voiceChannelId, last_participant: lastParticipant}});
1301
+ async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string) : Promise<VoiceLeavedEvent> {
1302
+ const response = await this.send({voice_leaved_event: {id: id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId}});
1303
1303
  return response.voice_leaved_event
1304
1304
  }
1305
1305