mezon-js 2.14.12 → 2.14.14
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/api.gen.ts +38 -150
- package/client.ts +2 -39
- package/dist/api.gen.d.ts +4 -9
- package/dist/client.d.ts +1 -3
- package/dist/mezon-js.cjs.js +35 -147
- package/dist/mezon-js.esm.mjs +35 -147
- package/package.json +1 -1
- package/socket.ts +2 -2
package/api.gen.ts
CHANGED
|
@@ -1994,7 +1994,7 @@ export interface ApiNotification {
|
|
|
1994
1994
|
//Category code for this notification.
|
|
1995
1995
|
code?: number;
|
|
1996
1996
|
//Content of the notification in JSON.
|
|
1997
|
-
content?:
|
|
1997
|
+
content?: tsproto.DirectFcmProto;
|
|
1998
1998
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the notification was created.
|
|
1999
1999
|
create_time?: string;
|
|
2000
2000
|
//ID of the Notification.
|
|
@@ -3473,35 +3473,6 @@ export class MezonApi {
|
|
|
3473
3473
|
this.basePath = basePath;
|
|
3474
3474
|
}
|
|
3475
3475
|
|
|
3476
|
-
/** A healthcheck which load balancers can use to check the service. */
|
|
3477
|
-
healthcheck(bearerToken: string, options: any = {}): Promise<any> {
|
|
3478
|
-
const urlPath = "/healthcheck";
|
|
3479
|
-
const queryParams = new Map<string, any>();
|
|
3480
|
-
|
|
3481
|
-
let bodyJson: string = "";
|
|
3482
|
-
|
|
3483
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
3484
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
3485
|
-
if (bearerToken) {
|
|
3486
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
3487
|
-
}
|
|
3488
|
-
|
|
3489
|
-
return Promise.race([
|
|
3490
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
3491
|
-
if (response.status == 204) {
|
|
3492
|
-
return response;
|
|
3493
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
3494
|
-
return response.json();
|
|
3495
|
-
} else {
|
|
3496
|
-
throw response;
|
|
3497
|
-
}
|
|
3498
|
-
}),
|
|
3499
|
-
new Promise((_, reject) =>
|
|
3500
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
3501
|
-
),
|
|
3502
|
-
]);
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
3476
|
/** Delete the current user's account. */
|
|
3506
3477
|
deleteAccount(bearerToken: string, options: any = {}): Promise<any> {
|
|
3507
3478
|
const urlPath = "/mezon.api.Mezon/DeleteAccount";
|
|
@@ -6077,47 +6048,6 @@ export class MezonApi {
|
|
|
6077
6048
|
]);
|
|
6078
6049
|
}
|
|
6079
6050
|
|
|
6080
|
-
/** check duplicate clan name */
|
|
6081
|
-
checkDuplicateClanName(
|
|
6082
|
-
bearerToken: string,
|
|
6083
|
-
clanName: string,
|
|
6084
|
-
options: any = {}
|
|
6085
|
-
): Promise<ApiCheckDuplicateClanNameResponse> {
|
|
6086
|
-
if (clanName === null || clanName === undefined) {
|
|
6087
|
-
throw new Error(
|
|
6088
|
-
"'clanName' is a required parameter but is null or undefined."
|
|
6089
|
-
);
|
|
6090
|
-
}
|
|
6091
|
-
const urlPath = "/v2/clandesc/{clanName}".replace(
|
|
6092
|
-
"{clanName}",
|
|
6093
|
-
encodeURIComponent(String(clanName))
|
|
6094
|
-
);
|
|
6095
|
-
const queryParams = new Map<string, any>();
|
|
6096
|
-
|
|
6097
|
-
let bodyJson: string = "";
|
|
6098
|
-
|
|
6099
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6100
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
6101
|
-
if (bearerToken) {
|
|
6102
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6103
|
-
}
|
|
6104
|
-
|
|
6105
|
-
return Promise.race([
|
|
6106
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
6107
|
-
if (response.status == 204) {
|
|
6108
|
-
return response;
|
|
6109
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
6110
|
-
return response.json();
|
|
6111
|
-
} else {
|
|
6112
|
-
throw response;
|
|
6113
|
-
}
|
|
6114
|
-
}),
|
|
6115
|
-
new Promise((_, reject) =>
|
|
6116
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
6117
|
-
),
|
|
6118
|
-
]);
|
|
6119
|
-
}
|
|
6120
|
-
|
|
6121
6051
|
/** */
|
|
6122
6052
|
createCategoryDesc(
|
|
6123
6053
|
bearerToken: string,
|
|
@@ -6215,47 +6145,6 @@ export class MezonApi {
|
|
|
6215
6145
|
]);
|
|
6216
6146
|
}
|
|
6217
6147
|
|
|
6218
|
-
/** */
|
|
6219
|
-
deleteCategoryOrder(
|
|
6220
|
-
bearerToken: string,
|
|
6221
|
-
clanId: string,
|
|
6222
|
-
options: any = {}
|
|
6223
|
-
): Promise<any> {
|
|
6224
|
-
if (clanId === null || clanId === undefined) {
|
|
6225
|
-
throw new Error(
|
|
6226
|
-
"'clanId' is a required parameter but is null or undefined."
|
|
6227
|
-
);
|
|
6228
|
-
}
|
|
6229
|
-
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace(
|
|
6230
|
-
"{clanId}",
|
|
6231
|
-
encodeURIComponent(String(clanId))
|
|
6232
|
-
);
|
|
6233
|
-
const queryParams = new Map<string, any>();
|
|
6234
|
-
|
|
6235
|
-
let bodyJson: string = "";
|
|
6236
|
-
|
|
6237
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6238
|
-
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
6239
|
-
if (bearerToken) {
|
|
6240
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6241
|
-
}
|
|
6242
|
-
|
|
6243
|
-
return Promise.race([
|
|
6244
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
6245
|
-
if (response.status == 204) {
|
|
6246
|
-
return response;
|
|
6247
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
6248
|
-
return response.json();
|
|
6249
|
-
} else {
|
|
6250
|
-
throw response;
|
|
6251
|
-
}
|
|
6252
|
-
}),
|
|
6253
|
-
new Promise((_, reject) =>
|
|
6254
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
6255
|
-
),
|
|
6256
|
-
]);
|
|
6257
|
-
}
|
|
6258
|
-
|
|
6259
6148
|
/** regist fcm device token */
|
|
6260
6149
|
registFCMDeviceToken(
|
|
6261
6150
|
bearerToken: string,
|
|
@@ -6535,7 +6424,7 @@ export class MezonApi {
|
|
|
6535
6424
|
let bodyJson : string = "";
|
|
6536
6425
|
|
|
6537
6426
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6538
|
-
const fetchOptions = buildFetchOptions("
|
|
6427
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
6539
6428
|
if (bearerToken) {
|
|
6540
6429
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6541
6430
|
}
|
|
@@ -6563,13 +6452,13 @@ export class MezonApi {
|
|
|
6563
6452
|
bearerToken: string,
|
|
6564
6453
|
options: any = {}
|
|
6565
6454
|
): Promise<ApiEmojiListedResponse> {
|
|
6566
|
-
const urlPath = "/
|
|
6455
|
+
const urlPath = "/mezon.api.Mezon/GetListEmojisByUserId";
|
|
6567
6456
|
const queryParams = new Map<string, any>();
|
|
6568
6457
|
|
|
6569
6458
|
let bodyJson: string = "";
|
|
6570
6459
|
|
|
6571
6460
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
6572
|
-
const fetchOptions = buildFetchOptions("
|
|
6461
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
6573
6462
|
if (bearerToken) {
|
|
6574
6463
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
6575
6464
|
}
|
|
@@ -7448,9 +7337,8 @@ export class MezonApi {
|
|
|
7448
7337
|
}
|
|
7449
7338
|
|
|
7450
7339
|
/** Add users to a channel. */
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
basicAuthPassword: string,
|
|
7340
|
+
inviteUser(
|
|
7341
|
+
bearerToken: string,
|
|
7454
7342
|
inviteId: string,
|
|
7455
7343
|
options: any = {}
|
|
7456
7344
|
): Promise<ApiInviteUserRes> {
|
|
@@ -7459,41 +7347,42 @@ export class MezonApi {
|
|
|
7459
7347
|
"'inviteId' is a required parameter but is null or undefined."
|
|
7460
7348
|
);
|
|
7461
7349
|
}
|
|
7462
|
-
const urlPath = "/
|
|
7463
|
-
"{inviteId}",
|
|
7464
|
-
encodeURIComponent(String(inviteId))
|
|
7465
|
-
);
|
|
7350
|
+
const urlPath = "/mezon.api.Mezon/InviteUser";
|
|
7466
7351
|
const queryParams = new Map<string, any>();
|
|
7467
7352
|
|
|
7468
|
-
|
|
7353
|
+
const bodyWriter = tsproto.InviteUserRequest.encode(
|
|
7354
|
+
tsproto.InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
7355
|
+
);
|
|
7356
|
+
const encodedBody = bodyWriter.finish();
|
|
7469
7357
|
|
|
7470
7358
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7471
|
-
const fetchOptions = buildFetchOptions("
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7359
|
+
const fetchOptions = buildFetchOptions("POST", options, '');
|
|
7360
|
+
fetchOptions.body = encodedBody;
|
|
7361
|
+
if (bearerToken) {
|
|
7362
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
7475
7363
|
}
|
|
7476
7364
|
|
|
7477
7365
|
return Promise.race([
|
|
7478
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7366
|
+
fetch(fullUrl, fetchOptions).then(async (response) => {
|
|
7479
7367
|
if (response.status == 204) {
|
|
7480
|
-
return
|
|
7368
|
+
return {} as ApiInviteUserRes;
|
|
7481
7369
|
} else if (response.status >= 200 && response.status < 300) {
|
|
7482
|
-
|
|
7370
|
+
const buffer = await response.arrayBuffer();
|
|
7371
|
+
return tsproto.InviteUserRes.decode(new Uint8Array(buffer)) as unknown as ApiInviteUserRes;
|
|
7483
7372
|
} else {
|
|
7484
7373
|
throw response;
|
|
7485
7374
|
}
|
|
7486
7375
|
}),
|
|
7487
|
-
new Promise((_, reject) =>
|
|
7488
|
-
setTimeout(reject
|
|
7376
|
+
new Promise<never>((_, reject) =>
|
|
7377
|
+
setTimeout(() => reject(new Error("Request timed out.")), this.timeoutMs)
|
|
7489
7378
|
),
|
|
7490
7379
|
]);
|
|
7491
7380
|
}
|
|
7492
7381
|
|
|
7493
|
-
|
|
7494
7382
|
/** Add users to a channel. */
|
|
7495
|
-
|
|
7496
|
-
|
|
7383
|
+
getLinkInvite(
|
|
7384
|
+
basicAuthUsername: string,
|
|
7385
|
+
basicAuthPassword: string,
|
|
7497
7386
|
inviteId: string,
|
|
7498
7387
|
options: any = {}
|
|
7499
7388
|
): Promise<ApiInviteUserRes> {
|
|
@@ -7502,34 +7391,33 @@ export class MezonApi {
|
|
|
7502
7391
|
"'inviteId' is a required parameter but is null or undefined."
|
|
7503
7392
|
);
|
|
7504
7393
|
}
|
|
7505
|
-
const urlPath = "/
|
|
7394
|
+
const urlPath = "/v2/invite/{inviteId}".replace(
|
|
7395
|
+
"{inviteId}",
|
|
7396
|
+
encodeURIComponent(String(inviteId))
|
|
7397
|
+
);
|
|
7506
7398
|
const queryParams = new Map<string, any>();
|
|
7507
7399
|
|
|
7508
|
-
|
|
7509
|
-
tsproto.InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
7510
|
-
);
|
|
7511
|
-
const encodedBody = bodyWriter.finish();
|
|
7400
|
+
let bodyJson: string = "";
|
|
7512
7401
|
|
|
7513
7402
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
7514
|
-
const fetchOptions = buildFetchOptions("
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7403
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
7404
|
+
if (basicAuthUsername) {
|
|
7405
|
+
fetchOptions.headers["Authorization"] =
|
|
7406
|
+
"Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
|
7518
7407
|
}
|
|
7519
7408
|
|
|
7520
7409
|
return Promise.race([
|
|
7521
|
-
fetch(fullUrl, fetchOptions).then(
|
|
7410
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
7522
7411
|
if (response.status == 204) {
|
|
7523
|
-
return
|
|
7412
|
+
return response;
|
|
7524
7413
|
} else if (response.status >= 200 && response.status < 300) {
|
|
7525
|
-
|
|
7526
|
-
return tsproto.InviteUserRes.decode(new Uint8Array(buffer)) as unknown as ApiInviteUserRes;
|
|
7414
|
+
return response.json();
|
|
7527
7415
|
} else {
|
|
7528
7416
|
throw response;
|
|
7529
7417
|
}
|
|
7530
7418
|
}),
|
|
7531
|
-
new Promise
|
|
7532
|
-
setTimeout(
|
|
7419
|
+
new Promise((_, reject) =>
|
|
7420
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
7533
7421
|
),
|
|
7534
7422
|
]);
|
|
7535
7423
|
}
|
package/client.ts
CHANGED
|
@@ -70,7 +70,6 @@ import {
|
|
|
70
70
|
ApiWebhookListResponse,
|
|
71
71
|
MezonUpdateWebhookByIdBody,
|
|
72
72
|
ApiWebhookGenerateResponse,
|
|
73
|
-
ApiCheckDuplicateClanNameResponse,
|
|
74
73
|
ApiClanStickerAddRequest,
|
|
75
74
|
MezonUpdateClanStickerByIdBody,
|
|
76
75
|
MezonChangeChannelCategoryBody,
|
|
@@ -174,7 +173,7 @@ import {
|
|
|
174
173
|
|
|
175
174
|
import { Session } from "./session";
|
|
176
175
|
import { DefaultSocket, Socket } from "./socket";
|
|
177
|
-
import { decodeAttachments, decodeMentions, decodeReactions, decodeRefs, safeJSONParse } from "./utils";
|
|
176
|
+
import { decodeAttachments, decodeMentions, decodeNotificationFcm, decodeReactions, decodeRefs, safeJSONParse } from "./utils";
|
|
178
177
|
import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
|
|
179
178
|
|
|
180
179
|
const DEFAULT_HOST = "127.0.0.1";
|
|
@@ -1920,7 +1919,7 @@ export class Client {
|
|
|
1920
1919
|
result.notifications!.push({
|
|
1921
1920
|
id: n.id,
|
|
1922
1921
|
subject: n.subject,
|
|
1923
|
-
content: n.content ?
|
|
1922
|
+
content: n.content ? decodeNotificationFcm(n.content) : undefined,
|
|
1924
1923
|
code: n.code ? Number(n.code) : 0,
|
|
1925
1924
|
sender_id: n.sender_id,
|
|
1926
1925
|
create_time: n.create_time,
|
|
@@ -2736,26 +2735,6 @@ export class Client {
|
|
|
2736
2735
|
});
|
|
2737
2736
|
}
|
|
2738
2737
|
|
|
2739
|
-
//**check duplicate clan name */
|
|
2740
|
-
async checkDuplicateClanName(
|
|
2741
|
-
session: Session,
|
|
2742
|
-
clan_name: string
|
|
2743
|
-
): Promise<ApiCheckDuplicateClanNameResponse> {
|
|
2744
|
-
if (
|
|
2745
|
-
this.autoRefreshSession &&
|
|
2746
|
-
session.refresh_token &&
|
|
2747
|
-
session.isexpired(Date.now() / 1000)
|
|
2748
|
-
) {
|
|
2749
|
-
await this.sessionRefresh(session);
|
|
2750
|
-
}
|
|
2751
|
-
|
|
2752
|
-
return this.apiClient
|
|
2753
|
-
.checkDuplicateClanName(session.token, clan_name)
|
|
2754
|
-
.then((response: any) => {
|
|
2755
|
-
return Promise.resolve(response);
|
|
2756
|
-
});
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
2738
|
//**Add a new sticker */
|
|
2760
2739
|
async addClanSticker(session: Session, request: ApiClanStickerAddRequest) {
|
|
2761
2740
|
if (
|
|
@@ -3030,22 +3009,6 @@ export class Client {
|
|
|
3030
3009
|
});
|
|
3031
3010
|
}
|
|
3032
3011
|
|
|
3033
|
-
async deleteCategoryOrder(session: Session, clanId: string): Promise<any> {
|
|
3034
|
-
if (
|
|
3035
|
-
this.autoRefreshSession &&
|
|
3036
|
-
session.refresh_token &&
|
|
3037
|
-
session.isexpired(Date.now() / 1000)
|
|
3038
|
-
) {
|
|
3039
|
-
await this.sessionRefresh(session);
|
|
3040
|
-
}
|
|
3041
|
-
|
|
3042
|
-
return this.apiClient
|
|
3043
|
-
.deleteCategoryOrder(session.token, clanId)
|
|
3044
|
-
.then((response: any) => {
|
|
3045
|
-
return Promise.resolve(response);
|
|
3046
|
-
});
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
3012
|
async givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<any> {
|
|
3050
3013
|
if (
|
|
3051
3014
|
this.autoRefreshSession &&
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as tsproto from "./api/api";
|
|
1
2
|
import { ApiUpdateChannelDescRequest } from "./client";
|
|
2
3
|
/** A single user-role pair. */
|
|
3
4
|
export interface ChannelUserListChannelUser {
|
|
@@ -1134,7 +1135,7 @@ export interface ApiNotification {
|
|
|
1134
1135
|
channel_type?: number;
|
|
1135
1136
|
clan_id?: string;
|
|
1136
1137
|
code?: number;
|
|
1137
|
-
content?:
|
|
1138
|
+
content?: tsproto.DirectFcmProto;
|
|
1138
1139
|
create_time?: string;
|
|
1139
1140
|
id?: string;
|
|
1140
1141
|
persistent?: boolean;
|
|
@@ -1987,8 +1988,6 @@ export declare class MezonApi {
|
|
|
1987
1988
|
basePath: string;
|
|
1988
1989
|
constructor(serverKey: string, timeoutMs: number, basePath: string);
|
|
1989
1990
|
setBasePath(basePath: string): void;
|
|
1990
|
-
/** A healthcheck which load balancers can use to check the service. */
|
|
1991
|
-
healthcheck(bearerToken: string, options?: any): Promise<any>;
|
|
1992
1991
|
/** Delete the current user's account. */
|
|
1993
1992
|
deleteAccount(bearerToken: string, options?: any): Promise<any>;
|
|
1994
1993
|
/** Fetch the current user's account. */
|
|
@@ -2104,14 +2103,10 @@ export declare class MezonApi {
|
|
|
2104
2103
|
banClanUsers(bearerToken: string, clanId: string, channelId?: string, userIds?: Array<string>, banTime?: number, options?: any): Promise<any>;
|
|
2105
2104
|
/** List all users that are part of a clan. */
|
|
2106
2105
|
listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
|
|
2107
|
-
/** check duplicate clan name */
|
|
2108
|
-
checkDuplicateClanName(bearerToken: string, clanName: string, options?: any): Promise<ApiCheckDuplicateClanNameResponse>;
|
|
2109
2106
|
/** */
|
|
2110
2107
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
|
2111
2108
|
/** */
|
|
2112
2109
|
deleteCategoryDesc(bearerToken: string, categoryId: string, clanId: string, categoryLabel?: string, options?: any): Promise<any>;
|
|
2113
|
-
/** */
|
|
2114
|
-
deleteCategoryOrder(bearerToken: string, clanId: string, options?: any): Promise<any>;
|
|
2115
2110
|
/** regist fcm device token */
|
|
2116
2111
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, voipToken?: string, options?: any): Promise<ApiRegistFcmDeviceTokenResponse>;
|
|
2117
2112
|
/** close direct message. */
|
|
@@ -2171,9 +2166,9 @@ export declare class MezonApi {
|
|
|
2171
2166
|
/** Add users to a channel. */
|
|
2172
2167
|
createLinkInviteUser(bearerToken: string, body: ApiLinkInviteUserRequest, options?: any): Promise<ApiLinkInviteUser>;
|
|
2173
2168
|
/** Add users to a channel. */
|
|
2174
|
-
getLinkInvite(basicAuthUsername: string, basicAuthPassword: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
|
|
2175
|
-
/** Add users to a channel. */
|
|
2176
2169
|
inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
|
|
2170
|
+
/** Add users to a channel. */
|
|
2171
|
+
getLinkInvite(basicAuthUsername: string, basicAuthPassword: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
|
|
2177
2172
|
/** List HashtagDMList */
|
|
2178
2173
|
listChannelByUserId(bearerToken: string, options?: any): Promise<ApiChannelDescList>;
|
|
2179
2174
|
/** Mark as read */
|
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, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse,
|
|
16
|
+
import { ApiAccount, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiForSaleItemList, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest, ApiBannedUserList, ApiIsBannedResponse, ApiLogedDeviceList, ChannelMessage } from "./api.gen";
|
|
17
17
|
import { Session } from "./session";
|
|
18
18
|
import { Socket } from "./socket";
|
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
@@ -379,7 +379,6 @@ export declare class Client {
|
|
|
379
379
|
listWebhookByChannelId(session: Session, channel_id: string, clan_id: string): Promise<ApiWebhookListResponse>;
|
|
380
380
|
updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
|
|
381
381
|
deleteWebhookById(session: Session, id: string, request: MezonDeleteWebhookByIdBody): Promise<boolean>;
|
|
382
|
-
checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
|
|
383
382
|
addClanSticker(session: Session, request: ApiClanStickerAddRequest): Promise<boolean>;
|
|
384
383
|
deleteClanStickerById(session: Session, id: string, clan_id: string, stickerLabel?: string): Promise<boolean>;
|
|
385
384
|
updateClanStickerById(session: Session, id: string, request: MezonUpdateClanStickerByIdBody): Promise<boolean>;
|
|
@@ -396,7 +395,6 @@ export declare class Client {
|
|
|
396
395
|
updateSystemMessage(session: Session, clanId: string, request: MezonUpdateSystemMessageBody): Promise<any>;
|
|
397
396
|
deleteSystemMessage(session: Session, clanId: string): Promise<any>;
|
|
398
397
|
updateCategoryOrder(session: Session, request: ApiUpdateCategoryOrderRequest): Promise<any>;
|
|
399
|
-
deleteCategoryOrder(session: Session, clanId: string): Promise<any>;
|
|
400
398
|
givecoffee(session: Session, request: ApiGiveCoffeeEvent): Promise<any>;
|
|
401
399
|
sendToken(session: Session, request: ApiTokenSentEvent): Promise<any>;
|
|
402
400
|
/** List a channel's users. */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -31651,31 +31651,6 @@ var MezonApi = class {
|
|
|
31651
31651
|
setBasePath(basePath) {
|
|
31652
31652
|
this.basePath = basePath;
|
|
31653
31653
|
}
|
|
31654
|
-
/** A healthcheck which load balancers can use to check the service. */
|
|
31655
|
-
healthcheck(bearerToken, options = {}) {
|
|
31656
|
-
const urlPath = "/healthcheck";
|
|
31657
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
31658
|
-
let bodyJson = "";
|
|
31659
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
31660
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
31661
|
-
if (bearerToken) {
|
|
31662
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
31663
|
-
}
|
|
31664
|
-
return Promise.race([
|
|
31665
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
31666
|
-
if (response.status == 204) {
|
|
31667
|
-
return response;
|
|
31668
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
31669
|
-
return response.json();
|
|
31670
|
-
} else {
|
|
31671
|
-
throw response;
|
|
31672
|
-
}
|
|
31673
|
-
}),
|
|
31674
|
-
new Promise(
|
|
31675
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
31676
|
-
)
|
|
31677
|
-
]);
|
|
31678
|
-
}
|
|
31679
31654
|
/** Delete the current user's account. */
|
|
31680
31655
|
deleteAccount(bearerToken, options = {}) {
|
|
31681
31656
|
const urlPath = "/mezon.api.Mezon/DeleteAccount";
|
|
@@ -33716,39 +33691,6 @@ var MezonApi = class {
|
|
|
33716
33691
|
)
|
|
33717
33692
|
]);
|
|
33718
33693
|
}
|
|
33719
|
-
/** check duplicate clan name */
|
|
33720
|
-
checkDuplicateClanName(bearerToken, clanName, options = {}) {
|
|
33721
|
-
if (clanName === null || clanName === void 0) {
|
|
33722
|
-
throw new Error(
|
|
33723
|
-
"'clanName' is a required parameter but is null or undefined."
|
|
33724
|
-
);
|
|
33725
|
-
}
|
|
33726
|
-
const urlPath = "/v2/clandesc/{clanName}".replace(
|
|
33727
|
-
"{clanName}",
|
|
33728
|
-
encodeURIComponent(String(clanName))
|
|
33729
|
-
);
|
|
33730
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
33731
|
-
let bodyJson = "";
|
|
33732
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
33733
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
33734
|
-
if (bearerToken) {
|
|
33735
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
33736
|
-
}
|
|
33737
|
-
return Promise.race([
|
|
33738
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
33739
|
-
if (response.status == 204) {
|
|
33740
|
-
return response;
|
|
33741
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
33742
|
-
return response.json();
|
|
33743
|
-
} else {
|
|
33744
|
-
throw response;
|
|
33745
|
-
}
|
|
33746
|
-
}),
|
|
33747
|
-
new Promise(
|
|
33748
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
33749
|
-
)
|
|
33750
|
-
]);
|
|
33751
|
-
}
|
|
33752
33694
|
/** */
|
|
33753
33695
|
createCategoryDesc(bearerToken, body, options = {}) {
|
|
33754
33696
|
if (body === null || body === void 0) {
|
|
@@ -33828,39 +33770,6 @@ var MezonApi = class {
|
|
|
33828
33770
|
)
|
|
33829
33771
|
]);
|
|
33830
33772
|
}
|
|
33831
|
-
/** */
|
|
33832
|
-
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
|
33833
|
-
if (clanId === null || clanId === void 0) {
|
|
33834
|
-
throw new Error(
|
|
33835
|
-
"'clanId' is a required parameter but is null or undefined."
|
|
33836
|
-
);
|
|
33837
|
-
}
|
|
33838
|
-
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace(
|
|
33839
|
-
"{clanId}",
|
|
33840
|
-
encodeURIComponent(String(clanId))
|
|
33841
|
-
);
|
|
33842
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
33843
|
-
let bodyJson = "";
|
|
33844
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
33845
|
-
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
33846
|
-
if (bearerToken) {
|
|
33847
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
33848
|
-
}
|
|
33849
|
-
return Promise.race([
|
|
33850
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
33851
|
-
if (response.status == 204) {
|
|
33852
|
-
return response;
|
|
33853
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
33854
|
-
return response.json();
|
|
33855
|
-
} else {
|
|
33856
|
-
throw response;
|
|
33857
|
-
}
|
|
33858
|
-
}),
|
|
33859
|
-
new Promise(
|
|
33860
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
33861
|
-
)
|
|
33862
|
-
]);
|
|
33863
|
-
}
|
|
33864
33773
|
/** regist fcm device token */
|
|
33865
33774
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, voipToken, options = {}) {
|
|
33866
33775
|
const urlPath = "/mezon.api.Mezon/RegistFCMDeviceToken";
|
|
@@ -34082,7 +33991,7 @@ var MezonApi = class {
|
|
|
34082
33991
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34083
33992
|
let bodyJson = "";
|
|
34084
33993
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34085
|
-
const fetchOptions = buildFetchOptions("
|
|
33994
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
34086
33995
|
if (bearerToken) {
|
|
34087
33996
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34088
33997
|
}
|
|
@@ -34104,11 +34013,11 @@ var MezonApi = class {
|
|
|
34104
34013
|
}
|
|
34105
34014
|
/** get list emoji by user id */
|
|
34106
34015
|
getListEmojisByUserId(bearerToken, options = {}) {
|
|
34107
|
-
const urlPath = "/
|
|
34016
|
+
const urlPath = "/mezon.api.Mezon/GetListEmojisByUserId";
|
|
34108
34017
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34109
34018
|
let bodyJson = "";
|
|
34110
34019
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34111
|
-
const fetchOptions = buildFetchOptions("
|
|
34020
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
34112
34021
|
if (bearerToken) {
|
|
34113
34022
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34114
34023
|
}
|
|
@@ -34806,70 +34715,70 @@ var MezonApi = class {
|
|
|
34806
34715
|
]);
|
|
34807
34716
|
}
|
|
34808
34717
|
/** Add users to a channel. */
|
|
34809
|
-
|
|
34718
|
+
inviteUser(bearerToken, inviteId, options = {}) {
|
|
34810
34719
|
if (inviteId === null || inviteId === void 0) {
|
|
34811
34720
|
throw new Error(
|
|
34812
34721
|
"'inviteId' is a required parameter but is null or undefined."
|
|
34813
34722
|
);
|
|
34814
34723
|
}
|
|
34815
|
-
const urlPath = "/
|
|
34816
|
-
"{inviteId}",
|
|
34817
|
-
encodeURIComponent(String(inviteId))
|
|
34818
|
-
);
|
|
34724
|
+
const urlPath = "/mezon.api.Mezon/InviteUser";
|
|
34819
34725
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34820
|
-
|
|
34726
|
+
const bodyWriter = InviteUserRequest.encode(
|
|
34727
|
+
InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
34728
|
+
);
|
|
34729
|
+
const encodedBody = bodyWriter.finish();
|
|
34821
34730
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34822
|
-
const fetchOptions = buildFetchOptions("
|
|
34823
|
-
|
|
34824
|
-
|
|
34731
|
+
const fetchOptions = buildFetchOptions("POST", options, "");
|
|
34732
|
+
fetchOptions.body = encodedBody;
|
|
34733
|
+
if (bearerToken) {
|
|
34734
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34825
34735
|
}
|
|
34826
34736
|
return Promise.race([
|
|
34827
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
34737
|
+
fetch(fullUrl, fetchOptions).then((response) => __async(this, null, function* () {
|
|
34828
34738
|
if (response.status == 204) {
|
|
34829
|
-
return
|
|
34739
|
+
return {};
|
|
34830
34740
|
} else if (response.status >= 200 && response.status < 300) {
|
|
34831
|
-
|
|
34741
|
+
const buffer = yield response.arrayBuffer();
|
|
34742
|
+
return InviteUserRes.decode(new Uint8Array(buffer));
|
|
34832
34743
|
} else {
|
|
34833
34744
|
throw response;
|
|
34834
34745
|
}
|
|
34835
|
-
}),
|
|
34746
|
+
})),
|
|
34836
34747
|
new Promise(
|
|
34837
|
-
(_, reject) => setTimeout(reject
|
|
34748
|
+
(_, reject) => setTimeout(() => reject(new Error("Request timed out.")), this.timeoutMs)
|
|
34838
34749
|
)
|
|
34839
34750
|
]);
|
|
34840
34751
|
}
|
|
34841
34752
|
/** Add users to a channel. */
|
|
34842
|
-
|
|
34753
|
+
getLinkInvite(basicAuthUsername, basicAuthPassword, inviteId, options = {}) {
|
|
34843
34754
|
if (inviteId === null || inviteId === void 0) {
|
|
34844
34755
|
throw new Error(
|
|
34845
34756
|
"'inviteId' is a required parameter but is null or undefined."
|
|
34846
34757
|
);
|
|
34847
34758
|
}
|
|
34848
|
-
const urlPath = "/
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
34759
|
+
const urlPath = "/v2/invite/{inviteId}".replace(
|
|
34760
|
+
"{inviteId}",
|
|
34761
|
+
encodeURIComponent(String(inviteId))
|
|
34852
34762
|
);
|
|
34853
|
-
const
|
|
34763
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
34764
|
+
let bodyJson = "";
|
|
34854
34765
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34855
|
-
const fetchOptions = buildFetchOptions("
|
|
34856
|
-
|
|
34857
|
-
|
|
34858
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34766
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
34767
|
+
if (basicAuthUsername) {
|
|
34768
|
+
fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
|
34859
34769
|
}
|
|
34860
34770
|
return Promise.race([
|
|
34861
|
-
fetch(fullUrl, fetchOptions).then((response) =>
|
|
34771
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
34862
34772
|
if (response.status == 204) {
|
|
34863
|
-
return
|
|
34773
|
+
return response;
|
|
34864
34774
|
} else if (response.status >= 200 && response.status < 300) {
|
|
34865
|
-
|
|
34866
|
-
return InviteUserRes.decode(new Uint8Array(buffer));
|
|
34775
|
+
return response.json();
|
|
34867
34776
|
} else {
|
|
34868
34777
|
throw response;
|
|
34869
34778
|
}
|
|
34870
|
-
})
|
|
34779
|
+
}),
|
|
34871
34780
|
new Promise(
|
|
34872
|
-
(_, reject) => setTimeout(
|
|
34781
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
34873
34782
|
)
|
|
34874
34783
|
]);
|
|
34875
34784
|
}
|
|
@@ -38768,7 +38677,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
38768
38677
|
if (!message.cid) {
|
|
38769
38678
|
if (message.notifications) {
|
|
38770
38679
|
message.notifications.notifications.forEach((n) => {
|
|
38771
|
-
n.content = n.content ?
|
|
38680
|
+
n.content = n.content ? decodeNotificationFcm(n.content) : void 0;
|
|
38772
38681
|
this.onnotification(n);
|
|
38773
38682
|
});
|
|
38774
38683
|
} else if (message.voice_started_event) {
|
|
@@ -40859,7 +40768,7 @@ var Client = class {
|
|
|
40859
40768
|
result.notifications.push({
|
|
40860
40769
|
id: n.id,
|
|
40861
40770
|
subject: n.subject,
|
|
40862
|
-
content: n.content ?
|
|
40771
|
+
content: n.content ? decodeNotificationFcm(n.content) : void 0,
|
|
40863
40772
|
code: n.code ? Number(n.code) : 0,
|
|
40864
40773
|
sender_id: n.sender_id,
|
|
40865
40774
|
create_time: n.create_time,
|
|
@@ -41320,17 +41229,6 @@ var Client = class {
|
|
|
41320
41229
|
});
|
|
41321
41230
|
});
|
|
41322
41231
|
}
|
|
41323
|
-
//**check duplicate clan name */
|
|
41324
|
-
checkDuplicateClanName(session, clan_name) {
|
|
41325
|
-
return __async(this, null, function* () {
|
|
41326
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
41327
|
-
yield this.sessionRefresh(session);
|
|
41328
|
-
}
|
|
41329
|
-
return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
|
|
41330
|
-
return Promise.resolve(response);
|
|
41331
|
-
});
|
|
41332
|
-
});
|
|
41333
|
-
}
|
|
41334
41232
|
//**Add a new sticker */
|
|
41335
41233
|
addClanSticker(session, request) {
|
|
41336
41234
|
return __async(this, null, function* () {
|
|
@@ -41486,16 +41384,6 @@ var Client = class {
|
|
|
41486
41384
|
});
|
|
41487
41385
|
});
|
|
41488
41386
|
}
|
|
41489
|
-
deleteCategoryOrder(session, clanId) {
|
|
41490
|
-
return __async(this, null, function* () {
|
|
41491
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
41492
|
-
yield this.sessionRefresh(session);
|
|
41493
|
-
}
|
|
41494
|
-
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
|
41495
|
-
return Promise.resolve(response);
|
|
41496
|
-
});
|
|
41497
|
-
});
|
|
41498
|
-
}
|
|
41499
41387
|
givecoffee(session, request) {
|
|
41500
41388
|
return __async(this, null, function* () {
|
|
41501
41389
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -31621,31 +31621,6 @@ var MezonApi = class {
|
|
|
31621
31621
|
setBasePath(basePath) {
|
|
31622
31622
|
this.basePath = basePath;
|
|
31623
31623
|
}
|
|
31624
|
-
/** A healthcheck which load balancers can use to check the service. */
|
|
31625
|
-
healthcheck(bearerToken, options = {}) {
|
|
31626
|
-
const urlPath = "/healthcheck";
|
|
31627
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
31628
|
-
let bodyJson = "";
|
|
31629
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
31630
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
31631
|
-
if (bearerToken) {
|
|
31632
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
31633
|
-
}
|
|
31634
|
-
return Promise.race([
|
|
31635
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
31636
|
-
if (response.status == 204) {
|
|
31637
|
-
return response;
|
|
31638
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
31639
|
-
return response.json();
|
|
31640
|
-
} else {
|
|
31641
|
-
throw response;
|
|
31642
|
-
}
|
|
31643
|
-
}),
|
|
31644
|
-
new Promise(
|
|
31645
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
31646
|
-
)
|
|
31647
|
-
]);
|
|
31648
|
-
}
|
|
31649
31624
|
/** Delete the current user's account. */
|
|
31650
31625
|
deleteAccount(bearerToken, options = {}) {
|
|
31651
31626
|
const urlPath = "/mezon.api.Mezon/DeleteAccount";
|
|
@@ -33686,39 +33661,6 @@ var MezonApi = class {
|
|
|
33686
33661
|
)
|
|
33687
33662
|
]);
|
|
33688
33663
|
}
|
|
33689
|
-
/** check duplicate clan name */
|
|
33690
|
-
checkDuplicateClanName(bearerToken, clanName, options = {}) {
|
|
33691
|
-
if (clanName === null || clanName === void 0) {
|
|
33692
|
-
throw new Error(
|
|
33693
|
-
"'clanName' is a required parameter but is null or undefined."
|
|
33694
|
-
);
|
|
33695
|
-
}
|
|
33696
|
-
const urlPath = "/v2/clandesc/{clanName}".replace(
|
|
33697
|
-
"{clanName}",
|
|
33698
|
-
encodeURIComponent(String(clanName))
|
|
33699
|
-
);
|
|
33700
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
33701
|
-
let bodyJson = "";
|
|
33702
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
33703
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
33704
|
-
if (bearerToken) {
|
|
33705
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
33706
|
-
}
|
|
33707
|
-
return Promise.race([
|
|
33708
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
33709
|
-
if (response.status == 204) {
|
|
33710
|
-
return response;
|
|
33711
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
33712
|
-
return response.json();
|
|
33713
|
-
} else {
|
|
33714
|
-
throw response;
|
|
33715
|
-
}
|
|
33716
|
-
}),
|
|
33717
|
-
new Promise(
|
|
33718
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
33719
|
-
)
|
|
33720
|
-
]);
|
|
33721
|
-
}
|
|
33722
33664
|
/** */
|
|
33723
33665
|
createCategoryDesc(bearerToken, body, options = {}) {
|
|
33724
33666
|
if (body === null || body === void 0) {
|
|
@@ -33798,39 +33740,6 @@ var MezonApi = class {
|
|
|
33798
33740
|
)
|
|
33799
33741
|
]);
|
|
33800
33742
|
}
|
|
33801
|
-
/** */
|
|
33802
|
-
deleteCategoryOrder(bearerToken, clanId, options = {}) {
|
|
33803
|
-
if (clanId === null || clanId === void 0) {
|
|
33804
|
-
throw new Error(
|
|
33805
|
-
"'clanId' is a required parameter but is null or undefined."
|
|
33806
|
-
);
|
|
33807
|
-
}
|
|
33808
|
-
const urlPath = "/v2/deletecategoryorder/clan_id/{clanId}".replace(
|
|
33809
|
-
"{clanId}",
|
|
33810
|
-
encodeURIComponent(String(clanId))
|
|
33811
|
-
);
|
|
33812
|
-
const queryParams = /* @__PURE__ */ new Map();
|
|
33813
|
-
let bodyJson = "";
|
|
33814
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
33815
|
-
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
|
33816
|
-
if (bearerToken) {
|
|
33817
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
33818
|
-
}
|
|
33819
|
-
return Promise.race([
|
|
33820
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
33821
|
-
if (response.status == 204) {
|
|
33822
|
-
return response;
|
|
33823
|
-
} else if (response.status >= 200 && response.status < 300) {
|
|
33824
|
-
return response.json();
|
|
33825
|
-
} else {
|
|
33826
|
-
throw response;
|
|
33827
|
-
}
|
|
33828
|
-
}),
|
|
33829
|
-
new Promise(
|
|
33830
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
33831
|
-
)
|
|
33832
|
-
]);
|
|
33833
|
-
}
|
|
33834
33743
|
/** regist fcm device token */
|
|
33835
33744
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, voipToken, options = {}) {
|
|
33836
33745
|
const urlPath = "/mezon.api.Mezon/RegistFCMDeviceToken";
|
|
@@ -34052,7 +33961,7 @@ var MezonApi = class {
|
|
|
34052
33961
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34053
33962
|
let bodyJson = "";
|
|
34054
33963
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34055
|
-
const fetchOptions = buildFetchOptions("
|
|
33964
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
34056
33965
|
if (bearerToken) {
|
|
34057
33966
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34058
33967
|
}
|
|
@@ -34074,11 +33983,11 @@ var MezonApi = class {
|
|
|
34074
33983
|
}
|
|
34075
33984
|
/** get list emoji by user id */
|
|
34076
33985
|
getListEmojisByUserId(bearerToken, options = {}) {
|
|
34077
|
-
const urlPath = "/
|
|
33986
|
+
const urlPath = "/mezon.api.Mezon/GetListEmojisByUserId";
|
|
34078
33987
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34079
33988
|
let bodyJson = "";
|
|
34080
33989
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34081
|
-
const fetchOptions = buildFetchOptions("
|
|
33990
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
|
34082
33991
|
if (bearerToken) {
|
|
34083
33992
|
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34084
33993
|
}
|
|
@@ -34776,70 +34685,70 @@ var MezonApi = class {
|
|
|
34776
34685
|
]);
|
|
34777
34686
|
}
|
|
34778
34687
|
/** Add users to a channel. */
|
|
34779
|
-
|
|
34688
|
+
inviteUser(bearerToken, inviteId, options = {}) {
|
|
34780
34689
|
if (inviteId === null || inviteId === void 0) {
|
|
34781
34690
|
throw new Error(
|
|
34782
34691
|
"'inviteId' is a required parameter but is null or undefined."
|
|
34783
34692
|
);
|
|
34784
34693
|
}
|
|
34785
|
-
const urlPath = "/
|
|
34786
|
-
"{inviteId}",
|
|
34787
|
-
encodeURIComponent(String(inviteId))
|
|
34788
|
-
);
|
|
34694
|
+
const urlPath = "/mezon.api.Mezon/InviteUser";
|
|
34789
34695
|
const queryParams = /* @__PURE__ */ new Map();
|
|
34790
|
-
|
|
34696
|
+
const bodyWriter = InviteUserRequest.encode(
|
|
34697
|
+
InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
34698
|
+
);
|
|
34699
|
+
const encodedBody = bodyWriter.finish();
|
|
34791
34700
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34792
|
-
const fetchOptions = buildFetchOptions("
|
|
34793
|
-
|
|
34794
|
-
|
|
34701
|
+
const fetchOptions = buildFetchOptions("POST", options, "");
|
|
34702
|
+
fetchOptions.body = encodedBody;
|
|
34703
|
+
if (bearerToken) {
|
|
34704
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34795
34705
|
}
|
|
34796
34706
|
return Promise.race([
|
|
34797
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
|
34707
|
+
fetch(fullUrl, fetchOptions).then((response) => __async(this, null, function* () {
|
|
34798
34708
|
if (response.status == 204) {
|
|
34799
|
-
return
|
|
34709
|
+
return {};
|
|
34800
34710
|
} else if (response.status >= 200 && response.status < 300) {
|
|
34801
|
-
|
|
34711
|
+
const buffer = yield response.arrayBuffer();
|
|
34712
|
+
return InviteUserRes.decode(new Uint8Array(buffer));
|
|
34802
34713
|
} else {
|
|
34803
34714
|
throw response;
|
|
34804
34715
|
}
|
|
34805
|
-
}),
|
|
34716
|
+
})),
|
|
34806
34717
|
new Promise(
|
|
34807
|
-
(_, reject) => setTimeout(reject
|
|
34718
|
+
(_, reject) => setTimeout(() => reject(new Error("Request timed out.")), this.timeoutMs)
|
|
34808
34719
|
)
|
|
34809
34720
|
]);
|
|
34810
34721
|
}
|
|
34811
34722
|
/** Add users to a channel. */
|
|
34812
|
-
|
|
34723
|
+
getLinkInvite(basicAuthUsername, basicAuthPassword, inviteId, options = {}) {
|
|
34813
34724
|
if (inviteId === null || inviteId === void 0) {
|
|
34814
34725
|
throw new Error(
|
|
34815
34726
|
"'inviteId' is a required parameter but is null or undefined."
|
|
34816
34727
|
);
|
|
34817
34728
|
}
|
|
34818
|
-
const urlPath = "/
|
|
34819
|
-
|
|
34820
|
-
|
|
34821
|
-
InviteUserRequest.fromPartial({ invite_id: inviteId })
|
|
34729
|
+
const urlPath = "/v2/invite/{inviteId}".replace(
|
|
34730
|
+
"{inviteId}",
|
|
34731
|
+
encodeURIComponent(String(inviteId))
|
|
34822
34732
|
);
|
|
34823
|
-
const
|
|
34733
|
+
const queryParams = /* @__PURE__ */ new Map();
|
|
34734
|
+
let bodyJson = "";
|
|
34824
34735
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
|
34825
|
-
const fetchOptions = buildFetchOptions("
|
|
34826
|
-
|
|
34827
|
-
|
|
34828
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
|
34736
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
|
34737
|
+
if (basicAuthUsername) {
|
|
34738
|
+
fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
|
|
34829
34739
|
}
|
|
34830
34740
|
return Promise.race([
|
|
34831
|
-
fetch(fullUrl, fetchOptions).then((response) =>
|
|
34741
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
|
34832
34742
|
if (response.status == 204) {
|
|
34833
|
-
return
|
|
34743
|
+
return response;
|
|
34834
34744
|
} else if (response.status >= 200 && response.status < 300) {
|
|
34835
|
-
|
|
34836
|
-
return InviteUserRes.decode(new Uint8Array(buffer));
|
|
34745
|
+
return response.json();
|
|
34837
34746
|
} else {
|
|
34838
34747
|
throw response;
|
|
34839
34748
|
}
|
|
34840
|
-
})
|
|
34749
|
+
}),
|
|
34841
34750
|
new Promise(
|
|
34842
|
-
(_, reject) => setTimeout(
|
|
34751
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
|
34843
34752
|
)
|
|
34844
34753
|
]);
|
|
34845
34754
|
}
|
|
@@ -38738,7 +38647,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
38738
38647
|
if (!message.cid) {
|
|
38739
38648
|
if (message.notifications) {
|
|
38740
38649
|
message.notifications.notifications.forEach((n) => {
|
|
38741
|
-
n.content = n.content ?
|
|
38650
|
+
n.content = n.content ? decodeNotificationFcm(n.content) : void 0;
|
|
38742
38651
|
this.onnotification(n);
|
|
38743
38652
|
});
|
|
38744
38653
|
} else if (message.voice_started_event) {
|
|
@@ -40829,7 +40738,7 @@ var Client = class {
|
|
|
40829
40738
|
result.notifications.push({
|
|
40830
40739
|
id: n.id,
|
|
40831
40740
|
subject: n.subject,
|
|
40832
|
-
content: n.content ?
|
|
40741
|
+
content: n.content ? decodeNotificationFcm(n.content) : void 0,
|
|
40833
40742
|
code: n.code ? Number(n.code) : 0,
|
|
40834
40743
|
sender_id: n.sender_id,
|
|
40835
40744
|
create_time: n.create_time,
|
|
@@ -41290,17 +41199,6 @@ var Client = class {
|
|
|
41290
41199
|
});
|
|
41291
41200
|
});
|
|
41292
41201
|
}
|
|
41293
|
-
//**check duplicate clan name */
|
|
41294
|
-
checkDuplicateClanName(session, clan_name) {
|
|
41295
|
-
return __async(this, null, function* () {
|
|
41296
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
41297
|
-
yield this.sessionRefresh(session);
|
|
41298
|
-
}
|
|
41299
|
-
return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
|
|
41300
|
-
return Promise.resolve(response);
|
|
41301
|
-
});
|
|
41302
|
-
});
|
|
41303
|
-
}
|
|
41304
41202
|
//**Add a new sticker */
|
|
41305
41203
|
addClanSticker(session, request) {
|
|
41306
41204
|
return __async(this, null, function* () {
|
|
@@ -41456,16 +41354,6 @@ var Client = class {
|
|
|
41456
41354
|
});
|
|
41457
41355
|
});
|
|
41458
41356
|
}
|
|
41459
|
-
deleteCategoryOrder(session, clanId) {
|
|
41460
|
-
return __async(this, null, function* () {
|
|
41461
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
|
41462
|
-
yield this.sessionRefresh(session);
|
|
41463
|
-
}
|
|
41464
|
-
return this.apiClient.deleteCategoryOrder(session.token, clanId).then((response) => {
|
|
41465
|
-
return Promise.resolve(response);
|
|
41466
|
-
});
|
|
41467
|
-
});
|
|
41468
|
-
}
|
|
41469
41357
|
givecoffee(session, request) {
|
|
41470
41358
|
return __async(this, null, function* () {
|
|
41471
41359
|
if (this.autoRefreshSession && session.refresh_token && session.isexpired(Date.now() / 1e3)) {
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
} from "./api.gen";
|
|
66
66
|
import { Session } from "./session";
|
|
67
67
|
import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
|
|
68
|
-
import { safeJSONParse } from "./utils";
|
|
68
|
+
import { decodeNotificationFcm, safeJSONParse } from "./utils";
|
|
69
69
|
|
|
70
70
|
/** Stores function references for resolve/reject with a DOM Promise. */
|
|
71
71
|
interface PromiseExecutor {
|
|
@@ -1952,7 +1952,7 @@ export class DefaultSocket implements Socket {
|
|
|
1952
1952
|
if (!message.cid) {
|
|
1953
1953
|
if (message.notifications) {
|
|
1954
1954
|
message.notifications.notifications.forEach((n: ApiNotification) => {
|
|
1955
|
-
n.content = n.content ?
|
|
1955
|
+
n.content = n.content ? decodeNotificationFcm(n.content) : undefined;
|
|
1956
1956
|
this.onnotification(n);
|
|
1957
1957
|
});
|
|
1958
1958
|
} else if (message.voice_started_event) {
|