mezon-js 2.7.22 → 2.7.23

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -704,6 +704,24 @@ export interface ApiNotification {
704
704
  subject?: string;
705
705
  }
706
706
 
707
+ /** */
708
+ export interface ApiNotificationChannelCategoySetting {
709
+ //
710
+ channel_category_label?: string;
711
+ //
712
+ channel_category_title?: string;
713
+ //
714
+ id?: string;
715
+ //
716
+ notification_setting_type?: string;
717
+ }
718
+
719
+ /** */
720
+ export interface ApiNotificationChannelCategoySettingsList {
721
+ //
722
+ noti_channel_categoy_setting?: Array<ApiNotificationChannelCategoySetting>;
723
+ }
724
+
707
725
  /** A collection of zero or more notifications. */
708
726
  export interface ApiNotificationList {
709
727
  //Use this cursor to paginate notifications. Cache this to catch up to new notifications.
@@ -712,6 +730,24 @@ export interface ApiNotificationList {
712
730
  notifications?: Array<ApiNotification>;
713
731
  }
714
732
 
733
+ /** */
734
+ export interface ApiNotificationSetting {
735
+ //
736
+ id?: string;
737
+ //
738
+ notification_setting_type?: string;
739
+ }
740
+
741
+ /** */
742
+ export interface ApiNotificationUserChannel {
743
+ //
744
+ id?: string;
745
+ //
746
+ notification_setting_type?: string;
747
+ //
748
+ time_mute?: string;
749
+ }
750
+
715
751
  /** */
716
752
  export interface ApiPermission {
717
753
  //
@@ -838,6 +874,26 @@ export interface ApiSessionRefreshRequest {
838
874
  vars?: Record<string, string>;
839
875
  }
840
876
 
877
+ /** */
878
+ export interface ApiSetDefaultNotificationRequest {
879
+ //
880
+ category_id?: string;
881
+ //
882
+ clan_id?: string;
883
+ //
884
+ notification_type?: string;
885
+ }
886
+
887
+ /** */
888
+ export interface ApiSetNotificationRequest {
889
+ //
890
+ channel_id?: string;
891
+ //
892
+ notification_type?: string;
893
+ //
894
+ time_mute?: string;
895
+ }
896
+
841
897
  /** An object within the storage engine. */
842
898
  export interface ApiStorageObject {
843
899
  //The collection which stores the object.
@@ -3754,6 +3810,312 @@ return Promise.race([
3754
3810
  ]);
3755
3811
  }
3756
3812
 
3813
+ /** notification selected */
3814
+ getNotificationChannelSetting(bearerToken: string,
3815
+ channelId?:string,
3816
+ options: any = {}): Promise<ApiNotificationUserChannel> {
3817
+
3818
+ const urlPath = "/v2/notificationchannel/get";
3819
+ const queryParams = new Map<string, any>();
3820
+ queryParams.set("channel_id", channelId);
3821
+
3822
+ let bodyJson : string = "";
3823
+
3824
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3825
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3826
+ if (bearerToken) {
3827
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3828
+ }
3829
+
3830
+ return Promise.race([
3831
+ fetch(fullUrl, fetchOptions).then((response) => {
3832
+ if (response.status == 204) {
3833
+ return response;
3834
+ } else if (response.status >= 200 && response.status < 300) {
3835
+ return response.json();
3836
+ } else {
3837
+ throw response;
3838
+ }
3839
+ }),
3840
+ new Promise((_, reject) =>
3841
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3842
+ ),
3843
+ ]);
3844
+ }
3845
+
3846
+ /** set notification user channel. */
3847
+ setNotificationChannelSetting(bearerToken: string,
3848
+ body:ApiSetNotificationRequest,
3849
+ options: any = {}): Promise<any> {
3850
+
3851
+ if (body === null || body === undefined) {
3852
+ throw new Error("'body' is a required parameter but is null or undefined.");
3853
+ }
3854
+ const urlPath = "/v2/notificationchannel/set";
3855
+ const queryParams = new Map<string, any>();
3856
+
3857
+ let bodyJson : string = "";
3858
+ bodyJson = JSON.stringify(body || {});
3859
+
3860
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3861
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3862
+ if (bearerToken) {
3863
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3864
+ }
3865
+
3866
+ return Promise.race([
3867
+ fetch(fullUrl, fetchOptions).then((response) => {
3868
+ if (response.status == 204) {
3869
+ return response;
3870
+ } else if (response.status >= 200 && response.status < 300) {
3871
+ return response.json();
3872
+ } else {
3873
+ throw response;
3874
+ }
3875
+ }),
3876
+ new Promise((_, reject) =>
3877
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3878
+ ),
3879
+ ]);
3880
+ }
3881
+
3882
+ /** set notification user channel. */
3883
+ setNotificationClanSetting(bearerToken: string,
3884
+ body:ApiSetDefaultNotificationRequest,
3885
+ options: any = {}): Promise<any> {
3886
+
3887
+ if (body === null || body === undefined) {
3888
+ throw new Error("'body' is a required parameter but is null or undefined.");
3889
+ }
3890
+ const urlPath = "/v2/notificationclan/set";
3891
+ const queryParams = new Map<string, any>();
3892
+
3893
+ let bodyJson : string = "";
3894
+ bodyJson = JSON.stringify(body || {});
3895
+
3896
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3897
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3898
+ if (bearerToken) {
3899
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3900
+ }
3901
+
3902
+ return Promise.race([
3903
+ fetch(fullUrl, fetchOptions).then((response) => {
3904
+ if (response.status == 204) {
3905
+ return response;
3906
+ } else if (response.status >= 200 && response.status < 300) {
3907
+ return response.json();
3908
+ } else {
3909
+ throw response;
3910
+ }
3911
+ }),
3912
+ new Promise((_, reject) =>
3913
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3914
+ ),
3915
+ ]);
3916
+ }
3917
+
3918
+ /** set notification user channel. */
3919
+ setNotificationCategorySetting(bearerToken: string,
3920
+ body:ApiSetDefaultNotificationRequest,
3921
+ options: any = {}): Promise<any> {
3922
+
3923
+ if (body === null || body === undefined) {
3924
+ throw new Error("'body' is a required parameter but is null or undefined.");
3925
+ }
3926
+ const urlPath = "/v2/notificationucategory/set";
3927
+ const queryParams = new Map<string, any>();
3928
+
3929
+ let bodyJson : string = "";
3930
+ bodyJson = JSON.stringify(body || {});
3931
+
3932
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3933
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3934
+ if (bearerToken) {
3935
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3936
+ }
3937
+
3938
+ return Promise.race([
3939
+ fetch(fullUrl, fetchOptions).then((response) => {
3940
+ if (response.status == 204) {
3941
+ return response;
3942
+ } else if (response.status >= 200 && response.status < 300) {
3943
+ return response.json();
3944
+ } else {
3945
+ throw response;
3946
+ }
3947
+ }),
3948
+ new Promise((_, reject) =>
3949
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3950
+ ),
3951
+ ]);
3952
+ }
3953
+
3954
+ /** */
3955
+ deleteNotificationCategorySetting(bearerToken: string,
3956
+ categoryId?:string,
3957
+ options: any = {}): Promise<any> {
3958
+
3959
+ const urlPath = "/v2/notificationusercategory/delete";
3960
+ const queryParams = new Map<string, any>();
3961
+ queryParams.set("category_id", categoryId);
3962
+
3963
+ let bodyJson : string = "";
3964
+
3965
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3966
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
3967
+ if (bearerToken) {
3968
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3969
+ }
3970
+
3971
+ return Promise.race([
3972
+ fetch(fullUrl, fetchOptions).then((response) => {
3973
+ if (response.status == 204) {
3974
+ return response;
3975
+ } else if (response.status >= 200 && response.status < 300) {
3976
+ return response.json();
3977
+ } else {
3978
+ throw response;
3979
+ }
3980
+ }),
3981
+ new Promise((_, reject) =>
3982
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3983
+ ),
3984
+ ]);
3985
+ }
3986
+
3987
+ /** notification selected */
3988
+ getNotificationCategorySetting(bearerToken: string,
3989
+ categoryId?:string,
3990
+ options: any = {}): Promise<ApiNotificationSetting> {
3991
+
3992
+ const urlPath = "/v2/notificationusercategory/get";
3993
+ const queryParams = new Map<string, any>();
3994
+ queryParams.set("category_id", categoryId);
3995
+
3996
+ let bodyJson : string = "";
3997
+
3998
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3999
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4000
+ if (bearerToken) {
4001
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4002
+ }
4003
+
4004
+ return Promise.race([
4005
+ fetch(fullUrl, fetchOptions).then((response) => {
4006
+ if (response.status == 204) {
4007
+ return response;
4008
+ } else if (response.status >= 200 && response.status < 300) {
4009
+ return response.json();
4010
+ } else {
4011
+ throw response;
4012
+ }
4013
+ }),
4014
+ new Promise((_, reject) =>
4015
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4016
+ ),
4017
+ ]);
4018
+ }
4019
+
4020
+ /** */
4021
+ deleteNotificationChannel(bearerToken: string,
4022
+ channelId?:string,
4023
+ options: any = {}): Promise<any> {
4024
+
4025
+ const urlPath = "/v2/notificationuserchannel/delete";
4026
+ const queryParams = new Map<string, any>();
4027
+ queryParams.set("channel_id", channelId);
4028
+
4029
+ let bodyJson : string = "";
4030
+
4031
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4032
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
4033
+ if (bearerToken) {
4034
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4035
+ }
4036
+
4037
+ return Promise.race([
4038
+ fetch(fullUrl, fetchOptions).then((response) => {
4039
+ if (response.status == 204) {
4040
+ return response;
4041
+ } else if (response.status >= 200 && response.status < 300) {
4042
+ return response.json();
4043
+ } else {
4044
+ throw response;
4045
+ }
4046
+ }),
4047
+ new Promise((_, reject) =>
4048
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4049
+ ),
4050
+ ]);
4051
+ }
4052
+
4053
+ /** notification selected */
4054
+ getNotificationClanSetting(bearerToken: string,
4055
+ clanId?:string,
4056
+ options: any = {}): Promise<ApiNotificationSetting> {
4057
+
4058
+ const urlPath = "/v2/notificationuserclan/get";
4059
+ const queryParams = new Map<string, any>();
4060
+ queryParams.set("clan_id", clanId);
4061
+
4062
+ let bodyJson : string = "";
4063
+
4064
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4065
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4066
+ if (bearerToken) {
4067
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4068
+ }
4069
+
4070
+ return Promise.race([
4071
+ fetch(fullUrl, fetchOptions).then((response) => {
4072
+ if (response.status == 204) {
4073
+ return response;
4074
+ } else if (response.status >= 200 && response.status < 300) {
4075
+ return response.json();
4076
+ } else {
4077
+ throw response;
4078
+ }
4079
+ }),
4080
+ new Promise((_, reject) =>
4081
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4082
+ ),
4083
+ ]);
4084
+ }
4085
+
4086
+ /** notification category, channel selected */
4087
+ getChannelCategoryNotiSettingsList(bearerToken: string,
4088
+ clanId?:string,
4089
+ options: any = {}): Promise<ApiNotificationChannelCategoySettingsList> {
4090
+
4091
+ const urlPath = "/v2/notifichannelcategory/get";
4092
+ const queryParams = new Map<string, any>();
4093
+ queryParams.set("clan_id", clanId);
4094
+
4095
+ let bodyJson : string = "";
4096
+
4097
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4098
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4099
+ if (bearerToken) {
4100
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4101
+ }
4102
+
4103
+ return Promise.race([
4104
+ fetch(fullUrl, fetchOptions).then((response) => {
4105
+ if (response.status == 204) {
4106
+ return response;
4107
+ } else if (response.status >= 200 && response.status < 300) {
4108
+ return response.json();
4109
+ } else {
4110
+ throw response;
4111
+ }
4112
+ }),
4113
+ new Promise((_, reject) =>
4114
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4115
+ ),
4116
+ ]);
4117
+ }
4118
+
3757
4119
  /** Get permission list */
3758
4120
  getListPermission(bearerToken: string,
3759
4121
  options: any = {}): Promise<ApiPermissionList> {
package/client.ts CHANGED
@@ -79,6 +79,11 @@ import {
79
79
  ApiEventManagement,
80
80
  ApiEventList,
81
81
  ApiDeleteEventRequest,
82
+ ApiNotificationChannelCategoySettingsList,
83
+ ApiNotificationSetting,
84
+ ApiSetDefaultNotificationRequest,
85
+ ApiNotificationUserChannel,
86
+ ApiSetNotificationRequest,
82
87
  } from "./api.gen";
83
88
 
84
89
  import { Session } from "./session";
@@ -1938,6 +1943,110 @@ export class Client {
1938
1943
 
1939
1944
  return this.apiClient.writeStorageObjects(session.token, request);
1940
1945
  }
1946
+ /** Set default notification clan*/
1947
+ async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
1948
+ if (this.autoRefreshSession && session.refresh_token &&
1949
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1950
+ await this.sessionRefresh(session);
1951
+ }
1952
+
1953
+ return this.apiClient.setNotificationClanSetting(session.token, request).then((response: any) => {
1954
+ return response !== undefined;
1955
+ });
1956
+ }
1957
+
1958
+ /** get default notification clan */
1959
+ async getNotificationClanSetting(session: Session, clanId: string): Promise<ApiNotificationSetting> {
1960
+ if (this.autoRefreshSession && session.refresh_token &&
1961
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1962
+ await this.sessionRefresh(session);
1963
+ }
1964
+
1965
+ return this.apiClient.getNotificationClanSetting(session.token, clanId, {}).then((response: ApiNotificationSetting) => {
1966
+ return Promise.resolve(response);
1967
+ });
1968
+ }
1969
+
1970
+ /** Set notification channel*/
1971
+ async setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean> {
1972
+ if (this.autoRefreshSession && session.refresh_token &&
1973
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1974
+ await this.sessionRefresh(session);
1975
+ }
1976
+
1977
+ return this.apiClient.setNotificationChannelSetting(session.token, request).then((response: any) => {
1978
+ return response !== undefined;
1979
+ });
1980
+ }
1981
+
1982
+ /** get default notification clan */
1983
+ async getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel> {
1984
+ if (this.autoRefreshSession && session.refresh_token &&
1985
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1986
+ await this.sessionRefresh(session);
1987
+ }
1988
+
1989
+ return this.apiClient.getNotificationChannelSetting(session.token, channelId, {}).then((response: ApiNotificationUserChannel) => {
1990
+ return Promise.resolve(response);
1991
+ });
1992
+ }
1993
+
1994
+ /** Set default notification category*/
1995
+ async setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
1996
+ if (this.autoRefreshSession && session.refresh_token &&
1997
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1998
+ await this.sessionRefresh(session);
1999
+ }
2000
+
2001
+ return this.apiClient.setNotificationCategorySetting(session.token, request).then((response: any) => {
2002
+ return response !== undefined;
2003
+ });
2004
+ }
2005
+
2006
+ /** get default notification category */
2007
+ async getNotificationCategory(session: Session, category_id: string): Promise<ApiNotificationSetting> {
2008
+ if (this.autoRefreshSession && session.refresh_token &&
2009
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2010
+ await this.sessionRefresh(session);
2011
+ }
2012
+
2013
+ return this.apiClient.getNotificationCategorySetting(session.token, category_id, {}).then((response: ApiNotificationSetting) => {
2014
+ return Promise.resolve(response);
2015
+ });
2016
+ }
2017
+
2018
+ async deleteNotificationCategory(session: Session, category_id: string): Promise<boolean> {
2019
+ if (this.autoRefreshSession && session.refresh_token &&
2020
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2021
+ await this.sessionRefresh(session);
2022
+ }
2023
+
2024
+ return this.apiClient.deleteNotificationCategorySetting(session.token, category_id).then((response: any) => {
2025
+ return response !== undefined;
2026
+ });
2027
+ }
2028
+
2029
+ async getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList> {
2030
+ if (this.autoRefreshSession && session.refresh_token &&
2031
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2032
+ await this.sessionRefresh(session);
2033
+ }
2034
+
2035
+ return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response: ApiNotificationChannelCategoySettingsList) => {
2036
+ return Promise.resolve(response);
2037
+ });
2038
+ }
2039
+
2040
+ async deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean> {
2041
+ if (this.autoRefreshSession && session.refresh_token &&
2042
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2043
+ await this.sessionRefresh(session);
2044
+ }
2045
+
2046
+ return this.apiClient.deleteNotificationChannel(session.token, channel_id).then((response: any) => {
2047
+ return response !== undefined;
2048
+ });
2049
+ }
1941
2050
  };
