mezon-js 2.8.25 → 2.8.27
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +326 -22
- package/client.ts +28 -4
- package/dist/api.gen.d.ts +55 -13
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +222 -0
- package/dist/mezon-js.esm.mjs +222 -0
- package/dist/socket.d.ts +2 -0
- package/package.json +1 -1
- package/socket.ts +4 -0
package/api.gen.ts
CHANGED
@@ -42,6 +42,72 @@ export interface MezonChangeChannelCategoryBody {
|
|
42
42
|
channel_id?: string;
|
43
43
|
}
|
44
44
|
|
45
|
+
/** Update app information. */
|
46
|
+
export interface MezonUpdateAppBody {
|
47
|
+
//Avatar URL.
|
48
|
+
applogo?: string;
|
49
|
+
//Username.
|
50
|
+
appname?: string;
|
51
|
+
//Metadata.
|
52
|
+
metadata?: string;
|
53
|
+
//Token.
|
54
|
+
token?: string;
|
55
|
+
}
|
56
|
+
|
57
|
+
/** */
|
58
|
+
export interface ApiAddAppRequest {
|
59
|
+
//The appname.
|
60
|
+
appname?: string;
|
61
|
+
//Creator of the app.
|
62
|
+
creator_id?: string;
|
63
|
+
//
|
64
|
+
role?: ApiAppRole;
|
65
|
+
//The password.
|
66
|
+
token?: string;
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
/** App information. */
|
71
|
+
export interface ApiApp {
|
72
|
+
//
|
73
|
+
applogo?: string;
|
74
|
+
//
|
75
|
+
appname?: string;
|
76
|
+
//
|
77
|
+
creator_id?: string;
|
78
|
+
//The UNIX time when the app was disabled.
|
79
|
+
disable_time?: string;
|
80
|
+
//
|
81
|
+
online?: boolean;
|
82
|
+
}
|
83
|
+
|
84
|
+
/** A list of apps. */
|
85
|
+
export interface ApiAppList {
|
86
|
+
//A list of apps.
|
87
|
+
apps?: Array<ApiApp>;
|
88
|
+
//Next cursor.
|
89
|
+
next_cursor?: string;
|
90
|
+
//Approximate total number of apps.
|
91
|
+
total_count?: number;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* - USER_ROLE_ADMIN: All access
|
96
|
+
- USER_ROLE_DEVELOPER: Best for developers, also enables APIs and API explorer
|
97
|
+
- USER_ROLE_MAINTAINER: Best for users who regularly update player information.
|
98
|
+
- USER_ROLE_READONLY: Read-only role for those only need to view data
|
99
|
+
*/
|
100
|
+
export enum ApiAppRole
|
101
|
+
{
|
102
|
+
/* */
|
103
|
+
USER_ROLE_UNKNOWN = 0,
|
104
|
+
/* */
|
105
|
+
USER_ROLE_ADMIN = 1, // All access
|
106
|
+
USER_ROLE_DEVELOPER = 2, // Best for developers, also enables APIs and API explorer
|
107
|
+
USER_ROLE_MAINTAINER = 3, // Best for users who regularly update player information.
|
108
|
+
USER_ROLE_READONLY = 4, // Read-only role for those only need to view data
|
109
|
+
}
|
110
|
+
|
45
111
|
|
46
112
|
/** Update fields in a given channel. */
|
47
113
|
export interface MezonUpdateChannelDescBody {
|
@@ -1570,28 +1636,6 @@ export interface ApiWebhookListResponse {
|
|
1570
1636
|
webhooks?: Array<ApiWebhook>;
|
1571
1637
|
}
|
1572
1638
|
|
1573
|
-
/** The object to store. */
|
1574
|
-
export interface ApiWriteStorageObject {
|
1575
|
-
//The collection to store the object.
|
1576
|
-
collection?: string;
|
1577
|
-
//The key for the object within the collection.
|
1578
|
-
key?: string;
|
1579
|
-
//The read access permissions for the object.
|
1580
|
-
permission_read?: number;
|
1581
|
-
//The write access permissions for the object.
|
1582
|
-
permission_write?: number;
|
1583
|
-
//The value of the object.
|
1584
|
-
value?: string;
|
1585
|
-
//The version hash of the object to check. Possible values are: ["", "*", "#hash#"]. if-match and if-none-match
|
1586
|
-
version?: string;
|
1587
|
-
}
|
1588
|
-
|
1589
|
-
/** Write objects to the storage engine. */
|
1590
|
-
export interface ApiWriteStorageObjectsRequest {
|
1591
|
-
//The objects to store on the server.
|
1592
|
-
objects?: Array<ApiWriteStorageObject>;
|
1593
|
-
}
|
1594
|
-
|
1595
1639
|
/** */
|
1596
1640
|
export interface ProtobufAny {
|
1597
1641
|
//
|
@@ -2837,6 +2881,266 @@ export class MezonApi {
|
|
2837
2881
|
]);
|
2838
2882
|
}
|
2839
2883
|
|
2884
|
+
/** Add a new apps. */
|
2885
|
+
addApp(bearerToken: string,
|
2886
|
+
body:ApiAddAppRequest,
|
2887
|
+
options: any = {}): Promise<any> {
|
2888
|
+
|
2889
|
+
if (body === null || body === undefined) {
|
2890
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2891
|
+
}
|
2892
|
+
const urlPath = "/v2/apps/add";
|
2893
|
+
const queryParams = new Map<string, any>();
|
2894
|
+
|
2895
|
+
let bodyJson : string = "";
|
2896
|
+
bodyJson = JSON.stringify(body || {});
|
2897
|
+
|
2898
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2899
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2900
|
+
if (bearerToken) {
|
2901
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2902
|
+
}
|
2903
|
+
|
2904
|
+
return Promise.race([
|
2905
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2906
|
+
if (response.status == 204) {
|
2907
|
+
return response;
|
2908
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2909
|
+
return response.json();
|
2910
|
+
} else {
|
2911
|
+
throw response;
|
2912
|
+
}
|
2913
|
+
}),
|
2914
|
+
new Promise((_, reject) =>
|
2915
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2916
|
+
),
|
2917
|
+
]);
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
/** List (and optionally filter) accounts. */
|
2921
|
+
listApps(bearerToken: string,
|
2922
|
+
filter?:string,
|
2923
|
+
tombstones?:boolean,
|
2924
|
+
cursor?:string,
|
2925
|
+
options: any = {}): Promise<ApiAppList> {
|
2926
|
+
|
2927
|
+
const urlPath = "/v2/apps/app";
|
2928
|
+
const queryParams = new Map<string, any>();
|
2929
|
+
queryParams.set("filter", filter);
|
2930
|
+
queryParams.set("tombstones", tombstones);
|
2931
|
+
queryParams.set("cursor", cursor);
|
2932
|
+
|
2933
|
+
let bodyJson : string = "";
|
2934
|
+
|
2935
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2936
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2937
|
+
if (bearerToken) {
|
2938
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2939
|
+
}
|
2940
|
+
|
2941
|
+
return Promise.race([
|
2942
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2943
|
+
if (response.status == 204) {
|
2944
|
+
return response;
|
2945
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2946
|
+
return response.json();
|
2947
|
+
} else {
|
2948
|
+
throw response;
|
2949
|
+
}
|
2950
|
+
}),
|
2951
|
+
new Promise((_, reject) =>
|
2952
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2953
|
+
),
|
2954
|
+
]);
|
2955
|
+
}
|
2956
|
+
|
2957
|
+
/** Delete all information stored for an app. */
|
2958
|
+
deleteApp(bearerToken: string,
|
2959
|
+
id:string,
|
2960
|
+
recordDeletion?:boolean,
|
2961
|
+
options: any = {}): Promise<any> {
|
2962
|
+
|
2963
|
+
if (id === null || id === undefined) {
|
2964
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
2965
|
+
}
|
2966
|
+
const urlPath = "/v2/apps/app/{id}"
|
2967
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
2968
|
+
const queryParams = new Map<string, any>();
|
2969
|
+
queryParams.set("record_deletion", recordDeletion);
|
2970
|
+
|
2971
|
+
let bodyJson : string = "";
|
2972
|
+
|
2973
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2974
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2975
|
+
if (bearerToken) {
|
2976
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2977
|
+
}
|
2978
|
+
|
2979
|
+
return Promise.race([
|
2980
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2981
|
+
if (response.status == 204) {
|
2982
|
+
return response;
|
2983
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2984
|
+
return response.json();
|
2985
|
+
} else {
|
2986
|
+
throw response;
|
2987
|
+
}
|
2988
|
+
}),
|
2989
|
+
new Promise((_, reject) =>
|
2990
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2991
|
+
),
|
2992
|
+
]);
|
2993
|
+
}
|
2994
|
+
|
2995
|
+
/** Get detailed app information. */
|
2996
|
+
getApp(bearerToken: string,
|
2997
|
+
id:string,
|
2998
|
+
options: any = {}): Promise<ApiApp> {
|
2999
|
+
|
3000
|
+
if (id === null || id === undefined) {
|
3001
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
3002
|
+
}
|
3003
|
+
const urlPath = "/v2/apps/app/{id}"
|
3004
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
3005
|
+
const queryParams = new Map<string, any>();
|
3006
|
+
|
3007
|
+
let bodyJson : string = "";
|
3008
|
+
|
3009
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3010
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3011
|
+
if (bearerToken) {
|
3012
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3013
|
+
}
|
3014
|
+
|
3015
|
+
return Promise.race([
|
3016
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3017
|
+
if (response.status == 204) {
|
3018
|
+
return response;
|
3019
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3020
|
+
return response.json();
|
3021
|
+
} else {
|
3022
|
+
throw response;
|
3023
|
+
}
|
3024
|
+
}),
|
3025
|
+
new Promise((_, reject) =>
|
3026
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3027
|
+
),
|
3028
|
+
]);
|
3029
|
+
}
|
3030
|
+
|
3031
|
+
/** Update one or more fields on a app. */
|
3032
|
+
updateApp(bearerToken: string,
|
3033
|
+
id:string,
|
3034
|
+
body:MezonUpdateAppBody,
|
3035
|
+
options: any = {}): Promise<any> {
|
3036
|
+
|
3037
|
+
if (id === null || id === undefined) {
|
3038
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
3039
|
+
}
|
3040
|
+
if (body === null || body === undefined) {
|
3041
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3042
|
+
}
|
3043
|
+
const urlPath = "/v2/apps/app/{id}"
|
3044
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
3045
|
+
const queryParams = new Map<string, any>();
|
3046
|
+
|
3047
|
+
let bodyJson : string = "";
|
3048
|
+
bodyJson = JSON.stringify(body || {});
|
3049
|
+
|
3050
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3051
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3052
|
+
if (bearerToken) {
|
3053
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3054
|
+
}
|
3055
|
+
|
3056
|
+
return Promise.race([
|
3057
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3058
|
+
if (response.status == 204) {
|
3059
|
+
return response;
|
3060
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3061
|
+
return response.json();
|
3062
|
+
} else {
|
3063
|
+
throw response;
|
3064
|
+
}
|
3065
|
+
}),
|
3066
|
+
new Promise((_, reject) =>
|
3067
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3068
|
+
),
|
3069
|
+
]);
|
3070
|
+
}
|
3071
|
+
|
3072
|
+
/** Ban a app. */
|
3073
|
+
banApp(bearerToken: string,
|
3074
|
+
id:string,
|
3075
|
+
options: any = {}): Promise<any> {
|
3076
|
+
|
3077
|
+
if (id === null || id === undefined) {
|
3078
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
3079
|
+
}
|
3080
|
+
const urlPath = "/v2/apps/app/{id}/ban"
|
3081
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
3082
|
+
const queryParams = new Map<string, any>();
|
3083
|
+
|
3084
|
+
let bodyJson : string = "";
|
3085
|
+
|
3086
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3087
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3088
|
+
if (bearerToken) {
|
3089
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3090
|
+
}
|
3091
|
+
|
3092
|
+
return Promise.race([
|
3093
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3094
|
+
if (response.status == 204) {
|
3095
|
+
return response;
|
3096
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3097
|
+
return response.json();
|
3098
|
+
} else {
|
3099
|
+
throw response;
|
3100
|
+
}
|
3101
|
+
}),
|
3102
|
+
new Promise((_, reject) =>
|
3103
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3104
|
+
),
|
3105
|
+
]);
|
3106
|
+
}
|
3107
|
+
|
3108
|
+
/** Unban an app. */
|
3109
|
+
unbanApp(bearerToken: string,
|
3110
|
+
id:string,
|
3111
|
+
options: any = {}): Promise<any> {
|
3112
|
+
|
3113
|
+
if (id === null || id === undefined) {
|
3114
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
3115
|
+
}
|
3116
|
+
const urlPath = "/v2/apps/app/{id}/unban"
|
3117
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
3118
|
+
const queryParams = new Map<string, any>();
|
3119
|
+
|
3120
|
+
let bodyJson : string = "";
|
3121
|
+
|
3122
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3123
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3124
|
+
if (bearerToken) {
|
3125
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3126
|
+
}
|
3127
|
+
|
3128
|
+
return Promise.race([
|
3129
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3130
|
+
if (response.status == 204) {
|
3131
|
+
return response;
|
3132
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3133
|
+
return response.json();
|
3134
|
+
} else {
|
3135
|
+
throw response;
|
3136
|
+
}
|
3137
|
+
}),
|
3138
|
+
new Promise((_, reject) =>
|
3139
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3140
|
+
),
|
3141
|
+
]);
|
3142
|
+
}
|
3143
|
+
|
2840
3144
|
/** */
|
2841
3145
|
listCategoryDescs(bearerToken: string,
|
2842
3146
|
clanId:string,
|
package/client.ts
CHANGED
@@ -98,6 +98,8 @@ import {
|
|
98
98
|
MezonChangeChannelCategoryBody,
|
99
99
|
ApiPermissionRoleChannelList,
|
100
100
|
ApiUpdateRoleChannelRequest,
|
101
|
+
ApiAddAppRequest,
|
102
|
+
ApiAppList,
|
101
103
|
} from "./api.gen";
|
102
104
|
|
103
105
|
import { Session } from "./session";
|
@@ -2310,8 +2312,8 @@ async changeChannelCategory(session: Session, id: string, request: MezonChangeCh
|
|
2310
2312
|
/** */
|
2311
2313
|
async getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList> {
|
2312
2314
|
if (this.autoRefreshSession && session.refresh_token &&
|
2313
|
-
|
2314
|
-
|
2315
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2316
|
+
await this.sessionRefresh(session);
|
2315
2317
|
}
|
2316
2318
|
|
2317
2319
|
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response: ApiPermissionRoleChannelList) => {
|
@@ -2322,8 +2324,8 @@ async getListPermissionRoleChannel(session: Session, roleId: string, channelId:
|
|
2322
2324
|
/** */
|
2323
2325
|
async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean> {
|
2324
2326
|
if (this.autoRefreshSession && session.refresh_token &&
|
2325
|
-
|
2326
|
-
|
2327
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2328
|
+
await this.sessionRefresh(session);
|
2327
2329
|
}
|
2328
2330
|
|
2329
2331
|
return this.apiClient.setRoleChannelPermission(session.token, request).then((response: any) => {
|
@@ -2331,4 +2333,26 @@ async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRe
|
|
2331
2333
|
});
|
2332
2334
|
}
|
2333
2335
|
|
2336
|
+
async addApp(session: Session, request: ApiAddAppRequest): Promise<boolean> {
|
2337
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2338
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2339
|
+
await this.sessionRefresh(session);
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
return this.apiClient.addApp(session.token, request).then((response: any) => {
|
2343
|
+
return response !== undefined;
|
2344
|
+
});
|
2345
|
+
}
|
2346
|
+
|
2347
|
+
async ListApp(session: Session): Promise<ApiAppList> {
|
2348
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2349
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2350
|
+
await this.sessionRefresh(session);
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
return this.apiClient.listApps(session.token).then((response: ApiAppList) => {
|
2354
|
+
return Promise.resolve(response);
|
2355
|
+
});
|
2356
|
+
}
|
2357
|
+
|
2334
2358
|
};
|
package/dist/api.gen.d.ts
CHANGED
@@ -20,6 +20,47 @@ export interface ClanUserListClanUser {
|
|
20
20
|
export interface MezonChangeChannelCategoryBody {
|
21
21
|
channel_id?: string;
|
22
22
|
}
|
23
|
+
/** Update app information. */
|
24
|
+
export interface MezonUpdateAppBody {
|
25
|
+
applogo?: string;
|
26
|
+
appname?: string;
|
27
|
+
metadata?: string;
|
28
|
+
token?: string;
|
29
|
+
}
|
30
|
+
/** */
|
31
|
+
export interface ApiAddAppRequest {
|
32
|
+
appname?: string;
|
33
|
+
creator_id?: string;
|
34
|
+
role?: ApiAppRole;
|
35
|
+
token?: string;
|
36
|
+
}
|
37
|
+
/** App information. */
|
38
|
+
export interface ApiApp {
|
39
|
+
applogo?: string;
|
40
|
+
appname?: string;
|
41
|
+
creator_id?: string;
|
42
|
+
disable_time?: string;
|
43
|
+
online?: boolean;
|
44
|
+
}
|
45
|
+
/** A list of apps. */
|
46
|
+
export interface ApiAppList {
|
47
|
+
apps?: Array<ApiApp>;
|
48
|
+
next_cursor?: string;
|
49
|
+
total_count?: number;
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* - USER_ROLE_ADMIN: All access
|
53
|
+
- USER_ROLE_DEVELOPER: Best for developers, also enables APIs and API explorer
|
54
|
+
- USER_ROLE_MAINTAINER: Best for users who regularly update player information.
|
55
|
+
- USER_ROLE_READONLY: Read-only role for those only need to view data
|
56
|
+
*/
|
57
|
+
export declare enum ApiAppRole {
|
58
|
+
USER_ROLE_UNKNOWN = 0,
|
59
|
+
USER_ROLE_ADMIN = 1,
|
60
|
+
USER_ROLE_DEVELOPER = 2,
|
61
|
+
USER_ROLE_MAINTAINER = 3,
|
62
|
+
USER_ROLE_READONLY = 4
|
63
|
+
}
|
23
64
|
/** Update fields in a given channel. */
|
24
65
|
export interface MezonUpdateChannelDescBody {
|
25
66
|
category_id?: string;
|
@@ -903,19 +944,6 @@ export interface ApiWebhookGenerateResponse {
|
|
903
944
|
export interface ApiWebhookListResponse {
|
904
945
|
webhooks?: Array<ApiWebhook>;
|
905
946
|
}
|
906
|
-
/** The object to store. */
|
907
|
-
export interface ApiWriteStorageObject {
|
908
|
-
collection?: string;
|
909
|
-
key?: string;
|
910
|
-
permission_read?: number;
|
911
|
-
permission_write?: number;
|
912
|
-
value?: string;
|
913
|
-
version?: string;
|
914
|
-
}
|
915
|
-
/** Write objects to the storage engine. */
|
916
|
-
export interface ApiWriteStorageObjectsRequest {
|
917
|
-
objects?: Array<ApiWriteStorageObject>;
|
918
|
-
}
|
919
947
|
/** */
|
920
948
|
export interface ProtobufAny {
|
921
949
|
type_url?: string;
|
@@ -998,6 +1026,20 @@ export declare class MezonApi {
|
|
998
1026
|
unlinkGoogle(bearerToken: string, body: ApiAccountGoogle, options?: any): Promise<any>;
|
999
1027
|
/** Remove Steam from the social profiles on the current user's account. */
|
1000
1028
|
unlinkSteam(bearerToken: string, body: ApiAccountSteam, options?: any): Promise<any>;
|
1029
|
+
/** Add a new apps. */
|
1030
|
+
addApp(bearerToken: string, body: ApiAddAppRequest, options?: any): Promise<any>;
|
1031
|
+
/** List (and optionally filter) accounts. */
|
1032
|
+
listApps(bearerToken: string, filter?: string, tombstones?: boolean, cursor?: string, options?: any): Promise<ApiAppList>;
|
1033
|
+
/** Delete all information stored for an app. */
|
1034
|
+
deleteApp(bearerToken: string, id: string, recordDeletion?: boolean, options?: any): Promise<any>;
|
1035
|
+
/** Get detailed app information. */
|
1036
|
+
getApp(bearerToken: string, id: string, options?: any): Promise<ApiApp>;
|
1037
|
+
/** Update one or more fields on a app. */
|
1038
|
+
updateApp(bearerToken: string, id: string, body: MezonUpdateAppBody, options?: any): Promise<any>;
|
1039
|
+
/** Ban a app. */
|
1040
|
+
banApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1041
|
+
/** Unban an app. */
|
1042
|
+
unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
|
1001
1043
|
/** */
|
1002
1044
|
listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, options?: any): Promise<ApiCategoryDescList>;
|
1003
1045
|
/** List a channel's message history. */
|
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, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } 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, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -592,4 +592,6 @@ export declare class Client {
|
|
592
592
|
getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
|
593
593
|
/** */
|
594
594
|
setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
|
595
|
+
addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
|
596
|
+
ListApp(session: Session): Promise<ApiAppList>;
|
595
597
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -1619,6 +1619,208 @@ var MezonApi = class {
|
|
1619
1619
|
)
|
1620
1620
|
]);
|
1621
1621
|
}
|
1622
|
+
/** Add a new apps. */
|
1623
|
+
addApp(bearerToken, body, options = {}) {
|
1624
|
+
if (body === null || body === void 0) {
|
1625
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1626
|
+
}
|
1627
|
+
const urlPath = "/v2/apps/add";
|
1628
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1629
|
+
let bodyJson = "";
|
1630
|
+
bodyJson = JSON.stringify(body || {});
|
1631
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1632
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1633
|
+
if (bearerToken) {
|
1634
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1635
|
+
}
|
1636
|
+
return Promise.race([
|
1637
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1638
|
+
if (response.status == 204) {
|
1639
|
+
return response;
|
1640
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1641
|
+
return response.json();
|
1642
|
+
} else {
|
1643
|
+
throw response;
|
1644
|
+
}
|
1645
|
+
}),
|
1646
|
+
new Promise(
|
1647
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1648
|
+
)
|
1649
|
+
]);
|
1650
|
+
}
|
1651
|
+
/** List (and optionally filter) accounts. */
|
1652
|
+
listApps(bearerToken, filter, tombstones, cursor, options = {}) {
|
1653
|
+
const urlPath = "/v2/apps/app";
|
1654
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1655
|
+
queryParams.set("filter", filter);
|
1656
|
+
queryParams.set("tombstones", tombstones);
|
1657
|
+
queryParams.set("cursor", cursor);
|
1658
|
+
let bodyJson = "";
|
1659
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1660
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1661
|
+
if (bearerToken) {
|
1662
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1663
|
+
}
|
1664
|
+
return Promise.race([
|
1665
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1666
|
+
if (response.status == 204) {
|
1667
|
+
return response;
|
1668
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1669
|
+
return response.json();
|
1670
|
+
} else {
|
1671
|
+
throw response;
|
1672
|
+
}
|
1673
|
+
}),
|
1674
|
+
new Promise(
|
1675
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1676
|
+
)
|
1677
|
+
]);
|
1678
|
+
}
|
1679
|
+
/** Delete all information stored for an app. */
|
1680
|
+
deleteApp(bearerToken, id, recordDeletion, options = {}) {
|
1681
|
+
if (id === null || id === void 0) {
|
1682
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1683
|
+
}
|
1684
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1685
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1686
|
+
queryParams.set("record_deletion", recordDeletion);
|
1687
|
+
let bodyJson = "";
|
1688
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1689
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
1690
|
+
if (bearerToken) {
|
1691
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1692
|
+
}
|
1693
|
+
return Promise.race([
|
1694
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1695
|
+
if (response.status == 204) {
|
1696
|
+
return response;
|
1697
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1698
|
+
return response.json();
|
1699
|
+
} else {
|
1700
|
+
throw response;
|
1701
|
+
}
|
1702
|
+
}),
|
1703
|
+
new Promise(
|
1704
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1705
|
+
)
|
1706
|
+
]);
|
1707
|
+
}
|
1708
|
+
/** Get detailed app information. */
|
1709
|
+
getApp(bearerToken, id, options = {}) {
|
1710
|
+
if (id === null || id === void 0) {
|
1711
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1712
|
+
}
|
1713
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1714
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1715
|
+
let bodyJson = "";
|
1716
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1717
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1718
|
+
if (bearerToken) {
|
1719
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1720
|
+
}
|
1721
|
+
return Promise.race([
|
1722
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1723
|
+
if (response.status == 204) {
|
1724
|
+
return response;
|
1725
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1726
|
+
return response.json();
|
1727
|
+
} else {
|
1728
|
+
throw response;
|
1729
|
+
}
|
1730
|
+
}),
|
1731
|
+
new Promise(
|
1732
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1733
|
+
)
|
1734
|
+
]);
|
1735
|
+
}
|
1736
|
+
/** Update one or more fields on a app. */
|
1737
|
+
updateApp(bearerToken, id, body, options = {}) {
|
1738
|
+
if (id === null || id === void 0) {
|
1739
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1740
|
+
}
|
1741
|
+
if (body === null || body === void 0) {
|
1742
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1743
|
+
}
|
1744
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1745
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1746
|
+
let bodyJson = "";
|
1747
|
+
bodyJson = JSON.stringify(body || {});
|
1748
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1749
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1750
|
+
if (bearerToken) {
|
1751
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1752
|
+
}
|
1753
|
+
return Promise.race([
|
1754
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1755
|
+
if (response.status == 204) {
|
1756
|
+
return response;
|
1757
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1758
|
+
return response.json();
|
1759
|
+
} else {
|
1760
|
+
throw response;
|
1761
|
+
}
|
1762
|
+
}),
|
1763
|
+
new Promise(
|
1764
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1765
|
+
)
|
1766
|
+
]);
|
1767
|
+
}
|
1768
|
+
/** Ban a app. */
|
1769
|
+
banApp(bearerToken, id, options = {}) {
|
1770
|
+
if (id === null || id === void 0) {
|
1771
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1772
|
+
}
|
1773
|
+
const urlPath = "/v2/apps/app/{id}/ban".replace("{id}", encodeURIComponent(String(id)));
|
1774
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1775
|
+
let bodyJson = "";
|
1776
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1777
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1778
|
+
if (bearerToken) {
|
1779
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1780
|
+
}
|
1781
|
+
return Promise.race([
|
1782
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1783
|
+
if (response.status == 204) {
|
1784
|
+
return response;
|
1785
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1786
|
+
return response.json();
|
1787
|
+
} else {
|
1788
|
+
throw response;
|
1789
|
+
}
|
1790
|
+
}),
|
1791
|
+
new Promise(
|
1792
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1793
|
+
)
|
1794
|
+
]);
|
1795
|
+
}
|
1796
|
+
/** Unban an app. */
|
1797
|
+
unbanApp(bearerToken, id, options = {}) {
|
1798
|
+
if (id === null || id === void 0) {
|
1799
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1800
|
+
}
|
1801
|
+
const urlPath = "/v2/apps/app/{id}/unban".replace("{id}", encodeURIComponent(String(id)));
|
1802
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1803
|
+
let bodyJson = "";
|
1804
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1805
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1806
|
+
if (bearerToken) {
|
1807
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1808
|
+
}
|
1809
|
+
return Promise.race([
|
1810
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1811
|
+
if (response.status == 204) {
|
1812
|
+
return response;
|
1813
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1814
|
+
return response.json();
|
1815
|
+
} else {
|
1816
|
+
throw response;
|
1817
|
+
}
|
1818
|
+
}),
|
1819
|
+
new Promise(
|
1820
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1821
|
+
)
|
1822
|
+
]);
|
1823
|
+
}
|
1622
1824
|
/** */
|
1623
1825
|
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, options = {}) {
|
1624
1826
|
if (clanId === null || clanId === void 0) {
|
@@ -6706,4 +6908,24 @@ var Client = class {
|
|
6706
6908
|
});
|
6707
6909
|
});
|
6708
6910
|
}
|
6911
|
+
addApp(session, request) {
|
6912
|
+
return __async(this, null, function* () {
|
6913
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6914
|
+
yield this.sessionRefresh(session);
|
6915
|
+
}
|
6916
|
+
return this.apiClient.addApp(session.token, request).then((response) => {
|
6917
|
+
return response !== void 0;
|
6918
|
+
});
|
6919
|
+
});
|
6920
|
+
}
|
6921
|
+
ListApp(session) {
|
6922
|
+
return __async(this, null, function* () {
|
6923
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6924
|
+
yield this.sessionRefresh(session);
|
6925
|
+
}
|
6926
|
+
return this.apiClient.listApps(session.token).then((response) => {
|
6927
|
+
return Promise.resolve(response);
|
6928
|
+
});
|
6929
|
+
});
|
6930
|
+
}
|
6709
6931
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1590,6 +1590,208 @@ var MezonApi = class {
|
|
1590
1590
|
)
|
1591
1591
|
]);
|
1592
1592
|
}
|
1593
|
+
/** Add a new apps. */
|
1594
|
+
addApp(bearerToken, body, options = {}) {
|
1595
|
+
if (body === null || body === void 0) {
|
1596
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1597
|
+
}
|
1598
|
+
const urlPath = "/v2/apps/add";
|
1599
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1600
|
+
let bodyJson = "";
|
1601
|
+
bodyJson = JSON.stringify(body || {});
|
1602
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1603
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1604
|
+
if (bearerToken) {
|
1605
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1606
|
+
}
|
1607
|
+
return Promise.race([
|
1608
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1609
|
+
if (response.status == 204) {
|
1610
|
+
return response;
|
1611
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1612
|
+
return response.json();
|
1613
|
+
} else {
|
1614
|
+
throw response;
|
1615
|
+
}
|
1616
|
+
}),
|
1617
|
+
new Promise(
|
1618
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1619
|
+
)
|
1620
|
+
]);
|
1621
|
+
}
|
1622
|
+
/** List (and optionally filter) accounts. */
|
1623
|
+
listApps(bearerToken, filter, tombstones, cursor, options = {}) {
|
1624
|
+
const urlPath = "/v2/apps/app";
|
1625
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1626
|
+
queryParams.set("filter", filter);
|
1627
|
+
queryParams.set("tombstones", tombstones);
|
1628
|
+
queryParams.set("cursor", cursor);
|
1629
|
+
let bodyJson = "";
|
1630
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1631
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1632
|
+
if (bearerToken) {
|
1633
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1634
|
+
}
|
1635
|
+
return Promise.race([
|
1636
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1637
|
+
if (response.status == 204) {
|
1638
|
+
return response;
|
1639
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1640
|
+
return response.json();
|
1641
|
+
} else {
|
1642
|
+
throw response;
|
1643
|
+
}
|
1644
|
+
}),
|
1645
|
+
new Promise(
|
1646
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1647
|
+
)
|
1648
|
+
]);
|
1649
|
+
}
|
1650
|
+
/** Delete all information stored for an app. */
|
1651
|
+
deleteApp(bearerToken, id, recordDeletion, options = {}) {
|
1652
|
+
if (id === null || id === void 0) {
|
1653
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1654
|
+
}
|
1655
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1656
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1657
|
+
queryParams.set("record_deletion", recordDeletion);
|
1658
|
+
let bodyJson = "";
|
1659
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1660
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
1661
|
+
if (bearerToken) {
|
1662
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1663
|
+
}
|
1664
|
+
return Promise.race([
|
1665
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1666
|
+
if (response.status == 204) {
|
1667
|
+
return response;
|
1668
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1669
|
+
return response.json();
|
1670
|
+
} else {
|
1671
|
+
throw response;
|
1672
|
+
}
|
1673
|
+
}),
|
1674
|
+
new Promise(
|
1675
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1676
|
+
)
|
1677
|
+
]);
|
1678
|
+
}
|
1679
|
+
/** Get detailed app information. */
|
1680
|
+
getApp(bearerToken, id, options = {}) {
|
1681
|
+
if (id === null || id === void 0) {
|
1682
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1683
|
+
}
|
1684
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1685
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1686
|
+
let bodyJson = "";
|
1687
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1688
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1689
|
+
if (bearerToken) {
|
1690
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1691
|
+
}
|
1692
|
+
return Promise.race([
|
1693
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1694
|
+
if (response.status == 204) {
|
1695
|
+
return response;
|
1696
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1697
|
+
return response.json();
|
1698
|
+
} else {
|
1699
|
+
throw response;
|
1700
|
+
}
|
1701
|
+
}),
|
1702
|
+
new Promise(
|
1703
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1704
|
+
)
|
1705
|
+
]);
|
1706
|
+
}
|
1707
|
+
/** Update one or more fields on a app. */
|
1708
|
+
updateApp(bearerToken, id, body, options = {}) {
|
1709
|
+
if (id === null || id === void 0) {
|
1710
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1711
|
+
}
|
1712
|
+
if (body === null || body === void 0) {
|
1713
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1714
|
+
}
|
1715
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1716
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1717
|
+
let bodyJson = "";
|
1718
|
+
bodyJson = JSON.stringify(body || {});
|
1719
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1720
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1721
|
+
if (bearerToken) {
|
1722
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1723
|
+
}
|
1724
|
+
return Promise.race([
|
1725
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1726
|
+
if (response.status == 204) {
|
1727
|
+
return response;
|
1728
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1729
|
+
return response.json();
|
1730
|
+
} else {
|
1731
|
+
throw response;
|
1732
|
+
}
|
1733
|
+
}),
|
1734
|
+
new Promise(
|
1735
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1736
|
+
)
|
1737
|
+
]);
|
1738
|
+
}
|
1739
|
+
/** Ban a app. */
|
1740
|
+
banApp(bearerToken, id, options = {}) {
|
1741
|
+
if (id === null || id === void 0) {
|
1742
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1743
|
+
}
|
1744
|
+
const urlPath = "/v2/apps/app/{id}/ban".replace("{id}", encodeURIComponent(String(id)));
|
1745
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1746
|
+
let bodyJson = "";
|
1747
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1748
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1749
|
+
if (bearerToken) {
|
1750
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1751
|
+
}
|
1752
|
+
return Promise.race([
|
1753
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1754
|
+
if (response.status == 204) {
|
1755
|
+
return response;
|
1756
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1757
|
+
return response.json();
|
1758
|
+
} else {
|
1759
|
+
throw response;
|
1760
|
+
}
|
1761
|
+
}),
|
1762
|
+
new Promise(
|
1763
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1764
|
+
)
|
1765
|
+
]);
|
1766
|
+
}
|
1767
|
+
/** Unban an app. */
|
1768
|
+
unbanApp(bearerToken, id, options = {}) {
|
1769
|
+
if (id === null || id === void 0) {
|
1770
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1771
|
+
}
|
1772
|
+
const urlPath = "/v2/apps/app/{id}/unban".replace("{id}", encodeURIComponent(String(id)));
|
1773
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1774
|
+
let bodyJson = "";
|
1775
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1776
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1777
|
+
if (bearerToken) {
|
1778
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1779
|
+
}
|
1780
|
+
return Promise.race([
|
1781
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1782
|
+
if (response.status == 204) {
|
1783
|
+
return response;
|
1784
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1785
|
+
return response.json();
|
1786
|
+
} else {
|
1787
|
+
throw response;
|
1788
|
+
}
|
1789
|
+
}),
|
1790
|
+
new Promise(
|
1791
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1792
|
+
)
|
1793
|
+
]);
|
1794
|
+
}
|
1593
1795
|
/** */
|
1594
1796
|
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, options = {}) {
|
1595
1797
|
if (clanId === null || clanId === void 0) {
|
@@ -6677,6 +6879,26 @@ var Client = class {
|
|
6677
6879
|
});
|
6678
6880
|
});
|
6679
6881
|
}
|
6882
|
+
addApp(session, request) {
|
6883
|
+
return __async(this, null, function* () {
|
6884
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6885
|
+
yield this.sessionRefresh(session);
|
6886
|
+
}
|
6887
|
+
return this.apiClient.addApp(session.token, request).then((response) => {
|
6888
|
+
return response !== void 0;
|
6889
|
+
});
|
6890
|
+
});
|
6891
|
+
}
|
6892
|
+
ListApp(session) {
|
6893
|
+
return __async(this, null, function* () {
|
6894
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6895
|
+
yield this.sessionRefresh(session);
|
6896
|
+
}
|
6897
|
+
return this.apiClient.listApps(session.token).then((response) => {
|
6898
|
+
return Promise.resolve(response);
|
6899
|
+
});
|
6900
|
+
});
|
6901
|
+
}
|
6680
6902
|
};
|
6681
6903
|
export {
|
6682
6904
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -484,6 +484,7 @@ export interface ChannelDescription {
|
|
484
484
|
channel_private?: number;
|
485
485
|
meeting_code?: string;
|
486
486
|
clan_name?: string;
|
487
|
+
parrent_id?: string;
|
487
488
|
}
|
488
489
|
export interface HashtagDmListEvent {
|
489
490
|
user_id?: Array<string>;
|
@@ -498,6 +499,7 @@ export interface HashtagDm {
|
|
498
499
|
meeting_code?: string;
|
499
500
|
type?: number;
|
500
501
|
channel_private?: number;
|
502
|
+
parrent_id?: string;
|
501
503
|
}
|
502
504
|
/** A socket connection to Mezon server. */
|
503
505
|
export interface Socket {
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -697,6 +697,8 @@ export interface ChannelDescription {
|
|
697
697
|
meeting_code?: string;
|
698
698
|
//
|
699
699
|
clan_name?: string;
|
700
|
+
//
|
701
|
+
parrent_id?: string;
|
700
702
|
}
|
701
703
|
|
702
704
|
// A list of Channel
|
@@ -725,6 +727,8 @@ export interface HashtagDm {
|
|
725
727
|
type?: number;
|
726
728
|
//
|
727
729
|
channel_private?: number;
|
730
|
+
//
|
731
|
+
parrent_id?: string;
|
728
732
|
}
|
729
733
|
|
730
734
|
/** A socket connection to Mezon server. */
|