mezon-js 2.8.67 → 2.8.69
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +245 -54
- package/client.ts +2317 -1160
- package/dist/api.gen.d.ts +29 -32
- package/dist/client.d.ts +6 -1
- package/dist/mezon-js.cjs.js +364 -38
- package/dist/mezon-js.esm.mjs +364 -38
- package/package.json +1 -1
package/dist/mezon-js.esm.mjs
CHANGED
@@ -3756,15 +3756,46 @@ var MezonApi = class {
|
|
3756
3756
|
)
|
3757
3757
|
]);
|
3758
3758
|
}
|
3759
|
+
/** Update a role when Delete a role by ID. */
|
3760
|
+
updateRoleDelete(bearerToken, roleId, body, options = {}) {
|
3761
|
+
if (roleId === null || roleId === void 0) {
|
3762
|
+
throw new Error("'roleId' is a required parameter but is null or undefined.");
|
3763
|
+
}
|
3764
|
+
if (body === null || body === void 0) {
|
3765
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3766
|
+
}
|
3767
|
+
const urlPath = "/v2/roles/delete/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
|
3768
|
+
const queryParams = /* @__PURE__ */ new Map();
|
3769
|
+
let bodyJson = "";
|
3770
|
+
bodyJson = JSON.stringify(body || {});
|
3771
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3772
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3773
|
+
if (bearerToken) {
|
3774
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3775
|
+
}
|
3776
|
+
return Promise.race([
|
3777
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3778
|
+
if (response.status == 204) {
|
3779
|
+
return response;
|
3780
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3781
|
+
return response.json();
|
3782
|
+
} else {
|
3783
|
+
throw response;
|
3784
|
+
}
|
3785
|
+
}),
|
3786
|
+
new Promise(
|
3787
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3788
|
+
)
|
3789
|
+
]);
|
3790
|
+
}
|
3759
3791
|
/** Delete a role by ID. */
|
3760
|
-
deleteRole(bearerToken, roleId, channelId,
|
3792
|
+
deleteRole(bearerToken, roleId, channelId, options = {}) {
|
3761
3793
|
if (roleId === null || roleId === void 0) {
|
3762
3794
|
throw new Error("'roleId' is a required parameter but is null or undefined.");
|
3763
3795
|
}
|
3764
3796
|
const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
|
3765
3797
|
const queryParams = /* @__PURE__ */ new Map();
|
3766
3798
|
queryParams.set("channel_id", channelId);
|
3767
|
-
queryParams.set("clan_id", clanId);
|
3768
3799
|
let bodyJson = "";
|
3769
3800
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3770
3801
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -4064,6 +4095,148 @@ var MezonApi = class {
|
|
4064
4095
|
)
|
4065
4096
|
]);
|
4066
4097
|
}
|
4098
|
+
/** Get the list of system messages. */
|
4099
|
+
getSystemMessagesList(bearerToken, options = {}) {
|
4100
|
+
const urlPath = "/v2/systemmessages";
|
4101
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4102
|
+
let bodyJson = "";
|
4103
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4104
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4105
|
+
if (bearerToken) {
|
4106
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4107
|
+
}
|
4108
|
+
return Promise.race([
|
4109
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4110
|
+
if (response.status == 204) {
|
4111
|
+
return response;
|
4112
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4113
|
+
return response.json();
|
4114
|
+
} else {
|
4115
|
+
throw response;
|
4116
|
+
}
|
4117
|
+
}),
|
4118
|
+
new Promise(
|
4119
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4120
|
+
)
|
4121
|
+
]);
|
4122
|
+
}
|
4123
|
+
/** Create a system messages. */
|
4124
|
+
createSystemMessage(bearerToken, body, options = {}) {
|
4125
|
+
if (body === null || body === void 0) {
|
4126
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4127
|
+
}
|
4128
|
+
const urlPath = "/v2/systemmessages";
|
4129
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4130
|
+
let bodyJson = "";
|
4131
|
+
bodyJson = JSON.stringify(body || {});
|
4132
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4133
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
4134
|
+
if (bearerToken) {
|
4135
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4136
|
+
}
|
4137
|
+
return Promise.race([
|
4138
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4139
|
+
if (response.status == 204) {
|
4140
|
+
return response;
|
4141
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4142
|
+
return response.json();
|
4143
|
+
} else {
|
4144
|
+
throw response;
|
4145
|
+
}
|
4146
|
+
}),
|
4147
|
+
new Promise(
|
4148
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4149
|
+
)
|
4150
|
+
]);
|
4151
|
+
}
|
4152
|
+
/** Delete a specific system messages. */
|
4153
|
+
deleteSystemMessage(bearerToken, clanId, options = {}) {
|
4154
|
+
if (clanId === null || clanId === void 0) {
|
4155
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4156
|
+
}
|
4157
|
+
const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
4158
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4159
|
+
let bodyJson = "";
|
4160
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4161
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
4162
|
+
if (bearerToken) {
|
4163
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4164
|
+
}
|
4165
|
+
return Promise.race([
|
4166
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4167
|
+
if (response.status == 204) {
|
4168
|
+
return response;
|
4169
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4170
|
+
return response.json();
|
4171
|
+
} else {
|
4172
|
+
throw response;
|
4173
|
+
}
|
4174
|
+
}),
|
4175
|
+
new Promise(
|
4176
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4177
|
+
)
|
4178
|
+
]);
|
4179
|
+
}
|
4180
|
+
/** Get details of a specific system messages. */
|
4181
|
+
getSystemMessageByClanId(bearerToken, clanId, options = {}) {
|
4182
|
+
if (clanId === null || clanId === void 0) {
|
4183
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4184
|
+
}
|
4185
|
+
const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
4186
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4187
|
+
let bodyJson = "";
|
4188
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4189
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
4190
|
+
if (bearerToken) {
|
4191
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4192
|
+
}
|
4193
|
+
return Promise.race([
|
4194
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4195
|
+
if (response.status == 204) {
|
4196
|
+
return response;
|
4197
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4198
|
+
return response.json();
|
4199
|
+
} else {
|
4200
|
+
throw response;
|
4201
|
+
}
|
4202
|
+
}),
|
4203
|
+
new Promise(
|
4204
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4205
|
+
)
|
4206
|
+
]);
|
4207
|
+
}
|
4208
|
+
/** Update a system messages. */
|
4209
|
+
updateSystemMessage(bearerToken, clanId, body, options = {}) {
|
4210
|
+
if (clanId === null || clanId === void 0) {
|
4211
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
4212
|
+
}
|
4213
|
+
if (body === null || body === void 0) {
|
4214
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
4215
|
+
}
|
4216
|
+
const urlPath = "/v2/systemmessages/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
4217
|
+
const queryParams = /* @__PURE__ */ new Map();
|
4218
|
+
let bodyJson = "";
|
4219
|
+
bodyJson = JSON.stringify(body || {});
|
4220
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
4221
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
4222
|
+
if (bearerToken) {
|
4223
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
4224
|
+
}
|
4225
|
+
return Promise.race([
|
4226
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
4227
|
+
if (response.status == 204) {
|
4228
|
+
return response;
|
4229
|
+
} else if (response.status >= 200 && response.status < 300) {
|
4230
|
+
return response.json();
|
4231
|
+
} else {
|
4232
|
+
throw response;
|
4233
|
+
}
|
4234
|
+
}),
|
4235
|
+
new Promise(
|
4236
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
4237
|
+
)
|
4238
|
+
]);
|
4239
|
+
}
|
4067
4240
|
/** Update fields in a given category. */
|
4068
4241
|
updateCategory(bearerToken, body, options = {}) {
|
4069
4242
|
if (body === null || body === void 0) {
|
@@ -5187,50 +5360,73 @@ var Client = class {
|
|
5187
5360
|
authenticateApple(_0, _1, _2) {
|
5188
5361
|
return __async(this, arguments, function* (token, create, username, vars = {}, options = {}) {
|
5189
5362
|
const request = {
|
5190
|
-
|
5191
|
-
|
5363
|
+
token,
|
5364
|
+
vars
|
5192
5365
|
};
|
5193
5366
|
return this.apiClient.authenticateApple(this.serverkey, "", request, create, username, options).then((apiSession) => {
|
5194
|
-
return new Session(
|
5367
|
+
return new Session(
|
5368
|
+
apiSession.token || "",
|
5369
|
+
apiSession.refresh_token || "",
|
5370
|
+
apiSession.created || false
|
5371
|
+
);
|
5195
5372
|
});
|
5196
5373
|
});
|
5197
5374
|
}
|
5198
5375
|
/** Authenticate a user with a custom id against the server. */
|
5199
5376
|
authenticateCustom(id, create, username, vars = {}, options = {}) {
|
5200
5377
|
const request = {
|
5201
|
-
|
5202
|
-
|
5378
|
+
id,
|
5379
|
+
vars
|
5203
5380
|
};
|
5204
|
-
return this.apiClient.authenticateCustom(
|
5205
|
-
|
5381
|
+
return this.apiClient.authenticateCustom(
|
5382
|
+
this.serverkey,
|
5383
|
+
"",
|
5384
|
+
request,
|
5385
|
+
create,
|
5386
|
+
username,
|
5387
|
+
options
|
5388
|
+
).then((apiSession) => {
|
5389
|
+
return new Session(
|
5390
|
+
apiSession.token || "",
|
5391
|
+
apiSession.refresh_token || "",
|
5392
|
+
apiSession.created || false
|
5393
|
+
);
|
5206
5394
|
});
|
5207
5395
|
}
|
5208
5396
|
/** Authenticate a user with a device id against the server. */
|
5209
5397
|
authenticateDevice(id, create, username, vars) {
|
5210
5398
|
const request = {
|
5211
|
-
|
5212
|
-
|
5399
|
+
id,
|
5400
|
+
vars
|
5213
5401
|
};
|
5214
5402
|
return this.apiClient.authenticateDevice(this.serverkey, "", request, create, username).then((apiSession) => {
|
5215
|
-
return new Session(
|
5403
|
+
return new Session(
|
5404
|
+
apiSession.token || "",
|
5405
|
+
apiSession.refresh_token || "",
|
5406
|
+
apiSession.created || false
|
5407
|
+
);
|
5216
5408
|
});
|
5217
5409
|
}
|
5218
5410
|
/** Authenticate a user with an email+password against the server. */
|
5219
5411
|
authenticateEmail(email, password, username, vars) {
|
5220
5412
|
const request = {
|
5221
|
-
|
5222
|
-
|
5223
|
-
|
5413
|
+
email,
|
5414
|
+
password,
|
5415
|
+
vars
|
5224
5416
|
};
|
5225
5417
|
return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
|
5226
|
-
return new Session(
|
5418
|
+
return new Session(
|
5419
|
+
apiSession.token || "",
|
5420
|
+
apiSession.refresh_token || "",
|
5421
|
+
apiSession.created || false
|
5422
|
+
);
|
5227
5423
|
});
|
5228
5424
|
}
|
5229
5425
|
/** Authenticate a user with a Facebook Instant Game token against the server. */
|
5230
5426
|
authenticateFacebookInstantGame(signedPlayerInfo, create, username, vars, options = {}) {
|
5231
5427
|
const request = {
|
5232
|
-
|
5233
|
-
|
5428
|
+
signed_player_info: signedPlayerInfo,
|
5429
|
+
vars
|
5234
5430
|
};
|
5235
5431
|
return this.apiClient.authenticateFacebookInstantGame(
|
5236
5432
|
this.serverkey,
|
@@ -5240,17 +5436,33 @@ var Client = class {
|
|
5240
5436
|
username,
|
5241
5437
|
options
|
5242
5438
|
).then((apiSession) => {
|
5243
|
-
return new Session(
|
5439
|
+
return new Session(
|
5440
|
+
apiSession.token || "",
|
5441
|
+
apiSession.refresh_token || "",
|
5442
|
+
apiSession.created || false
|
5443
|
+
);
|
5244
5444
|
});
|
5245
5445
|
}
|
5246
5446
|
/** Authenticate a user with a Facebook OAuth token against the server. */
|
5247
5447
|
authenticateFacebook(token, create, username, sync, vars, options = {}) {
|
5248
5448
|
const request = {
|
5249
|
-
|
5250
|
-
|
5449
|
+
token,
|
5450
|
+
vars
|
5251
5451
|
};
|
5252
|
-
return this.apiClient.authenticateFacebook(
|
5253
|
-
|
5452
|
+
return this.apiClient.authenticateFacebook(
|
5453
|
+
this.serverkey,
|
5454
|
+
"",
|
5455
|
+
request,
|
5456
|
+
create,
|
5457
|
+
username,
|
5458
|
+
sync,
|
5459
|
+
options
|
5460
|
+
).then((apiSession) => {
|
5461
|
+
return new Session(
|
5462
|
+
apiSession.token || "",
|
5463
|
+
apiSession.refresh_token || "",
|
5464
|
+
apiSession.created || false
|
5465
|
+
);
|
5254
5466
|
});
|
5255
5467
|
}
|
5256
5468
|
/** Authenticate a user with Google against the server. */
|
@@ -5306,12 +5518,16 @@ var Client = class {
|
|
5306
5518
|
authenticateSteam(token, create, username, sync, vars) {
|
5307
5519
|
return __async(this, null, function* () {
|
5308
5520
|
const request = {
|
5309
|
-
|
5310
|
-
|
5311
|
-
|
5521
|
+
token,
|
5522
|
+
vars,
|
5523
|
+
sync
|
5312
5524
|
};
|
5313
5525
|
return this.apiClient.authenticateSteam(this.serverkey, "", request, create, username).then((apiSession) => {
|
5314
|
-
return new Session(
|
5526
|
+
return new Session(
|
5527
|
+
apiSession.token || "",
|
5528
|
+
apiSession.refresh_token || "",
|
5529
|
+
apiSession.created || false
|
5530
|
+
);
|
5315
5531
|
});
|
5316
5532
|
});
|
5317
5533
|
}
|
@@ -5424,7 +5640,14 @@ var Client = class {
|
|
5424
5640
|
}
|
5425
5641
|
/** A socket created with the client's configuration. */
|
5426
5642
|
createSocket(useSSL = false, verbose = false, adapter = new WebSocketAdapterText(), sendTimeoutMs = DefaultSocket.DefaultSendTimeoutMs) {
|
5427
|
-
return new DefaultSocket(
|
5643
|
+
return new DefaultSocket(
|
5644
|
+
this.host,
|
5645
|
+
this.port,
|
5646
|
+
useSSL,
|
5647
|
+
verbose,
|
5648
|
+
adapter,
|
5649
|
+
sendTimeoutMs
|
5650
|
+
);
|
5428
5651
|
}
|
5429
5652
|
/** Delete one or more users by ID or username. */
|
5430
5653
|
deleteFriends(session, ids, usernames) {
|
@@ -5621,7 +5844,13 @@ var Client = class {
|
|
5621
5844
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5622
5845
|
yield this.sessionRefresh(session);
|
5623
5846
|
}
|
5624
|
-
return this.apiClient.listChannelMessages(
|
5847
|
+
return this.apiClient.listChannelMessages(
|
5848
|
+
session.token,
|
5849
|
+
channelId,
|
5850
|
+
messageId,
|
5851
|
+
direction,
|
5852
|
+
limit
|
5853
|
+
).then((response) => {
|
5625
5854
|
var result = {
|
5626
5855
|
messages: [],
|
5627
5856
|
last_seen_message: response.last_seen_message,
|
@@ -5687,7 +5916,15 @@ var Client = class {
|
|
5687
5916
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5688
5917
|
yield this.sessionRefresh(session);
|
5689
5918
|
}
|
5690
|
-
return this.apiClient.listChannelVoiceUsers(
|
5919
|
+
return this.apiClient.listChannelVoiceUsers(
|
5920
|
+
session.token,
|
5921
|
+
clanId,
|
5922
|
+
channelId,
|
5923
|
+
channelType,
|
5924
|
+
limit,
|
5925
|
+
state,
|
5926
|
+
cursor
|
5927
|
+
).then((response) => {
|
5691
5928
|
var result = {
|
5692
5929
|
voice_channel_users: []
|
5693
5930
|
};
|
@@ -5712,7 +5949,15 @@ var Client = class {
|
|
5712
5949
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5713
5950
|
yield this.sessionRefresh(session);
|
5714
5951
|
}
|
5715
|
-
return this.apiClient.listChannelUsers(
|
5952
|
+
return this.apiClient.listChannelUsers(
|
5953
|
+
session.token,
|
5954
|
+
clanId,
|
5955
|
+
channelId,
|
5956
|
+
channelType,
|
5957
|
+
limit,
|
5958
|
+
state,
|
5959
|
+
cursor
|
5960
|
+
).then((response) => {
|
5716
5961
|
var result = {
|
5717
5962
|
channel_users: [],
|
5718
5963
|
cursor: response.cursor,
|
@@ -5761,7 +6006,15 @@ var Client = class {
|
|
5761
6006
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5762
6007
|
yield this.sessionRefresh(session);
|
5763
6008
|
}
|
5764
|
-
return this.apiClient.listChannelAttachment(
|
6009
|
+
return this.apiClient.listChannelAttachment(
|
6010
|
+
session.token,
|
6011
|
+
clanId,
|
6012
|
+
channelId,
|
6013
|
+
fileType,
|
6014
|
+
limit,
|
6015
|
+
state,
|
6016
|
+
cursor
|
6017
|
+
).then((response) => {
|
5765
6018
|
var result = {
|
5766
6019
|
attachments: []
|
5767
6020
|
};
|
@@ -5833,7 +6086,14 @@ var Client = class {
|
|
5833
6086
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5834
6087
|
yield this.sessionRefresh(session);
|
5835
6088
|
}
|
5836
|
-
return this.apiClient.listChannelDescs(
|
6089
|
+
return this.apiClient.listChannelDescs(
|
6090
|
+
session.token,
|
6091
|
+
limit,
|
6092
|
+
state,
|
6093
|
+
cursor,
|
6094
|
+
clanId,
|
6095
|
+
channelType
|
6096
|
+
).then((response) => {
|
5837
6097
|
var result = {
|
5838
6098
|
channeldesc: [],
|
5839
6099
|
next_cursor: response.next_cursor,
|
@@ -6156,7 +6416,13 @@ var Client = class {
|
|
6156
6416
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6157
6417
|
yield this.sessionRefresh(session);
|
6158
6418
|
}
|
6159
|
-
return this.apiClient.rpcFunc(
|
6419
|
+
return this.apiClient.rpcFunc(
|
6420
|
+
session.token,
|
6421
|
+
basicAuthUsername,
|
6422
|
+
basicAuthPassword,
|
6423
|
+
id,
|
6424
|
+
JSON.stringify(input)
|
6425
|
+
).then((response) => {
|
6160
6426
|
return Promise.resolve({
|
6161
6427
|
id: response.id,
|
6162
6428
|
payload: !response.payload ? void 0 : JSON.parse(response.payload)
|
@@ -6183,7 +6449,10 @@ var Client = class {
|
|
6183
6449
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6184
6450
|
yield this.sessionRefresh(session);
|
6185
6451
|
}
|
6186
|
-
return this.apiClient.sessionLogout(session.token, {
|
6452
|
+
return this.apiClient.sessionLogout(session.token, {
|
6453
|
+
refresh_token: refreshToken,
|
6454
|
+
token
|
6455
|
+
}).then((response) => {
|
6187
6456
|
return response !== void 0;
|
6188
6457
|
});
|
6189
6458
|
});
|
@@ -6196,12 +6465,19 @@ var Client = class {
|
|
6196
6465
|
return session;
|
6197
6466
|
}
|
6198
6467
|
if (session.created && session.expires_at - session.created_at < 70) {
|
6199
|
-
console.warn(
|
6468
|
+
console.warn(
|
6469
|
+
"Session lifetime too short, please set '--session.token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
|
6470
|
+
);
|
6200
6471
|
}
|
6201
6472
|
if (session.created && session.refresh_expires_at - session.created_at < 3700) {
|
6202
|
-
console.warn(
|
6473
|
+
console.warn(
|
6474
|
+
"Session refresh lifetime too short, please set '--session.refresh_token_expiry_sec' option. See the documentation for more info: https://mezon.vn/docs/mezon/getting-started/configuration/#session"
|
6475
|
+
);
|
6203
6476
|
}
|
6204
|
-
const apiSession = yield this.apiClient.sessionRefresh(this.serverkey, "", {
|
6477
|
+
const apiSession = yield this.apiClient.sessionRefresh(this.serverkey, "", {
|
6478
|
+
token: session.refresh_token,
|
6479
|
+
vars
|
6480
|
+
});
|
6205
6481
|
session.update(apiSession.token, apiSession.refresh_token);
|
6206
6482
|
return session;
|
6207
6483
|
});
|
@@ -6781,6 +7057,56 @@ var Client = class {
|
|
6781
7057
|
});
|
6782
7058
|
});
|
6783
7059
|
}
|
7060
|
+
getSystemMessagesList(session) {
|
7061
|
+
return __async(this, null, function* () {
|
7062
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7063
|
+
yield this.sessionRefresh(session);
|
7064
|
+
}
|
7065
|
+
return this.apiClient.getSystemMessagesList(session.token).then((response) => {
|
7066
|
+
return Promise.resolve(response);
|
7067
|
+
});
|
7068
|
+
});
|
7069
|
+
}
|
7070
|
+
getSystemMessageByClanId(session, clanId) {
|
7071
|
+
return __async(this, null, function* () {
|
7072
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7073
|
+
yield this.sessionRefresh(session);
|
7074
|
+
}
|
7075
|
+
return this.apiClient.getSystemMessageByClanId(session.token, clanId).then((response) => {
|
7076
|
+
return Promise.resolve(response);
|
7077
|
+
});
|
7078
|
+
});
|
7079
|
+
}
|
7080
|
+
createSystemMessage(session, request) {
|
7081
|
+
return __async(this, null, function* () {
|
7082
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7083
|
+
yield this.sessionRefresh(session);
|
7084
|
+
}
|
7085
|
+
return this.apiClient.createSystemMessage(session.token, request).then((response) => {
|
7086
|
+
return Promise.resolve(response);
|
7087
|
+
});
|
7088
|
+
});
|
7089
|
+
}
|
7090
|
+
updateSystemMessage(session, clanId, request) {
|
7091
|
+
return __async(this, null, function* () {
|
7092
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7093
|
+
yield this.sessionRefresh(session);
|
7094
|
+
}
|
7095
|
+
return this.apiClient.updateSystemMessage(session.token, clanId, request).then((response) => {
|
7096
|
+
return Promise.resolve(response);
|
7097
|
+
});
|
7098
|
+
});
|
7099
|
+
}
|
7100
|
+
deleteSystemMessage(session, clanId) {
|
7101
|
+
return __async(this, null, function* () {
|
7102
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
7103
|
+
yield this.sessionRefresh(session);
|
7104
|
+
}
|
7105
|
+
return this.apiClient.deleteSystemMessage(session.token, clanId).then((response) => {
|
7106
|
+
return Promise.resolve(response);
|
7107
|
+
});
|
7108
|
+
});
|
7109
|
+
}
|
6784
7110
|
};
|
6785
7111
|
export {
|
6786
7112
|
ChannelStreamMode,
|