mezon-js 2.8.24 → 2.8.26
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +326 -81
- package/client.ts +28 -17
- package/dist/api.gen.d.ts +55 -29
- package/dist/client.d.ts +3 -2
- package/dist/mezon-js.cjs.js +234 -37
- package/dist/mezon-js.esm.mjs +234 -37
- package/dist/socket.d.ts +32 -0
- package/package.json +1 -1
- package/socket.ts +66 -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 {
|
@@ -807,30 +873,6 @@ export interface ApiFriendList {
|
|
807
873
|
friends?: Array<ApiFriend>;
|
808
874
|
}
|
809
875
|
|
810
|
-
/** */
|
811
|
-
export interface ApiHashtagDmVoice {
|
812
|
-
//The channel id.
|
813
|
-
channel_id?: string;
|
814
|
-
//
|
815
|
-
channel_label?: string;
|
816
|
-
//
|
817
|
-
channel_private?: number;
|
818
|
-
//
|
819
|
-
clan_id?: string;
|
820
|
-
//
|
821
|
-
clan_name?: string;
|
822
|
-
//
|
823
|
-
meeting_code?: string;
|
824
|
-
//
|
825
|
-
type?: number;
|
826
|
-
}
|
827
|
-
|
828
|
-
/** */
|
829
|
-
export interface ApiHashtagDmVoiceList {
|
830
|
-
//A list of channel.
|
831
|
-
hashtage_voice?: Array<ApiHashtagDmVoice>;
|
832
|
-
}
|
833
|
-
|
834
876
|
/** Add link invite users to. */
|
835
877
|
export interface ApiInviteUserRes {
|
836
878
|
//id channel to add link to.
|
@@ -1594,28 +1636,6 @@ export interface ApiWebhookListResponse {
|
|
1594
1636
|
webhooks?: Array<ApiWebhook>;
|
1595
1637
|
}
|
1596
1638
|
|
1597
|
-
/** The object to store. */
|
1598
|
-
export interface ApiWriteStorageObject {
|
1599
|
-
//The collection to store the object.
|
1600
|
-
collection?: string;
|
1601
|
-
//The key for the object within the collection.
|
1602
|
-
key?: string;
|
1603
|
-
//The read access permissions for the object.
|
1604
|
-
permission_read?: number;
|
1605
|
-
//The write access permissions for the object.
|
1606
|
-
permission_write?: number;
|
1607
|
-
//The value of the object.
|
1608
|
-
value?: string;
|
1609
|
-
//The version hash of the object to check. Possible values are: ["", "*", "#hash#"]. if-match and if-none-match
|
1610
|
-
version?: string;
|
1611
|
-
}
|
1612
|
-
|
1613
|
-
/** Write objects to the storage engine. */
|
1614
|
-
export interface ApiWriteStorageObjectsRequest {
|
1615
|
-
//The objects to store on the server.
|
1616
|
-
objects?: Array<ApiWriteStorageObject>;
|
1617
|
-
}
|
1618
|
-
|
1619
1639
|
/** */
|
1620
1640
|
export interface ProtobufAny {
|
1621
1641
|
//
|
@@ -2861,6 +2881,266 @@ export class MezonApi {
|
|
2861
2881
|
]);
|
2862
2882
|
}
|
2863
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
|
+
|
2864
3144
|
/** */
|
2865
3145
|
listCategoryDescs(bearerToken: string,
|
2866
3146
|
clanId:string,
|
@@ -4488,41 +4768,6 @@ export class MezonApi {
|
|
4488
4768
|
]);
|
4489
4769
|
}
|
4490
4770
|
|
4491
|
-
/** List channelvoices */
|
4492
|
-
hashtagDMVoiceList(bearerToken: string,
|
4493
|
-
userId?:Array<string>,
|
4494
|
-
limit?:number,
|
4495
|
-
options: any = {}): Promise<ApiHashtagDmVoiceList> {
|
4496
|
-
|
4497
|
-
const urlPath = "/v2/hashtagdmvoice";
|
4498
|
-
const queryParams = new Map<string, any>();
|
4499
|
-
queryParams.set("user_id", userId);
|
4500
|
-
queryParams.set("limit", limit);
|
4501
|
-
|
4502
|
-
let bodyJson : string = "";
|
4503
|
-
|
4504
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4505
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4506
|
-
if (bearerToken) {
|
4507
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4508
|
-
}
|
4509
|
-
|
4510
|
-
return Promise.race([
|
4511
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
4512
|
-
if (response.status == 204) {
|
4513
|
-
return response;
|
4514
|
-
} else if (response.status >= 200 && response.status < 300) {
|
4515
|
-
return response.json();
|
4516
|
-
} else {
|
4517
|
-
throw response;
|
4518
|
-
}
|
4519
|
-
}),
|
4520
|
-
new Promise((_, reject) =>
|
4521
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4522
|
-
),
|
4523
|
-
]);
|
4524
|
-
}
|
4525
|
-
|
4526
4771
|
/** Add users to a channel. */
|
4527
4772
|
createLinkInviteUser(bearerToken: string,
|
4528
4773
|
body:ApiLinkInviteUserRequest,
|
package/client.ts
CHANGED
@@ -96,9 +96,10 @@ import {
|
|
96
96
|
ApiClanStickerAddRequest,
|
97
97
|
MezonUpdateClanStickerByIdBody,
|
98
98
|
MezonChangeChannelCategoryBody,
|
99
|
-
ApiHashtagDmVoiceList,
|
100
99
|
ApiPermissionRoleChannelList,
|
101
100
|
ApiUpdateRoleChannelRequest,
|
101
|
+
ApiAddAppRequest,
|
102
|
+
ApiAppList,
|
102
103
|
} from "./api.gen";
|
103
104
|
|
104
105
|
import { Session } from "./session";
|
@@ -2152,18 +2153,6 @@ async pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessag
|
|
2152
2153
|
});
|
2153
2154
|
}
|
2154
2155
|
|
2155
|
-
async hashtagDmVoiceList(session: Session, userId:Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList> {
|
2156
|
-
if (this.autoRefreshSession && session.refresh_token &&
|
2157
|
-
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2158
|
-
await this.sessionRefresh(session);
|
2159
|
-
}
|
2160
|
-
|
2161
|
-
return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response: ApiHashtagDmVoiceList) => {
|
2162
|
-
return Promise.resolve(response);
|
2163
|
-
});
|
2164
|
-
}
|
2165
|
-
|
2166
|
-
|
2167
2156
|
//** */
|
2168
2157
|
async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
|
2169
2158
|
if (this.autoRefreshSession && session.refresh_token &&
|
@@ -2323,8 +2312,8 @@ async changeChannelCategory(session: Session, id: string, request: MezonChangeCh
|
|
2323
2312
|
/** */
|
2324
2313
|
async getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList> {
|
2325
2314
|
if (this.autoRefreshSession && session.refresh_token &&
|
2326
|
-
|
2327
|
-
|
2315
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2316
|
+
await this.sessionRefresh(session);
|
2328
2317
|
}
|
2329
2318
|
|
2330
2319
|
return this.apiClient.getListPermissionRoleChannel(session.token, roleId, channelId).then((response: ApiPermissionRoleChannelList) => {
|
@@ -2335,8 +2324,8 @@ async getListPermissionRoleChannel(session: Session, roleId: string, channelId:
|
|
2335
2324
|
/** */
|
2336
2325
|
async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean> {
|
2337
2326
|
if (this.autoRefreshSession && session.refresh_token &&
|
2338
|
-
|
2339
|
-
|
2327
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2328
|
+
await this.sessionRefresh(session);
|
2340
2329
|
}
|
2341
2330
|
|
2342
2331
|
return this.apiClient.setRoleChannelPermission(session.token, request).then((response: any) => {
|
@@ -2344,4 +2333,26 @@ async setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRe
|
|
2344
2333
|
});
|
2345
2334
|
}
|
2346
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
|
+
|
2347
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;
|
@@ -461,20 +502,6 @@ export interface ApiFriendList {
|
|
461
502
|
cursor?: string;
|
462
503
|
friends?: Array<ApiFriend>;
|
463
504
|
}
|
464
|
-
/** */
|
465
|
-
export interface ApiHashtagDmVoice {
|
466
|
-
channel_id?: string;
|
467
|
-
channel_label?: string;
|
468
|
-
channel_private?: number;
|
469
|
-
clan_id?: string;
|
470
|
-
clan_name?: string;
|
471
|
-
meeting_code?: string;
|
472
|
-
type?: number;
|
473
|
-
}
|
474
|
-
/** */
|
475
|
-
export interface ApiHashtagDmVoiceList {
|
476
|
-
hashtage_voice?: Array<ApiHashtagDmVoice>;
|
477
|
-
}
|
478
505
|
/** Add link invite users to. */
|
479
506
|
export interface ApiInviteUserRes {
|
480
507
|
channel_id?: string;
|
@@ -917,19 +944,6 @@ export interface ApiWebhookGenerateResponse {
|
|
917
944
|
export interface ApiWebhookListResponse {
|
918
945
|
webhooks?: Array<ApiWebhook>;
|
919
946
|
}
|
920
|
-
/** The object to store. */
|
921
|
-
export interface ApiWriteStorageObject {
|
922
|
-
collection?: string;
|
923
|
-
key?: string;
|
924
|
-
permission_read?: number;
|
925
|
-
permission_write?: number;
|
926
|
-
value?: string;
|
927
|
-
version?: string;
|
928
|
-
}
|
929
|
-
/** Write objects to the storage engine. */
|
930
|
-
export interface ApiWriteStorageObjectsRequest {
|
931
|
-
objects?: Array<ApiWriteStorageObject>;
|
932
|
-
}
|
933
947
|
/** */
|
934
948
|
export interface ProtobufAny {
|
935
949
|
type_url?: string;
|
@@ -1012,6 +1026,20 @@ export declare class MezonApi {
|
|
1012
1026
|
unlinkGoogle(bearerToken: string, body: ApiAccountGoogle, options?: any): Promise<any>;
|
1013
1027
|
/** Remove Steam from the social profiles on the current user's account. */
|
1014
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>;
|
1015
1043
|
/** */
|
1016
1044
|
listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, options?: any): Promise<ApiCategoryDescList>;
|
1017
1045
|
/** List a channel's message history. */
|
@@ -1098,8 +1126,6 @@ export declare class MezonApi {
|
|
1098
1126
|
importSteamFriends(bearerToken: string, account: ApiAccountSteam, reset?: boolean, options?: any): Promise<any>;
|
1099
1127
|
/** */
|
1100
1128
|
getUserProfileOnClan(bearerToken: string, clanId: string, options?: any): Promise<ApiClanProfile>;
|
1101
|
-
/** List channelvoices */
|
1102
|
-
hashtagDMVoiceList(bearerToken: string, userId?: Array<string>, limit?: number, options?: any): Promise<ApiHashtagDmVoiceList>;
|
1103
1129
|
/** Add users to a channel. */
|
1104
1130
|
createLinkInviteUser(bearerToken: string, body: ApiLinkInviteUserRequest, options?: any): Promise<ApiLinkInviteUser>;
|
1105
1131
|
/** Add users to a channel. */
|
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,
|
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";
|
@@ -574,7 +574,6 @@ export declare class Client {
|
|
574
574
|
/** */
|
575
575
|
createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
|
576
576
|
pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
|
577
|
-
hashtagDmVoiceList(session: Session, userId: Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList>;
|
578
577
|
deletePinMessage(session: Session, message_id: string): Promise<boolean>;
|
579
578
|
/** create clan emoji */
|
580
579
|
createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
|
@@ -593,4 +592,6 @@ export declare class Client {
|
|
593
592
|
getListPermissionRoleChannel(session: Session, roleId: string, channelId: string): Promise<ApiPermissionRoleChannelList>;
|
594
593
|
/** */
|
595
594
|
setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
|
595
|
+
addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
|
596
|
+
ListApp(session: Session): Promise<ApiAppList>;
|
596
597
|
}
|