1942
2051
 
1943
2052
 
package/dist/api.gen.d.ts CHANGED
@@ -403,12 +403,34 @@ export interface ApiNotification {
403
403
  sender_id?: string;
404
404
  subject?: string;
405
405
  }
406
+ /** */
407
+ export interface ApiNotificationChannelCategoySetting {
408
+ channel_category_label?: string;
409
+ channel_category_title?: string;
410
+ id?: string;
411
+ notification_setting_type?: string;
412
+ }
413
+ /** */
414
+ export interface ApiNotificationChannelCategoySettingsList {
415
+ noti_channel_categoy_setting?: Array<ApiNotificationChannelCategoySetting>;
416
+ }
406
417
  /** A collection of zero or more notifications. */
407
418
  export interface ApiNotificationList {
408
419
  cacheable_cursor?: string;
409
420
  notifications?: Array<ApiNotification>;
410
421
  }
411
422
  /** */
423
+ export interface ApiNotificationSetting {
424
+ id?: string;
425
+ notification_setting_type?: string;
426
+ }
427
+ /** */
428
+ export interface ApiNotificationUserChannel {
429
+ id?: string;
430
+ notification_setting_type?: string;
431
+ time_mute?: string;
432
+ }
433
+ /** */
412
434
  export interface ApiPermission {
413
435
  active?: number;
414
436
  description?: string;
@@ -482,6 +504,18 @@ export interface ApiSessionRefreshRequest {
482
504
  token?: string;
483
505
  vars?: Record<string, string>;
484
506
  }
507
+ /** */
508
+ export interface ApiSetDefaultNotificationRequest {
509
+ category_id?: string;
510
+ clan_id?: string;
511
+ notification_type?: string;
512
+ }
513
+ /** */
514
+ export interface ApiSetNotificationRequest {
515
+ channel_id?: string;
516
+ notification_type?: string;
517
+ time_mute?: string;
518
+ }
485
519
  /** An object within the storage engine. */
486
520
  export interface ApiStorageObject {
487
521
  collection?: string;
@@ -757,6 +791,24 @@ export declare class MezonApi {
757
791
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
758
792
  /** Fetch list of notifications. */
759
793
  listNotifications(bearerToken: string, limit?: number, cacheableCursor?: string, options?: any): Promise<ApiNotificationList>;
794
+ /** notification selected */
795
+ getNotificationChannelSetting(bearerToken: string, channelId?: string, options?: any): Promise<ApiNotificationUserChannel>;
796
+ /** set notification user channel. */
797
+ setNotificationChannelSetting(bearerToken: string, body: ApiSetNotificationRequest, options?: any): Promise<any>;
798
+ /** set notification user channel. */
799
+ setNotificationClanSetting(bearerToken: string, body: ApiSetDefaultNotificationRequest, options?: any): Promise<any>;
800
+ /** set notification user channel. */
801
+ setNotificationCategorySetting(bearerToken: string, body: ApiSetDefaultNotificationRequest, options?: any): Promise<any>;
802
+ /** */
803
+ deleteNotificationCategorySetting(bearerToken: string, categoryId?: string, options?: any): Promise<any>;
804
+ /** notification selected */
805
+ getNotificationCategorySetting(bearerToken: string, categoryId?: string, options?: any): Promise<ApiNotificationSetting>;
806
+ /** */
807
+ deleteNotificationChannel(bearerToken: string, channelId?: string, options?: any): Promise<any>;
808
+ /** notification selected */
809
+ getNotificationClanSetting(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationSetting>;
810
+ /** notification category, channel selected */
811
+ getChannelCategoryNotiSettingsList(bearerToken: string, clanId?: string, options?: any): Promise<ApiNotificationChannelCategoySettingsList>;
760
812
  /** Get permission list */
761
813
  getListPermission(bearerToken: string, options?: any): Promise<ApiPermissionList>;
762
814
  /** */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -536,4 +536,19 @@ export declare class Client {
536
536
  inviteUser(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
537
537
  /** Write storage objects. */
538
538
  writeStorageObjects(session: Session, objects: Array<WriteStorageObject>): Promise<ApiStorageObjectAcks>;
539
+ /** Set default notification clan*/
540
+ setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
541
+ /** get default notification clan */
542
+ getNotificationClanSetting(session: Session, clanId: string): Promise<ApiNotificationSetting>;
543
+ /** Set notification channel*/
544
+ setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
545
+ /** get default notification clan */
546
+ getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel>;
547
+ /** Set default notification category*/
548
+ setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
549
+ /** get default notification category */
550
+ getNotificationCategory(session: Session, category_id: string): Promise<ApiNotificationSetting>;
551
+ deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
552
+ getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList>;
553
+ deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
539
554
  }
package/dist/dist.zip ADDED
Binary file
@@ -2769,6 +2769,249 @@ var MezonApi = class {
2769
2769
  )
2770
2770
  ]);
2771
2771
  }
2772
+ /** notification selected */
2773
+ getNotificationChannelSetting(bearerToken, channelId, options = {}) {
2774
+ const urlPath = "/v2/notificationchannel/get";
2775
+ const queryParams = /* @__PURE__ */ new Map();
2776
+ queryParams.set("channel_id", channelId);
2777
+ let bodyJson = "";
2778
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2779
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2780
+ if (bearerToken) {
2781
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2782
+ }
2783
+ return Promise.race([
2784
+ fetch(fullUrl, fetchOptions).then((response) => {
2785
+ if (response.status == 204) {
2786
+ return response;
2787
+ } else if (response.status >= 200 && response.status < 300) {
2788
+ return response.json();
2789
+ } else {
2790
+ throw response;
2791
+ }
2792
+ }),
2793
+ new Promise(
2794
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2795
+ )
2796
+ ]);
2797
+ }
2798
+ /** set notification user channel. */
2799
+ setNotificationChannelSetting(bearerToken, body, options = {}) {
2800
+ if (body === null || body === void 0) {
2801
+ throw new Error("'body' is a required parameter but is null or undefined.");
2802
+ }
2803
+ const urlPath = "/v2/notificationchannel/set";
2804
+ const queryParams = /* @__PURE__ */ new Map();
2805
+ let bodyJson = "";
2806
+ bodyJson = JSON.stringify(body || {});
2807
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2808
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2809
+ if (bearerToken) {
2810
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2811
+ }
2812
+ return Promise.race([
2813
+ fetch(fullUrl, fetchOptions).then((response) => {
2814
+ if (response.status == 204) {
2815
+ return response;
2816
+ } else if (response.status >= 200 && response.status < 300) {
2817
+ return response.json();
2818
+ } else {
2819
+ throw response;
2820
+ }
2821
+ }),
2822
+ new Promise(
2823
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2824
+ )
2825
+ ]);
2826
+ }
2827
+ /** set notification user channel. */
2828
+ setNotificationClanSetting(bearerToken, body, options = {}) {
2829
+ if (body === null || body === void 0) {
2830
+ throw new Error("'body' is a required parameter but is null or undefined.");
2831
+ }
2832
+ const urlPath = "/v2/notificationclan/set";
2833
+ const queryParams = /* @__PURE__ */ new Map();
2834
+ let bodyJson = "";
2835
+ bodyJson = JSON.stringify(body || {});
2836
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2837
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2838
+ if (bearerToken) {
2839
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2840
+ }
2841
+ return Promise.race([
2842
+ fetch(fullUrl, fetchOptions).then((response) => {
2843
+ if (response.status == 204) {
2844
+ return response;
2845
+ } else if (response.status >= 200 && response.status < 300) {
2846
+ return response.json();
2847
+ } else {
2848
+ throw response;
2849
+ }
2850
+ }),
2851
+ new Promise(
2852
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2853
+ )
2854
+ ]);
2855
+ }
2856
+ /** set notification user channel. */
2857
+ setNotificationCategorySetting(bearerToken, body, options = {}) {
2858
+ if (body === null || body === void 0) {
2859
+ throw new Error("'body' is a required parameter but is null or undefined.");
2860
+ }
2861
+ const urlPath = "/v2/notificationucategory/set";
2862
+ const queryParams = /* @__PURE__ */ new Map();
2863
+ let bodyJson = "";
2864
+ bodyJson = JSON.stringify(body || {});
2865
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2866
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2867
+ if (bearerToken) {
2868
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2869
+ }
2870
+ return Promise.race([
2871
+ fetch(fullUrl, fetchOptions).then((response) => {
2872
+ if (response.status == 204) {
2873
+ return response;
2874
+ } else if (response.status >= 200 && response.status < 300) {
2875
+ return response.json();
2876
+ } else {
2877
+ throw response;
2878
+ }
2879
+ }),
2880
+ new Promise(
2881
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2882
+ )
2883
+ ]);
2884
+ }
2885
+ /** */
2886
+ deleteNotificationCategorySetting(bearerToken, categoryId, options = {}) {
2887
+ const urlPath = "/v2/notificationusercategory/delete";
2888
+ const queryParams = /* @__PURE__ */ new Map();
2889
+ queryParams.set("category_id", categoryId);
2890
+ let bodyJson = "";
2891
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2892
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2893
+ if (bearerToken) {
2894
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2895
+ }
2896
+ return Promise.race([
2897
+ fetch(fullUrl, fetchOptions).then((response) => {
2898
+ if (response.status == 204) {
2899
+ return response;
2900
+ } else if (response.status >= 200 && response.status < 300) {
2901
+ return response.json();
2902
+ } else {
2903
+ throw response;
2904
+ }
2905
+ }),
2906
+ new Promise(
2907
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2908
+ )
2909
+ ]);
2910
+ }
2911
+ /** notification selected */
2912
+ getNotificationCategorySetting(bearerToken, categoryId, options = {}) {
2913
+ const urlPath = "/v2/notificationusercategory/get";
2914
+ const queryParams = /* @__PURE__ */ new Map();
2915
+ queryParams.set("category_id", categoryId);
2916
+ let bodyJson = "";
2917
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2918
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2919
+ if (bearerToken) {
2920
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2921
+ }
2922
+ return Promise.race([
2923
+ fetch(fullUrl, fetchOptions).then((response) => {
2924
+ if (response.status == 204) {
2925
+ return response;
2926
+ } else if (response.status >= 200 && response.status < 300) {
2927
+ return response.json();
2928
+ } else {
2929
+ throw response;
2930
+ }
2931
+ }),
2932
+ new Promise(
2933
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2934
+ )
2935
+ ]);
2936
+ }
2937
+ /** */
2938
+ deleteNotificationChannel(bearerToken, channelId, options = {}) {
2939
+ const urlPath = "/v2/notificationuserchannel/delete";
2940
+ const queryParams = /* @__PURE__ */ new Map();
2941
+ queryParams.set("channel_id", channelId);
2942
+ let bodyJson = "";
2943
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2944
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2945
+ if (bearerToken) {
2946
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2947
+ }
2948
+ return Promise.race([
2949
+ fetch(fullUrl, fetchOptions).then((response) => {
2950
+ if (response.status == 204) {
2951
+ return response;
2952
+ } else if (response.status >= 200 && response.status < 300) {
2953
+ return response.json();
2954
+ } else {
2955
+ throw response;
2956
+ }
2957
+ }),
2958
+ new Promise(
2959
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2960
+ )
2961
+ ]);
2962
+ }
2963
+ /** notification selected */
2964
+ getNotificationClanSetting(bearerToken, clanId, options = {}) {
2965
+ const urlPath = "/v2/notificationuserclan/get";
2966
+ const queryParams = /* @__PURE__ */ new Map();
2967
+ queryParams.set("clan_id", clanId);
2968
+ let bodyJson = "";
2969
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2970
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2971
+ if (bearerToken) {
2972
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2973
+ }
2974
+ return Promise.race([
2975
+ fetch(fullUrl, fetchOptions).then((response) => {
2976
+ if (response.status == 204) {
2977
+ return response;
2978
+ } else if (response.status >= 200 && response.status < 300) {
2979
+ return response.json();
2980
+ } else {
2981
+ throw response;
2982
+ }
2983
+ }),
2984
+ new Promise(
2985
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2986
+ )
2987
+ ]);
2988
+ }
2989
+ /** notification category, channel selected */
2990
+ getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
2991
+ const urlPath = "/v2/notifichannelcategory/get";
2992
+ const queryParams = /* @__PURE__ */ new Map();
2993
+ queryParams.set("clan_id", clanId);
2994
+ let bodyJson = "";
2995
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2996
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2997
+ if (bearerToken) {
2998
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2999
+ }
3000
+ return Promise.race([
3001
+ fetch(fullUrl, fetchOptions).then((response) => {
3002
+ if (response.status == 204) {
3003
+ return response;
3004
+ } else if (response.status >= 200 && response.status < 300) {
3005
+ return response.json();
3006
+ } else {
3007
+ throw response;
3008
+ }
3009
+ }),
3010
+ new Promise(
3011
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3012
+ )
3013
+ ]);
3014
+ }
2772
3015
  /** Get permission list */
2773
3016
  getListPermission(bearerToken, options = {}) {
2774
3017
  const urlPath = "/v2/permissions";
@@ -5478,4 +5721,100 @@ var Client = class {
5478
5721
  return this.apiClient.writeStorageObjects(session.token, request);
5479
5722
  });
5480
5723
  }
5724
+ /** Set default notification clan*/
5725
+ setNotificationClan(session, request) {
5726
+ return __async(this, null, function* () {
5727
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5728
+ yield this.sessionRefresh(session);
5729
+ }
5730
+ return this.apiClient.setNotificationClanSetting(session.token, request).then((response) => {
5731
+ return response !== void 0;
5732
+ });
5733
+ });
5734
+ }
5735
+ /** get default notification clan */
5736
+ getNotificationClanSetting(session, clanId) {
5737
+ return __async(this, null, function* () {
5738
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5739
+ yield this.sessionRefresh(session);
5740
+ }
5741
+ return this.apiClient.getNotificationClanSetting(session.token, clanId, {}).then((response) => {
5742
+ return Promise.resolve(response);
5743
+ });
5744
+ });
5745
+ }
5746
+ /** Set notification channel*/
5747
+ setNotificationChannel(session, request) {
5748
+ return __async(this, null, function* () {
5749
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5750
+ yield this.sessionRefresh(session);
5751
+ }
5752
+ return this.apiClient.setNotificationChannelSetting(session.token, request).then((response) => {
5753
+ return response !== void 0;
5754
+ });
5755
+ });
5756
+ }
5757
+ /** get default notification clan */
5758
+ getNotificationChannel(session, channelId) {
5759
+ return __async(this, null, function* () {
5760
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5761
+ yield this.sessionRefresh(session);
5762
+ }
5763
+ return this.apiClient.getNotificationChannelSetting(session.token, channelId, {}).then((response) => {
5764
+ return Promise.resolve(response);
5765
+ });
5766
+ });
5767
+ }
5768
+ /** Set default notification category*/
5769
+ setNotificationCategory(session, request) {
5770
+ return __async(this, null, function* () {
5771
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5772
+ yield this.sessionRefresh(session);
5773
+ }
5774
+ return this.apiClient.setNotificationCategorySetting(session.token, request).then((response) => {
5775
+ return response !== void 0;
5776
+ });
5777
+ });
5778
+ }
5779
+ /** get default notification category */
5780
+ getNotificationCategory(session, category_id) {
5781
+ return __async(this, null, function* () {
5782
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5783
+ yield this.sessionRefresh(session);
5784
+ }
5785
+ return this.apiClient.getNotificationCategorySetting(session.token, category_id, {}).then((response) => {
5786
+ return Promise.resolve(response);
5787
+ });
5788
+ });
5789
+ }
5790
+ deleteNotificationCategory(session, category_id) {
5791
+ return __async(this, null, function* () {
5792
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5793
+ yield this.sessionRefresh(session);
5794
+ }
5795
+ return this.apiClient.deleteNotificationCategorySetting(session.token, category_id).then((response) => {
5796
+ return response !== void 0;
5797
+ });
5798
+ });
5799
+ }
5800
+ getChannelCategoryNotiSettingsList(session, clan_id) {
5801
+ return __async(this, null, function* () {
5802
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5803
+ yield this.sessionRefresh(session);
5804
+ }
5805
+ return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response) => {
5806
+ return Promise.resolve(response);
5807
+ });
5808
+ });
5809
+ }
5810
+ deleteNotificationChannel(session, channel_id) {
5811
+ return __async(this, null, function* () {
5812
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5813
+ yield this.sessionRefresh(session);
5814
+ }
5815
+ return this.apiClient.deleteNotificationChannel(session.token, channel_id).then((response) => {
5816
+ return response !== void 0;
5817
+ });
5818
+ });
5819
+ }
5481
5820
  };
