mezon-js 2.7.25 → 2.7.26

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -620,6 +620,15 @@ export interface ApiLinkSteamRequest {
620
620
  sync?: boolean;
621
621
  }
622
622
 
623
+ export interface ApiNotifiReactMessage {
624
+ //
625
+ channel_id?: string;
626
+ //
627
+ id?: string;
628
+ //
629
+ user_id?: string;
630
+ }
631
+
623
632
  /** */
624
633
  export interface ApiMessageAttachment {
625
634
  //
@@ -708,6 +717,12 @@ export interface ApiNotification {
708
717
  subject?: string;
709
718
  }
710
719
 
720
+ /** */
721
+ export interface ApiNotificationChannel {
722
+ //
723
+ channel_id?: string;
724
+ }
725
+
711
726
  /** */
712
727
  export interface ApiNotificationChannelCategoySetting {
713
728
  //
@@ -4120,6 +4135,108 @@ return Promise.race([
4120
4135
  ]);
4121
4136
  }
4122
4137
 
4138
+ /** */
4139
+ deleteNotiReactMessage(bearerToken: string,
4140
+ channelId?:string,
4141
+ options: any = {}): Promise<any> {
4142
+
4143
+ const urlPath = "/v2/notifireactmessage/delete";
4144
+ const queryParams = new Map<string, any>();
4145
+ queryParams.set("channel_id", channelId);
4146
+
4147
+ let bodyJson : string = "";
4148
+
4149
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4150
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
4151
+ if (bearerToken) {
4152
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4153
+ }
4154
+
4155
+ return Promise.race([
4156
+ fetch(fullUrl, fetchOptions).then((response) => {
4157
+ if (response.status == 204) {
4158
+ return response;
4159
+ } else if (response.status >= 200 && response.status < 300) {
4160
+ return response.json();
4161
+ } else {
4162
+ throw response;
4163
+ }
4164
+ }),
4165
+ new Promise((_, reject) =>
4166
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4167
+ ),
4168
+ ]);
4169
+ }
4170
+
4171
+ /** */
4172
+ getNotificationReactMessage(bearerToken: string,
4173
+ channelId?:string,
4174
+ options: any = {}): Promise<ApiNotifiReactMessage> {
4175
+
4176
+ const urlPath = "/v2/notifireactmessage/get";
4177
+ const queryParams = new Map<string, any>();
4178
+ queryParams.set("channel_id", channelId);
4179
+
4180
+ let bodyJson : string = "";
4181
+
4182
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4183
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4184
+ if (bearerToken) {
4185
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4186
+ }
4187
+
4188
+ return Promise.race([
4189
+ fetch(fullUrl, fetchOptions).then((response) => {
4190
+ if (response.status == 204) {
4191
+ return response;
4192
+ } else if (response.status >= 200 && response.status < 300) {
4193
+ return response.json();
4194
+ } else {
4195
+ throw response;
4196
+ }
4197
+ }),
4198
+ new Promise((_, reject) =>
4199
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4200
+ ),
4201
+ ]);
4202
+ }
4203
+
4204
+ /** */
4205
+ setNotificationReactMessage(bearerToken: string,
4206
+ body:ApiNotificationChannel,
4207
+ options: any = {}): Promise<any> {
4208
+
4209
+ if (body === null || body === undefined) {
4210
+ throw new Error("'body' is a required parameter but is null or undefined.");
4211
+ }
4212
+ const urlPath = "/v2/notifireactmessage/set";
4213
+ const queryParams = new Map<string, any>();
4214
+
4215
+ let bodyJson : string = "";
4216
+ bodyJson = JSON.stringify(body || {});
4217
+
4218
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4219
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4220
+ if (bearerToken) {
4221
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4222
+ }
4223
+
4224
+ return Promise.race([
4225
+ fetch(fullUrl, fetchOptions).then((response) => {
4226
+ if (response.status == 204) {
4227
+ return response;
4228
+ } else if (response.status >= 200 && response.status < 300) {
4229
+ return response.json();
4230
+ } else {
4231
+ throw response;
4232
+ }
4233
+ }),
4234
+ new Promise((_, reject) =>
4235
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4236
+ ),
4237
+ ]);
4238
+ }
4239
+
4123
4240
  /** Get permission list */
4124
4241
  getListPermission(bearerToken: string,
4125
4242
  options: any = {}): Promise<ApiPermissionList> {
package/client.ts CHANGED
@@ -84,6 +84,7 @@ import {
84
84
  ApiSetDefaultNotificationRequest,
85
85
  ApiNotificationUserChannel,
86
86
  ApiSetNotificationRequest,
87
+ ApiNotifiReactMessage,
87
88
  } from "./api.gen";
88
89
 
89
90
  import { Session } from "./session";
@@ -2053,6 +2054,41 @@ async deleteNotificationChannel(session: Session, channel_id: string): Promise<b
2053
2054
  return response !== undefined;
2054
2055
  });
2055
2056
  }
2057
+
2058
+ /** */
2059
+ async setNotificationReactMessage(session: Session, channel_id: string): Promise<boolean> {
2060
+ if (this.autoRefreshSession && session.refresh_token &&
2061
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2062
+ await this.sessionRefresh(session);
2063
+ }
2064
+
2065
+ return this.apiClient.setNotificationReactMessage(session.token, {channel_id}).then((response: any) => {
2066
+ return response !== undefined;
2067
+ });
2068
+ }
2069
+
2070
+ /** */
2071
+ async getNotificationReactMessage(session: Session, channelId: string): Promise<ApiNotifiReactMessage> {
2072
+ if (this.autoRefreshSession && session.refresh_token &&
2073
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2074
+ await this.sessionRefresh(session);
2075
+ }
2076
+
2077
+ return this.apiClient.getNotificationReactMessage(session.token, channelId).then((response: ApiNotifiReactMessage) => {
2078
+ return Promise.resolve(response);
2079
+ });
2080
+ }
2081
+ //** */
2082
+ async deleteNotiReactMessage(session: Session, channel_id: string): Promise<boolean> {
2083
+ if (this.autoRefreshSession && session.refresh_token &&
2084
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2085
+ await this.sessionRefresh(session);
2086
+ }
2087
+
2088
+ return this.apiClient.deleteNotiReactMessage(session.token, channel_id).then((response: any) => {
2089
+ return response !== undefined;
2090
+ });
2091
+ }
2056
2092
  };
2057
2093
 
2058
2094
 
package/dist/api.gen.d.ts CHANGED
@@ -355,6 +355,11 @@ export interface ApiLinkSteamRequest {
355
355
  account?: ApiAccountSteam;
356
356
  sync?: boolean;
357
357
  }
358
+ export interface ApiNotifiReactMessage {
359
+ channel_id?: string;
360
+ id?: string;
361
+ user_id?: string;
362
+ }
358
363
  /** */
