mezon-js 2.7.27 → 2.7.29

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -761,6 +761,8 @@ export interface ApiNotificationSetting {
761
761
 
762
762
  /** */
763
763
  export interface ApiNotificationUserChannel {
764
+ //
765
+ active?: number;
764
766
  //
765
767
  id?: string;
766
768
  //
@@ -905,6 +907,16 @@ export interface ApiSetDefaultNotificationRequest {
905
907
  notification_type?: string;
906
908
  }
907
909
 
910
+ /** */
911
+ export interface ApiSetMuteNotificationRequest {
912
+ //
913
+ active?: number;
914
+ //
915
+ channel_id?: string;
916
+ //
917
+ notification_type?: string;
918
+ }
919
+
908
920
  /** */
909
921
  export interface ApiSetNotificationRequest {
910
922
  //
@@ -3763,6 +3775,42 @@ return Promise.race([
3763
3775
  ]);
3764
3776
  }
3765
3777
 
3778
+ /** set mute notification user channel. */
3779
+ setMuteNotificationChannel(bearerToken: string,
3780
+ body:ApiSetMuteNotificationRequest,
3781
+ options: any = {}): Promise<any> {
3782
+
3783
+ if (body === null || body === undefined) {
3784
+ throw new Error("'body' is a required parameter but is null or undefined.");
3785
+ }
3786
+ const urlPath = "/v2/mutenotificationchannel/set";
3787
+ const queryParams = new Map<string, any>();
3788
+
3789
+ let bodyJson : string = "";
3790
+ bodyJson = JSON.stringify(body || {});
3791
+
3792
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3793
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3794
+ if (bearerToken) {
3795
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3796
+ }
3797
+
3798
+ return Promise.race([
3799
+ fetch(fullUrl, fetchOptions).then((response) => {
3800
+ if (response.status == 204) {
3801
+ return response;
3802
+ } else if (response.status >= 200 && response.status < 300) {
3803
+ return response.json();
3804
+ } else {
3805
+ throw response;
3806
+ }
3807
+ }),
3808
+ new Promise((_, reject) =>
3809
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3810
+ ),
3811
+ ]);
3812
+ }
3813
+
3766
3814
  /** Delete one or more notifications for the current user. */
3767
3815
  deleteNotifications(bearerToken: string,
3768
3816
  ids?:Array<string>,
package/client.ts CHANGED
@@ -85,6 +85,7 @@ import {
85
85
  ApiNotificationUserChannel,
86
86
  ApiSetNotificationRequest,
87
87
  ApiNotifiReactMessage,
88
+ ApiSetMuteNotificationRequest,
88
89
  } from "./api.gen";
89
90
 
90
91
  import { Session } from "./session";
@@ -1986,6 +1987,18 @@ async setNotificationChannel(session: Session, request: ApiSetNotificationReques
1986
1987
  });
1987
1988
  }
1988
1989
 
1990
+ /** Set notification channel*/
1991
+ async setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean> {
1992
+ if (this.autoRefreshSession && session.refresh_token &&
1993
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1994
+ await this.sessionRefresh(session);
1995
+ }
1996
+
1997
+ return this.apiClient.setMuteNotificationChannel(session.token, request).then((response: any) => {
1998
+ return response !== undefined;
1999
+ });
2000
+ }
2001
+
1989
2002
  /** get default notification clan */
1990
2003
  async getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel> {
1991
2004
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -438,6 +438,7 @@ export interface ApiNotificationSetting {
438
438
  }
439
439
  /** */
440
440
  export interface ApiNotificationUserChannel {
441
+ active?: number;
441
442
  id?: string;
442
443
  notification_setting_type?: string;
443
444
  time_mute?: string;
@@ -523,6 +524,12 @@ export interface ApiSetDefaultNotificationRequest {
523
524
  notification_type?: string;
524
525
  }
525
526
  /** */
527
+ export interface ApiSetMuteNotificationRequest {
528
+ active?: number;
529
+ channel_id?: string;
530
+ notification_type?: string;
531
+ }
532
+ /** */
526
533
  export interface ApiSetNotificationRequest {
527
534
  channel_id?: string;
528
535
  notification_type?: string;
@@ -799,6 +806,8 @@ export declare class MezonApi {
799
806
  getLinkInvite(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
800
807
  /** Add users to a channel. */
801
808
  inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
809
+ /** set mute notification user channel. */
810
+ setMuteNotificationChannel(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
802
811
  /** Delete one or more notifications for the current user. */
803
812
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
804
813
  /** Fetch list of notifications. */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -547,6 +547,8 @@ export declare class Client {
547
547
  getNotificationClanSetting(session: Session, clanId: string): Promise<ApiNotificationSetting>;
548
548
  /** Set notification channel*/
549
549
  setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
550
+ /** Set notification channel*/
551
+ setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean>;
550
552
  /** get default notification clan */
551
553
  getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel>;
552
554
  /** Set default notification category*/
@@ -2717,6 +2717,35 @@ var MezonApi = class {
2717
2717
  )
2718
2718
  ]);
2719
2719
  }
2720
+ /** set mute notification user channel. */
2721
+ setMuteNotificationChannel(bearerToken, body, options = {}) {
2722
+ if (body === null || body === void 0) {
2723
+ throw new Error("'body' is a required parameter but is null or undefined.");
2724
+ }
2725
+ const urlPath = "/v2/mutenotificationchannel/set";
2726
+ const queryParams = /* @__PURE__ */ new Map();
2727
+ let bodyJson = "";
2728
+ bodyJson = JSON.stringify(body || {});
2729
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2730
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2731
+ if (bearerToken) {
2732
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2733
+ }
2734
+ return Promise.race([
2735
+ fetch(fullUrl, fetchOptions).then((response) => {
2736
+ if (response.status == 204) {
2737
+ return response;
2738
+ } else if (response.status >= 200 && response.status < 300) {
2739
+ return response.json();
2740
+ } else {
2741
+ throw response;
2742
+ }
2743
+ }),
2744
+ new Promise(
2745
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2746
+ )
2747
+ ]);
2748
+ }
2720
2749
  /** Delete one or more notifications for the current user. */
2721
2750
  deleteNotifications(bearerToken, ids, options = {}) {
2722
2751
  const urlPath = "/v2/notification";
@@ -5842,6 +5871,17 @@ var Client = class {
5842
5871
  });
5843
5872
  });
5844
5873
  }
5874
+ /** Set notification channel*/
5875
+ setMuteNotificationChannel(session, request) {
5876
+ return __async(this, null, function* () {
5877
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5878
+ yield this.sessionRefresh(session);
5879
+ }
5880
+ return this.apiClient.setMuteNotificationChannel(session.token, request).then((response) => {
5881
+ return response !== void 0;
5882
+ });
5883
+ });
5884
+ }
5845
5885
  /** get default notification clan */
5846
5886
  getNotificationChannel(session, channelId) {
5847
5887
  return __async(this, null, function* () {
@@ -2688,6 +2688,35 @@ var MezonApi = class {
2688
2688
  )
2689
2689
  ]);
2690
2690
  }
2691
+ /** set mute notification user channel. */
2692
+ setMuteNotificationChannel(bearerToken, body, options = {}) {
2693
+ if (body === null || body === void 0) {
2694
+ throw new Error("'body' is a required parameter but is null or undefined.");
2695
+ }
2696
+ const urlPath = "/v2/mutenotificationchannel/set";
2697
+ const queryParams = /* @__PURE__ */ new Map();
2698
+ let bodyJson = "";
2699
+ bodyJson = JSON.stringify(body || {});
2700
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2701
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2702
+ if (bearerToken) {
2703
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2704
+ }
2705
+ return Promise.race([
2706
+ fetch(fullUrl, fetchOptions).then((response) => {
2707
+ if (response.status == 204) {
2708
+ return response;
2709
+ } else if (response.status >= 200 && response.status < 300) {
2710
+ return response.json();
2711
+ } else {
2712
+ throw response;
2713
+ }
2714
+ }),
2715
+ new Promise(
2716
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2717
+ )
2718
+ ]);
2719
+ }
2691
2720
  /** Delete one or more notifications for the current user. */
2692
2721
  deleteNotifications(bearerToken, ids, options = {}) {
2693
2722
  const urlPath = "/v2/notification";
@@ -5813,6 +5842,17 @@ var Client = class {
5813
5842
  });
5814
5843
  });
5815
5844
  }
5845
+ /** Set notification channel*/
5846
+ setMuteNotificationChannel(session, request) {
5847
+ return __async(this, null, function* () {
5848
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5849
+ yield this.sessionRefresh(session);
5850
+ }
5851
+ return this.apiClient.setMuteNotificationChannel(session.token, request).then((response) => {
5852
+ return response !== void 0;
5853
+ });
5854
+ });
5855
+ }
5816
5856
  /** get default notification clan */
5817
5857
  getNotificationChannel(session, channelId) {
5818
5858
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.27",
3
+ "version": "2.7.29",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },