mezon-js 2.9.21 → 2.9.23

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -105,6 +105,8 @@ export enum ApiAppRole {
105
105
 
106
106
  /** Update fields in a given channel. */
107
107
  export interface MezonUpdateChannelDescBody {
108
+ //
109
+ app_url?: string;
108
110
  //
109
111
  category_id?: string;
110
112
  //
@@ -543,6 +545,8 @@ export interface ApiChannelDescription {
543
545
  //
544
546
  active?: number;
545
547
  //
548
+ app_url?: string;
549
+ //
546
550
  category_id?: string;
547
551
  //
548
552
  category_name?: string;
@@ -1222,6 +1226,16 @@ export interface ApiMessageDeleted {
1222
1226
  message_id?: string;
1223
1227
  }
1224
1228
 
1229
+ /** */
1230
+ export interface ApiMarkAsReadRequest {
1231
+ //
1232
+ category_id?: string;
1233
+ //
1234
+ channel_id?: string;
1235
+ //
1236
+ clan_id?: string;
1237
+ }
1238
+
1225
1239
  /** */
1226
1240
  export interface ApiMessageMention {
1227
1241
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
@@ -6096,6 +6110,42 @@ export class MezonApi {
6096
6110
  ]);
6097
6111
  }
6098
6112
 
6113
+ /** Mark as read */
6114
+ markAsRead(bearerToken: string,
6115
+ body:ApiMarkAsReadRequest,
6116
+ options: any = {}): Promise<any> {
6117
+
6118
+ if (body === null || body === undefined) {
6119
+ throw new Error("'body' is a required parameter but is null or undefined.");
6120
+ }
6121
+ const urlPath = "/v2/markasread";
6122
+ const queryParams = new Map<string, any>();
6123
+
6124
+ let bodyJson : string = "";
6125
+ bodyJson = JSON.stringify(body || {});
6126
+
6127
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6128
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6129
+ if (bearerToken) {
6130
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6131
+ }
6132
+
6133
+ return Promise.race([
6134
+ fetch(fullUrl, fetchOptions).then((response) => {
6135
+ if (response.status == 204) {
6136
+ return response;
6137
+ } else if (response.status >= 200 && response.status < 300) {
6138
+ return response.json();
6139
+ } else {
6140
+ throw response;
6141
+ }
6142
+ }),
6143
+ new Promise((_, reject) =>
6144
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
6145
+ ),
6146
+ ]);
6147
+ }
6148
+
6099
6149
  /** set mute notification user channel. */
6100
6150
  setMuteNotificationCategory(
6101
6151
  bearerToken: string,
package/client.ts CHANGED
@@ -120,6 +120,7 @@ import {
120
120
  ApiAllUserClans,
121
121
  ApiUserPermissionInChannelListResponse,
122
122
  ApiPermissionRoleChannelListEventResponse,
123
+ ApiMarkAsReadRequest,
123
124
  } from "./api.gen";
124
125
 
125
126
  import { Session } from "./session";
@@ -401,6 +402,8 @@ export interface ApiUpdateChannelDescRequest {
401
402
  channel_label: string | undefined;
402
403
  /** The category of channel */
403
404
  category_id: string | undefined;
405
+ /** The app url of channel */
406
+ app_url: string | undefined;
404
407
  }
405
408
 
406
409
  /** Add users to a channel. */
@@ -3897,4 +3900,23 @@ export class Client {
3897
3900
  return Promise.resolve(result);
3898
3901
  });
3899
3902
  }
3903
+
3904
+ async markAsRead(
3905
+ session: Session,
3906
+ request: ApiMarkAsReadRequest
3907
+ ): Promise<any> {
3908
+ if (
3909
+ this.autoRefreshSession &&
3910
+ session.refresh_token &&
3911
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3912
+ ) {
3913
+ await this.sessionRefresh(session);
3914
+ }
3915
+
3916
+ return this.apiClient
3917
+ .markAsRead(session.token, request)
3918
+ .then((response: any) => {
3919
+ return Promise.resolve(response);
3920
+ });
3921
+ }
3900
3922
  }