359
364
  export interface ApiMessageAttachment {
360
365
  filename?: string;
@@ -406,6 +411,10 @@ export interface ApiNotification {
406
411
  subject?: string;
407
412
  }
408
413
  /** */
414
+ export interface ApiNotificationChannel {
415
+ channel_id?: string;
416
+ }
417
+ /** */
409
418
  export interface ApiNotificationChannelCategoySetting {
410
419
  channel_category_label?: string;
411
420
  channel_category_title?: string;
@@ -811,6 +820,12 @@ export declare class MezonApi {
811
820
  getNotificationClanSetting(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationSetting>;
812
821
  /** notification category, channel selected */
813
822
  getChannelCategoryNotiSettingsList(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationChannelCategoySettingsList>;
823
+ /** */
824
+ deleteNotiReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<any>;
825
+ /** */
826
+ getNotificationReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotifiReactMessage>;
827
+ /** */
828
+ setNotificationReactMessage(bearerToken: string, body: ApiNotificationChannel, options?: any): Promise<any>;
814
829
  /** Get permission list */
815
830
  getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
816
831
  /** */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -556,4 +556,9 @@ export declare class Client {
556
556
  deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
557
557
  getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList>;
558
558
  deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
559
+ /** */
560
+ setNotificationReactMessage(session: Session, channel_id: string): Promise<boolean>;
561
+ /** */
562
+ getNotificationReactMessage(session: Session, channelId: string): Promise<ApiNotifiReactMessage>;
563
+ deleteNotiReactMessage(session: Session, channel_id: string): Promise<boolean>;
559
564
  }
@@ -2984,6 +2984,87 @@ var MezonApi = class {
2984
2984
  )
2985
2985
  ]);
2986
2986
  }
2987
+ /** */
2988
+ deleteNotiReactMessage(bearerToken, channelId, options = {}) {
2989
+ const urlPath = "/v2/notifireactmessage/delete";
2990
+ const queryParams = /* @__PURE__ */ new Map();
2991
+ queryParams.set("channel_id", channelId);
2992
+ let bodyJson = "";
2993
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2994
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2995
+ if (bearerToken) {
2996
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2997
+ }
2998
+ return Promise.race([
2999
+ fetch(fullUrl, fetchOptions).then((response) => {
3000
+ if (response.status == 204) {
3001
+ return response;
3002
+ } else if (response.status >= 200 && response.status < 300) {
3003
+ return response.json();
3004
+ } else {
3005
+ throw response;
3006
+ }
3007
+ }),
3008
+ new Promise(
3009
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3010
+ )
3011
+ ]);
3012
+ }
3013
+ /** */
3014
+ getNotificationReactMessage(bearerToken, channelId, options = {}) {
3015
+ const urlPath = "/v2/notifireactmessage/get";
3016
+ const queryParams = /* @__PURE__ */ new Map();
3017
+ queryParams.set("channel_id", channelId);
3018
+ let bodyJson = "";
3019
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3020
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3021
+ if (bearerToken) {
3022
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3023
+ }
3024
+ return Promise.race([
3025
+ fetch(fullUrl, fetchOptions).then((response) => {
3026
+ if (response.status == 204) {
3027
+ return response;
3028
+ } else if (response.status >= 200 && response.status < 300) {
3029
+ return response.json();
3030
+ } else {
3031
+ throw response;
3032
+ }
3033
+ }),
3034
+ new Promise(
3035
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3036
+ )
3037
+ ]);
3038
+ }
3039
+ /** */
3040
+ setNotificationReactMessage(bearerToken, body, options = {}) {
3041
+ if (body === null || body === void 0) {
3042
+ throw new Error("'body' is a required parameter but is null or undefined.");
3043
+ }
3044
+ const urlPath = "/v2/notifireactmessage/set";
3045
+ const queryParams = /* @__PURE__ */ new Map();
3046
+ let bodyJson = "";
3047
+ bodyJson = JSON.stringify(body || {});
3048
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3049
+ const fetchOptions = buildFetchOptions("POST", 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
+ }
2987
3068
  /** Get permission list */
2988
3069
  getListPermission(bearerToken, options = {}) {
2989
3070
  const urlPath = "/v2/permissions";
@@ -5795,6 +5876,39 @@ var Client = class {
5795
5876
  });
5796
5877
  });
5797
5878
  }
5879
+ /** */
5880
+ setNotificationReactMessage(session, channel_id) {
5881
+ return __async(this, null, function* () {
5882
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5883
+ yield this.sessionRefresh(session);
5884
+ }
5885
+ return this.apiClient.setNotificationReactMessage(session.token, { channel_id }).then((response) => {
5886
+ return response !== void 0;
5887
+ });
5888
+ });
5889
+ }
5890
+ /** */
5891
+ getNotificationReactMessage(session, channelId) {
5892
+ return __async(this, null, function* () {
5893
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5894
+ yield this.sessionRefresh(session);
5895
+ }
5896
+ return this.apiClient.getNotificationReactMessage(session.token, channelId).then((response) => {
5897
+ return Promise.resolve(response);
5898
+ });
5899
+ });
5900
+ }
5901
+ //** */
5902
+ deleteNotiReactMessage(session, channel_id) {
5903
+ return __async(this, null, function* () {
5904
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5905
+ yield this.sessionRefresh(session);
5906
+ }
5907
+ return this.apiClient.deleteNotiReactMessage(session.token, channel_id).then((response) => {
5908
+ return response !== void 0;
5909
+ });
5910
+ });
5911
+ }
5798
5912
  };
5799
5913
  export {
5800
5914
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.25",
3
+ "version": "2.7.26",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },