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/dist/mezon-js.cjs.js
CHANGED
@@ -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
|
};
|