mezon-js 2.7.45 → 2.7.47
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +44 -0
- package/client.ts +13 -0
- package/dist/api.gen.d.ts +7 -0
- package/dist/client.d.ts +2 -1
- package/dist/mezon-js.cjs.js +50 -0
- package/dist/mezon-js.esm.mjs +50 -0
- package/dist/socket.d.ts +8 -0
- package/package.json +1 -1
- package/socket.ts +20 -0
package/api.gen.ts
CHANGED
@@ -210,6 +210,8 @@ export interface ApiChannelDescList {
|
|
210
210
|
|
211
211
|
/** */
|
212
212
|
export interface ApiChannelDescription {
|
213
|
+
//
|
214
|
+
active?: number;
|
213
215
|
//
|
214
216
|
category_id?: string;
|
215
217
|
//
|
@@ -488,6 +490,12 @@ export interface ApiCreateWebhookRequest {
|
|
488
490
|
hook_name?: string;
|
489
491
|
}
|
490
492
|
|
493
|
+
/** Delete a channel the user has access to. */
|
494
|
+
export interface ApiDeleteChannelDescRequest {
|
495
|
+
//The id of a channel.
|
496
|
+
channel_id?: string;
|
497
|
+
}
|
498
|
+
|
491
499
|
/** */
|
492
500
|
export interface ApiDeleteEventRequest {
|
493
501
|
//The id of a event.
|
@@ -3365,6 +3373,42 @@ export class MezonApi {
|
|
3365
3373
|
]);
|
3366
3374
|
}
|
3367
3375
|
|
3376
|
+
/** close direct message. */
|
3377
|
+
closeDirectMess(bearerToken: string,
|
3378
|
+
body:ApiDeleteChannelDescRequest,
|
3379
|
+
options: any = {}): Promise<any> {
|
3380
|
+
|
3381
|
+
if (body === null || body === undefined) {
|
3382
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3383
|
+
}
|
3384
|
+
const urlPath = "/v2/direct/close";
|
3385
|
+
const queryParams = new Map<string, any>();
|
3386
|
+
|
3387
|
+
let bodyJson : string = "";
|
3388
|
+
bodyJson = JSON.stringify(body || {});
|
3389
|
+
|
3390
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3391
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
3392
|
+
if (bearerToken) {
|
3393
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3394
|
+
}
|
3395
|
+
|
3396
|
+
return Promise.race([
|
3397
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3398
|
+
if (response.status == 204) {
|
3399
|
+
return response;
|
3400
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3401
|
+
return response.json();
|
3402
|
+
} else {
|
3403
|
+
throw response;
|
3404
|
+
}
|
3405
|
+
}),
|
3406
|
+
new Promise((_, reject) =>
|
3407
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3408
|
+
),
|
3409
|
+
]);
|
3410
|
+
}
|
3411
|
+
|
3368
3412
|
/** Search message from elasticsearch service. */
|
3369
3413
|
searchMessage(bearerToken: string,
|
3370
3414
|
body:ApiSearchMessageRequest,
|
package/client.ts
CHANGED
@@ -92,6 +92,7 @@ import {
|
|
92
92
|
ApiPinMessagesList,
|
93
93
|
ApiCreateWebhookRequest,
|
94
94
|
ApiWebhookResponse,
|
95
|
+
ApiDeleteChannelDescRequest,
|
95
96
|
} from "./api.gen";
|
96
97
|
|
97
98
|
import { Session } from "./session";
|
@@ -1407,6 +1408,18 @@ export class Client {
|
|
1407
1408
|
});
|
1408
1409
|
}
|
1409
1410
|
|
1411
|
+
//
|
1412
|
+
async closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean> {
|
1413
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
1414
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
1415
|
+
await this.sessionRefresh(session);
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
return this.apiClient.closeDirectMess(session.token, request).then((response: any) => {
|
1419
|
+
return response !== undefined;
|
1420
|
+
});
|
1421
|
+
}
|
1422
|
+
|
1410
1423
|
/** Add a custom ID to the social profiles on the current user's account. */
|
1411
1424
|
async linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean> {
|
1412
1425
|
if (this.autoRefreshSession && session.refresh_token &&
|
package/dist/api.gen.d.ts
CHANGED
@@ -122,6 +122,7 @@ export interface ApiChannelDescList {
|
|
122
122
|
}
|
123
123
|
/** */
|
124
124
|
export interface ApiChannelDescription {
|
125
|
+
active?: number;
|
125
126
|
category_id?: string;
|
126
127
|
category_name?: string;
|
127
128
|
channel_avatar?: Array<string>;
|
@@ -277,6 +278,10 @@ export interface ApiCreateWebhookRequest {
|
|
277
278
|
clan_id?: string;
|
278
279
|
hook_name?: string;
|
279
280
|
}
|
281
|
+
/** Delete a channel the user has access to. */
|
282
|
+
export interface ApiDeleteChannelDescRequest {
|
283
|
+
channel_id?: string;
|
284
|
+
}
|
280
285
|
/** */
|
281
286
|
export interface ApiDeleteEventRequest {
|
282
287
|
event_id?: string;
|
@@ -853,6 +858,8 @@ export declare class MezonApi {
|
|
853
858
|
deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
|
854
859
|
/** regist fcm device token */
|
855
860
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
861
|
+
/** close direct message. */
|
862
|
+
closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
856
863
|
/** Search message from elasticsearch service. */
|
857
864
|
searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
|
858
865
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -470,6 +470,7 @@ export declare class Client {
|
|
470
470
|
getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
|
471
471
|
/** Add an Apple ID to the social profiles on the current user's account. */
|
472
472
|
linkApple(session: Session, request: ApiAccountApple): Promise<boolean>;
|
473
|
+
closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
|
473
474
|
/** Add a custom ID to the social profiles on the current user's account. */
|
474
475
|
linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean>;
|
475
476
|
/** Add a device ID to the social profiles on the current user's account. */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2291,6 +2291,35 @@ var MezonApi = class {
|
|
2291
2291
|
)
|
2292
2292
|
]);
|
2293
2293
|
}
|
2294
|
+
/** close direct message. */
|
2295
|
+
closeDirectMess(bearerToken, body, options = {}) {
|
2296
|
+
if (body === null || body === void 0) {
|
2297
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2298
|
+
}
|
2299
|
+
const urlPath = "/v2/direct/close";
|
2300
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2301
|
+
let bodyJson = "";
|
2302
|
+
bodyJson = JSON.stringify(body || {});
|
2303
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2304
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2305
|
+
if (bearerToken) {
|
2306
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2307
|
+
}
|
2308
|
+
return Promise.race([
|
2309
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2310
|
+
if (response.status == 204) {
|
2311
|
+
return response;
|
2312
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2313
|
+
return response.json();
|
2314
|
+
} else {
|
2315
|
+
throw response;
|
2316
|
+
}
|
2317
|
+
}),
|
2318
|
+
new Promise(
|
2319
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2320
|
+
)
|
2321
|
+
]);
|
2322
|
+
}
|
2294
2323
|
/** Search message from elasticsearch service. */
|
2295
2324
|
searchMessage(bearerToken, body, options = {}) {
|
2296
2325
|
if (body === null || body === void 0) {
|
@@ -4514,6 +4543,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4514
4543
|
return response.status;
|
4515
4544
|
});
|
4516
4545
|
}
|
4546
|
+
joinClanChat(clan_id) {
|
4547
|
+
return __async(this, null, function* () {
|
4548
|
+
const response = yield this.send({
|
4549
|
+
clan_join: {
|
4550
|
+
clan_id
|
4551
|
+
}
|
4552
|
+
});
|
4553
|
+
return response.clan_join;
|
4554
|
+
});
|
4555
|
+
}
|
4517
4556
|
joinChat(channel_id, channel_label, mode, type, persistence, hidden) {
|
4518
4557
|
return __async(this, null, function* () {
|
4519
4558
|
const response = yield this.send(
|
@@ -5522,6 +5561,17 @@ var Client = class {
|
|
5522
5561
|
});
|
5523
5562
|
});
|
5524
5563
|
}
|
5564
|
+
//
|
5565
|
+
closeDirectMess(session, request) {
|
5566
|
+
return __async(this, null, function* () {
|
5567
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5568
|
+
yield this.sessionRefresh(session);
|
5569
|
+
}
|
5570
|
+
return this.apiClient.closeDirectMess(session.token, request).then((response) => {
|
5571
|
+
return response !== void 0;
|
5572
|
+
});
|
5573
|
+
});
|
5574
|
+
}
|
5525
5575
|
/** Add a custom ID to the social profiles on the current user's account. */
|
5526
5576
|
linkCustom(session, request) {
|
5527
5577
|
return __async(this, null, function* () {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2262,6 +2262,35 @@ var MezonApi = class {
|
|
2262
2262
|
)
|
2263
2263
|
]);
|
2264
2264
|
}
|
2265
|
+
/** close direct message. */
|
2266
|
+
closeDirectMess(bearerToken, body, options = {}) {
|
2267
|
+
if (body === null || body === void 0) {
|
2268
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2269
|
+
}
|
2270
|
+
const urlPath = "/v2/direct/close";
|
2271
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2272
|
+
let bodyJson = "";
|
2273
|
+
bodyJson = JSON.stringify(body || {});
|
2274
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2275
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2276
|
+
if (bearerToken) {
|
2277
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2278
|
+
}
|
2279
|
+
return Promise.race([
|
2280
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2281
|
+
if (response.status == 204) {
|
2282
|
+
return response;
|
2283
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2284
|
+
return response.json();
|
2285
|
+
} else {
|
2286
|
+
throw response;
|
2287
|
+
}
|
2288
|
+
}),
|
2289
|
+
new Promise(
|
2290
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2291
|
+
)
|
2292
|
+
]);
|
2293
|
+
}
|
2265
2294
|
/** Search message from elasticsearch service. */
|
2266
2295
|
searchMessage(bearerToken, body, options = {}) {
|
2267
2296
|
if (body === null || body === void 0) {
|
@@ -4485,6 +4514,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4485
4514
|
return response.status;
|
4486
4515
|
});
|
4487
4516
|
}
|
4517
|
+
joinClanChat(clan_id) {
|
4518
|
+
return __async(this, null, function* () {
|
4519
|
+
const response = yield this.send({
|
4520
|
+
clan_join: {
|
4521
|
+
clan_id
|
4522
|
+
}
|
4523
|
+
});
|
4524
|
+
return response.clan_join;
|
4525
|
+
});
|
4526
|
+
}
|
4488
4527
|
joinChat(channel_id, channel_label, mode, type, persistence, hidden) {
|
4489
4528
|
return __async(this, null, function* () {
|
4490
4529
|
const response = yield this.send(
|
@@ -5493,6 +5532,17 @@ var Client = class {
|
|
5493
5532
|
});
|
5494
5533
|
});
|
5495
5534
|
}
|
5535
|
+
//
|
5536
|
+
closeDirectMess(session, request) {
|
5537
|
+
return __async(this, null, function* () {
|
5538
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5539
|
+
yield this.sessionRefresh(session);
|
5540
|
+
}
|
5541
|
+
return this.apiClient.closeDirectMess(session.token, request).then((response) => {
|
5542
|
+
return response !== void 0;
|
5543
|
+
});
|
5544
|
+
});
|
5545
|
+
}
|
5496
5546
|
/** Add a custom ID to the social profiles on the current user's account. */
|
5497
5547
|
linkCustom(session, request) {
|
5498
5548
|
return __async(this, null, function* () {
|
package/dist/socket.d.ts
CHANGED
@@ -40,6 +40,11 @@ export interface Channel {
|
|
40
40
|
user_id_one: string;
|
41
41
|
user_id_two: string;
|
42
42
|
}
|
43
|
+
interface ClanJoin {
|
44
|
+
clan_join: {
|
45
|
+
clan_id: string;
|
46
|
+
};
|
47
|
+
}
|
43
48
|
/** Join a realtime chat channel. */
|
44
49
|
interface ChannelJoin {
|
45
50
|
channel_join: {
|
@@ -534,6 +539,8 @@ export interface Socket {
|
|
534
539
|
createParty(open: boolean, max_size: number): Promise<Party>;
|
535
540
|
/** Subscribe to one or more users for their status updates. */
|
536
541
|
followUsers(user_ids: string[]): Promise<Status>;
|
542
|
+
/** Join clan chat */
|
543
|
+
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
537
544
|
/** Join a chat channel on the server. */
|
538
545
|
joinChat(channel_id: string, channel_label: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel>;
|
539
546
|
/** Join a party. */
|
@@ -680,6 +687,7 @@ export declare class DefaultSocket implements Socket {
|
|
680
687
|
closeParty(party_id: string): Promise<void>;
|
681
688
|
createParty(open: boolean, max_size: number): Promise<Party>;
|
682
689
|
followUsers(userIds: string[]): Promise<Status>;
|
690
|
+
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
683
691
|
joinChat(channel_id: string, channel_label: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel>;
|
684
692
|
joinParty(party_id: string): Promise<void>;
|
685
693
|
leaveChat(channel_id: string, channel_label: string, mode: number): Promise<void>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -54,6 +54,12 @@ export interface Channel {
|
|
54
54
|
user_id_two: string;
|
55
55
|
}
|
56
56
|
|
57
|
+
interface ClanJoin {
|
58
|
+
clan_join: {
|
59
|
+
clan_id: string;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
57
63
|
/** Join a realtime chat channel. */
|
58
64
|
interface ChannelJoin {
|
59
65
|
channel_join: {
|
@@ -694,6 +700,9 @@ export interface Socket {
|
|
694
700
|
/** Subscribe to one or more users for their status updates. */
|
695
701
|
followUsers(user_ids: string[]) : Promise<Status>;
|
696
702
|
|
703
|
+
/** Join clan chat */
|
704
|
+
joinClanChat(clan_id: string) : Promise<ClanJoin>;
|
705
|
+
|
697
706
|
/** Join a chat channel on the server. */
|
698
707
|
joinChat(channel_id: string, channel_label: string, mode: number, type: number, persistence: boolean, hidden: boolean) : Promise<Channel>;
|
699
708
|
|
@@ -1253,6 +1262,17 @@ export class DefaultSocket implements Socket {
|
|
1253
1262
|
return response.status;
|
1254
1263
|
}
|
1255
1264
|
|
1265
|
+
async joinClanChat(clan_id: string): Promise<ClanJoin> {
|
1266
|
+
|
1267
|
+
const response = await this.send({
|
1268
|
+
clan_join: {
|
1269
|
+
clan_id: clan_id,
|
1270
|
+
}
|
1271
|
+
});
|
1272
|
+
|
1273
|
+
return response.clan_join;
|
1274
|
+
}
|
1275
|
+
|
1256
1276
|
async joinChat(channel_id: string, channel_label: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel> {
|
1257
1277
|
|
1258
1278
|
const response = await this.send({
|