mezon-js 2.7.22 → 2.7.24
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 +362 -0
- package/client.ts +115 -0
- package/dist/api.gen.d.ts +52 -0
- package/dist/client.d.ts +21 -1
- package/dist/dist.zip +0 -0
- package/dist/mezon-js.cjs.js +339 -0
- package/dist/mezon-js.esm.mjs +5807 -5461
- package/package.json +1 -1
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";
|
@@ -105,6 +110,12 @@ export enum ChannelStreamMode {
|
|
105
110
|
STREAM_MODE_DM = 4,
|
106
111
|
}
|
107
112
|
|
113
|
+
export enum NotificationType {
|
114
|
+
ALL_MESSAGE = "ALL",
|
115
|
+
NOTHING_MESSAGE = "NOTHING",
|
116
|
+
MENTION_MESSAGE = "MENTION",
|
117
|
+
}
|
118
|
+
|
108
119
|
/** Response for an RPC function executed on the server. */
|
109
120
|
export interface RpcResponse {
|
110
121
|
/** The identifier of the function. */
|
@@ -1938,6 +1949,110 @@ export class Client {
|
|
1938
1949
|
|
1939
1950
|
return this.apiClient.writeStorageObjects(session.token, request);
|
1940
1951
|
}
|
1952
|
+
/** Set default notification clan*/
|
1953
|
+
async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
|
1954
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1955
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1956
|
+
await this.sessionRefresh(session);
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
return this.apiClient.setNotificationClanSetting(session.token, request).then((response: any) => {
|
1960
|
+
return response !== undefined;
|
1961
|
+
});
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
/** get default notification clan */
|
1965
|
+
async getNotificationClanSetting(session: Session, clanId: string): Promise<ApiNotificationSetting> {
|
1966
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1967
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1968
|
+
await this.sessionRefresh(session);
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
return this.apiClient.getNotificationClanSetting(session.token, clanId, {}).then((response: ApiNotificationSetting) => {
|
1972
|
+
return Promise.resolve(response);
|
1973
|
+
});
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
/** Set notification channel*/
|
1977
|
+
async setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean> {
|
1978
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1979
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1980
|
+
await this.sessionRefresh(session);
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
return this.apiClient.setNotificationChannelSetting(session.token, request).then((response: any) => {
|
1984
|
+
return response !== undefined;
|
1985
|
+
});
|
1986
|
+
}
|
1987
|
+
|
1988
|
+
/** get default notification clan */
|
1989
|
+
async getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel> {
|
1990
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1991
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1992
|
+
await this.sessionRefresh(session);
|
1993
|
+
}
|
1994
|
+
|
1995
|
+
return this.apiClient.getNotificationChannelSetting(session.token, channelId, {}).then((response: ApiNotificationUserChannel) => {
|
1996
|
+
return Promise.resolve(response);
|
1997
|
+
});
|
1998
|
+
}
|
1999
|
+
|
2000
|
+
/** Set default notification category*/
|
2001
|
+
async setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
|
2002
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2003
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2004
|
+
await this.sessionRefresh(session);
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
return this.apiClient.setNotificationCategorySetting(session.token, request).then((response: any) => {
|
2008
|
+
return response !== undefined;
|
2009
|
+
});
|
2010
|
+
}
|
2011
|
+
|
2012
|
+
/** get default notification category */
|
2013
|
+
async getNotificationCategory(session: Session, category_id: string): Promise<ApiNotificationSetting> {
|
2014
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2015
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2016
|
+
await this.sessionRefresh(session);
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
return this.apiClient.getNotificationCategorySetting(session.token, category_id, {}).then((response: ApiNotificationSetting) => {
|
2020
|
+
return Promise.resolve(response);
|
2021
|
+
});
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
async deleteNotificationCategory(session: Session, category_id: string): Promise<boolean> {
|
2025
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2026
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2027
|
+
await this.sessionRefresh(session);
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
return this.apiClient.deleteNotificationCategorySetting(session.token, category_id).then((response: any) => {
|
2031
|
+
return response !== undefined;
|
2032
|
+
});
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
async getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList> {
|
2036
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2037
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2038
|
+
await this.sessionRefresh(session);
|
2039
|
+
}
|
2040
|
+
|
2041
|
+
return this.apiClient.getChannelCategoryNotiSettingsList(session.token, clan_id).then((response: ApiNotificationChannelCategoySettingsList) => {
|
2042
|
+
return Promise.resolve(response);
|
2043
|
+
});
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
async deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean> {
|
2047
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2048
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2049
|
+
await this.sessionRefresh(session);
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
return this.apiClient.deleteNotificationChannel(session.token, channel_id).then((response: any) => {
|
2053
|
+
return response !== undefined;
|
2054
|
+
});
|
2055
|
+
}
|
1941
2056
|
};
|
1942
2057
|
|
1943
2058
|
|
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";
|
@@ -30,6 +30,11 @@ export declare enum ChannelStreamMode {
|
|
30
30
|
STREAM_MODE_GROUP = 3,
|
31
31
|
STREAM_MODE_DM = 4
|
32
32
|
}
|
33
|
+
export declare enum NotificationType {
|
34
|
+
ALL_MESSAGE = "ALL",
|
35
|
+
NOTHING_MESSAGE = "NOTHING",
|
36
|
+
MENTION_MESSAGE = "MENTION"
|
37
|
+
}
|
33
38
|
/** Response for an RPC function executed on the server. */
|
34
39
|
export interface RpcResponse {
|
35
40
|
/** The identifier of the function. */
|
@@ -536,4 +541,19 @@ export declare class Client {
|
|
536
541
|
inviteUser(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
537
542
|
/** Write storage objects. */
|
538
543
|
writeStorageObjects(session: Session, objects: Array<WriteStorageObject>): Promise<ApiStorageObjectAcks>;
|
544
|
+
/** Set default notification clan*/
|
545
|
+
setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
|
546
|
+
/** get default notification clan */
|
547
|
+
getNotificationClanSetting(session: Session, clanId: string): Promise<ApiNotificationSetting>;
|
548
|
+
/** Set notification channel*/
|
549
|
+
setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
|
550
|
+
/** get default notification clan */
|
551
|
+
getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel>;
|
552
|
+
/** Set default notification category*/
|
553
|
+
setNotificationCategory(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
|
554
|
+
/** get default notification category */
|
555
|
+
getNotificationCategory(session: Session, category_id: string): Promise<ApiNotificationSetting>;
|
556
|
+
deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
|
557
|
+
getChannelCategoryNotiSettingsList(session: Session, clan_id: string): Promise<ApiNotificationChannelCategoySettingsList>;
|
558
|
+
deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
|
539
559
|
}
|
package/dist/dist.zip
ADDED
Binary file
|