mezon-js 2.7.27 → 2.7.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/api.gen.ts +48 -0
  2. package/client.ts +13 -0
  3. package/package.json +1 -1
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.27",
3
+ "version": "2.7.28",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },