mezon-js 2.9.81 → 2.9.84
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +111 -10
- package/client.ts +116 -66
- package/dist/api.gen.d.ts +25 -2
- package/dist/client.d.ts +9 -3
- package/dist/mezon-js.cjs.js +116 -13
- package/dist/mezon-js.esm.mjs +116 -13
- package/dist/socket.d.ts +5 -0
- package/package.json +1 -1
- package/socket.ts +60 -22
package/api.gen.ts
CHANGED
@@ -133,12 +133,18 @@ export enum ApiAppRole {
|
|
133
133
|
|
134
134
|
/** Update fields in a given channel. */
|
135
135
|
export interface MezonUpdateChannelDescBody {
|
136
|
+
//
|
137
|
+
age_restricted?: number;
|
136
138
|
//
|
137
139
|
app_url?: string;
|
138
140
|
//
|
139
141
|
category_id?: string;
|
140
142
|
//
|
141
143
|
channel_label?: string;
|
144
|
+
//
|
145
|
+
e2ee?: number;
|
146
|
+
//
|
147
|
+
topic?: string;
|
142
148
|
}
|
143
149
|
|
144
150
|
/** */
|
@@ -683,6 +689,8 @@ export interface ApiChannelDescription {
|
|
683
689
|
//
|
684
690
|
active?: number;
|
685
691
|
//
|
692
|
+
age_restricted?: number;
|
693
|
+
//
|
686
694
|
app_url?: string;
|
687
695
|
//
|
688
696
|
category_id?: string;
|
@@ -709,6 +717,8 @@ export interface ApiChannelDescription {
|
|
709
717
|
//
|
710
718
|
creator_name?: string;
|
711
719
|
//
|
720
|
+
e2ee?: number;
|
721
|
+
//
|
712
722
|
is_mute?: boolean;
|
713
723
|
//
|
714
724
|
last_pin_message?: string;
|
@@ -724,6 +734,8 @@ export interface ApiChannelDescription {
|
|
724
734
|
parrent_id?: string;
|
725
735
|
//
|
726
736
|
is_online?: Array<boolean>;
|
737
|
+
//
|
738
|
+
topic?: string;
|
727
739
|
//The channel type.
|
728
740
|
type?: number;
|
729
741
|
//
|
@@ -2177,6 +2189,8 @@ export interface ApiUpdateAccountRequest {
|
|
2177
2189
|
about_me?: string;
|
2178
2190
|
//A URL for an avatar image.
|
2179
2191
|
avatar_url?: string;
|
2192
|
+
//
|
2193
|
+
dob?: string;
|
2180
2194
|
//The display name of the user.
|
2181
2195
|
display_name?: string;
|
2182
2196
|
//The language expected to be a tag which follows the BCP-47 spec.
|
@@ -2258,6 +2272,8 @@ export interface ApiUser {
|
|
2258
2272
|
apple_id?: string;
|
2259
2273
|
//A URL for an avatar image.
|
2260
2274
|
avatar_url?: string;
|
2275
|
+
//
|
2276
|
+
dob?: string;
|
2261
2277
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
|
2262
2278
|
create_time?: string;
|
2263
2279
|
//The display name of the user.
|
@@ -2324,6 +2340,24 @@ export interface ApiUserPermissionInChannelListResponse {
|
|
2324
2340
|
permissions?: ApiPermissionList;
|
2325
2341
|
}
|
2326
2342
|
|
2343
|
+
/** */
|
2344
|
+
export interface ApiUserStatus {
|
2345
|
+
//
|
2346
|
+
status?: string;
|
2347
|
+
//
|
2348
|
+
user_id?: string;
|
2349
|
+
}
|
2350
|
+
|
2351
|
+
/** */
|
2352
|
+
export interface ApiUserStatusUpdate {
|
2353
|
+
//
|
2354
|
+
minutes?: number;
|
2355
|
+
//
|
2356
|
+
status?: string;
|
2357
|
+
//
|
2358
|
+
until_turn_on?: boolean;
|
2359
|
+
}
|
2360
|
+
|
2327
2361
|
/** A collection of zero or more users. */
|
2328
2362
|
export interface ApiUsers {
|
2329
2363
|
//The User objects.
|
@@ -2591,7 +2625,7 @@ export interface ApiListClanWebhookResponse {
|
|
2591
2625
|
}
|
2592
2626
|
|
2593
2627
|
/** */
|
2594
|
-
export interface
|
2628
|
+
export interface MezonUpdateOnboardingStepByClanIdBody {
|
2595
2629
|
//onboarding step.
|
2596
2630
|
onboarding_step?: number;
|
2597
2631
|
}
|
@@ -9397,6 +9431,73 @@ pushPubKey(bearerToken: string,
|
|
9397
9431
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9398
9432
|
}
|
9399
9433
|
|
9434
|
+
return Promise.race([
|
9435
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9436
|
+
if (response.status == 204) {
|
9437
|
+
return response;
|
9438
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9439
|
+
return response.json();
|
9440
|
+
} else {
|
9441
|
+
throw response;
|
9442
|
+
}
|
9443
|
+
}),
|
9444
|
+
new Promise((_, reject) =>
|
9445
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9446
|
+
),
|
9447
|
+
]);
|
9448
|
+
}
|
9449
|
+
|
9450
|
+
/** Get user status */
|
9451
|
+
getUserStatus(bearerToken: string,
|
9452
|
+
options: any = {}): Promise<ApiUserStatus> {
|
9453
|
+
|
9454
|
+
const urlPath = "/v2/userstatus";
|
9455
|
+
const queryParams = new Map<string, any>();
|
9456
|
+
|
9457
|
+
let bodyJson : string = "";
|
9458
|
+
|
9459
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9460
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
9461
|
+
if (bearerToken) {
|
9462
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9463
|
+
}
|
9464
|
+
|
9465
|
+
return Promise.race([
|
9466
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
9467
|
+
if (response.status == 204) {
|
9468
|
+
return response;
|
9469
|
+
} else if (response.status >= 200 && response.status < 300) {
|
9470
|
+
return response.json();
|
9471
|
+
} else {
|
9472
|
+
throw response;
|
9473
|
+
}
|
9474
|
+
}),
|
9475
|
+
new Promise((_, reject) =>
|
9476
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
9477
|
+
),
|
9478
|
+
]);
|
9479
|
+
}
|
9480
|
+
|
9481
|
+
/** Update user status */
|
9482
|
+
updateUserStatus(bearerToken: string,
|
9483
|
+
body:ApiUserStatusUpdate,
|
9484
|
+
options: any = {}): Promise<any> {
|
9485
|
+
|
9486
|
+
if (body === null || body === undefined) {
|
9487
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
9488
|
+
}
|
9489
|
+
const urlPath = "/v2/userstatus";
|
9490
|
+
const queryParams = new Map<string, any>();
|
9491
|
+
|
9492
|
+
let bodyJson : string = "";
|
9493
|
+
bodyJson = JSON.stringify(body || {});
|
9494
|
+
|
9495
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
9496
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
9497
|
+
if (bearerToken) {
|
9498
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
9499
|
+
}
|
9500
|
+
|
9400
9501
|
return Promise.race([
|
9401
9502
|
fetch(fullUrl, fetchOptions).then((response) => {
|
9402
9503
|
if (response.status == 204) {
|
@@ -10149,20 +10250,20 @@ pushPubKey(bearerToken: string,
|
|
10149
10250
|
]);
|
10150
10251
|
}
|
10151
10252
|
|
10152
|
-
/** Update onboarding step. */
|
10153
|
-
|
10154
|
-
|
10155
|
-
body:
|
10253
|
+
/** Update onboarding step. */
|
10254
|
+
updateOnboardingStepByClanId(bearerToken: string,
|
10255
|
+
clanId:string,
|
10256
|
+
body:MezonUpdateOnboardingStepByClanIdBody,
|
10156
10257
|
options: any = {}): Promise<any> {
|
10157
|
-
|
10158
|
-
if (
|
10159
|
-
throw new Error("'
|
10258
|
+
|
10259
|
+
if (clanId === null || clanId === undefined) {
|
10260
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
10160
10261
|
}
|
10161
10262
|
if (body === null || body === undefined) {
|
10162
10263
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
10163
10264
|
}
|
10164
|
-
const urlPath = "/v2/onboardingsteps/{
|
10165
|
-
.replace("{
|
10265
|
+
const urlPath = "/v2/onboardingsteps/{clanId}"
|
10266
|
+
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
10166
10267
|
const queryParams = new Map<string, any>();
|
10167
10268
|
|
10168
10269
|
let bodyJson : string = "";
|
package/client.ts
CHANGED
@@ -149,8 +149,10 @@ import {
|
|
149
149
|
ApiListClanWebhookResponse,
|
150
150
|
MezonUpdateClanWebhookByIdBody,
|
151
151
|
MezonUpdateClanDescBody,
|
152
|
+
ApiUserStatusUpdate,
|
153
|
+
ApiUserStatus,
|
152
154
|
ApiListOnboardingStepResponse,
|
153
|
-
|
155
|
+
MezonUpdateOnboardingStepByClanIdBody,
|
154
156
|
} from "./api.gen";
|
155
157
|
|
156
158
|
import { Session } from "./session";
|
@@ -189,9 +191,10 @@ export enum NotificationType {
|
|
189
191
|
}
|
190
192
|
|
191
193
|
export enum WebrtcSignalingType {
|
192
|
-
WEBRTC_SDP_OFFER
|
193
|
-
WEBRTC_SDP_ANSWER
|
194
|
-
WEBRTC_ICE_CANDIDATE = 3
|
194
|
+
WEBRTC_SDP_OFFER = 1,
|
195
|
+
WEBRTC_SDP_ANSWER = 2,
|
196
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
197
|
+
WEBRTC_SDP_QUIT = 4,
|
195
198
|
}
|
196
199
|
|
197
200
|
/** Response for an RPC function executed on the server. */
|
@@ -444,6 +447,12 @@ export interface ApiUpdateChannelDescRequest {
|
|
444
447
|
category_id: string | undefined;
|
445
448
|
/** The app url of channel */
|
446
449
|
app_url: string | undefined;
|
450
|
+
//
|
451
|
+
e2ee?: number;
|
452
|
+
//
|
453
|
+
topic?: string;
|
454
|
+
//
|
455
|
+
age_restricted?: number;
|
447
456
|
}
|
448
457
|
|
449
458
|
/** Add users to a channel. */
|
@@ -3199,7 +3208,11 @@ export class Client {
|
|
3199
3208
|
}
|
3200
3209
|
|
3201
3210
|
//**disabled webhook by id */
|
3202
|
-
async deleteWebhookById(
|
3211
|
+
async deleteWebhookById(
|
3212
|
+
session: Session,
|
3213
|
+
id: string,
|
3214
|
+
request: MezonDeleteWebhookByIdBody
|
3215
|
+
) {
|
3203
3216
|
if (
|
3204
3217
|
this.autoRefreshSession &&
|
3205
3218
|
session.refresh_token &&
|
@@ -4237,9 +4250,7 @@ export class Client {
|
|
4237
4250
|
});
|
4238
4251
|
}
|
4239
4252
|
/** List activity */
|
4240
|
-
async listActivity(
|
4241
|
-
session: Session
|
4242
|
-
): Promise<ApiListUserActivity> {
|
4253
|
+
async listActivity(session: Session): Promise<ApiListUserActivity> {
|
4243
4254
|
if (
|
4244
4255
|
this.autoRefreshSession &&
|
4245
4256
|
session.refresh_token &&
|
@@ -4248,11 +4259,9 @@ export class Client {
|
|
4248
4259
|
await this.sessionRefresh(session);
|
4249
4260
|
}
|
4250
4261
|
|
4251
|
-
return this.apiClient
|
4252
|
-
|
4253
|
-
|
4254
|
-
return response;
|
4255
|
-
});
|
4262
|
+
return this.apiClient.listActivity(session.token).then((response: any) => {
|
4263
|
+
return response;
|
4264
|
+
});
|
4256
4265
|
}
|
4257
4266
|
|
4258
4267
|
async createActiviy(
|
@@ -4283,26 +4292,26 @@ export class Client {
|
|
4283
4292
|
const response = {
|
4284
4293
|
login_id: apiSession.login_id,
|
4285
4294
|
create_time_second: apiSession.create_time_second,
|
4286
|
-
|
4287
|
-
|
4288
|
-
return response
|
4295
|
+
};
|
4296
|
+
return response;
|
4289
4297
|
}
|
4290
4298
|
|
4291
|
-
async checkLoginRequest(
|
4299
|
+
async checkLoginRequest(
|
4300
|
+
requet: ApiConfirmLoginRequest
|
4301
|
+
): Promise<Session | null> {
|
4292
4302
|
const apiSession = await this.apiClient.checkLoginRequest(
|
4293
4303
|
this.serverkey,
|
4294
4304
|
"",
|
4295
4305
|
requet
|
4296
4306
|
);
|
4297
4307
|
if (!apiSession?.token) {
|
4298
|
-
return null
|
4308
|
+
return null;
|
4299
4309
|
}
|
4300
4310
|
return new Session(
|
4301
4311
|
apiSession.token || "",
|
4302
4312
|
apiSession.refresh_token || "",
|
4303
4313
|
apiSession.created || false
|
4304
4314
|
);
|
4305
|
-
|
4306
4315
|
}
|
4307
4316
|
|
4308
4317
|
async confirmLogin(
|
@@ -4324,9 +4333,10 @@ export class Client {
|
|
4324
4333
|
});
|
4325
4334
|
}
|
4326
4335
|
|
4327
|
-
async getChanEncryptionMethod(
|
4336
|
+
async getChanEncryptionMethod(
|
4337
|
+
session: Session,
|
4328
4338
|
channelId: string
|
4329
|
-
)
|
4339
|
+
): Promise<ApiChanEncryptionMethod> {
|
4330
4340
|
if (
|
4331
4341
|
this.autoRefreshSession &&
|
4332
4342
|
session.refresh_token &&
|
@@ -4342,27 +4352,30 @@ export class Client {
|
|
4342
4352
|
});
|
4343
4353
|
}
|
4344
4354
|
|
4345
|
-
async setChanEncryptionMethod(
|
4355
|
+
async setChanEncryptionMethod(
|
4356
|
+
session: Session,
|
4346
4357
|
channelId: string,
|
4347
|
-
method: string
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
)
|
4353
|
-
|
4354
|
-
|
4355
|
-
|
4356
|
-
return this.apiClient
|
4357
|
-
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
4358
|
-
.then((response: any) => {
|
4359
|
-
return response;
|
4360
|
-
});
|
4358
|
+
method: string
|
4359
|
+
): Promise<any> {
|
4360
|
+
if (
|
4361
|
+
this.autoRefreshSession &&
|
4362
|
+
session.refresh_token &&
|
4363
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4364
|
+
) {
|
4365
|
+
await this.sessionRefresh(session);
|
4361
4366
|
}
|
4362
4367
|
|
4363
|
-
|
4368
|
+
return this.apiClient
|
4369
|
+
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
4370
|
+
.then((response: any) => {
|
4371
|
+
return response;
|
4372
|
+
});
|
4373
|
+
}
|
4374
|
+
|
4375
|
+
async getPubKeys(
|
4376
|
+
session: Session,
|
4364
4377
|
userIds: Array<string>
|
4365
|
-
)
|
4378
|
+
): Promise<ApiGetPubKeysResponse> {
|
4366
4379
|
if (
|
4367
4380
|
this.autoRefreshSession &&
|
4368
4381
|
session.refresh_token &&
|
@@ -4378,9 +4391,10 @@ export class Client {
|
|
4378
4391
|
});
|
4379
4392
|
}
|
4380
4393
|
|
4381
|
-
async pushPubKey(
|
4394
|
+
async pushPubKey(
|
4395
|
+
session: Session,
|
4382
4396
|
PK: ApiPubKey
|
4383
|
-
)
|
4397
|
+
): Promise<ApiGetPubKeysResponse> {
|
4384
4398
|
if (
|
4385
4399
|
this.autoRefreshSession &&
|
4386
4400
|
session.refresh_token &&
|
@@ -4396,7 +4410,7 @@ export class Client {
|
|
4396
4410
|
});
|
4397
4411
|
}
|
4398
4412
|
|
4399
|
-
async getKeyServer(session: Session)
|
4413
|
+
async getKeyServer(session: Session): Promise<ApiGetKeyServerResp> {
|
4400
4414
|
if (
|
4401
4415
|
this.autoRefreshSession &&
|
4402
4416
|
session.refresh_token &&
|
@@ -4414,12 +4428,12 @@ export class Client {
|
|
4414
4428
|
|
4415
4429
|
async listAuditLog(
|
4416
4430
|
session: Session,
|
4417
|
-
actionLog?:string,
|
4418
|
-
userId?:string,
|
4419
|
-
clanId?:string,
|
4420
|
-
page?:number,
|
4421
|
-
pageSize?:number
|
4422
|
-
)
|
4431
|
+
actionLog?: string,
|
4432
|
+
userId?: string,
|
4433
|
+
clanId?: string,
|
4434
|
+
page?: number,
|
4435
|
+
pageSize?: number
|
4436
|
+
): Promise<MezonapiListAuditLog> {
|
4423
4437
|
if (
|
4424
4438
|
this.autoRefreshSession &&
|
4425
4439
|
session.refresh_token &&
|
@@ -4436,12 +4450,12 @@ export class Client {
|
|
4436
4450
|
}
|
4437
4451
|
|
4438
4452
|
async listOnboarding(
|
4439
|
-
session: Session,
|
4440
|
-
clanId?:string,
|
4441
|
-
guideType?:number,
|
4442
|
-
limit?:number,
|
4443
|
-
page?:number
|
4444
|
-
)
|
4453
|
+
session: Session,
|
4454
|
+
clanId?: string,
|
4455
|
+
guideType?: number,
|
4456
|
+
limit?: number,
|
4457
|
+
page?: number
|
4458
|
+
): Promise<ApiListOnboardingResponse> {
|
4445
4459
|
if (
|
4446
4460
|
this.autoRefreshSession &&
|
4447
4461
|
session.refresh_token &&
|
@@ -4460,7 +4474,7 @@ export class Client {
|
|
4460
4474
|
async getOnboardingDetail(
|
4461
4475
|
session: Session,
|
4462
4476
|
id: string,
|
4463
|
-
clanId?: string
|
4477
|
+
clanId?: string
|
4464
4478
|
): Promise<ApiOnboardingItem> {
|
4465
4479
|
if (
|
4466
4480
|
this.autoRefreshSession &&
|
@@ -4518,8 +4532,8 @@ export class Client {
|
|
4518
4532
|
|
4519
4533
|
async deleteOnboarding(
|
4520
4534
|
session: Session,
|
4521
|
-
id:string,
|
4522
|
-
clanId?:string
|
4535
|
+
id: string,
|
4536
|
+
clanId?: string
|
4523
4537
|
): Promise<any> {
|
4524
4538
|
if (
|
4525
4539
|
this.autoRefreshSession &&
|
@@ -4550,12 +4564,12 @@ export class Client {
|
|
4550
4564
|
}
|
4551
4565
|
|
4552
4566
|
return this.apiClient
|
4553
|
-
.
|
4567
|
+
.generateClanWebhook(session.token, request)
|
4554
4568
|
.then((response: any) => {
|
4555
4569
|
return Promise.resolve(response);
|
4556
4570
|
});
|
4557
4571
|
}
|
4558
|
-
|
4572
|
+
|
4559
4573
|
//**list webhook belong to the clan */
|
4560
4574
|
async listClanWebhook(
|
4561
4575
|
session: Session,
|
@@ -4577,11 +4591,7 @@ export class Client {
|
|
4577
4591
|
}
|
4578
4592
|
|
4579
4593
|
//**disabled webhook by id */
|
4580
|
-
async deleteClanWebhookById(
|
4581
|
-
session: Session,
|
4582
|
-
id: string,
|
4583
|
-
clan_id: string
|
4584
|
-
) {
|
4594
|
+
async deleteClanWebhookById(session: Session, id: string, clan_id: string) {
|
4585
4595
|
if (
|
4586
4596
|
this.autoRefreshSession &&
|
4587
4597
|
session.refresh_token &&
|
@@ -4641,10 +4651,10 @@ export class Client {
|
|
4641
4651
|
}
|
4642
4652
|
|
4643
4653
|
//**update onboarding step by id */
|
4644
|
-
async
|
4654
|
+
async updateOnboardingStepByClanId(
|
4645
4655
|
session: Session,
|
4646
4656
|
id: string,
|
4647
|
-
request:
|
4657
|
+
request: MezonUpdateOnboardingStepByClanIdBody
|
4648
4658
|
) {
|
4649
4659
|
if (
|
4650
4660
|
this.autoRefreshSession &&
|
@@ -4655,9 +4665,49 @@ export class Client {
|
|
4655
4665
|
}
|
4656
4666
|
|
4657
4667
|
return this.apiClient
|
4658
|
-
.
|
4668
|
+
.updateOnboardingStepByClanId(session.token, id, request)
|
4659
4669
|
.then((response: any) => {
|
4660
4670
|
return response !== undefined;
|
4661
4671
|
});
|
4662
4672
|
}
|
4673
|
+
|
4674
|
+
//**update status */
|
4675
|
+
async updateUserStatus(
|
4676
|
+
session: Session,
|
4677
|
+
request: ApiUserStatusUpdate
|
4678
|
+
) {
|
4679
|
+
if (
|
4680
|
+
this.autoRefreshSession &&
|
4681
|
+
session.refresh_token &&
|
4682
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4683
|
+
) {
|
4684
|
+
await this.sessionRefresh(session);
|
4685
|
+
}
|
4686
|
+
|
4687
|
+
return this.apiClient
|
4688
|
+
.updateUserStatus(session.token, request)
|
4689
|
+
.then((response: any) => {
|
4690
|
+
return response !== undefined;
|
4691
|
+
});
|
4692
|
+
}
|
4693
|
+
|
4694
|
+
//**get user status */
|
4695
|
+
async getUserStatus(
|
4696
|
+
session: Session
|
4697
|
+
): Promise<ApiUserStatus> {
|
4698
|
+
if (
|
4699
|
+
this.autoRefreshSession &&
|
4700
|
+
session.refresh_token &&
|
4701
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4702
|
+
) {
|
4703
|
+
await this.sessionRefresh(session);
|
4704
|
+
}
|
4705
|
+
|
4706
|
+
return this.apiClient
|
4707
|
+
.getUserStatus(session.token)
|
4708
|
+
.then((response: ApiUserStatus) => {
|
4709
|
+
return Promise.resolve(response);
|
4710
|
+
});
|
4711
|
+
}
|
4712
|
+
|
4663
4713
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -79,9 +79,12 @@ export declare enum ApiAppRole {
|
|
79
79
|
}
|
80
80
|
/** Update fields in a given channel. */
|
81
81
|
export interface MezonUpdateChannelDescBody {
|
82
|
+
age_restricted?: number;
|
82
83
|
app_url?: string;
|
83
84
|
category_id?: string;
|
84
85
|
channel_label?: string;
|
86
|
+
e2ee?: number;
|
87
|
+
topic?: string;
|
85
88
|
}
|
86
89
|
/** */
|
87
90
|
export interface MezonUpdateClanDescBody {
|
@@ -401,6 +404,7 @@ export interface ApiChannelDescList {
|
|
401
404
|
/** */
|
402
405
|
export interface ApiChannelDescription {
|
403
406
|
active?: number;
|
407
|
+
age_restricted?: number;
|
404
408
|
app_url?: string;
|
405
409
|
category_id?: string;
|
406
410
|
category_name?: string;
|
@@ -414,6 +418,7 @@ export interface ApiChannelDescription {
|
|
414
418
|
create_time_seconds?: number;
|
415
419
|
creator_id?: string;
|
416
420
|
creator_name?: string;
|
421
|
+
e2ee?: number;
|
417
422
|
is_mute?: boolean;
|
418
423
|
last_pin_message?: string;
|
419
424
|
last_seen_message?: ApiChannelMessageHeader;
|
@@ -422,6 +427,7 @@ export interface ApiChannelDescription {
|
|
422
427
|
meeting_uri?: string;
|
423
428
|
parrent_id?: string;
|
424
429
|
is_online?: Array<boolean>;
|
430
|
+
topic?: string;
|
425
431
|
type?: number;
|
426
432
|
update_time_seconds?: number;
|
427
433
|
user_id?: Array<string>;
|
@@ -1267,6 +1273,7 @@ export interface ApiTokenSentEvent {
|
|
1267
1273
|
export interface ApiUpdateAccountRequest {
|
1268
1274
|
about_me?: string;
|
1269
1275
|
avatar_url?: string;
|
1276
|
+
dob?: string;
|
1270
1277
|
display_name?: string;
|
1271
1278
|
lang_tag?: string;
|
1272
1279
|
location?: string;
|
@@ -1315,6 +1322,7 @@ export interface ApiUser {
|
|
1315
1322
|
about_me?: string;
|
1316
1323
|
apple_id?: string;
|
1317
1324
|
avatar_url?: string;
|
1325
|
+
dob?: string;
|
1318
1326
|
create_time?: string;
|
1319
1327
|
display_name?: string;
|
1320
1328
|
edge_count?: number;
|
@@ -1350,6 +1358,17 @@ export interface ApiUserPermissionInChannelListResponse {
|
|
1350
1358
|
clan_id?: string;
|
1351
1359
|
permissions?: ApiPermissionList;
|
1352
1360
|
}
|
1361
|
+
/** */
|
1362
|
+
export interface ApiUserStatus {
|
1363
|
+
status?: string;
|
1364
|
+
user_id?: string;
|
1365
|
+
}
|
1366
|
+
/** */
|
1367
|
+
export interface ApiUserStatusUpdate {
|
1368
|
+
minutes?: number;
|
1369
|
+
status?: string;
|
1370
|
+
until_turn_on?: boolean;
|
1371
|
+
}
|
1353
1372
|
/** A collection of zero or more users. */
|
1354
1373
|
export interface ApiUsers {
|
1355
1374
|
users?: Array<ApiUser>;
|
@@ -1507,7 +1526,7 @@ export interface ApiListClanWebhookResponse {
|
|
1507
1526
|
list_clan_webhooks?: Array<ApiClanWebhook>;
|
1508
1527
|
}
|
1509
1528
|
/** */
|
1510
|
-
export interface
|
1529
|
+
export interface MezonUpdateOnboardingStepByClanIdBody {
|
1511
1530
|
onboarding_step?: number;
|
1512
1531
|
}
|
1513
1532
|
/** */
|
@@ -1868,6 +1887,10 @@ export declare class MezonApi {
|
|
1868
1887
|
listUserClansByUserId(bearerToken: string, options?: any): Promise<ApiAllUserClans>;
|
1869
1888
|
/** ListUserPermissionInChannel */
|
1870
1889
|
listUserPermissionInChannel(bearerToken: string, clanId?: string, channelId?: string, options?: any): Promise<ApiUserPermissionInChannelListResponse>;
|
1890
|
+
/** Get user status */
|
1891
|
+
getUserStatus(bearerToken: string, options?: any): Promise<ApiUserStatus>;
|
1892
|
+
/** Update user status */
|
1893
|
+
updateUserStatus(bearerToken: string, body: ApiUserStatusUpdate, options?: any): Promise<any>;
|
1871
1894
|
/** create webhook */
|
1872
1895
|
generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
|
1873
1896
|
/** update webhook name by id */
|
@@ -1906,5 +1929,5 @@ export declare class MezonApi {
|
|
1906
1929
|
/** List onboarding step. */
|
1907
1930
|
listOnboardingStep(bearerToken: string, clanId?: string, limit?: number, page?: number, options?: any): Promise<ApiListOnboardingStepResponse>;
|
1908
1931
|
/** Update onboarding step. */
|
1909
|
-
|
1932
|
+
updateOnboardingStepByClanId(bearerToken: string, clanId: string, body: MezonUpdateOnboardingStepByClanIdBody, options?: any): Promise<any>;
|
1910
1933
|
}
|
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, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiListOnboardingStepResponse,
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, 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, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -43,7 +43,8 @@ export declare enum NotificationType {
|
|
43
43
|
export declare enum WebrtcSignalingType {
|
44
44
|
WEBRTC_SDP_OFFER = 1,
|
45
45
|
WEBRTC_SDP_ANSWER = 2,
|
46
|
-
WEBRTC_ICE_CANDIDATE = 3
|
46
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
47
|
+
WEBRTC_SDP_QUIT = 4
|
47
48
|
}
|
48
49
|
/** Response for an RPC function executed on the server. */
|
49
50
|
export interface RpcResponse {
|
@@ -251,6 +252,9 @@ export interface ApiUpdateChannelDescRequest {
|
|
251
252
|
category_id: string | undefined;
|
252
253
|
/** The app url of channel */
|
253
254
|
app_url: string | undefined;
|
255
|
+
e2ee?: number;
|
256
|
+
topic?: string;
|
257
|
+
age_restricted?: number;
|
254
258
|
}
|
255
259
|
/** Add users to a channel. */
|
256
260
|
export interface ApiAddChannelUsersRequest {
|
@@ -620,5 +624,7 @@ export declare class Client {
|
|
620
624
|
deleteClanWebhookById(session: Session, id: string, clan_id: string): Promise<boolean>;
|
621
625
|
updateClanWebhookById(session: Session, id: string, request: MezonUpdateClanWebhookByIdBody): Promise<boolean>;
|
622
626
|
listOnboardingStep(session: Session, clan_id?: string, limit?: number, page?: number): Promise<ApiListOnboardingStepResponse>;
|
623
|
-
|
627
|
+
updateOnboardingStepByClanId(session: Session, id: string, request: MezonUpdateOnboardingStepByClanIdBody): Promise<boolean>;
|
628
|
+
updateUserStatus(session: Session, request: ApiUserStatusUpdate): Promise<boolean>;
|
629
|
+
getUserStatus(session: Session): Promise<ApiUserStatus>;
|
624
630
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -6005,6 +6005,60 @@ var MezonApi = class {
|
|
6005
6005
|
)
|
6006
6006
|
]);
|
6007
6007
|
}
|
6008
|
+
/** Get user status */
|
6009
|
+
getUserStatus(bearerToken, options = {}) {
|
6010
|
+
const urlPath = "/v2/userstatus";
|
6011
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6012
|
+
let bodyJson = "";
|
6013
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6014
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
6015
|
+
if (bearerToken) {
|
6016
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6017
|
+
}
|
6018
|
+
return Promise.race([
|
6019
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6020
|
+
if (response.status == 204) {
|
6021
|
+
return response;
|
6022
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6023
|
+
return response.json();
|
6024
|
+
} else {
|
6025
|
+
throw response;
|
6026
|
+
}
|
6027
|
+
}),
|
6028
|
+
new Promise(
|
6029
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6030
|
+
)
|
6031
|
+
]);
|
6032
|
+
}
|
6033
|
+
/** Update user status */
|
6034
|
+
updateUserStatus(bearerToken, body, options = {}) {
|
6035
|
+
if (body === null || body === void 0) {
|
6036
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6037
|
+
}
|
6038
|
+
const urlPath = "/v2/userstatus";
|
6039
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6040
|
+
let bodyJson = "";
|
6041
|
+
bodyJson = JSON.stringify(body || {});
|
6042
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6043
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
6044
|
+
if (bearerToken) {
|
6045
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6046
|
+
}
|
6047
|
+
return Promise.race([
|
6048
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6049
|
+
if (response.status == 204) {
|
6050
|
+
return response;
|
6051
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6052
|
+
return response.json();
|
6053
|
+
} else {
|
6054
|
+
throw response;
|
6055
|
+
}
|
6056
|
+
}),
|
6057
|
+
new Promise(
|
6058
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6059
|
+
)
|
6060
|
+
]);
|
6061
|
+
}
|
6008
6062
|
/** create webhook */
|
6009
6063
|
generateWebhook(bearerToken, body, options = {}) {
|
6010
6064
|
if (body === null || body === void 0) {
|
@@ -6577,14 +6631,14 @@ var MezonApi = class {
|
|
6577
6631
|
]);
|
6578
6632
|
}
|
6579
6633
|
/** Update onboarding step. */
|
6580
|
-
|
6581
|
-
if (
|
6582
|
-
throw new Error("'
|
6634
|
+
updateOnboardingStepByClanId(bearerToken, clanId, body, options = {}) {
|
6635
|
+
if (clanId === null || clanId === void 0) {
|
6636
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
6583
6637
|
}
|
6584
6638
|
if (body === null || body === void 0) {
|
6585
6639
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
6586
6640
|
}
|
6587
|
-
const urlPath = "/v2/onboardingsteps/{
|
6641
|
+
const urlPath = "/v2/onboardingsteps/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
6588
6642
|
const queryParams = /* @__PURE__ */ new Map();
|
6589
6643
|
let bodyJson = "";
|
6590
6644
|
bodyJson = JSON.stringify(body || {});
|
@@ -6993,9 +7047,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6993
7047
|
} else if (message.token_sent_event) {
|
6994
7048
|
this.ontokensent(message.token_sent_event);
|
6995
7049
|
} else if (message.message_button_clicked) {
|
6996
|
-
this.onmessagebuttonclicked(
|
7050
|
+
this.onmessagebuttonclicked(
|
7051
|
+
message.message_button_clicked
|
7052
|
+
);
|
6997
7053
|
} else if (message.webrtc_signaling_fwd) {
|
6998
|
-
this.onwebrtcsignalingfwd(
|
7054
|
+
this.onwebrtcsignalingfwd(
|
7055
|
+
message.webrtc_signaling_fwd
|
7056
|
+
);
|
6999
7057
|
} else if (message.list_activity) {
|
7000
7058
|
this.onactivityupdated(message.list_activity);
|
7001
7059
|
} else if (message.join_ptt_channel) {
|
@@ -7553,7 +7611,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7553
7611
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
7554
7612
|
return __async(this, null, function* () {
|
7555
7613
|
const response = yield this.send({
|
7556
|
-
webrtc_signaling_fwd: {
|
7614
|
+
webrtc_signaling_fwd: {
|
7615
|
+
receiver_id,
|
7616
|
+
data_type,
|
7617
|
+
json_data,
|
7618
|
+
channel_id,
|
7619
|
+
caller_id
|
7620
|
+
}
|
7557
7621
|
});
|
7558
7622
|
return response.webrtc_signaling_fwd;
|
7559
7623
|
});
|
@@ -7561,7 +7625,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7561
7625
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
7562
7626
|
return __async(this, null, function* () {
|
7563
7627
|
const response = yield this.send({
|
7564
|
-
message_button_clicked: {
|
7628
|
+
message_button_clicked: {
|
7629
|
+
message_id,
|
7630
|
+
channel_id,
|
7631
|
+
button_id,
|
7632
|
+
sender_id,
|
7633
|
+
user_id
|
7634
|
+
}
|
7565
7635
|
});
|
7566
7636
|
return response.webrtc_signaling_fwd;
|
7567
7637
|
});
|
@@ -7569,7 +7639,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7569
7639
|
joinPTTChannel(channelId, dataType, jsonData) {
|
7570
7640
|
return __async(this, null, function* () {
|
7571
7641
|
const response = yield this.send({
|
7572
|
-
join_ptt_channel: {
|
7642
|
+
join_ptt_channel: {
|
7643
|
+
channel_id: channelId,
|
7644
|
+
data_type: dataType,
|
7645
|
+
json_data: jsonData,
|
7646
|
+
receiver_id: ""
|
7647
|
+
}
|
7573
7648
|
});
|
7574
7649
|
return response.join_ptt_channel;
|
7575
7650
|
});
|
@@ -7577,7 +7652,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7577
7652
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7578
7653
|
return __async(this, null, function* () {
|
7579
7654
|
const response = yield this.send({
|
7580
|
-
talk_ptt_channel: {
|
7655
|
+
talk_ptt_channel: {
|
7656
|
+
channel_id: channelId,
|
7657
|
+
data_type: dataType,
|
7658
|
+
json_data: jsonData,
|
7659
|
+
state
|
7660
|
+
}
|
7581
7661
|
});
|
7582
7662
|
return response.talk_ptt_channel;
|
7583
7663
|
});
|
@@ -7644,6 +7724,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
7644
7724
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
7645
7725
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
7646
7726
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
7727
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
7647
7728
|
return WebrtcSignalingType2;
|
7648
7729
|
})(WebrtcSignalingType || {});
|
7649
7730
|
var Client = class {
|
@@ -10030,7 +10111,7 @@ var Client = class {
|
|
10030
10111
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10031
10112
|
yield this.sessionRefresh(session);
|
10032
10113
|
}
|
10033
|
-
return this.apiClient.
|
10114
|
+
return this.apiClient.generateClanWebhook(session.token, request).then((response) => {
|
10034
10115
|
return Promise.resolve(response);
|
10035
10116
|
});
|
10036
10117
|
});
|
@@ -10080,14 +10161,36 @@ var Client = class {
|
|
10080
10161
|
});
|
10081
10162
|
}
|
10082
10163
|
//**update onboarding step by id */
|
10083
|
-
|
10164
|
+
updateOnboardingStepByClanId(session, id, request) {
|
10165
|
+
return __async(this, null, function* () {
|
10166
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10167
|
+
yield this.sessionRefresh(session);
|
10168
|
+
}
|
10169
|
+
return this.apiClient.updateOnboardingStepByClanId(session.token, id, request).then((response) => {
|
10170
|
+
return response !== void 0;
|
10171
|
+
});
|
10172
|
+
});
|
10173
|
+
}
|
10174
|
+
//**update status */
|
10175
|
+
updateUserStatus(session, request) {
|
10084
10176
|
return __async(this, null, function* () {
|
10085
10177
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10086
10178
|
yield this.sessionRefresh(session);
|
10087
10179
|
}
|
10088
|
-
return this.apiClient.
|
10180
|
+
return this.apiClient.updateUserStatus(session.token, request).then((response) => {
|
10089
10181
|
return response !== void 0;
|
10090
10182
|
});
|
10091
10183
|
});
|
10092
10184
|
}
|
10185
|
+
//**get user status */
|
10186
|
+
getUserStatus(session) {
|
10187
|
+
return __async(this, null, function* () {
|
10188
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10189
|
+
yield this.sessionRefresh(session);
|
10190
|
+
}
|
10191
|
+
return this.apiClient.getUserStatus(session.token).then((response) => {
|
10192
|
+
return Promise.resolve(response);
|
10193
|
+
});
|
10194
|
+
});
|
10195
|
+
}
|
10093
10196
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5975,6 +5975,60 @@ var MezonApi = class {
|
|
5975
5975
|
)
|
5976
5976
|
]);
|
5977
5977
|
}
|
5978
|
+
/** Get user status */
|
5979
|
+
getUserStatus(bearerToken, options = {}) {
|
5980
|
+
const urlPath = "/v2/userstatus";
|
5981
|
+
const queryParams = /* @__PURE__ */ new Map();
|
5982
|
+
let bodyJson = "";
|
5983
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
5984
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
5985
|
+
if (bearerToken) {
|
5986
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
5987
|
+
}
|
5988
|
+
return Promise.race([
|
5989
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
5990
|
+
if (response.status == 204) {
|
5991
|
+
return response;
|
5992
|
+
} else if (response.status >= 200 && response.status < 300) {
|
5993
|
+
return response.json();
|
5994
|
+
} else {
|
5995
|
+
throw response;
|
5996
|
+
}
|
5997
|
+
}),
|
5998
|
+
new Promise(
|
5999
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6000
|
+
)
|
6001
|
+
]);
|
6002
|
+
}
|
6003
|
+
/** Update user status */
|
6004
|
+
updateUserStatus(bearerToken, body, options = {}) {
|
6005
|
+
if (body === null || body === void 0) {
|
6006
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
6007
|
+
}
|
6008
|
+
const urlPath = "/v2/userstatus";
|
6009
|
+
const queryParams = /* @__PURE__ */ new Map();
|
6010
|
+
let bodyJson = "";
|
6011
|
+
bodyJson = JSON.stringify(body || {});
|
6012
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
6013
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
6014
|
+
if (bearerToken) {
|
6015
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
6016
|
+
}
|
6017
|
+
return Promise.race([
|
6018
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
6019
|
+
if (response.status == 204) {
|
6020
|
+
return response;
|
6021
|
+
} else if (response.status >= 200 && response.status < 300) {
|
6022
|
+
return response.json();
|
6023
|
+
} else {
|
6024
|
+
throw response;
|
6025
|
+
}
|
6026
|
+
}),
|
6027
|
+
new Promise(
|
6028
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
6029
|
+
)
|
6030
|
+
]);
|
6031
|
+
}
|
5978
6032
|
/** create webhook */
|
5979
6033
|
generateWebhook(bearerToken, body, options = {}) {
|
5980
6034
|
if (body === null || body === void 0) {
|
@@ -6547,14 +6601,14 @@ var MezonApi = class {
|
|
6547
6601
|
]);
|
6548
6602
|
}
|
6549
6603
|
/** Update onboarding step. */
|
6550
|
-
|
6551
|
-
if (
|
6552
|
-
throw new Error("'
|
6604
|
+
updateOnboardingStepByClanId(bearerToken, clanId, body, options = {}) {
|
6605
|
+
if (clanId === null || clanId === void 0) {
|
6606
|
+
throw new Error("'clanId' is a required parameter but is null or undefined.");
|
6553
6607
|
}
|
6554
6608
|
if (body === null || body === void 0) {
|
6555
6609
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
6556
6610
|
}
|
6557
|
-
const urlPath = "/v2/onboardingsteps/{
|
6611
|
+
const urlPath = "/v2/onboardingsteps/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
|
6558
6612
|
const queryParams = /* @__PURE__ */ new Map();
|
6559
6613
|
let bodyJson = "";
|
6560
6614
|
bodyJson = JSON.stringify(body || {});
|
@@ -6963,9 +7017,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6963
7017
|
} else if (message.token_sent_event) {
|
6964
7018
|
this.ontokensent(message.token_sent_event);
|
6965
7019
|
} else if (message.message_button_clicked) {
|
6966
|
-
this.onmessagebuttonclicked(
|
7020
|
+
this.onmessagebuttonclicked(
|
7021
|
+
message.message_button_clicked
|
7022
|
+
);
|
6967
7023
|
} else if (message.webrtc_signaling_fwd) {
|
6968
|
-
this.onwebrtcsignalingfwd(
|
7024
|
+
this.onwebrtcsignalingfwd(
|
7025
|
+
message.webrtc_signaling_fwd
|
7026
|
+
);
|
6969
7027
|
} else if (message.list_activity) {
|
6970
7028
|
this.onactivityupdated(message.list_activity);
|
6971
7029
|
} else if (message.join_ptt_channel) {
|
@@ -7523,7 +7581,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7523
7581
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
7524
7582
|
return __async(this, null, function* () {
|
7525
7583
|
const response = yield this.send({
|
7526
|
-
webrtc_signaling_fwd: {
|
7584
|
+
webrtc_signaling_fwd: {
|
7585
|
+
receiver_id,
|
7586
|
+
data_type,
|
7587
|
+
json_data,
|
7588
|
+
channel_id,
|
7589
|
+
caller_id
|
7590
|
+
}
|
7527
7591
|
});
|
7528
7592
|
return response.webrtc_signaling_fwd;
|
7529
7593
|
});
|
@@ -7531,7 +7595,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7531
7595
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
7532
7596
|
return __async(this, null, function* () {
|
7533
7597
|
const response = yield this.send({
|
7534
|
-
message_button_clicked: {
|
7598
|
+
message_button_clicked: {
|
7599
|
+
message_id,
|
7600
|
+
channel_id,
|
7601
|
+
button_id,
|
7602
|
+
sender_id,
|
7603
|
+
user_id
|
7604
|
+
}
|
7535
7605
|
});
|
7536
7606
|
return response.webrtc_signaling_fwd;
|
7537
7607
|
});
|
@@ -7539,7 +7609,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7539
7609
|
joinPTTChannel(channelId, dataType, jsonData) {
|
7540
7610
|
return __async(this, null, function* () {
|
7541
7611
|
const response = yield this.send({
|
7542
|
-
join_ptt_channel: {
|
7612
|
+
join_ptt_channel: {
|
7613
|
+
channel_id: channelId,
|
7614
|
+
data_type: dataType,
|
7615
|
+
json_data: jsonData,
|
7616
|
+
receiver_id: ""
|
7617
|
+
}
|
7543
7618
|
});
|
7544
7619
|
return response.join_ptt_channel;
|
7545
7620
|
});
|
@@ -7547,7 +7622,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7547
7622
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7548
7623
|
return __async(this, null, function* () {
|
7549
7624
|
const response = yield this.send({
|
7550
|
-
talk_ptt_channel: {
|
7625
|
+
talk_ptt_channel: {
|
7626
|
+
channel_id: channelId,
|
7627
|
+
data_type: dataType,
|
7628
|
+
json_data: jsonData,
|
7629
|
+
state
|
7630
|
+
}
|
7551
7631
|
});
|
7552
7632
|
return response.talk_ptt_channel;
|
7553
7633
|
});
|
@@ -7614,6 +7694,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
7614
7694
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
7615
7695
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
7616
7696
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
7697
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
7617
7698
|
return WebrtcSignalingType2;
|
7618
7699
|
})(WebrtcSignalingType || {});
|
7619
7700
|
var Client = class {
|
@@ -10000,7 +10081,7 @@ var Client = class {
|
|
10000
10081
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10001
10082
|
yield this.sessionRefresh(session);
|
10002
10083
|
}
|
10003
|
-
return this.apiClient.
|
10084
|
+
return this.apiClient.generateClanWebhook(session.token, request).then((response) => {
|
10004
10085
|
return Promise.resolve(response);
|
10005
10086
|
});
|
10006
10087
|
});
|
@@ -10050,16 +10131,38 @@ var Client = class {
|
|
10050
10131
|
});
|
10051
10132
|
}
|
10052
10133
|
//**update onboarding step by id */
|
10053
|
-
|
10134
|
+
updateOnboardingStepByClanId(session, id, request) {
|
10135
|
+
return __async(this, null, function* () {
|
10136
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10137
|
+
yield this.sessionRefresh(session);
|
10138
|
+
}
|
10139
|
+
return this.apiClient.updateOnboardingStepByClanId(session.token, id, request).then((response) => {
|
10140
|
+
return response !== void 0;
|
10141
|
+
});
|
10142
|
+
});
|
10143
|
+
}
|
10144
|
+
//**update status */
|
10145
|
+
updateUserStatus(session, request) {
|
10054
10146
|
return __async(this, null, function* () {
|
10055
10147
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10056
10148
|
yield this.sessionRefresh(session);
|
10057
10149
|
}
|
10058
|
-
return this.apiClient.
|
10150
|
+
return this.apiClient.updateUserStatus(session.token, request).then((response) => {
|
10059
10151
|
return response !== void 0;
|
10060
10152
|
});
|
10061
10153
|
});
|
10062
10154
|
}
|
10155
|
+
//**get user status */
|
10156
|
+
getUserStatus(session) {
|
10157
|
+
return __async(this, null, function* () {
|
10158
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10159
|
+
yield this.sessionRefresh(session);
|
10160
|
+
}
|
10161
|
+
return this.apiClient.getUserStatus(session.token).then((response) => {
|
10162
|
+
return Promise.resolve(response);
|
10163
|
+
});
|
10164
|
+
});
|
10165
|
+
}
|
10063
10166
|
};
|
10064
10167
|
export {
|
10065
10168
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -592,9 +592,14 @@ export interface WebrtcSignalingFwd {
|
|
592
592
|
caller_id: string;
|
593
593
|
}
|
594
594
|
export interface JoinPTTChannel {
|
595
|
+
/** channel id */
|
595
596
|
channel_id: string;
|
597
|
+
/** type offer, answer or candidate */
|
596
598
|
data_type: number;
|
599
|
+
/** offer */
|
597
600
|
json_data: string;
|
601
|
+
/** receiver id */
|
602
|
+
receiver_id: string;
|
598
603
|
}
|
599
604
|
export interface TalkPTTChannel {
|
600
605
|
channel_id: string;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -837,12 +837,14 @@ export interface WebrtcSignalingFwd {
|
|
837
837
|
}
|
838
838
|
|
839
839
|
export interface JoinPTTChannel {
|
840
|
-
|
840
|
+
/** channel id */
|
841
841
|
channel_id: string;
|
842
|
-
|
842
|
+
/** type offer, answer or candidate */
|
843
843
|
data_type: number;
|
844
|
-
|
844
|
+
/** offer */
|
845
845
|
json_data: string;
|
846
|
+
/** receiver id */
|
847
|
+
receiver_id: string;
|
846
848
|
}
|
847
849
|
|
848
850
|
export interface TalkPTTChannel {
|
@@ -1140,15 +1142,23 @@ export interface Socket {
|
|
1140
1142
|
type: number
|
1141
1143
|
): Promise<CheckNameExistedEvent>;
|
1142
1144
|
|
1143
|
-
handleMessageButtonClick: (
|
1145
|
+
handleMessageButtonClick: (
|
1146
|
+
message_id: string,
|
1144
1147
|
channel_id: string,
|
1145
1148
|
button_id: string,
|
1146
1149
|
sender_id: string,
|
1147
|
-
user_id: string
|
1150
|
+
user_id: string
|
1151
|
+
) => Promise<MessageButtonClicked>;
|
1148
1152
|
|
1149
1153
|
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
1150
1154
|
|
1151
|
-
forwardWebrtcSignaling: (
|
1155
|
+
forwardWebrtcSignaling: (
|
1156
|
+
receiverId: string,
|
1157
|
+
dataType: number,
|
1158
|
+
jsonData: string,
|
1159
|
+
channelId: string,
|
1160
|
+
caller_id: string
|
1161
|
+
) => Promise<WebrtcSignalingFwd>;
|
1152
1162
|
|
1153
1163
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
1154
1164
|
|
@@ -1182,7 +1192,7 @@ export interface Socket {
|
|
1182
1192
|
|
1183
1193
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
1184
1194
|
|
1185
|
-
ontokensent: (token: ApiTokenSentEvent) => void;
|
1195
|
+
ontokensent: (token: ApiTokenSentEvent) => void;
|
1186
1196
|
|
1187
1197
|
onactivityupdated: (list_activity: ListActivity) => void;
|
1188
1198
|
|
@@ -1440,14 +1450,18 @@ export class DefaultSocket implements Socket {
|
|
1440
1450
|
} else if (message.token_sent_event) {
|
1441
1451
|
this.ontokensent(<ApiTokenSentEvent>message.token_sent_event);
|
1442
1452
|
} else if (message.message_button_clicked) {
|
1443
|
-
this.onmessagebuttonclicked(
|
1453
|
+
this.onmessagebuttonclicked(
|
1454
|
+
<MessageButtonClicked>message.message_button_clicked
|
1455
|
+
);
|
1444
1456
|
} else if (message.webrtc_signaling_fwd) {
|
1445
|
-
this.onwebrtcsignalingfwd(
|
1446
|
-
|
1457
|
+
this.onwebrtcsignalingfwd(
|
1458
|
+
<WebrtcSignalingFwd>message.webrtc_signaling_fwd
|
1459
|
+
);
|
1460
|
+
} else if (message.list_activity) {
|
1447
1461
|
this.onactivityupdated(<ListActivity>message.list_activity);
|
1448
|
-
} else if (message.join_ptt_channel){
|
1462
|
+
} else if (message.join_ptt_channel) {
|
1449
1463
|
this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
|
1450
|
-
} else if (message.talk_ptt_channel){
|
1464
|
+
} else if (message.talk_ptt_channel) {
|
1451
1465
|
this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
|
1452
1466
|
} else {
|
1453
1467
|
if (this.verbose && window && window.console) {
|
@@ -2162,25 +2176,39 @@ export class DefaultSocket implements Socket {
|
|
2162
2176
|
}
|
2163
2177
|
|
2164
2178
|
async forwardWebrtcSignaling(
|
2165
|
-
receiver_id: string,
|
2166
|
-
data_type: number,
|
2179
|
+
receiver_id: string,
|
2180
|
+
data_type: number,
|
2167
2181
|
json_data: string,
|
2168
|
-
channel_id: string,
|
2169
|
-
caller_id: string
|
2182
|
+
channel_id: string,
|
2183
|
+
caller_id: string
|
2184
|
+
): Promise<WebrtcSignalingFwd> {
|
2170
2185
|
const response = await this.send({
|
2171
|
-
webrtc_signaling_fwd: {
|
2186
|
+
webrtc_signaling_fwd: {
|
2187
|
+
receiver_id: receiver_id,
|
2188
|
+
data_type: data_type,
|
2189
|
+
json_data: json_data,
|
2190
|
+
channel_id: channel_id,
|
2191
|
+
caller_id: caller_id,
|
2192
|
+
},
|
2172
2193
|
});
|
2173
2194
|
return response.webrtc_signaling_fwd;
|
2174
2195
|
}
|
2175
2196
|
|
2176
|
-
async handleMessageButtonClick
|
2197
|
+
async handleMessageButtonClick(
|
2177
2198
|
message_id: string,
|
2178
2199
|
channel_id: string,
|
2179
2200
|
button_id: string,
|
2180
2201
|
sender_id: string,
|
2181
|
-
user_id: string
|
2202
|
+
user_id: string
|
2203
|
+
): Promise<MessageButtonClicked> {
|
2182
2204
|
const response = await this.send({
|
2183
|
-
message_button_clicked: {
|
2205
|
+
message_button_clicked: {
|
2206
|
+
message_id: message_id,
|
2207
|
+
channel_id: channel_id,
|
2208
|
+
button_id: button_id,
|
2209
|
+
sender_id: sender_id,
|
2210
|
+
user_id: user_id,
|
2211
|
+
},
|
2184
2212
|
});
|
2185
2213
|
return response.webrtc_signaling_fwd;
|
2186
2214
|
}
|
@@ -2191,7 +2219,12 @@ export class DefaultSocket implements Socket {
|
|
2191
2219
|
jsonData: string
|
2192
2220
|
): Promise<JoinPTTChannel> {
|
2193
2221
|
const response = await this.send({
|
2194
|
-
join_ptt_channel: {
|
2222
|
+
join_ptt_channel: {
|
2223
|
+
channel_id: channelId,
|
2224
|
+
data_type: dataType,
|
2225
|
+
json_data: jsonData,
|
2226
|
+
receiver_id: "",
|
2227
|
+
},
|
2195
2228
|
});
|
2196
2229
|
return response.join_ptt_channel;
|
2197
2230
|
}
|
@@ -2203,7 +2236,12 @@ export class DefaultSocket implements Socket {
|
|
2203
2236
|
state: number
|
2204
2237
|
): Promise<TalkPTTChannel> {
|
2205
2238
|
const response = await this.send({
|
2206
|
-
talk_ptt_channel: {
|
2239
|
+
talk_ptt_channel: {
|
2240
|
+
channel_id: channelId,
|
2241
|
+
data_type: dataType,
|
2242
|
+
json_data: jsonData,
|
2243
|
+
state: state,
|
2244
|
+
},
|
2207
2245
|
});
|
2208
2246
|
return response.talk_ptt_channel;
|
2209
2247
|
}
|