mezon-js 2.7.35 → 2.7.37

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 CHANGED
@@ -174,6 +174,8 @@ export interface ApiCategoryDescList {
174
174
 
175
175
  /** */
176
176
  export interface ApiChannelAttachment {
177
+ //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
178
+ create_time?: string;
177
179
  //
178
180
  filename?: string;
179
181
  //
@@ -799,6 +801,38 @@ export interface ApiPermissionList {
799
801
  permissions?: Array<ApiPermission>;
800
802
  }
801
803
 
804
+ /** */
805
+ export interface ApiPinMessage {
806
+ //
807
+ avatar?: string;
808
+ //
809
+ channel_id?: string;
810
+ //
811
+ content?: string;
812
+ //
813
+ id?: string;
814
+ //
815
+ message_id?: string;
816
+ //
817
+ sender_id?: string;
818
+ //
819
+ username?: string;
820
+ }
821
+
822
+ /** */
823
+ export interface ApiPinMessageRequest {
824
+ //
825
+ channel_id?: string;
826
+ //
827
+ message_id?: string;
828
+ }
829
+
830
+ /** */
831
+ export interface ApiPinMessagesList {
832
+ //
833
+ pin_messages_list?: Array<ApiPinMessage>;
834
+ }
835
+
802
836
  /** Storage objects to get. */
803
837
  export interface ApiReadStorageObjectId {
804
838
  //The collection which stores the object.
@@ -4464,6 +4498,108 @@ export class MezonApi {
4464
4498
  ]);
4465
4499
  }
4466
4500
 
4501
+ /** */
4502
+ deletePinMessage(bearerToken: string,
4503
+ messageId?:string,
4504
+ options: any = {}): Promise<any> {
4505
+
4506
+ const urlPath = "/v2/pinmessage/delete";
4507
+ const queryParams = new Map<string, any>();
4508
+ queryParams.set("message_id", messageId);
4509
+
4510
+ let bodyJson : string = "";
4511
+
4512
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4513
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
4514
+ if (bearerToken) {
4515
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4516
+ }
4517
+
4518
+ return Promise.race([
4519
+ fetch(fullUrl, fetchOptions).then((response) => {
4520
+ if (response.status == 204) {
4521
+ return response;
4522
+ } else if (response.status >= 200 && response.status < 300) {
4523
+ return response.json();
4524
+ } else {
4525
+ throw response;
4526
+ }
4527
+ }),
4528
+ new Promise((_, reject) =>
4529
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4530
+ ),
4531
+ ]);
4532
+ }
4533
+
4534
+ /** */
4535
+ getPinMessagesList(bearerToken: string,
4536
+ channelId?:string,
4537
+ options: any = {}): Promise<ApiPinMessagesList> {
4538
+
4539
+ const urlPath = "/v2/pinmessage/get";
4540
+ const queryParams = new Map<string, any>();
4541
+ queryParams.set("channel_id", channelId);
4542
+
4543
+ let bodyJson : string = "";
4544
+
4545
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4546
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4547
+ if (bearerToken) {
4548
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4549
+ }
4550
+
4551
+ return Promise.race([
4552
+ fetch(fullUrl, fetchOptions).then((response) => {
4553
+ if (response.status == 204) {
4554
+ return response;
4555
+ } else if (response.status >= 200 && response.status < 300) {
4556
+ return response.json();
4557
+ } else {
4558
+ throw response;
4559
+ }
4560
+ }),
4561
+ new Promise((_, reject) =>
4562
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4563
+ ),
4564
+ ]);
4565
+ }
4566
+
4567
+ /** set notification user channel. */
4568
+ createPinMessage(bearerToken: string,
4569
+ body:ApiPinMessageRequest,
4570
+ options: any = {}): Promise<any> {
4571
+
4572
+ if (body === null || body === undefined) {
4573
+ throw new Error("'body' is a required parameter but is null or undefined.");
4574
+ }
4575
+ const urlPath = "/v2/pinmessage/set";
4576
+ const queryParams = new Map<string, any>();
4577
+
4578
+ let bodyJson : string = "";
4579
+ bodyJson = JSON.stringify(body || {});
4580
+
4581
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4582
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4583
+ if (bearerToken) {
4584
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4585
+ }
4586
+
4587
+ return Promise.race([
4588
+ fetch(fullUrl, fetchOptions).then((response) => {
4589
+ if (response.status == 204) {
4590
+ return response;
4591
+ } else if (response.status >= 200 && response.status < 300) {
4592
+ return response.json();
4593
+ } else {
4594
+ throw response;
4595
+ }
4596
+ }),
4597
+ new Promise((_, reject) =>
4598
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4599
+ ),
4600
+ ]);
4601
+ }
4602
+
4467
4603
  /** */
4468
4604
  addRolesChannelDesc(bearerToken: string,
4469
4605
  body:ApiAddRoleChannelDescRequest,
package/client.ts CHANGED
@@ -88,6 +88,8 @@ import {
88
88
  ApiSetMuteNotificationRequest,
89
89
  ApiSearchMessageRequest,
90
90
  ApiSearchMessageResponse,
91
+ ApiPinMessageRequest,
92
+ ApiPinMessagesList,
91
93
  } from "./api.gen";
92
94
 
93
95
  import { Session } from "./session";
@@ -1138,7 +1140,7 @@ export class Client {
1138
1140
  response.attachments!.forEach(at => {
1139
1141
  result.attachments!.push({
1140
1142
  filename: at.filename,
1141
- filesize: at.filetype,
1143
+ filesize: at.filesize,
1142
1144
  filetype: at.filetype,
1143
1145
  id: at.id,
1144
1146
  uploader: at.uploader,
@@ -2117,6 +2119,42 @@ async searchMessage(session: Session, request: ApiSearchMessageRequest): Promise
2117
2119
  return Promise.resolve(response);
2118
2120
  });
2119
2121
  }
2122
+
2123
+ /** */
2124
+ async createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean> {
2125
+ if (this.autoRefreshSession && session.refresh_token &&
2126
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2127
+ await this.sessionRefresh(session);
2128
+ }
2129
+
2130
+ return this.apiClient.createPinMessage(session.token, request).then((response: any) => {
2131
+ return response !== undefined;
2132
+ });
2133
+ }
2134
+
2135
+ async getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList> {
2136
+ if (this.autoRefreshSession && session.refresh_token &&
2137
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2138
+ await this.sessionRefresh(session);
2139
+ }
2140
+
2141
+ return this.apiClient.getPinMessagesList(session.token, channelId).then((response: ApiPinMessagesList) => {
2142
+ return Promise.resolve(response);
2143
+ });
2144
+ }
2145
+
2146
+ //** */
2147
+ async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
2148
+ if (this.autoRefreshSession && session.refresh_token &&
2149
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2150
+ await this.sessionRefresh(session);
2151
+ }
2152
+
2153
+ return this.apiClient.deletePinMessage(session.token, message_id).then((response: any) => {
2154
+ return response !== undefined;
2155
+ });
2156
+ }
2157
+
2120
2158
  };
2121
2159
 
2122
2160
 
package/dist/api.gen.d.ts CHANGED
@@ -101,6 +101,7 @@ export interface ApiCategoryDescList {
101
101
  }
102
102
  /** */
103
103
  export interface ApiChannelAttachment {
104
+ create_time?: string;
104
105
  filename?: string;
105
106
  filesize?: string;
106
107
  filetype?: string;
@@ -460,6 +461,25 @@ export interface ApiPermission {
460
461
  export interface ApiPermissionList {
461
462
  permissions?: Array<ApiPermission>;
462
463
  }
464
+ /** */
465
+ export interface ApiPinMessage {
466
+ avatar?: string;
467
+ channel_id?: string;
468
+ content?: string;
469
+ id?: string;
470
+ message_id?: string;
471
+ sender_id?: string;
472
+ username?: string;
473
+ }
474
+ /** */
475
+ export interface ApiPinMessageRequest {
476
+ channel_id?: string;
477
+ message_id?: string;
478
+ }
479
+ /** */
480
+ export interface ApiPinMessagesList {
481
+ pin_messages_list?: Array<ApiPinMessage>;
482
+ }
463
483
  /** Storage objects to get. */
464
484
  export interface ApiReadStorageObjectId {
465
485
  collection?: string;
@@ -886,6 +906,12 @@ export declare class MezonApi {
886
906
  /** */
887
907
  GetPermissionOfUserInTheClan(bearerToken: string, clanId: string, options?: any): Promise<ApiPermissionList>;
888
908
  /** */
909
+ deletePinMessage(bearerToken: string, messageId?: string, options?: any): Promise<any>;
910
+ /** */
911
+ getPinMessagesList(bearerToken: string, channelId?: string, options?: any): Promise<ApiPinMessagesList>;
912
+ /** set notification user channel. */
913
+ createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<any>;
914
+ /** */
889
915
  addRolesChannelDesc(bearerToken: string, body: ApiAddRoleChannelDescRequest, options?: any): Promise<any>;
890
916
  /** Update a role when Delete a role by ID. */
891
917
  deleteRoleChannelDesc(bearerToken: string, body: ApiDeleteRoleRequest, options?: any): Promise<any>;
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, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse } 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, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -565,4 +565,8 @@ export declare class Client {
565
565
  deleteNotiReactMessage(session: Session, channel_id: string): Promise<boolean>;
566
566
  /** query message in elasticsearch */
567
567
  searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse>;
568
+ /** */
569
+ createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
570
+ getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
571
+ deletePinMessage(session: Session, message_id: string): Promise<boolean>;
568
572
  }
@@ -3206,6 +3206,87 @@ var MezonApi = class {
3206
3206
  ]);
3207
3207
  }
3208
3208
  /** */
3209
+ deletePinMessage(bearerToken, messageId, options = {}) {
3210
+ const urlPath = "/v2/pinmessage/delete";
3211
+ const queryParams = /* @__PURE__ */ new Map();
3212
+ queryParams.set("message_id", messageId);
3213
+ let bodyJson = "";
3214
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3215
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3216
+ if (bearerToken) {
3217
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3218
+ }
3219
+ return Promise.race([
3220
+ fetch(fullUrl, fetchOptions).then((response) => {
3221
+ if (response.status == 204) {
3222
+ return response;
3223
+ } else if (response.status >= 200 && response.status < 300) {
3224
+ return response.json();
3225
+ } else {
3226
+ throw response;
3227
+ }
3228
+ }),
3229
+ new Promise(
3230
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3231
+ )
3232
+ ]);
3233
+ }
3234
+ /** */
3235
+ getPinMessagesList(bearerToken, channelId, options = {}) {
3236
+ const urlPath = "/v2/pinmessage/get";
3237
+ const queryParams = /* @__PURE__ */ new Map();
3238
+ queryParams.set("channel_id", channelId);
3239
+ let bodyJson = "";
3240
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3241
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3242
+ if (bearerToken) {
3243
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3244
+ }
3245
+ return Promise.race([
3246
+ fetch(fullUrl, fetchOptions).then((response) => {
3247
+ if (response.status == 204) {
3248
+ return response;
3249
+ } else if (response.status >= 200 && response.status < 300) {
3250
+ return response.json();
3251
+ } else {
3252
+ throw response;
3253
+ }
3254
+ }),
3255
+ new Promise(
3256
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3257
+ )
3258
+ ]);
3259
+ }
3260
+ /** set notification user channel. */
3261
+ createPinMessage(bearerToken, body, options = {}) {
3262
+ if (body === null || body === void 0) {
3263
+ throw new Error("'body' is a required parameter but is null or undefined.");
3264
+ }
3265
+ const urlPath = "/v2/pinmessage/set";
3266
+ const queryParams = /* @__PURE__ */ new Map();
3267
+ let bodyJson = "";
3268
+ bodyJson = JSON.stringify(body || {});
3269
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3270
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3271
+ if (bearerToken) {
3272
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3273
+ }
3274
+ return Promise.race([
3275
+ fetch(fullUrl, fetchOptions).then((response) => {
3276
+ if (response.status == 204) {
3277
+ return response;
3278
+ } else if (response.status >= 200 && response.status < 300) {
3279
+ return response.json();
3280
+ } else {
3281
+ throw response;
3282
+ }
3283
+ }),
3284
+ new Promise(
3285
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3286
+ )
3287
+ ]);
3288
+ }
3289
+ /** */
3209
3290
  addRolesChannelDesc(bearerToken, body, options = {}) {
3210
3291
  if (body === null || body === void 0) {
3211
3292
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -5128,7 +5209,7 @@ var Client = class {
5128
5209
  response.attachments.forEach((at) => {
5129
5210
  result.attachments.push({
5130
5211
  filename: at.filename,
5131
- filesize: at.filetype,
5212
+ filesize: at.filesize,
5132
5213
  filetype: at.filetype,
5133
5214
  id: at.id,
5134
5215
  uploader: at.uploader,
@@ -6020,4 +6101,36 @@ var Client = class {
6020
6101
  });
6021
6102
  });
6022
6103
  }
6104
+ /** */
6105
+ createPinMessage(session, request) {
6106
+ return __async(this, null, function* () {
6107
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6108
+ yield this.sessionRefresh(session);
6109
+ }
6110
+ return this.apiClient.createPinMessage(session.token, request).then((response) => {
6111
+ return response !== void 0;
6112
+ });
6113
+ });
6114
+ }
6115
+ getPinMessagesList(session, channelId) {
6116
+ return __async(this, null, function* () {
6117
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6118
+ yield this.sessionRefresh(session);
6119
+ }
6120
+ return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
6121
+ return Promise.resolve(response);
6122
+ });
6123
+ });
6124
+ }
6125
+ //** */
6126
+ deletePinMessage(session, message_id) {
6127
+ return __async(this, null, function* () {
6128
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6129
+ yield this.sessionRefresh(session);
6130
+ }
6131
+ return this.apiClient.deletePinMessage(session.token, message_id).then((response) => {
6132
+ return response !== void 0;
6133
+ });
6134
+ });
6135
+ }
6023
6136
  };
@@ -3177,6 +3177,87 @@ var MezonApi = class {
3177
3177
  ]);
3178
3178
  }
3179
3179
  /** */
3180
+ deletePinMessage(bearerToken, messageId, options = {}) {
3181
+ const urlPath = "/v2/pinmessage/delete";
3182
+ const queryParams = /* @__PURE__ */ new Map();
3183
+ queryParams.set("message_id", messageId);
3184
+ let bodyJson = "";
3185
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3186
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3187
+ if (bearerToken) {
3188
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3189
+ }
3190
+ return Promise.race([
3191
+ fetch(fullUrl, fetchOptions).then((response) => {
3192
+ if (response.status == 204) {
3193
+ return response;
3194
+ } else if (response.status >= 200 && response.status < 300) {
3195
+ return response.json();
3196
+ } else {
3197
+ throw response;
3198
+ }
3199
+ }),
3200
+ new Promise(
3201
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3202
+ )
3203
+ ]);
3204
+ }
3205
+ /** */
3206
+ getPinMessagesList(bearerToken, channelId, options = {}) {
3207
+ const urlPath = "/v2/pinmessage/get";
3208
+ const queryParams = /* @__PURE__ */ new Map();
3209
+ queryParams.set("channel_id", channelId);
3210
+ let bodyJson = "";
3211
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3212
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3213
+ if (bearerToken) {
3214
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3215
+ }
3216
+ return Promise.race([
3217
+ fetch(fullUrl, fetchOptions).then((response) => {
3218
+ if (response.status == 204) {
3219
+ return response;
3220
+ } else if (response.status >= 200 && response.status < 300) {
3221
+ return response.json();
3222
+ } else {
3223
+ throw response;
3224
+ }
3225
+ }),
3226
+ new Promise(
3227
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3228
+ )
3229
+ ]);
3230
+ }
3231
+ /** set notification user channel. */
3232
+ createPinMessage(bearerToken, body, options = {}) {
3233
+ if (body === null || body === void 0) {
3234
+ throw new Error("'body' is a required parameter but is null or undefined.");
3235
+ }
3236
+ const urlPath = "/v2/pinmessage/set";
3237
+ const queryParams = /* @__PURE__ */ new Map();
3238
+ let bodyJson = "";
3239
+ bodyJson = JSON.stringify(body || {});
3240
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3241
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3242
+ if (bearerToken) {
3243
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3244
+ }
3245
+ return Promise.race([
3246
+ fetch(fullUrl, fetchOptions).then((response) => {
3247
+ if (response.status == 204) {
3248
+ return response;
3249
+ } else if (response.status >= 200 && response.status < 300) {
3250
+ return response.json();
3251
+ } else {
3252
+ throw response;
3253
+ }
3254
+ }),
3255
+ new Promise(
3256
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3257
+ )
3258
+ ]);
3259
+ }
3260
+ /** */
3180
3261
  addRolesChannelDesc(bearerToken, body, options = {}) {
3181
3262
  if (body === null || body === void 0) {
3182
3263
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -5099,7 +5180,7 @@ var Client = class {
5099
5180
  response.attachments.forEach((at) => {
5100
5181
  result.attachments.push({
5101
5182
  filename: at.filename,
5102
- filesize: at.filetype,
5183
+ filesize: at.filesize,
5103
5184
  filetype: at.filetype,
5104
5185
  id: at.id,
5105
5186
  uploader: at.uploader,
@@ -5991,6 +6072,38 @@ var Client = class {
5991
6072
  });
5992
6073
  });
5993
6074
  }
6075
+ /** */
6076
+ createPinMessage(session, request) {
6077
+ return __async(this, null, function* () {
6078
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6079
+ yield this.sessionRefresh(session);
6080
+ }
6081
+ return this.apiClient.createPinMessage(session.token, request).then((response) => {
6082
+ return response !== void 0;
6083
+ });
6084
+ });
6085
+ }
6086
+ getPinMessagesList(session, channelId) {
6087
+ return __async(this, null, function* () {
6088
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6089
+ yield this.sessionRefresh(session);
6090
+ }
6091
+ return this.apiClient.getPinMessagesList(session.token, channelId).then((response) => {
6092
+ return Promise.resolve(response);
6093
+ });
6094
+ });
6095
+ }
6096
+ //** */
6097
+ deletePinMessage(session, message_id) {
6098
+ return __async(this, null, function* () {
6099
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6100
+ yield this.sessionRefresh(session);
6101
+ }
6102
+ return this.apiClient.deletePinMessage(session.token, message_id).then((response) => {
6103
+ return response !== void 0;
6104
+ });
6105
+ });
6106
+ }
5994
6107
  };
5995
6108
  export {
5996
6109
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.35",
3
+ "version": "2.7.37",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/dist/dist.zip DELETED
Binary file