package/dist/api.gen.d.ts CHANGED
@@ -63,6 +63,7 @@ export declare enum ApiAppRole {
63
63
  }
64
64
  /** Update fields in a given channel. */
65
65
  export interface MezonUpdateChannelDescBody {
66
+ app_url?: string;
66
67
  category_id?: string;
67
68
  channel_label?: string;
68
69
  }
@@ -320,6 +321,7 @@ export interface ApiChannelDescList {
320
321
  /** */
321
322
  export interface ApiChannelDescription {
322
323
  active?: number;
324
+ app_url?: string;
323
325
  category_id?: string;
324
326
  category_name?: string;
325
327
  channel_avatar?: Array<string>;
@@ -708,6 +710,12 @@ export interface ApiMessageDeleted {
708
710
  message_id?: string;
709
711
  }
710
712
  /** */
713
+ export interface ApiMarkAsReadRequest {
714
+ category_id?: string;
715
+ channel_id?: string;
716
+ clan_id?: string;
717
+ }
718
+ /** */
711
719
  export interface ApiMessageMention {
712
720
  create_time?: string;
713
721
  id?: string;
@@ -1414,6 +1422,8 @@ export declare class MezonApi {
1414
1422
  inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
1415
1423
  /** List HashtagDMList */
1416
1424
  listChannelByUserId(bearerToken: string, options?: any): Promise<ApiChannelDescList>;
1425
+ /** Mark as read */
1426
+ markAsRead(bearerToken: string, body: ApiMarkAsReadRequest, options?: any): Promise<any>;
1417
1427
  /** set mute notification user channel. */
1418
1428
  setMuteNotificationCategory(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
1419
1429
  /** set mute notification user channel. */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -241,6 +241,8 @@ export interface ApiUpdateChannelDescRequest {
241
241
  channel_label: string | undefined;
242
242
  /** The category of channel */
243
243
  category_id: string | undefined;
244
+ /** The app url of channel */
245
+ app_url: string | undefined;
244
246
  }
245
247
  /** Add users to a channel. */
246
248
  export interface ApiAddChannelUsersRequest {
@@ -574,4 +576,5 @@ export declare class Client {
574
576
  listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
575
577
  listUserPermissionInChannel(session: Session, clanId?: string, channelId?: string): Promise<ApiUserPermissionInChannelListResponse>;
576
578
  getPermissionByRoleIdChannelId(session: Session, roleId?: string, channelId?: string, userId?: string): Promise<ApiPermissionRoleChannelListEventResponse>;
579
+ markAsRead(session: Session, request: ApiMarkAsReadRequest): Promise<any>;
577
580
  }
@@ -3824,6 +3824,35 @@ var MezonApi = class {
3824
3824
  )
3825
3825
  ]);
3826
3826
  }
3827
+ /** Mark as read */
3828
+ markAsRead(bearerToken, body, options = {}) {
3829
+ if (body === null || body === void 0) {
3830
+ throw new Error("'body' is a required parameter but is null or undefined.");
3831
+ }
3832
+ const urlPath = "/v2/markasread";
3833
+ const queryParams = /* @__PURE__ */ new Map();
3834
+ let bodyJson = "";
3835
+ bodyJson = JSON.stringify(body || {});
3836
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3837
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3838
+ if (bearerToken) {
3839
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3840
+ }
3841
+ return Promise.race([
3842
+ fetch(fullUrl, fetchOptions).then((response) => {
3843
+ if (response.status == 204) {
3844
+ return response;
3845
+ } else if (response.status >= 200 && response.status < 300) {
3846
+ return response.json();
3847
+ } else {
3848
+ throw response;
3849
+ }
3850
+ }),
3851
+ new Promise(
3852
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3853
+ )
3854
+ ]);
3855
+ }
3827
3856
  /** set mute notification user channel. */
3828
3857
  setMuteNotificationCategory(bearerToken, body, options = {}) {
3829
3858
  if (body === null || body === void 0) {
@@ -8511,4 +8540,14 @@ var Client = class {
8511
8540
  });
8512
8541
  });
8513
8542
  }
8543
+ markAsRead(session, request) {
8544
+ return __async(this, null, function* () {
8545
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8546
+ yield this.sessionRefresh(session);
8547
+ }
8548
+ return this.apiClient.markAsRead(session.token, request).then((response) => {
8549
+ return Promise.resolve(response);
8550
+ });
8551
+ });
8552
+ }
8514
8553
  };
