mezon-js 2.7.60 → 2.7.62
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/README.md +7 -7
- package/api.gen.ts +288 -4
- package/client.ts +15 -4
- package/dist/api.gen.d.ts +86 -3
- package/dist/client.d.ts +4 -2
- package/dist/mezon-js.cjs.js +137 -5
- package/dist/mezon-js.esm.mjs +137 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ You'll need to setup the server and database before you can connect with the cli
|
|
|
15
15
|
|
|
16
16
|
1. Install and run the servers. Follow these [instructions](https://mezon.vn/docs/install-docker-quickstart).
|
|
17
17
|
|
|
18
|
-
2. Import the client into your project. It's [available on NPM](https://www.npmjs.com/package
|
|
18
|
+
2. Import the client into your project. It's [available on NPM](https://www.npmjs.com/package/mezon-js) and can be also be added to a project with Bower or other package managers.
|
|
19
19
|
|
|
20
20
|
```shell
|
|
21
|
-
npm install
|
|
21
|
+
npm install mezon-js
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
You'll now see the code in the "node_modules" folder and package listed in your "package.json".
|
|
@@ -26,13 +26,13 @@ You'll need to setup the server and database before you can connect with the cli
|
|
|
26
26
|
Optionally, if you would like to use the Protocol Buffers wire format with your sockets, you can import the adapter found in this package:
|
|
27
27
|
|
|
28
28
|
```shell
|
|
29
|
-
npm install
|
|
29
|
+
npm install mezon-js-protobuf
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
3. Use the connection credentials to build a client object.
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
-
import {Client} from "
|
|
35
|
+
import {Client} from "mezon-js";
|
|
36
36
|
|
|
37
37
|
var useSSL = false; // Enable if server is run with an SSL certificate.
|
|
38
38
|
var client = new Client("defaultkey", "127.0.0.1", "7350", useSSL);
|
|
@@ -124,7 +124,7 @@ const session = await socket.connect(session);
|
|
|
124
124
|
If you are using the optional protocol buffer adapter, pass the adapter to the Socket object during construction:
|
|
125
125
|
|
|
126
126
|
```js
|
|
127
|
-
import {WebSocketAdapterPb} from "
|
|
127
|
+
import {WebSocketAdapterPb} from "mezon-js-protobuf"
|
|
128
128
|
|
|
129
129
|
const secure = false; // Enable if server is run with an SSL certificate
|
|
130
130
|
const trace = false;
|
|
@@ -184,7 +184,7 @@ To build from source, first install all workspace dependencies from the reposito
|
|
|
184
184
|
Then to build a specific workspace, pass the `--workspace` flag to your build command, for example:
|
|
185
185
|
|
|
186
186
|
```shell
|
|
187
|
-
npm run build --workspace
|
|
187
|
+
npm run build --workspace=mezon-js
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
### Run Tests
|
|
@@ -195,7 +195,7 @@ Tests are run against each workspace bundle; if you have made source code change
|
|
|
195
195
|
|
|
196
196
|
```shell
|
|
197
197
|
docker-compose -f ./docker-compose.yml up
|
|
198
|
-
npm run test --workspace
|
|
198
|
+
npm run test --workspace=mezon-js-test
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
### Protocol Buffer Web Socket Adapter
|
package/api.gen.ts
CHANGED
|
@@ -24,6 +24,106 @@ export interface ClanUserListClanUser {
|
|
|
24
24
|
user?: ApiUser;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/** Update fields in a given channel. */
|
|
28
|
+
export interface MezonUpdateChannelDescBody {
|
|
29
|
+
//
|
|
30
|
+
category_id?: string;
|
|
31
|
+
//
|
|
32
|
+
channel_label?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** */
|
|
36
|
+
export interface MezonUpdateClanDescBody {
|
|
37
|
+
//
|
|
38
|
+
banner?: string;
|
|
39
|
+
//
|
|
40
|
+
clan_name?: string;
|
|
41
|
+
//
|
|
42
|
+
creator_id?: string;
|
|
43
|
+
//
|
|
44
|
+
logo?: string;
|
|
45
|
+
//
|
|
46
|
+
status?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** */
|
|
50
|
+
export interface MezonUpdateClanDescProfileBody {
|
|
51
|
+
//
|
|
52
|
+
avatar_url?: string;
|
|
53
|
+
//
|
|
54
|
+
nick_name?: string;
|
|
55
|
+
//
|
|
56
|
+
profile_banner?: string;
|
|
57
|
+
//
|
|
58
|
+
profile_theme?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** */
|
|
62
|
+
export interface MezonUpdateClanEmojiByIdBody {
|
|
63
|
+
//
|
|
64
|
+
category?: string;
|
|
65
|
+
//
|
|
66
|
+
shortname?: string;
|
|
67
|
+
//
|
|
68
|
+
source?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** update a event within clan. */
|
|
72
|
+
export interface MezonUpdateEventBody {
|
|
73
|
+
//
|
|
74
|
+
address?: string;
|
|
75
|
+
//
|
|
76
|
+
channel_id?: string;
|
|
77
|
+
//
|
|
78
|
+
description?: string;
|
|
79
|
+
//
|
|
80
|
+
end_time?: string;
|
|
81
|
+
//
|
|
82
|
+
logo?: string;
|
|
83
|
+
//
|
|
84
|
+
start_time?: string;
|
|
85
|
+
//
|
|
86
|
+
title?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Update fields in a given role. */
|
|
90
|
+
export interface MezonUpdateRoleBody {
|
|
91
|
+
//The permissions to add.
|
|
92
|
+
active_permission_ids?: Array<string>;
|
|
93
|
+
//The users to add.
|
|
94
|
+
add_user_ids?: Array<string>;
|
|
95
|
+
//
|
|
96
|
+
allow_mention?: number;
|
|
97
|
+
//
|
|
98
|
+
color?: string;
|
|
99
|
+
//
|
|
100
|
+
description?: string;
|
|
101
|
+
//
|
|
102
|
+
display_online?: number;
|
|
103
|
+
//The permissions to remove.
|
|
104
|
+
remove_permission_ids?: Array<string>;
|
|
105
|
+
//The users to remove.
|
|
106
|
+
remove_user_ids?: Array<string>;
|
|
107
|
+
//
|
|
108
|
+
role_icon?: string;
|
|
109
|
+
//
|
|
110
|
+
title?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Delete a role the user has access to. */
|
|
114
|
+
export interface MezonUpdateRoleDeleteBody {
|
|
115
|
+
//
|
|
116
|
+
channel_id?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** */
|
|
120
|
+
export interface MezonUpdateUserProfileByClanBody {
|
|
121
|
+
//
|
|
122
|
+
avatar?: string;
|
|
123
|
+
//
|
|
124
|
+
nick_name?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
27
127
|
/** A single user-role pair. */
|
|
28
128
|
export interface RoleUserListRoleUser {
|
|
29
129
|
//A URL for an avatar image.
|
|
@@ -386,6 +486,18 @@ export interface ApiClanEmoji {
|
|
|
386
486
|
src?: string;
|
|
387
487
|
}
|
|
388
488
|
|
|
489
|
+
/** */
|
|
490
|
+
export interface ApiClanEmojiCreateRequest {
|
|
491
|
+
//
|
|
492
|
+
category?: string;
|
|
493
|
+
//
|
|
494
|
+
clan_id?: string;
|
|
495
|
+
//
|
|
496
|
+
shortname?: string;
|
|
497
|
+
//
|
|
498
|
+
source?: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
389
501
|
/** */
|
|
390
502
|
export interface ApiClanEmojiList {
|
|
391
503
|
//
|
|
@@ -907,6 +1019,24 @@ export interface ApiReadStorageObjectsRequest {
|
|
|
907
1019
|
object_ids?: Array<ApiReadStorageObjectId>;
|
|
908
1020
|
}
|
|
909
1021
|
|
|
1022
|
+
/** */
|
|
1023
|
+
export interface ApiRegistrationEmailRequest {
|
|
1024
|
+
//
|
|
1025
|
+
avatar_url?: string;
|
|
1026
|
+
//
|
|
1027
|
+
display_name?: string;
|
|
1028
|
+
//
|
|
1029
|
+
dob?: string;
|
|
1030
|
+
//A valid RFC-5322 email address.
|
|
1031
|
+
email?: string;
|
|
1032
|
+
//A password for the user account.
|
|
1033
|
+
password?: string;
|
|
1034
|
+
//Set the username on the account at register. Must be unique.
|
|
1035
|
+
username?: string;
|
|
1036
|
+
//Extra information that will be bundled in the session token.
|
|
1037
|
+
vars?: Record<string, string>;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
910
1040
|
/** */
|
|
911
1041
|
export interface ApiRole {
|
|
912
1042
|
//
|
|
@@ -2153,6 +2283,42 @@ export class MezonApi {
|
|
|
2153
2283
|
]);
|
|
2154
2284
|
}
|
|
2155
2285
|
|
|
2286
|
+
/** Authenticate a user with an email+password against the server. */
|
|
2287
|
+
registrationEmail(bearerToken: string,
|
|
2288
|
+
body:ApiRegistrationEmailRequest,
|
|
2289
|
+
options: any = {}): Promise<ApiSession> {
|
|
2290
|
+
|
|
2291
|
+
if (body === null || body === undefined) {
|
|
2292
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2293
|
+
}
|
|
2294
|
+
const urlPath = "/v2/account/registry";
|
|
2295
|
+
const queryParams = new Map<string, any>();
|
|
2296
|
+
|
|
2297
|
+
let bodyJson : string = "";
|
|
2298
|
+
bodyJson = JSON.stringify(body || {});
|
|
2299
|
+
|
|
2300
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2301
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2302
|
+
if (bearerToken) {
|
|
2303
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
return Promise.race([
|
|
2307
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2308
|
+
if (response.status == 204) {
|
|
2309
|
+
return response;
|
|
2310
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2311
|
+
return response.json();
|
|
2312
|
+
} else {
|
|
2313
|
+
throw response;
|
|
2314
|
+
}
|
|
2315
|
+
}),
|
|
2316
|
+
new Promise((_, reject) =>
|
|
2317
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2318
|
+
),
|
|
2319
|
+
]);
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2156
2322
|
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
2157
2323
|
sessionRefresh(basicAuthUsername: string,
|
|
2158
2324
|
basicAuthPassword: string,
|
|
@@ -3481,11 +3647,52 @@ export class MezonApi {
|
|
|
3481
3647
|
]);
|
|
3482
3648
|
}
|
|
3483
3649
|
|
|
3484
|
-
/**
|
|
3485
|
-
|
|
3650
|
+
/** Post clan Emoji /v2/emoji/create */
|
|
3651
|
+
createClanEmoji(bearerToken: string,
|
|
3652
|
+
body:ApiClanEmojiCreateRequest,
|
|
3653
|
+
options: any = {}): Promise<any> {
|
|
3654
|
+
|
|
3655
|
+
if (body === null || body === undefined) {
|
|
3656
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3657
|
+
}
|
|
3658
|
+
const urlPath = "/v2/emoji/create";
|
|
3659
|
+
const queryParams = new Map<string, any>();
|
|
3660
|
+
|
|
3661
|
+
let bodyJson : string = "";
|
|
3662
|
+
bodyJson = JSON.stringify(body || {});
|
|
3663
|
+
|
|
3664
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3665
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
3666
|
+
if (bearerToken) {
|
|
3667
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
return Promise.race([
|
|
3671
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3672
|
+
if (response.status == 204) {
|
|
3673
|
+
return response;
|
|
3674
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3675
|
+
return response.json();
|
|
3676
|
+
} else {
|
|
3677
|
+
throw response;
|
|
3678
|
+
}
|
|
3679
|
+
}),
|
|
3680
|
+
new Promise((_, reject) =>
|
|
3681
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3682
|
+
),
|
|
3683
|
+
]);
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
/** Get emoji list by clan id */
|
|
3687
|
+
listClanEmojiByClanId(bearerToken: string,
|
|
3688
|
+
clanId:string,
|
|
3486
3689
|
options: any = {}): Promise<ApiClanEmojiList> {
|
|
3487
3690
|
|
|
3488
|
-
|
|
3691
|
+
if (clanId === null || clanId === undefined) {
|
|
3692
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
3693
|
+
}
|
|
3694
|
+
const urlPath = "/v2/emoji/{clanId}"
|
|
3695
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
3489
3696
|
const queryParams = new Map<string, any>();
|
|
3490
3697
|
|
|
3491
3698
|
let bodyJson : string = "";
|
|
@@ -3512,6 +3719,83 @@ export class MezonApi {
|
|
|
3512
3719
|
]);
|
|
3513
3720
|
}
|
|
3514
3721
|
|
|
3722
|
+
/** Delete a emoji by ID. */
|
|
3723
|
+
deleteByIdClanEmoji(bearerToken: string,
|
|
3724
|
+
id:string,
|
|
3725
|
+
options: any = {}): Promise<any> {
|
|
3726
|
+
|
|
3727
|
+
if (id === null || id === undefined) {
|
|
3728
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
3729
|
+
}
|
|
3730
|
+
const urlPath = "/v2/emoji/{id}"
|
|
3731
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
|
3732
|
+
const queryParams = new Map<string, any>();
|
|
3733
|
+
|
|
3734
|
+
let bodyJson : string = "";
|
|
3735
|
+
|
|
3736
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3737
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
3738
|
+
if (bearerToken) {
|
|
3739
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
return Promise.race([
|
|
3743
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3744
|
+
if (response.status == 204) {
|
|
3745
|
+
return response;
|
|
3746
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3747
|
+
return response.json();
|
|
3748
|
+
} else {
|
|
3749
|
+
throw response;
|
|
3750
|
+
}
|
|
3751
|
+
}),
|
|
3752
|
+
new Promise((_, reject) =>
|
|
3753
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3754
|
+
),
|
|
3755
|
+
]);
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
/** Update ClanEmoj By id */
|
|
3759
|
+
updateClanEmojiById(bearerToken: string,
|
|
3760
|
+
id:string,
|
|
3761
|
+
body: MezonUpdateClanEmojiByIdBody,
|
|
3762
|
+
options: any = {}): Promise<any> {
|
|
3763
|
+
|
|
3764
|
+
if (id === null || id === undefined) {
|
|
3765
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
3766
|
+
}
|
|
3767
|
+
if (body === null || body === undefined) {
|
|
3768
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
3769
|
+
}
|
|
3770
|
+
const urlPath = "/v2/emoji/{id}"
|
|
3771
|
+
.replace("{id}", encodeURIComponent(String(id)));
|
|
3772
|
+
const queryParams = new Map<string, any>();
|
|
3773
|
+
|
|
3774
|
+
let bodyJson : string = "";
|
|
3775
|
+
bodyJson = JSON.stringify(body || {});
|
|
3776
|
+
|
|
3777
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3778
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
3779
|
+
if (bearerToken) {
|
|
3780
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
return Promise.race([
|
|
3784
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3785
|
+
if (response.status == 204) {
|
|
3786
|
+
return response;
|
|
3787
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
3788
|
+
return response.json();
|
|
3789
|
+
} else {
|
|
3790
|
+
throw response;
|
|
3791
|
+
}
|
|
3792
|
+
}),
|
|
3793
|
+
new Promise((_, reject) =>
|
|
3794
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3795
|
+
),
|
|
3796
|
+
]);
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3515
3799
|
/** Search message from elasticsearch service. */
|
|
3516
3800
|
searchMessage(bearerToken: string,
|
|
3517
3801
|
body:ApiSearchMessageRequest,
|
|
@@ -4959,7 +5243,7 @@ export class MezonApi {
|
|
|
4959
5243
|
/** Update a role when Delete a role by ID. */
|
|
4960
5244
|
updateRoleDelete(bearerToken: string,
|
|
4961
5245
|
roleId:string,
|
|
4962
|
-
body:
|
|
5246
|
+
body: MezonUpdateRoleDeleteBody,
|
|
4963
5247
|
options: any = {}): Promise<any> {
|
|
4964
5248
|
|
|
4965
5249
|
if (roleId === null || roleId === undefined) {
|
package/client.ts
CHANGED
|
@@ -94,7 +94,8 @@ import {
|
|
|
94
94
|
ApiWebhookResponse,
|
|
95
95
|
ApiDeleteChannelDescRequest,
|
|
96
96
|
ApiChangeChannelPrivateRequest,
|
|
97
|
-
ApiClanEmojiList
|
|
97
|
+
ApiClanEmojiList,
|
|
98
|
+
ApiClanEmojiCreateRequest
|
|
98
99
|
} from "./api.gen";
|
|
99
100
|
|
|
100
101
|
import { Session } from "./session";
|
|
@@ -2221,17 +2222,27 @@ async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
|
|
|
2221
2222
|
}
|
|
2222
2223
|
|
|
2223
2224
|
/** List clan emoji. */
|
|
2224
|
-
async listClanEmoji(session: Session): Promise<ApiClanEmojiList> {
|
|
2225
|
+
async listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList> {
|
|
2225
2226
|
if (this.autoRefreshSession && session.refresh_token &&
|
|
2226
2227
|
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2227
2228
|
await this.sessionRefresh(session);
|
|
2228
2229
|
}
|
|
2229
2230
|
|
|
2230
|
-
return this.apiClient.
|
|
2231
|
+
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response: ApiClanEmojiList) => {
|
|
2231
2232
|
return Promise.resolve(response);
|
|
2232
2233
|
});
|
|
2233
2234
|
}
|
|
2234
2235
|
|
|
2235
|
-
|
|
2236
|
+
/** create clan emoji */
|
|
2237
|
+
async createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest) {
|
|
2238
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
|
2239
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
|
2240
|
+
await this.sessionRefresh(session);
|
|
2241
|
+
}
|
|
2236
2242
|
|
|
2243
|
+
return this.apiClient.createClanEmoji(session.token, request).then((response: any) => {
|
|
2244
|
+
return response !== undefined;
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2237
2247
|
|
|
2248
|
+
};
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -10,6 +10,64 @@ export interface ClanUserListClanUser {
|
|
|
10
10
|
role_id?: string;
|
|
11
11
|
user?: ApiUser;
|
|
12
12
|
}
|
|
13
|
+
/** Update fields in a given channel. */
|
|
14
|
+
export interface MezonUpdateChannelDescBody {
|
|
15
|
+
category_id?: string;
|
|
16
|
+
channel_label?: string;
|
|
17
|
+
}
|
|
18
|
+
/** */
|
|
19
|
+
export interface MezonUpdateClanDescBody {
|
|
20
|
+
banner?: string;
|
|
21
|
+
clan_name?: string;
|
|
22
|
+
creator_id?: string;
|
|
23
|
+
logo?: string;
|
|
24
|
+
status?: number;
|
|
25
|
+
}
|
|
26
|
+
/** */
|
|
27
|
+
export interface MezonUpdateClanDescProfileBody {
|
|
28
|
+
avatar_url?: string;
|
|
29
|
+
nick_name?: string;
|
|
30
|
+
profile_banner?: string;
|
|
31
|
+
profile_theme?: string;
|
|
32
|
+
}
|
|
33
|
+
/** */
|
|
34
|
+
export interface MezonUpdateClanEmojiByIdBody {
|
|
35
|
+
category?: string;
|
|
36
|
+
shortname?: string;
|
|
37
|
+
source?: string;
|
|
38
|
+
}
|
|
39
|
+
/** update a event within clan. */
|
|
40
|
+
export interface MezonUpdateEventBody {
|
|
41
|
+
address?: string;
|
|
42
|
+
channel_id?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
end_time?: string;
|
|
45
|
+
logo?: string;
|
|
46
|
+
start_time?: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Update fields in a given role. */
|
|
50
|
+
export interface MezonUpdateRoleBody {
|
|
51
|
+
active_permission_ids?: Array<string>;
|
|
52
|
+
add_user_ids?: Array<string>;
|
|
53
|
+
allow_mention?: number;
|
|
54
|
+
color?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
display_online?: number;
|
|
57
|
+
remove_permission_ids?: Array<string>;
|
|
58
|
+
remove_user_ids?: Array<string>;
|
|
59
|
+
role_icon?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Delete a role the user has access to. */
|
|
63
|
+
export interface MezonUpdateRoleDeleteBody {
|
|
64
|
+
channel_id?: string;
|
|
65
|
+
}
|
|
66
|
+
/** */
|
|
67
|
+
export interface MezonUpdateUserProfileByClanBody {
|
|
68
|
+
avatar?: string;
|
|
69
|
+
nick_name?: string;
|
|
70
|
+
}
|
|
13
71
|
/** A single user-role pair. */
|
|
14
72
|
export interface RoleUserListRoleUser {
|
|
15
73
|
avatar_url?: string;
|
|
@@ -220,6 +278,13 @@ export interface ApiClanEmoji {
|
|
|
220
278
|
src?: string;
|
|
221
279
|
}
|
|
222
280
|
/** */
|
|
281
|
+
export interface ApiClanEmojiCreateRequest {
|
|
282
|
+
category?: string;
|
|
283
|
+
clan_id?: string;
|
|
284
|
+
shortname?: string;
|
|
285
|
+
source?: string;
|
|
286
|
+
}
|
|
287
|
+
/** */
|
|
223
288
|
export interface ApiClanEmojiList {
|
|
224
289
|
emoji_list?: Array<ApiClanEmoji>;
|
|
225
290
|
}
|
|
@@ -525,6 +590,16 @@ export interface ApiReadStorageObjectsRequest {
|
|
|
525
590
|
object_ids?: Array<ApiReadStorageObjectId>;
|
|
526
591
|
}
|
|
527
592
|
/** */
|
|
593
|
+
export interface ApiRegistrationEmailRequest {
|
|
594
|
+
avatar_url?: string;
|
|
595
|
+
display_name?: string;
|
|
596
|
+
dob?: string;
|
|
597
|
+
email?: string;
|
|
598
|
+
password?: string;
|
|
599
|
+
username?: string;
|
|
600
|
+
vars?: Record<string, string>;
|
|
601
|
+
}
|
|
602
|
+
/** */
|
|
528
603
|
export interface ApiRole {
|
|
529
604
|
active?: number;
|
|
530
605
|
allow_mention?: number;
|
|
@@ -814,6 +889,8 @@ export declare class MezonApi {
|
|
|
814
889
|
linkGoogle(bearerToken: string, body: ApiAccountGoogle, options?: any): Promise<any>;
|
|
815
890
|
/** Add Steam to the social profiles on the current user's account. */
|
|
816
891
|
linkSteam(bearerToken: string, body: ApiLinkSteamRequest, options?: any): Promise<any>;
|
|
892
|
+
/** Authenticate a user with an email+password against the server. */
|
|
893
|
+
registrationEmail(bearerToken: string, body: ApiRegistrationEmailRequest, options?: any): Promise<ApiSession>;
|
|
817
894
|
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
818
895
|
sessionRefresh(basicAuthUsername: string, basicAuthPassword: string, body: ApiSessionRefreshRequest, options?: any): Promise<ApiSession>;
|
|
819
896
|
/** Remove the Apple ID from the social profiles on the current user's account. */
|
|
@@ -884,8 +961,14 @@ export declare class MezonApi {
|
|
|
884
961
|
closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
|
885
962
|
/** open direct message. */
|
|
886
963
|
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
|
887
|
-
/**
|
|
888
|
-
|
|
964
|
+
/** Post clan Emoji /v2/emoji/create */
|
|
965
|
+
createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
|
|
966
|
+
/** Get emoji list by clan id */
|
|
967
|
+
listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
|
|
968
|
+
/** Delete a emoji by ID. */
|
|
969
|
+
deleteByIdClanEmoji(bearerToken: string, id: string, options?: any): Promise<any>;
|
|
970
|
+
/** Update ClanEmoj By id */
|
|
971
|
+
updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
|
|
889
972
|
/** Search message from elasticsearch service. */
|
|
890
973
|
searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
|
|
891
974
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
|
@@ -969,7 +1052,7 @@ export declare class MezonApi {
|
|
|
969
1052
|
/** Create a new role for clan. */
|
|
970
1053
|
createRole(bearerToken: string, body: ApiCreateRoleRequest, options?: any): Promise<ApiRole>;
|
|
971
1054
|
/** Update a role when Delete a role by ID. */
|
|
972
|
-
updateRoleDelete(bearerToken: string, roleId: string, body:
|
|
1055
|
+
updateRoleDelete(bearerToken: string, roleId: string, body: MezonUpdateRoleDeleteBody, options?: any): Promise<any>;
|
|
973
1056
|
/** Delete a role by ID. */
|
|
974
1057
|
deleteRole(bearerToken: string, roleId: string, channelId?: string, options?: any): Promise<any>;
|
|
975
1058
|
/** Update fields in a given role. */
|
package/dist/client.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList } from "./api.gen";
|
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -578,5 +578,7 @@ export declare class Client {
|
|
|
578
578
|
getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
|
|
579
579
|
deletePinMessage(session: Session, message_id: string): Promise<boolean>;
|
|
580
580
|
/** List clan emoji. */
|
|
581
|
-
listClanEmoji(session: Session): Promise<ApiClanEmojiList>;
|
|
581
|
+
listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList>;
|
|
582
|
+
/** create clan emoji */
|
|
583
|
+
createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
|
|
582
584
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -1300,6 +1300,35 @@ var MezonApi = class {
|
|
|
1300
1300
|
)
|
|
1301
1301
|
]);
|
|
1302
1302
|
}
|
|
1303
|
+
/** Authenticate a user with an email+password against the server. */
|
|
1304
|
+
registrationEmail(bearerToken, body, options = {}) {
|
|
1305
|
+
if (body === null || body === void 0) {
|
|
1306
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
1307
|
+
}
|
|
1308
|
+
const urlPath = "/v2/account/registry";
|
|
1309
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
1310
|
+
let bodyJson = "";
|
|
1311
|
+
bodyJson = JSON.stringify(body || {});
|
|
1312
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
1313
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
1314
|
+
if (bearerToken) {
|
|
1315
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
1316
|
+
}
|
|
1317
|
+
return Promise.race([
|
|
1318
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
1319
|
+
if (response.status == 204) {
|
|
1320
|
+
return response;
|
|
1321
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
1322
|
+
return response.json();
|
|
1323
|
+
} else {
|
|
1324
|
+
throw response;
|
|
1325
|
+
}
|
|
1326
|
+
}),
|
|
1327
|
+
new Promise(
|
|
1328
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
1329
|
+
)
|
|
1330
|
+
]);
|
|
1331
|
+
}
|
|
1303
1332
|
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
1304
1333
|
sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
|
|
1305
1334
|
if (body === null || body === void 0) {
|
|
@@ -2331,9 +2360,41 @@ var MezonApi = class {
|
|
|
2331
2360
|
)
|
|
2332
2361
|
]);
|
|
2333
2362
|
}
|
|
2334
|
-
/**
|
|
2335
|
-
|
|
2336
|
-
|
|
2363
|
+
/** Post clan Emoji /v2/emoji/create */
|
|
2364
|
+
createClanEmoji(bearerToken, body, options = {}) {
|
|
2365
|
+
if (body === null || body === void 0) {
|
|
2366
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2367
|
+
}
|
|
2368
|
+
const urlPath = "/v2/emoji/create";
|
|
2369
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2370
|
+
let bodyJson = "";
|
|
2371
|
+
bodyJson = JSON.stringify(body || {});
|
|
2372
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2373
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2374
|
+
if (bearerToken) {
|
|
2375
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2376
|
+
}
|
|
2377
|
+
return Promise.race([
|
|
2378
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2379
|
+
if (response.status == 204) {
|
|
2380
|
+
return response;
|
|
2381
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2382
|
+
return response.json();
|
|
2383
|
+
} else {
|
|
2384
|
+
throw response;
|
|
2385
|
+
}
|
|
2386
|
+
}),
|
|
2387
|
+
new Promise(
|
|
2388
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2389
|
+
)
|
|
2390
|
+
]);
|
|
2391
|
+
}
|
|
2392
|
+
/** Get emoji list by clan id */
|
|
2393
|
+
listClanEmojiByClanId(bearerToken, clanId, options = {}) {
|
|
2394
|
+
if (clanId === null || clanId === void 0) {
|
|
2395
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2396
|
+
}
|
|
2397
|
+
const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2337
2398
|
const queryParams = /* @__PURE__ */ new Map();
|
|
2338
2399
|
let bodyJson = "";
|
|
2339
2400
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
@@ -2356,6 +2417,66 @@ var MezonApi = class {
|
|
|
2356
2417
|
)
|
|
2357
2418
|
]);
|
|
2358
2419
|
}
|
|
2420
|
+
/** Delete a emoji by ID. */
|
|
2421
|
+
deleteByIdClanEmoji(bearerToken, id, options = {}) {
|
|
2422
|
+
if (id === null || id === void 0) {
|
|
2423
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
2424
|
+
}
|
|
2425
|
+
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
2426
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2427
|
+
let bodyJson = "";
|
|
2428
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2429
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
2430
|
+
if (bearerToken) {
|
|
2431
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2432
|
+
}
|
|
2433
|
+
return Promise.race([
|
|
2434
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2435
|
+
if (response.status == 204) {
|
|
2436
|
+
return response;
|
|
2437
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2438
|
+
return response.json();
|
|
2439
|
+
} else {
|
|
2440
|
+
throw response;
|
|
2441
|
+
}
|
|
2442
|
+
}),
|
|
2443
|
+
new Promise(
|
|
2444
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2445
|
+
)
|
|
2446
|
+
]);
|
|
2447
|
+
}
|
|
2448
|
+
/** Update ClanEmoj By id */
|
|
2449
|
+
updateClanEmojiById(bearerToken, id, body, options = {}) {
|
|
2450
|
+
if (id === null || id === void 0) {
|
|
2451
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
2452
|
+
}
|
|
2453
|
+
if (body === null || body === void 0) {
|
|
2454
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2455
|
+
}
|
|
2456
|
+
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
2457
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2458
|
+
let bodyJson = "";
|
|
2459
|
+
bodyJson = JSON.stringify(body || {});
|
|
2460
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2461
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
2462
|
+
if (bearerToken) {
|
|
2463
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2464
|
+
}
|
|
2465
|
+
return Promise.race([
|
|
2466
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2467
|
+
if (response.status == 204) {
|
|
2468
|
+
return response;
|
|
2469
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2470
|
+
return response.json();
|
|
2471
|
+
} else {
|
|
2472
|
+
throw response;
|
|
2473
|
+
}
|
|
2474
|
+
}),
|
|
2475
|
+
new Promise(
|
|
2476
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2477
|
+
)
|
|
2478
|
+
]);
|
|
2479
|
+
}
|
|
2359
2480
|
/** Search message from elasticsearch service. */
|
|
2360
2481
|
searchMessage(bearerToken, body, options = {}) {
|
|
2361
2482
|
if (body === null || body === void 0) {
|
|
@@ -6265,14 +6386,25 @@ var Client = class {
|
|
|
6265
6386
|
});
|
|
6266
6387
|
}
|
|
6267
6388
|
/** List clan emoji. */
|
|
6268
|
-
listClanEmoji(session) {
|
|
6389
|
+
listClanEmoji(session, clan_id) {
|
|
6269
6390
|
return __async(this, null, function* () {
|
|
6270
6391
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6271
6392
|
yield this.sessionRefresh(session);
|
|
6272
6393
|
}
|
|
6273
|
-
return this.apiClient.
|
|
6394
|
+
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
|
|
6274
6395
|
return Promise.resolve(response);
|
|
6275
6396
|
});
|
|
6276
6397
|
});
|
|
6277
6398
|
}
|
|
6399
|
+
/** create clan emoji */
|
|
6400
|
+
createClanEmoji(session, request) {
|
|
6401
|
+
return __async(this, null, function* () {
|
|
6402
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6403
|
+
yield this.sessionRefresh(session);
|
|
6404
|
+
}
|
|
6405
|
+
return this.apiClient.createClanEmoji(session.token, request).then((response) => {
|
|
6406
|
+
return response !== void 0;
|
|
6407
|
+
});
|
|
6408
|
+
});
|
|
6409
|
+
}
|
|
6278
6410
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -1271,6 +1271,35 @@ var MezonApi = class {
|
|
|
1271
1271
|
)
|
|
1272
1272
|
]);
|
|
1273
1273
|
}
|
|
1274
|
+
/** Authenticate a user with an email+password against the server. */
|
|
1275
|
+
registrationEmail(bearerToken, body, options = {}) {
|
|
1276
|
+
if (body === null || body === void 0) {
|
|
1277
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
1278
|
+
}
|
|
1279
|
+
const urlPath = "/v2/account/registry";
|
|
1280
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
1281
|
+
let bodyJson = "";
|
|
1282
|
+
bodyJson = JSON.stringify(body || {});
|
|
1283
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
1284
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
1285
|
+
if (bearerToken) {
|
|
1286
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
1287
|
+
}
|
|
1288
|
+
return Promise.race([
|
|
1289
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
1290
|
+
if (response.status == 204) {
|
|
1291
|
+
return response;
|
|
1292
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
1293
|
+
return response.json();
|
|
1294
|
+
} else {
|
|
1295
|
+
throw response;
|
|
1296
|
+
}
|
|
1297
|
+
}),
|
|
1298
|
+
new Promise(
|
|
1299
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
1300
|
+
)
|
|
1301
|
+
]);
|
|
1302
|
+
}
|
|
1274
1303
|
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
1275
1304
|
sessionRefresh(basicAuthUsername, basicAuthPassword, body, options = {}) {
|
|
1276
1305
|
if (body === null || body === void 0) {
|
|
@@ -2302,9 +2331,41 @@ var MezonApi = class {
|
|
|
2302
2331
|
)
|
|
2303
2332
|
]);
|
|
2304
2333
|
}
|
|
2305
|
-
/**
|
|
2306
|
-
|
|
2307
|
-
|
|
2334
|
+
/** Post clan Emoji /v2/emoji/create */
|
|
2335
|
+
createClanEmoji(bearerToken, body, options = {}) {
|
|
2336
|
+
if (body === null || body === void 0) {
|
|
2337
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2338
|
+
}
|
|
2339
|
+
const urlPath = "/v2/emoji/create";
|
|
2340
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2341
|
+
let bodyJson = "";
|
|
2342
|
+
bodyJson = JSON.stringify(body || {});
|
|
2343
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2344
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
2345
|
+
if (bearerToken) {
|
|
2346
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2347
|
+
}
|
|
2348
|
+
return Promise.race([
|
|
2349
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2350
|
+
if (response.status == 204) {
|
|
2351
|
+
return response;
|
|
2352
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2353
|
+
return response.json();
|
|
2354
|
+
} else {
|
|
2355
|
+
throw response;
|
|
2356
|
+
}
|
|
2357
|
+
}),
|
|
2358
|
+
new Promise(
|
|
2359
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2360
|
+
)
|
|
2361
|
+
]);
|
|
2362
|
+
}
|
|
2363
|
+
/** Get emoji list by clan id */
|
|
2364
|
+
listClanEmojiByClanId(bearerToken, clanId, options = {}) {
|
|
2365
|
+
if (clanId === null || clanId === void 0) {
|
|
2366
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
|
2367
|
+
}
|
|
2368
|
+
const urlPath = "/v2/emoji/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
|
2308
2369
|
const queryParams = /* @__PURE__ */ new Map();
|
|
2309
2370
|
let bodyJson = "";
|
|
2310
2371
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
@@ -2327,6 +2388,66 @@ var MezonApi = class {
|
|
|
2327
2388
|
)
|
|
2328
2389
|
]);
|
|
2329
2390
|
}
|
|
2391
|
+
/** Delete a emoji by ID. */
|
|
2392
|
+
deleteByIdClanEmoji(bearerToken, id, options = {}) {
|
|
2393
|
+
if (id === null || id === void 0) {
|
|
2394
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
2395
|
+
}
|
|
2396
|
+
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
2397
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2398
|
+
let bodyJson = "";
|
|
2399
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2400
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
2401
|
+
if (bearerToken) {
|
|
2402
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2403
|
+
}
|
|
2404
|
+
return Promise.race([
|
|
2405
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2406
|
+
if (response.status == 204) {
|
|
2407
|
+
return response;
|
|
2408
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2409
|
+
return response.json();
|
|
2410
|
+
} else {
|
|
2411
|
+
throw response;
|
|
2412
|
+
}
|
|
2413
|
+
}),
|
|
2414
|
+
new Promise(
|
|
2415
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2416
|
+
)
|
|
2417
|
+
]);
|
|
2418
|
+
}
|
|
2419
|
+
/** Update ClanEmoj By id */
|
|
2420
|
+
updateClanEmojiById(bearerToken, id, body, options = {}) {
|
|
2421
|
+
if (id === null || id === void 0) {
|
|
2422
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
|
2423
|
+
}
|
|
2424
|
+
if (body === null || body === void 0) {
|
|
2425
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
|
2426
|
+
}
|
|
2427
|
+
const urlPath = "/v2/emoji/{id}".replace("{id}", encodeURIComponent(String(id)));
|
|
2428
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
2429
|
+
let bodyJson = "";
|
|
2430
|
+
bodyJson = JSON.stringify(body || {});
|
|
2431
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
2432
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
|
2433
|
+
if (bearerToken) {
|
|
2434
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
2435
|
+
}
|
|
2436
|
+
return Promise.race([
|
|
2437
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
2438
|
+
if (response.status == 204) {
|
|
2439
|
+
return response;
|
|
2440
|
+
} else if (response.status >= 200 && response.status < 300) {
|
|
2441
|
+
return response.json();
|
|
2442
|
+
} else {
|
|
2443
|
+
throw response;
|
|
2444
|
+
}
|
|
2445
|
+
}),
|
|
2446
|
+
new Promise(
|
|
2447
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
2448
|
+
)
|
|
2449
|
+
]);
|
|
2450
|
+
}
|
|
2330
2451
|
/** Search message from elasticsearch service. */
|
|
2331
2452
|
searchMessage(bearerToken, body, options = {}) {
|
|
2332
2453
|
if (body === null || body === void 0) {
|
|
@@ -6236,16 +6357,27 @@ var Client = class {
|
|
|
6236
6357
|
});
|
|
6237
6358
|
}
|
|
6238
6359
|
/** List clan emoji. */
|
|
6239
|
-
listClanEmoji(session) {
|
|
6360
|
+
listClanEmoji(session, clan_id) {
|
|
6240
6361
|
return __async(this, null, function* () {
|
|
6241
6362
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6242
6363
|
yield this.sessionRefresh(session);
|
|
6243
6364
|
}
|
|
6244
|
-
return this.apiClient.
|
|
6365
|
+
return this.apiClient.listClanEmojiByClanId(session.token, clan_id).then((response) => {
|
|
6245
6366
|
return Promise.resolve(response);
|
|
6246
6367
|
});
|
|
6247
6368
|
});
|
|
6248
6369
|
}
|
|
6370
|
+
/** create clan emoji */
|
|
6371
|
+
createClanEmoji(session, request) {
|
|
6372
|
+
return __async(this, null, function* () {
|
|
6373
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
|
6374
|
+
yield this.sessionRefresh(session);
|
|
6375
|
+
}
|
|
6376
|
+
return this.apiClient.createClanEmoji(session.token, request).then((response) => {
|
|
6377
|
+
return response !== void 0;
|
|
6378
|
+
});
|
|
6379
|
+
});
|
|
6380
|
+
}
|
|
6249
6381
|
};
|
|
6250
6382
|
export {
|
|
6251
6383
|
ChannelStreamMode,
|