mezon-js 2.8.66 → 2.8.68

Sign up to get free protection for your applications and to get access to all the features.
package/dist/api.gen.d.ts CHANGED
@@ -111,6 +111,10 @@ export interface MezonUpdateRoleBody {
111
111
  export interface MezonUpdateRoleDeleteBody {
112
112
  clan_id?: string;
113
113
  }
114
+ /** Request to get system message by clan and channel IDs. */
115
+ export interface MezonUpdateSystemMessageBody {
116
+ channel_id?: string;
117
+ }
114
118
  /** */
115
119
  export interface MezonUpdateUserProfileByClanBody {
116
120
  avatar?: string;
@@ -830,39 +834,20 @@ export interface ApiSortParam {
830
834
  field_name?: string;
831
835
  order?: string;
832
836
  }
833
- /** An object within the storage engine. */
834
- export interface ApiStorageObject {
835
- collection?: string;
836
- create_time?: string;
837
- key?: string;
838
- permission_read?: number;
839
- permission_write?: number;
840
- update_time?: string;
841
- user_id?: string;
842
- value?: string;
843
- version?: string;
844
- }
845
- /** A storage acknowledgement. */
846
- export interface ApiStorageObjectAck {
847
- collection?: string;
848
- create_time?: string;
849
- key?: string;
850
- update_time?: string;
851
- user_id?: string;
852
- version?: string;
853
- }
854
- /** Batch of acknowledgements for the storage object write. */
855
- export interface ApiStorageObjectAcks {
856
- acks?: Array<ApiStorageObjectAck>;
837
+ /** System message details. */
838
+ export interface ApiSystemMessage {
839
+ channel_id?: string;
840
+ clan_id?: string;
841
+ id?: string;
857
842
  }
858
- /** List of storage objects. */
859
- export interface ApiStorageObjectList {
860
- cursor?: string;
861
- objects?: Array<ApiStorageObject>;
843
+ /** Request to get system message by clan and channel IDs. */
844
+ export interface ApiSystemMessageRequest {
845
+ channel_id?: string;
846
+ clan_id?: string;
862
847
  }
863
- /** Batch of storage objects. */
864
- export interface ApiStorageObjects {
865
- objects?: Array<ApiStorageObject>;
848
+ /** List of system message. */
849
+ export interface ApiSystemMessagesList {
850
+ system_messages_list?: Array<ApiSystemMessage>;
866
851
  }
867
852
  /** Update a user's account details. */
868
853
  export interface ApiUpdateAccountRequest {
@@ -1201,8 +1186,10 @@ export declare class MezonApi {
1201
1186
  deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
1202
1187
  /** Create a new role for clan. */
1203
1188
  createRole(bearerToken: string, body: ApiCreateRoleRequest, options?: any): Promise<ApiRole>;
1189
+ /** Update a role when Delete a role by ID. */
1190
+ updateRoleDelete(bearerToken: string, roleId: string, body: MezonUpdateRoleDeleteBody, options?: any): Promise<any>;
1204
1191
  /** Delete a role by ID. */
1205
- deleteRole(bearerToken: string, roleId: string, channelId?: string, clanId?: string, options?: any): Promise<any>;
1192
+ deleteRole(bearerToken: string, roleId: string, channelId?: string, options?: any): Promise<any>;
1206
1193
  /** Update fields in a given role. */
1207
1194
  updateRole(bearerToken: string, roleId: string, body: MezonUpdateRoleBody, options?: any): Promise<any>;
1208
1195
  /** List role permissions */
@@ -1221,6 +1208,16 @@ export declare class MezonApi {
1221
1208
  deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1222
1209
  /** Update a sticker by ID */
1223
1210
  updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
1211
+ /** Get the list of system messages. */
1212
+ getSystemMessagesList(bearerToken: string, options?: any): Promise<ApiSystemMessagesList>;
1213
+ /** Create a system messages. */
1214
+ createSystemMessage(bearerToken: string, body: ApiSystemMessageRequest, options?: any): Promise<any>;
1215
+ /** Delete a specific system messages. */
1216
+ deleteSystemMessage(bearerToken: string, clanId: string, options?: any): Promise<any>;
1217
+ /** Get details of a specific system messages. */
1218
+ getSystemMessageByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiSystemMessage>;
1219
+ /** Update a system messages. */
1220
+ updateSystemMessage(bearerToken: string, clanId: string, body: MezonUpdateSystemMessageBody, options?: any): Promise<any>;
1224
1221
  /** Update fields in a given category. */
1225
1222
  updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
1226
1223
  /** Update channel private. */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -543,4 +543,9 @@ export declare class Client {
543
543
  getApp(session: Session, id: string): Promise<ApiApp>;
544
544
  listApps(session: Session): Promise<ApiAppList>;
545
545
  addAppToClan(session: Session, appId: string, clanId: string): Promise<boolean>;
546
+ getSystemMessagesList(session: Session): Promise<ApiSystemMessagesList>;
547
+ getSystemMessageByClanId(session: Session, clanId: string): Promise<ApiSystemMessage>;
548
+ createSystemMessage(session: Session, request: ApiSystemMessageRequest): Promise<any>;
549
+ updateSystemMessage(session: Session, clanId: string, request: MezonUpdateSystemMessageBody): Promise<any>;
550
+ deleteSystemMessage(session: Session, clanId: string): Promise<any>;
546
551
  }
@@ -3785,15 +3785,46 @@ var MezonApi = class {
3785
3785
  )
3786
3786
  ]);
3787
3787
  }
3788
+ /** Update a role when Delete a role by ID. */
3789
+ updateRoleDelete(bearerToken, roleId, body, options = {}) {
3790
+ if (roleId === null || roleId === void 0) {
3791
+ throw new Error("'roleId' is a required parameter but is null or undefined.");
3792
+ }
3793
+ if (body === null || body === void 0) {
3794
+ throw new Error("'body' is a required parameter but is null or undefined.");
3795
+ }
3796
+ const urlPath = "/v2/roles/delete/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3797
+ const queryParams = /* @__PURE__ */ new Map();
3798
+ let bodyJson = "";
3799
+ bodyJson = JSON.stringify(body || {});
3800
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3801
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3802
+ if (bearerToken) {
3803
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3804
+ }
3805
+ return Promise.race([
3806
+ fetch(fullUrl, fetchOptions).then((response) => {
3807
+ if (response.status == 204) {
3808
+ return response;
3809
+ } else if (response.status >= 200 && response.status < 300) {
3810
+ return response.json();
3811
+ } else {
3812
+ throw response;
3813
+ }
3814
+ }),
3815
+ new Promise(
3816
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3817
+ )
3818
+ ]);
3819
+ }
3788
3820
  /** Delete a role by ID. */
3789
- deleteRole(bearerToken, roleId, channelId, clanId, options = {}) {
3821
+ deleteRole(bearerToken, roleId, channelId, options = {}) {
3790
3822
  if (roleId === null || roleId === void 0) {
3791
3823
  throw new Error("'roleId' is a required parameter but is null or undefined.");
3792
3824
  }
3793
3825
  const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
3794
3826
  const queryParams = /* @__PURE__ */ new Map();
3795
3827
  queryParams.set("channel_id", channelId);
3796
- queryParams.set("clan_id", clanId);
3797
3828
  let bodyJson = "";
3798
3829
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3799
3830
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -4093,6 +4124,148 @@ var MezonApi = class {
4093
4124
  )
4094
4125
  ]);
4095
4126
  }
4127
+ /** Get the list of system messages. */
4128
+ getSystemMessagesList(bearerToken, options = {}) {
4129
+ const urlPath = "/v2/systemmessages";
4130
+ const queryParams = /* @__PURE__ */ new Map();
4131
+ let bodyJson = "";
4132
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4133
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4134
+ if (bearerToken) {
4135
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4136
+ }
4137
+ return Promise.race([
4138
+ fetch(fullUrl, fetchOptions).then((response) => {
4139
+ if (response.status == 204) {
4140
+ return response;
4141
+ } else if (response.status >= 200 && response.status < 300) {
4142
+ return response.json();
4143
+ } else {
4144
+ throw response;
4145
+ }
4146
+ }),
4147
+ new Promise(
4148
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4149
+ )
4150
+ ]);
4151
+ }
4152
+ /** Create a system messages. */
4153
+ createSystemMessage(bearerToken, body, options = {}) {
4154
+ if (body === null || body === void 0) {
4155
+ throw new Error("'body' is a required parameter but is null or undefined.");
4156
+ }
4157
+ const urlPath = "/v2/systemmessages";
4158
+ const queryParams = /* @__PURE__ */ new Map();
4159
+ let bodyJson = "";
4160
+ bodyJson = JSON.stringify(body || {});
4161
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4162
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4163
+ if (bearerToken) {
4164
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4165
+ }
4166
+ return Promise.race([
4167
+ fetch(fullUrl, fetchOptions).then((response) => {
4168
+ if (response.status == 204) {
4169
+ return response;
4170
+ } else if (response.status >= 200 && response.status < 300) {
4171
+ return response.json();
4172
+ } else {
4173
+ throw response;
4174
+ }
4175
+ }),
4176
+ new Promise(
4177
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4178
+ )
4179
+ ]);
4180
+ }
4181
+ /** Delete a specific system messages. */
4182
+ deleteSystemMessage(bearerToken, clanId, options = {}) {
4183
+ if (clanId === null || clanId === void 0) {
4184
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4185
+ }
4186
+ const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
4187
+ const queryParams = /* @__PURE__ */ new Map();
4188
+ let bodyJson = "";
4189
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4190
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
4191
+ if (bearerToken) {
4192
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4193
+ }
4194
+ return Promise.race([
4195
+ fetch(fullUrl, fetchOptions).then((response) => {
4196
+ if (response.status == 204) {
4197
+ return response;
4198
+ } else if (response.status >= 200 && response.status < 300) {
4199
+ return response.json();
4200
+ } else {
4201
+ throw response;
4202
+ }
4203
+ }),
4204
+ new Promise(
4205
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4206
+ )
4207
+ ]);
4208
+ }
4209
+ /** Get details of a specific system messages. */
4210
+ getSystemMessageByClanId(bearerToken, clanId, options = {}) {
4211
+ if (clanId === null || clanId === void 0) {
4212
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4213
+ }
4214
+ const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
4215
+ const queryParams = /* @__PURE__ */ new Map();
4216
+ let bodyJson = "";
4217
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4218
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4219
+ if (bearerToken) {
4220
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4221
+ }
4222
+ return Promise.race([
4223
+ fetch(fullUrl, fetchOptions).then((response) => {
4224
+ if (response.status == 204) {
4225
+ return response;
4226
+ } else if (response.status >= 200 && response.status < 300) {
4227
+ return response.json();
4228
+ } else {
4229
+ throw response;
4230
+ }
4231
+ }),
4232
+ new Promise(
4233
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4234
+ )
4235
+ ]);
4236
+ }
4237
+ /** Update a system messages. */
4238
+ updateSystemMessage(bearerToken, clanId, body, options = {}) {
4239
+ if (clanId === null || clanId === void 0) {
4240
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4241
+ }
4242
+ if (body === null || body === void 0) {
4243
+ throw new Error("'body' is a required parameter but is null or undefined.");
4244
+ }
4245
+ const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
4246
+ const queryParams = /* @__PURE__ */ new Map();
4247
+ let bodyJson = "";
4248
+ bodyJson = JSON.stringify(body || {});
4249
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4250
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
4251
+ if (bearerToken) {
4252
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4253
+ }
4254
+ return Promise.race([
4255
+ fetch(fullUrl, fetchOptions).then((response) => {
4256
+ if (response.status == 204) {
4257
+ return response;
4258
+ } else if (response.status >= 200 && response.status < 300) {
4259
+ return response.json();
4260
+ } else {
4261
+ throw response;
4262
+ }
4263
+ }),
4264
+ new Promise(
4265
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4266
+ )
4267
+ ]);
4268
+ }
4096
4269
  /** Update fields in a given category. */
4097
4270
  updateCategory(bearerToken, body, options = {}) {
4098
4271
  if (body === null || body === void 0) {
@@ -5002,9 +5175,9 @@ var _DefaultSocket = class _DefaultSocket {
5002
5175
  return response.message_reaction_event;
5003
5176
  });
5004
5177
  }
5005
- writeMessageTyping(clan_id, channel_id, mode, is_public) {
5178
+ writeMessageTyping(clan_id, channel_id, mode) {
5006
5179
  return __async(this, null, function* () {
5007
- const response = yield this.send({ message_typing_event: { clan_id, channel_id, mode, is_public } });
5180
+ const response = yield this.send({ message_typing_event: { clan_id, channel_id, mode } });
5008
5181
  return response.message_typing_event;
5009
5182
  });
5010
5183
  }
@@ -5216,50 +5389,73 @@ var Client = class {
5216
5389
  authenticateApple(_0, _1, _2) {
5217
5390
  return __async(this, arguments, function* (token, create, username, vars = {}, options = {}) {
5218
5391
  const request = {
5219
- "token": token,
5220
- "vars": vars
5392
+ token,
5393
+ vars
5221
5394
  };
5222
5395
  return this.apiClient.authenticateApple(this.serverkey, "", request, create, username, options).then((apiSession) => {
5223
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5396
+ return new Session(
5397
+ apiSession.token || "",
5398
+ apiSession.refresh_token || "",
5399
+ apiSession.created || false
5400
+ );
5224
5401
  });
5225
5402
  });
5226
5403
  }
5227
5404
  /** Authenticate a user with a custom id against the server. */
5228
5405
  authenticateCustom(id, create, username, vars = {}, options = {}) {
5229
5406
  const request = {
5230
- "id": id,
5231
- "vars": vars
5407
+ id,
5408
+ vars
5232
5409
  };
5233
- return this.apiClient.authenticateCustom(this.serverkey, "", request, create, username, options).then((apiSession) => {
5234
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5410
+ return this.apiClient.authenticateCustom(
5411
+ this.serverkey,
5412
+ "",
5413
+ request,
5414
+ create,
5415
+ username,
5416
+ options
5417
+ ).then((apiSession) => {
5418
+ return new Session(
5419
+ apiSession.token || "",
5420
+ apiSession.refresh_token || "",
5421
+ apiSession.created || false
5422
+ );
5235
5423
  });
5236
5424
  }
5237
5425
  /** Authenticate a user with a device id against the server. */
5238
5426
  authenticateDevice(id, create, username, vars) {
5239
5427
  const request = {
5240
- "id": id,
5241
- "vars": vars
5428
+ id,
5429
+ vars
5242
5430
  };
5243
5431
  return this.apiClient.authenticateDevice(this.serverkey, "", request, create, username).then((apiSession) => {
5244
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5432
+ return new Session(
5433
+ apiSession.token || "",
5434
+ apiSession.refresh_token || "",
5435
+ apiSession.created || false
5436
+ );
5245
5437
  });
5246
5438
  }
5247
5439
  /** Authenticate a user with an email+password against the server. */
5248
5440
  authenticateEmail(email, password, username, vars) {
5249
5441
  const request = {
5250
- "email": email,
5251
- "password": password,
5252
- "vars": vars
5442
+ email,
5443
+ password,
5444
+ vars
5253
5445
  };
5254
5446
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
5255
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5447
+ return new Session(
5448
+ apiSession.token || "",
5449
+ apiSession.refresh_token || "",
5450
+ apiSession.created || false
5451
+ );
5256
5452
  });
5257
5453
  }
5258
5454
  /** Authenticate a user with a Facebook Instant Game token against the server. */
5259
5455
  authenticateFacebookInstantGame(signedPlayerInfo, create, username, vars, options = {}) {
5260
5456
  const request = {
5261
- "signed_player_info": signedPlayerInfo,
5262
- "vars": vars
5457
+ signed_player_info: signedPlayerInfo,
5458
+ vars
5263
5459
  };
5264
5460
  return this.apiClient.authenticateFacebookInstantGame(
5265
5461
  this.serverkey,
@@ -5269,17 +5465,33 @@ var Client = class {
5269
5465
  username,
5270
5466
  options
5271
5467
  ).then((apiSession) => {
5272
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5468
+ return new Session(
5469
+ apiSession.token || "",
5470
+ apiSession.refresh_token || "",
5471
+ apiSession.created || false
5472
+ );
5273
5473
  });
5274
5474
  }
5275
5475
  /** Authenticate a user with a Facebook OAuth token against the server. */
5276
5476
  authenticateFacebook(token, create, username, sync, vars, options = {}) {
5277
5477
  const request = {
5278
- "token": token,
5279
- "vars": vars
5478
+ token,
5479
+ vars
5280
5480
  };
5281
- return this.apiClient.authenticateFacebook(this.serverkey, "", request, create, username, sync, options).then((apiSession) => {
5282
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5481
+ return this.apiClient.authenticateFacebook(
5482
+ this.serverkey,
5483
+ "",
5484
+ request,
5485
+ create,
5486
+ username,
5487
+ sync,
5488
+ options
5489
+ ).then((apiSession) => {
5490
+ return new Session(
5491
+ apiSession.token || "",
5492
+ apiSession.refresh_token || "",
5493
+ apiSession.created || false
5494
+ );
5283
5495
  });
5284
5496
  }
5285
5497
  /** Authenticate a user with Google against the server. */
@@ -5335,12 +5547,16 @@ var Client = class {
5335
5547
  authenticateSteam(token, create, username, sync, vars) {
5336
5548
  return __async(this, null, function* () {
5337
5549
  const request = {
5338
- "token": token,
5339
- "vars": vars,
5340
- "sync": sync
5550
+ token,
5551
+ vars,
5552
+ sync
5341
5553
  };
5342
5554
  return this.apiClient.authenticateSteam(this.serverkey, "", request, create, username).then((apiSession) => {
5343
- return new Session(apiSession.token || "", apiSession.refresh_token || "", apiSession.created || false);
5555
+ return new Session(
5556
+ apiSession.token || "",
5557
+ apiSession.refresh_token || "",
5558
+ apiSession.created || false
5559
+ );
5344
5560
  });
5345
5561
  });
5346
5562
  }
@@ -5453,7 +5669,14 @@ var Client = class {
5453
5669
  }
5454
5670
  /** A socket created with the client's configuration. */
5455
5671
  createSocket(useSSL = false, verbose = false, adapter = new WebSocketAdapterText(), sendTimeoutMs = DefaultSocket.DefaultSendTimeoutMs) {
5456
- return new DefaultSocket(this.host, this.port, useSSL, verbose, adapter, sendTimeoutMs);
5672
+ return new DefaultSocket(
5673
+ this.host,
5674
+ this.port,
5675
+ useSSL,
5676
+ verbose,
5677
+ adapter,
5678
+ sendTimeoutMs
5679
+ );
5457
5680
  }
5458
5681
  /** Delete one or more users by ID or username. */
5459
5682
  deleteFriends(session, ids, usernames) {
@@ -5650,7 +5873,13 @@ var Client = class {
5650
5873
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5651
5874
  yield this.sessionRefresh(session);
5652
5875
  }
5653
- return this.apiClient.listChannelMessages(session.token, channelId, messageId, direction, limit).then((response) => {
5876
+ return this.apiClient.listChannelMessages(
5877
+ session.token,
5878
+ channelId,
5879
+ messageId,
5880
+ direction,
5881
+ limit
5882
+ ).then((response) => {
5654
5883
  var result = {
5655
5884
  messages: [],
5656
5885
  last_seen_message: response.last_seen_message,
@@ -5716,7 +5945,15 @@ var Client = class {
5716
5945
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5717
5946
  yield this.sessionRefresh(session);
5718
5947
  }
5719
- return this.apiClient.listChannelVoiceUsers(session.token, clanId, channelId, channelType, limit, state, cursor).then((response) => {
5948
+ return this.apiClient.listChannelVoiceUsers(
5949
+ session.token,
5950
+ clanId,
5951
+ channelId,
5952
+ channelType,
5953
+ limit,
5954
+ state,
5955
+ cursor
5956
+ ).then((response) => {
5720
5957
  var result = {
5721
5958
  voice_channel_users: []
5722
5959
  };
@@ -5741,7 +5978,15 @@ var Client = class {
5741
5978
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5742
5979
  yield this.sessionRefresh(session);
5743
5980
  }
5744
- return this.apiClient.listChannelUsers(session.token, clanId, channelId, channelType, limit, state, cursor).then((response) => {
5981
+ return this.apiClient.listChannelUsers(
5982
+ session.token,
5983
+ clanId,
5984
+ channelId,
5985
+ channelType,
5986
+ limit,
5987
+ state,
5988
+ cursor
5989
+ ).then((response) => {
5745
5990
  var result = {
5746
5991
  channel_users: [],
5747
5992
  cursor: response.cursor,
@@ -5790,7 +6035,15 @@ var Client = class {
5790
6035
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5791
6036
  yield this.sessionRefresh(session);
5792
6037
  }
5793
- return this.apiClient.listChannelAttachment(session.token, clanId, channelId, fileType, limit, state, cursor).then((response) => {
6038
+ return this.apiClient.listChannelAttachment(
6039
+ session.token,
6040
+ clanId,
6041
+ channelId,
6042
+ fileType,
6043
+ limit,
6044
+ state,
6045
+ cursor
6046
+ ).then((response) => {
5794
6047
  var result = {
5795
6048
  attachments: []
5796
6049
  };
@@ -5862,7 +6115,14 @@ var Client = class {
5862
6115
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5863
6116
  yield this.sessionRefresh(session);
5864
6117
  }
5865
- return this.apiClient.listChannelDescs(session.token, limit, state, cursor, clanId, channelType).then((response) => {
6118
+ return this.apiClient.listChannelDescs(
6119
+ session.token,
6120
+ limit,
6121
+ state,
6122
+ cursor,
6123
+ clanId,
6124
+ channelType
6125
+ ).then((response) => {
5866
6126
  var result = {
5867
6127
  channeldesc: [],
5868
6128
  next_cursor: response.next_cursor,
@@ -6185,7 +6445,13 @@ var Client = class {
6185
6445
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6186
6446
  yield this.sessionRefresh(session);
6187
6447
  }
6188
- return this.apiClient.rpcFunc(session.token, basicAuthUsername, basicAuthPassword, id, JSON.stringify(input)).then((response) => {
6448
+ return this.apiClient.rpcFunc(
6449
+ session.token,
6450
+ basicAuthUsername,
6451
+ basicAuthPassword,
6452
+ id,
6453
+ JSON.stringify(input)
6454
+ ).then((response) => {
6189
6455
  return Promise.resolve({
6190
6456
  id: response.id,
6191
6457
  payload: !response.payload ? void 0 : JSON.parse(response.payload)
@@ -6212,7 +6478,10 @@ var Client = class {
6212
6478
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6213
6479
  yield this.sessionRefresh(session);
6214
6480
  }
6215
- return this.apiClient.sessionLogout(session.token, { refresh_token: refreshToken, token }).then((response) => {
6481
+ return this.apiClient.sessionLogout(session.token, {
6482
+ refresh_token: refreshToken,
6483
+ token
6484
+ }).then((response) => {
6216
6485
  return response !== void 0;
6217
6486
  });
6218
6487
  });
@@ -6225,12 +6494,19 @@ var Client = class {
6225
6494
  return session;
6226
6495
  }
6227
6496
  if (session.created && session.expires_at - session.created_at < 70) {
6228
- console.warn("Session lifetime too short, please set '--session.token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session");
6497
+ console.warn(
6498
+ "Session lifetime too short, please set '--session.token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
6499
+ );
6229
6500
  }
6230
6501
  if (session.created && session.refresh_expires_at - session.created_at < 3700) {
6231
- console.warn("Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session");
6502
+ console.warn(
6503
+ "Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
6504
+ );
6232
6505
  }
6233
- const apiSession = yield this.apiClient.sessionRefresh(this.serverkey, "", { token: session.refresh_token, vars });
6506
+ const apiSession = yield this.apiClient.sessionRefresh(this.serverkey, "", {
6507
+ token: session.refresh_token,
6508
+ vars
6509
+ });
6234
6510
  session.update(apiSession.token, apiSession.refresh_token);
6235
6511
  return session;
6236
6512
  });
@@ -6810,4 +7086,54 @@ var Client = class {
6810
7086
  });
6811
7087
  });
6812
7088
  }
7089
+ getSystemMessagesList(session) {
7090
+ return __async(this, null, function* () {
7091
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7092
+ yield this.sessionRefresh(session);
7093
+ }
7094
+ return this.apiClient.getSystemMessagesList(session.token).then((response) => {
7095
+ return Promise.resolve(response);
7096
+ });
7097
+ });
7098
+ }
7099
+ getSystemMessageByClanId(session, clanId) {
7100
+ return __async(this, null, function* () {
7101
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7102
+ yield this.sessionRefresh(session);
7103
+ }
7104
+ return this.apiClient.getSystemMessageByClanId(session.token, clanId).then((response) => {
7105
+ return Promise.resolve(response);
7106
+ });
7107
+ });
7108
+ }
7109
+ createSystemMessage(session, request) {
7110
+ return __async(this, null, function* () {
7111
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7112
+ yield this.sessionRefresh(session);
7113
+ }
7114
+ return this.apiClient.createSystemMessage(session.token, request).then((response) => {
7115
+ return Promise.resolve(response);
7116
+ });
7117
+ });
7118
+ }
7119
+ updateSystemMessage(session, clanId, request) {
7120
+ return __async(this, null, function* () {
7121
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7122
+ yield this.sessionRefresh(session);
7123
+ }
7124
+ return this.apiClient.updateSystemMessage(session.token, clanId, request).then((response) => {
7125
+ return Promise.resolve(response);
7126
+ });
7127
+ });
7128
+ }
7129
+ deleteSystemMessage(session, clanId) {
7130
+ return __async(this, null, function* () {
7131
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7132
+ yield this.sessionRefresh(session);
7133
+ }
7134
+ return this.apiClient.deleteSystemMessage(session.token, clanId).then((response) => {
7135
+ return Promise.resolve(response);
7136
+ });
7137
+ });
7138
+ }
6813
7139
  };