@@ -3795,6 +3795,35 @@ var MezonApi = class {
3795
3795
  )
3796
3796
  ]);
3797
3797
  }
3798
+ /** Mark as read */
3799
+ markAsRead(bearerToken, body, options = {}) {
3800
+ if (body === null || body === void 0) {
3801
+ throw new Error("'body' is a required parameter but is null or undefined.");
3802
+ }
3803
+ const urlPath = "/v2/markasread";
3804
+ const queryParams = /* @__PURE__ */ new Map();
3805
+ let bodyJson = "";
3806
+ bodyJson = JSON.stringify(body || {});
3807
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3808
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3809
+ if (bearerToken) {
3810
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3811
+ }
3812
+ return Promise.race([
3813
+ fetch(fullUrl, fetchOptions).then((response) => {
3814
+ if (response.status == 204) {
3815
+ return response;
3816
+ } else if (response.status >= 200 && response.status < 300) {
3817
+ return response.json();
3818
+ } else {
3819
+ throw response;
3820
+ }
3821
+ }),
3822
+ new Promise(
3823
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3824
+ )
3825
+ ]);
3826
+ }
3798
3827
  /** set mute notification user channel. */
3799
3828
  setMuteNotificationCategory(bearerToken, body, options = {}) {
3800
3829
  if (body === null || body === void 0) {
@@ -8482,6 +8511,16 @@ var Client = class {
8482
8511
  });
8483
8512
  });
8484
8513
  }
8514
+ markAsRead(session, request) {
8515
+ return __async(this, null, function* () {
8516
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8517
+ yield this.sessionRefresh(session);
8518
+ }
8519
+ return this.apiClient.markAsRead(session.token, request).then((response) => {
8520
+ return Promise.resolve(response);
8521
+ });
8522
+ });
8523
+ }
8485
8524
  };
8486
8525
  export {
8487
8526
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -293,6 +293,7 @@ export interface ChannelUpdatedEvent {
293
293
  status: number;
294
294
  meeting_code: string;
295
295
  is_error: boolean;
296
+ app_url: string;
296
297
  }
297
298
  export interface ChannelCreatedEvent {
298
299
  clan_id: string;
@@ -306,6 +307,7 @@ export interface ChannelCreatedEvent {
306
307
  status: number;
307
308
  parent_id: string;
308
309
  is_parent_public: boolean;
310
+ app_url: string;
309
311
  }
310
312
  export interface ChannelDeletedEvent {
311
313
  clan_id: string;
@@ -509,6 +511,7 @@ export interface ChannelDescription {
509
511
  channel_id?: string;
510
512
  type?: number;
511
513
  channel_label?: string;
514
+ app_url?: string;
512
515
  channel_private?: number;
513
516
  meeting_code?: string;
514
517
  clan_name?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.21",
4
+ "version": "2.9.23",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -422,6 +422,8 @@ export interface ChannelUpdatedEvent {
422
422
  meeting_code: string;
423
423
  // is error
424
424
  is_error: boolean;
425
+ // app url
426
+ app_url: string;
425
427
  }
426
428
 
427
429
  export interface ChannelCreatedEvent {
@@ -447,6 +449,8 @@ export interface ChannelCreatedEvent {
447
449
  parent_id: string;
448
450
  // parent public
449
451
  is_parent_public: boolean;
452
+ // app url
453
+ app_url: string;
450
454
  }
451
455
 
452
456
  export interface ChannelDeletedEvent {
@@ -743,6 +747,8 @@ export interface ChannelDescription {
743
747
  type?: number;
744
748
  // The channel lable
745
749
  channel_label?: string;
750
+ // The app url
751
+ app_url?: string;
746
752
  // The channel private
747
753
  channel_private?: number;
748
754
  // meeting code