mezon-js 2.7.26 → 2.7.28
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 +50 -0
- package/client.ts +13 -0
- package/dist/api.gen.d.ts +1 -0
- package/dist/mezon-js.cjs.js +114 -0
- package/dist/mezon-js.esm.mjs +5921 -5921
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -234,6 +234,8 @@ export interface ApiChannelDescription {
|
|
234
234
|
meeting_uri?: string;
|
235
235
|
//The parrent channel this message belongs to.
|
236
236
|
parrent_id?: string;
|
237
|
+
//
|
238
|
+
status?: number;
|
237
239
|
//The channel type.
|
238
240
|
type?: number;
|
239
241
|
//
|
@@ -759,6 +761,8 @@ export interface ApiNotificationSetting {
|
|
759
761
|
|
760
762
|
/** */
|
761
763
|
export interface ApiNotificationUserChannel {
|
764
|
+
//
|
765
|
+
active?: number;
|
762
766
|
//
|
763
767
|
id?: string;
|
764
768
|
//
|
@@ -903,6 +907,16 @@ export interface ApiSetDefaultNotificationRequest {
|
|
903
907
|
notification_type?: string;
|
904
908
|
}
|
905
909
|
|
910
|
+
/** */
|
911
|
+
export interface ApiSetMuteNotificationRequest {
|
912
|
+
//
|
913
|
+
active?: number;
|
914
|
+
//
|
915
|
+
channel_id?: string;
|
916
|
+
//
|
917
|
+
notification_type?: string;
|
918
|
+
}
|
919
|
+
|
906
920
|
/** */
|
907
921
|
export interface ApiSetNotificationRequest {
|
908
922
|
//
|
@@ -3761,6 +3775,42 @@ return Promise.race([
|
|
3761
3775
|
]);
|
3762
3776
|
}
|
3763
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
|
+
|
3764
3814
|
/** Delete one or more notifications for the current user. */
|
3765
3815
|
deleteNotifications(bearerToken: string,
|
3766
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
package/dist/mezon-js.cjs.js
CHANGED
@@ -3013,6 +3013,87 @@ var MezonApi = class {
|
|
3013
3013
|
)
|
3014
3014
|
]);
|
3015
3015
|
}
|
3016
|
+
/** */
|
3017
|
+
deleteNotiReactMessage(bearerToken, channelId, options = {}) {
|
3018
|
+
const urlPath = "/v2/notifireactmessage/delete";
|
3019
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3020
|
+
queryParams.set("channel_id", channelId);
|
3021
|
+
let bodyJson = "";
|
3022
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3023
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
3024
|
+
if (bearerToken) {
|
3025
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3026
|
+
}
|
3027
|
+
return Promise.race([
|
3028
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3029
|
+
if (response.status == 204) {
|
3030
|
+
return response;
|
3031
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3032
|
+
return response.json();
|
3033
|
+
} else {
|
3034
|
+
throw response;
|
3035
|
+
}
|
3036
|
+
}),
|
3037
|
+
new Promise(
|
3038
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3039
|
+
)
|
3040
|
+
]);
|
3041
|
+
}
|
3042
|
+
/** */
|
3043
|
+
getNotificationReactMessage(bearerToken, channelId, options = {}) {
|
3044
|
+
const urlPath = "/v2/notifireactmessage/get";
|
3045
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3046
|
+
queryParams.set("channel_id", channelId);
|
3047
|
+
let bodyJson = "";
|
3048
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3049
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3050
|
+
if (bearerToken) {
|
3051
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3052
|
+
}
|
3053
|
+
return Promise.race([
|
3054
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3055
|
+
if (response.status == 204) {
|
3056
|
+
return response;
|
3057
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3058
|
+
return response.json();
|
3059
|
+
} else {
|
3060
|
+
throw response;
|
3061
|
+
}
|
3062
|
+
}),
|
3063
|
+
new Promise(
|
3064
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3065
|
+
)
|
3066
|
+
]);
|
3067
|
+
}
|
3068
|
+
/** */
|
3069
|
+
setNotificationReactMessage(bearerToken, body, options = {}) {
|
3070
|
+
if (body === null || body === void 0) {
|
3071
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3072
|
+
}
|
3073
|
+
const urlPath = "/v2/notifireactmessage/set";
|
3074
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3075
|
+
let bodyJson = "";
|
3076
|
+
bodyJson = JSON.stringify(body || {});
|
3077
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3078
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3079
|
+
if (bearerToken) {
|
3080
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3081
|
+
}
|
3082
|
+
return Promise.race([
|
3083
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3084
|
+
if (response.status == 204) {
|
3085
|
+
return response;
|
3086
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3087
|
+
return response.json();
|
3088
|
+
} else {
|
3089
|
+
throw response;
|
3090
|
+
}
|
3091
|
+
}),
|
3092
|
+
new Promise(
|
3093
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3094
|
+
)
|
3095
|
+
]);
|
3096
|
+
}
|
3016
3097
|
/** Get permission list */
|
3017
3098
|
getListPermission(bearerToken, options = {}) {
|
3018
3099
|
const urlPath = "/v2/permissions";
|
@@ -5824,4 +5905,37 @@ var Client = class {
|
|
5824
5905
|
});
|
5825
5906
|
});
|
5826
5907
|
}
|
5908
|
+
/** */
|
5909
|
+
setNotificationReactMessage(session, channel_id) {
|
5910
|
+
return __async(this, null, function* () {
|
5911
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5912
|
+
yield this.sessionRefresh(session);
|
5913
|
+
}
|
5914
|
+
return this.apiClient.setNotificationReactMessage(session.token, { channel_id }).then((response) => {
|
5915
|
+
return response !== void 0;
|
5916
|
+
});
|
5917
|
+
});
|
5918
|
+
}
|
5919
|
+
/** */
|
5920
|
+
getNotificationReactMessage(session, channelId) {
|
5921
|
+
return __async(this, null, function* () {
|
5922
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5923
|
+
yield this.sessionRefresh(session);
|
5924
|
+
}
|
5925
|
+
return this.apiClient.getNotificationReactMessage(session.token, channelId).then((response) => {
|
5926
|
+
return Promise.resolve(response);
|
5927
|
+
});
|
5928
|
+
});
|
5929
|
+
}
|
5930
|
+
//** */
|
5931
|
+
deleteNotiReactMessage(session, channel_id) {
|
5932
|
+
return __async(this, null, function* () {
|
5933
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5934
|
+
yield this.sessionRefresh(session);
|
5935
|
+
}
|
5936
|
+
return this.apiClient.deleteNotiReactMessage(session.token, channel_id).then((response) => {
|
5937
|
+
return response !== void 0;
|
5938
|
+
});
|
5939
|
+
});
|
5940
|
+
}
|
5827
5941
|
};
|