@@ -2741,6 +2741,249 @@ var MezonApi = class {
2741
2741
  )
2742
2742
  ]);
2743
2743
  }
2744
+ /** notification selected */
2745
+ getNotificationChannelSetting(bearerToken, channelId, options = {}) {
2746
+ const urlPath = "/v2/notificationchannel/get";
2747
+ const queryParams = /* @__PURE__ */ new Map();
2748
+ queryParams.set("channel_id", channelId);
2749
+ let bodyJson = "";
2750
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2751
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2752
+ if (bearerToken) {
2753
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2754
+ }
2755
+ return Promise.race([
2756
+ fetch(fullUrl, fetchOptions).then((response) => {
2757
+ if (response.status == 204) {
2758
+ return response;
2759
+ } else if (response.status >= 200 && response.status < 300) {
2760
+ return response.json();
2761
+ } else {
2762
+ throw response;
2763
+ }
2764
+ }),
2765
+ new Promise(
2766
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2767
+ )
2768
+ ]);
2769
+ }
2770
+ /** set notification user channel. */
2771
+ setNotificationChannelSetting(bearerToken, body, options = {}) {
2772
+ if (body === null || body === void 0) {
2773
+ throw new Error("'body' is a required parameter but is null or undefined.");
2774
+ }
2775
+ const urlPath = "/v2/notificationchannel/set";
2776
+ const queryParams = /* @__PURE__ */ new Map();
2777
+ let bodyJson = "";
2778
+ bodyJson = JSON.stringify(body || {});
2779
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2780
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2781
+ if (bearerToken) {
2782
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2783
+ }
2784
+ return Promise.race([
2785
+ fetch(fullUrl, fetchOptions).then((response) => {
2786
+ if (response.status == 204) {
2787
+ return response;
2788
+ } else if (response.status >= 200 && response.status < 300) {
2789
+ return response.json();
2790
+ } else {
2791
+ throw response;
2792
+ }
2793
+ }),
2794
+ new Promise(
2795
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2796
+ )
2797
+ ]);
2798
+ }
2799
+ /** set notification user channel. */
2800
+ setNotificationClanSetting(bearerToken, body, options = {}) {
2801
+ if (body === null || body === void 0) {
2802
+ throw new Error("'body' is a required parameter but is null or undefined.");
2803
+ }
2804
+ const urlPath = "/v2/notificationclan/set";
2805
+ const queryParams = /* @__PURE__ */ new Map();
2806
+ let bodyJson = "";
2807
+ bodyJson = JSON.stringify(body || {});
2808
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2809
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2810
+ if (bearerToken) {
2811
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2812
+ }
2813
+ return Promise.race([
2814
+ fetch(fullUrl, fetchOptions).then((response) => {
2815
+ if (response.status == 204) {
2816
+ return response;
2817
+ } else if (response.status >= 200 && response.status < 300) {
2818
+ return response.json();
2819
+ } else {
2820
+ throw response;
2821
+ }
2822
+ }),
2823
+ new Promise(
2824
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2825
+ )
2826
+ ]);
2827
+ }
2828
+ /** set notification user channel. */
2829
+ setNotificationCategorySetting(bearerToken, body, options = {}) {
2830
+ if (body === null || body === void 0) {
2831
+ throw new Error("'body' is a required parameter but is null or undefined.");
2832
+ }
2833
+ const urlPath = "/v2/notificationucategory/set";
2834
+ const queryParams = /* @__PURE__ */ new Map();
2835
+ let bodyJson = "";
2836
+ bodyJson = JSON.stringify(body || {});
2837
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2838
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2839
+ if (bearerToken) {
2840
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2841
+ }
2842
+ return Promise.race([
2843
+ fetch(fullUrl, fetchOptions).then((response) => {
2844
+ if (response.status == 204) {
2845
+ return response;
2846
+ } else if (response.status >= 200 && response.status < 300) {
2847
+ return response.json();
2848
+ } else {
2849
+ throw response;
2850
+ }
2851
+ }),
2852
+ new Promise(
2853
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2854
+ )
2855
+ ]);
2856
+ }
2857
+ /** */
2858
+ deleteNotificationCategorySetting(bearerToken, categoryId, options = {}) {
2859
+ const urlPath = "/v2/notificationusercategory/delete";
2860
+ const queryParams = /* @__PURE__ */ new Map();
2861
+ queryParams.set("category_id", categoryId);
2862
+ let bodyJson = "";
2863
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2864
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2865
+ if (bearerToken) {
2866
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2867
+ }
2868
+ return Promise.race([
2869
+ fetch(fullUrl, fetchOptions).then((response) => {
2870
+ if (response.status == 204) {
2871
+ return response;
2872
+ } else if (response.status >= 200 && response.status < 300) {
2873
+ return response.json();
2874
+ } else {
2875
+ throw response;
2876
+ }
2877
+ }),
2878
+ new Promise(
2879
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2880
+ )
2881
+ ]);
2882
+ }
2883
+ /** notification selected */
2884
+ getNotificationCategorySetting(bearerToken, categoryId, options = {}) {
2885
+ const urlPath = "/v2/notificationusercategory/get";
2886
+ const queryParams = /* @__PURE__ */ new Map();
2887
+ queryParams.set("category_id", categoryId);
2888
+ let bodyJson = "";
2889
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2890
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2891
+ if (bearerToken) {
2892
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2893
+ }
2894
+ return Promise.race([
2895
+ fetch(fullUrl, fetchOptions).then((response) => {
2896
+ if (response.status == 204) {
2897
+ return response;
2898
+ } else if (response.status >= 200 && response.status < 300) {
2899
+ return response.json();
2900
+ } else {
2901
+ throw response;
2902
+ }
2903
+ }),
2904
+ new Promise(
2905
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2906
+ )
2907
+ ]);
2908
+ }
2909
+ /** */
2910
+ deleteNotificationChannel(bearerToken, channelId, options = {}) {
2911
+ const urlPath = "/v2/notificationuserchannel/delete";
2912
+ const queryParams = /* @__PURE__ */ new Map();
2913
+ queryParams.set("channel_id", channelId);
2914
+ let bodyJson = "";
2915
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2916
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
2917
+ if (bearerToken) {
2918
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2919
+ }
2920
+ return Promise.race([
2921
+ fetch(fullUrl, fetchOptions).then((response) => {
2922
+ if (response.status == 204) {
2923
+ return response;
2924
+ } else if (response.status >= 200 && response.status < 300) {
2925
+ return response.json();
2926
+ } else {
2927
+ throw response;
2928
+ }
2929
+ }),
2930
+ new Promise(
2931
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2932
+ )
2933
+ ]);
2934
+ }
2935
+ /** notification selected */
2936
+ getNotificationClanSetting(bearerToken, clanId, options = {}) {
2937
+ const urlPath = "/v2/notificationuserclan/get";
2938
+ const queryParams = /* @__PURE__ */ new Map();
2939
+ queryParams.set("clan_id", clanId);
2940
+ let bodyJson = "";
2941
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2942
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2943
+ if (bearerToken) {
2944
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2945
+ }
2946
+ return Promise.race([
2947
+ fetch(fullUrl, fetchOptions).then((response) => {
2948
+ if (response.status == 204) {
2949
+ return response;
2950
+ } else if (response.status >= 200 && response.status < 300) {
2951
+ return response.json();
2952
+ } else {
2953
+ throw response;
2954
+ }
2955
+ }),
2956
+ new Promise(
2957
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2958
+ )
2959
+ ]);
2960
+ }
2961
+ /** notification category, channel selected */
2962
+ getChannelCategoryNotiSettingsList(bearerToken, clanId, options = {}) {
2963
+ const urlPath = "/v2/notifichannelcategory/get";
2964
+ const queryParams = /* @__PURE__ */ new Map();
2965
+ queryParams.set("clan_id", clanId);
2966
+ let bodyJson = "";
2967
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2968
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2969
+ if (bearerToken) {
2970
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2971
+ }
2972
+ return Promise.race([
2973
+ fetch(fullUrl, fetchOptions).then((response) => {
2974
+ if (response.status == 204) {
2975
+ return response;
2976
+ } else if (response.status >= 200 && response.status < 300) {
2977
+ return response.json();
2978
+ } else {
2979
+ throw response;
2980
+ }
2981
+ }),
2982
+ new Promise(
2983
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2984
+ )
2985
+ ]);
2986
+ }
2744
2987
  /** Get permission list */
2745
2988
  getListPermission(bearerToken, options = {}) {
2746
2989
  const urlPath = "/v2/permissions";
@@ -5450,6 +5693,102 @@ var Client = class {
5450
5693
  return this.apiClient.writeStorageObjects(session.token, request);
5451
5694
  });
5452
5695
  }
5696
+ /** Set default notification clan*/
5697
+ setNotificationClan(session, request) {
5698
+ return __async(this, null, function* () {
5699
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5700
+ yield this.sessionRefresh(session);
5701
+ }
5702
+ return this.apiClient.setNotificationClanSetting(session.token, request).then((response) => {
5703
+ return response !== void 0;
5704
+ });
5705
+ });
5706
+ }
5707
+ /** get default notification clan */
5708
+ getNotificationClanSetting(session, clanId) {
5709
+ return __async(this, null, function* () {
5710
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5711
+ yield this.sessionRefresh(session);
5712
+ }
5713
+ return this.apiClient.getNotificationClanSetting(session.token, clanId, {}).then((response) => {
5714
+ return Promise.resolve(response);
5715
+ });
5716
+ });
5717
+ }
5718
+ /** Set notification channel*/
5719
+ setNotificationChannel(session, request) {
5720
+ return __async(this, null, function* () {
5721
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5722
+ yield this.sessionRefresh(session);
5723
+ }
5724
+ return this.apiClient.setNotificationChannelSetting(session.token, request).then((response) => {
5725
+ return response !== void 0;
5726
+ });
5727
+ });
5728
+ }
5729
+ /** get default notification clan */
5730
+ getNotificationChannel(session, channelId) {
5731
+ return __async(this, null, function* () {
5732
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5733
+ yield this.sessionRefresh(session);
5734
+ }
5735
+ return this.apiClient.getNotificationChannelSetting(session.token, channelId, {}).then((response) => {
5736
+ return Promise.resolve(response);
5737
+ });
5738
+ });
5739
+ }
5740
+ /** Set default notification category*/
5741
+ setNotificationCategory(session, request) {
5742
+ return __async(this, null, function* () {
5743
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5744
+ yield this.sessionRefresh(session);
5745
+ }
5746
+ return this.apiClient.setNotificationCategorySetting(session.token, request).then((response) => {
5747
+ return response !== void 0;
5748
+ });
5749
+ });
5750
+ }
5751
+ /** get default notification category */
5752
+ getNotificationCategory(session, category_id) {
5753
+ return __async(this, null, function* () {
5754
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5755
+ yield this.sessionRefresh(session);
5756
+ }
5757
+ return this.apiClient.getNotificationCategorySetting(session.token, category_id, {}).then((response) => {
5758
+ return Promise.resolve(response);
5759
+ });
5760
+ });
5761
+ }
5762
+ deleteNotificationCategory(session, category_id) {
5763
+ return __async(this, null, function* () {
5764
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5765
+ yield this.sessionRefresh(session);
5766
+ }
5767
+ return this.apiClient.deleteNotificationCategorySetting(session.token, category_id).then((response) => {
5768
+ return response !== void 0;
5769
+ });
5770
+ });
5771
+ }
5772
+ getChannelCategoryNotiSettingsList(session, clan_id) {
5773
+ return __async(this, null, function* () {
5774
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5775
+ yield this.sessionRefresh(session);
5776
+ }
5777
+ return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response) => {
5778
+ return Promise.resolve(response);
5779
+ });
5780
+ });
5781
+ }
5782
+ deleteNotificationChannel(session, channel_id) {
5783
+ return __async(this, null, function* () {
5784
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5785
+ yield this.sessionRefresh(session);
5786
+ }
5787
+ return this.apiClient.deleteNotificationChannel(session.token, channel_id).then((response) => {
5788
+ return response !== void 0;
5789
+ });
5790
+ });
5791
+ }
5453
5792
  };
5454
5793
  export {
5455
5794
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.22",
3
+ "version": "2.7.23",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },