mezon-js 2.9.23 → 2.9.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/mezon-js.cjs.js +7 -84
- package/dist/mezon-js.esm.mjs +7 -84
- package/dist/socket.d.ts +9 -105
- package/package.json +1 -1
- package/socket.ts +19 -231
package/dist/mezon-js.cjs.js
CHANGED
@@ -5950,6 +5950,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5950
5950
|
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5951
5951
|
} else if (message.set_permission_channel_event) {
|
5952
5952
|
this.onsetpermissionchannel(message.set_permission_channel_event);
|
5953
|
+
} else if (message.event_user_permission_channel) {
|
5954
|
+
this.onuserpermissionchannel(message.event_user_permission_channel);
|
5953
5955
|
} else {
|
5954
5956
|
if (this.verbose && window && window.console) {
|
5955
5957
|
console.log("Unrecognized message received: %o", message);
|
@@ -6212,6 +6214,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6212
6214
|
console.log(set_permission_channel_event);
|
6213
6215
|
}
|
6214
6216
|
}
|
6217
|
+
onuserpermissionchannel(event_user_permission_channel) {
|
6218
|
+
if (this.verbose && window && window.console) {
|
6219
|
+
console.log(event_user_permission_channel);
|
6220
|
+
}
|
6221
|
+
}
|
6215
6222
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
6216
6223
|
const untypedMessage = message;
|
6217
6224
|
return new Promise((resolve, reject) => {
|
@@ -6367,90 +6374,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6367
6374
|
return response.check_name_existed_event;
|
6368
6375
|
});
|
6369
6376
|
}
|
6370
|
-
listClanEmojiByUserId() {
|
6371
|
-
return __async(this, null, function* () {
|
6372
|
-
const response = yield this.send({ emojis_listed_event: {} });
|
6373
|
-
return response.emojis_listed_event;
|
6374
|
-
});
|
6375
|
-
}
|
6376
|
-
listUserPermissionInChannel(clan_id, channel_id) {
|
6377
|
-
return __async(this, null, function* () {
|
6378
|
-
const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
|
6379
|
-
return response.user_permission_in_channel_list_event;
|
6380
|
-
});
|
6381
|
-
}
|
6382
|
-
listRoles(ClanId, Limit, State, Cursor) {
|
6383
|
-
return __async(this, null, function* () {
|
6384
|
-
const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
|
6385
|
-
return response.role_list_event;
|
6386
|
-
});
|
6387
|
-
}
|
6388
|
-
listChannelByUserId() {
|
6389
|
-
return __async(this, null, function* () {
|
6390
|
-
const response = yield this.send({ channel_desc_list_event: {} });
|
6391
|
-
return response.channel_desc_list_event;
|
6392
|
-
});
|
6393
|
-
}
|
6394
|
-
listUserClansByUserId() {
|
6395
|
-
return __async(this, null, function* () {
|
6396
|
-
const response = yield this.send({ all_user_clans: {} });
|
6397
|
-
return response.all_user_clans;
|
6398
|
-
});
|
6399
|
-
}
|
6400
|
-
listUsersAddChannelByChannelId(channelId, limit) {
|
6401
|
-
return __async(this, null, function* () {
|
6402
|
-
const response = yield this.send({ all_users_add_channel_event: { channel_id: channelId, limit } });
|
6403
|
-
return response.all_users_add_channel_event;
|
6404
|
-
});
|
6405
|
-
}
|
6406
|
-
hashtagDMList(user_id, limit) {
|
6407
|
-
return __async(this, null, function* () {
|
6408
|
-
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
6409
|
-
return response.hashtag_dm_list_event;
|
6410
|
-
});
|
6411
|
-
}
|
6412
|
-
getPermissionByRoleIdChannelId(role_id, channel_id, user_id) {
|
6413
|
-
return __async(this, null, function* () {
|
6414
|
-
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id, user_id } });
|
6415
|
-
return response.permission_role_channel_list_event;
|
6416
|
-
});
|
6417
|
-
}
|
6418
|
-
listStickersByUserId() {
|
6419
|
-
return __async(this, null, function* () {
|
6420
|
-
const response = yield this.send({ sticker_listed_event: {} });
|
6421
|
-
return response.sticker_listed_event;
|
6422
|
-
});
|
6423
|
-
}
|
6424
|
-
getNotificationChannelSetting(channel_id) {
|
6425
|
-
return __async(this, null, function* () {
|
6426
|
-
const response = yield this.send({ notification_channel_setting_event: { channel_id } });
|
6427
|
-
return response.notification_channel_setting_event;
|
6428
|
-
});
|
6429
|
-
}
|
6430
|
-
getNotificationCategorySetting(category_id) {
|
6431
|
-
return __async(this, null, function* () {
|
6432
|
-
const response = yield this.send({ notification_category_setting_event: { category_id } });
|
6433
|
-
return response.notification_category_setting_event;
|
6434
|
-
});
|
6435
|
-
}
|
6436
|
-
getNotificationClanSetting(clan_id) {
|
6437
|
-
return __async(this, null, function* () {
|
6438
|
-
const response = yield this.send({ notification_clan_setting_event: { clan_id } });
|
6439
|
-
return response.notification_clan_setting_event;
|
6440
|
-
});
|
6441
|
-
}
|
6442
|
-
getNotificationReactMessage(channel_id) {
|
6443
|
-
return __async(this, null, function* () {
|
6444
|
-
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
6445
|
-
return response.notifi_react_message_event;
|
6446
|
-
});
|
6447
|
-
}
|
6448
|
-
getNotificationChannelCategorySetting(clan_id) {
|
6449
|
-
return __async(this, null, function* () {
|
6450
|
-
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
6451
|
-
return response.notification_channel_category_setting_event;
|
6452
|
-
});
|
6453
|
-
}
|
6454
6377
|
pingPong() {
|
6455
6378
|
return __async(this, null, function* () {
|
6456
6379
|
if (!this.adapter.isOpen()) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5921,6 +5921,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5921
5921
|
this.onstreamingchannelleaved(message.streaming_leaved_event);
|
5922
5922
|
} else if (message.set_permission_channel_event) {
|
5923
5923
|
this.onsetpermissionchannel(message.set_permission_channel_event);
|
5924
|
+
} else if (message.event_user_permission_channel) {
|
5925
|
+
this.onuserpermissionchannel(message.event_user_permission_channel);
|
5924
5926
|
} else {
|
5925
5927
|
if (this.verbose && window && window.console) {
|
5926
5928
|
console.log("Unrecognized message received: %o", message);
|
@@ -6183,6 +6185,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6183
6185
|
console.log(set_permission_channel_event);
|
6184
6186
|
}
|
6185
6187
|
}
|
6188
|
+
onuserpermissionchannel(event_user_permission_channel) {
|
6189
|
+
if (this.verbose && window && window.console) {
|
6190
|
+
console.log(event_user_permission_channel);
|
6191
|
+
}
|
6192
|
+
}
|
6186
6193
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
6187
6194
|
const untypedMessage = message;
|
6188
6195
|
return new Promise((resolve, reject) => {
|
@@ -6338,90 +6345,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6338
6345
|
return response.check_name_existed_event;
|
6339
6346
|
});
|
6340
6347
|
}
|
6341
|
-
listClanEmojiByUserId() {
|
6342
|
-
return __async(this, null, function* () {
|
6343
|
-
const response = yield this.send({ emojis_listed_event: {} });
|
6344
|
-
return response.emojis_listed_event;
|
6345
|
-
});
|
6346
|
-
}
|
6347
|
-
listUserPermissionInChannel(clan_id, channel_id) {
|
6348
|
-
return __async(this, null, function* () {
|
6349
|
-
const response = yield this.send({ user_permission_in_channel_list_event: { clan_id, channel_id } });
|
6350
|
-
return response.user_permission_in_channel_list_event;
|
6351
|
-
});
|
6352
|
-
}
|
6353
|
-
listRoles(ClanId, Limit, State, Cursor) {
|
6354
|
-
return __async(this, null, function* () {
|
6355
|
-
const response = yield this.send({ role_list_event: { ClanId, Limit, State, Cursor } });
|
6356
|
-
return response.role_list_event;
|
6357
|
-
});
|
6358
|
-
}
|
6359
|
-
listChannelByUserId() {
|
6360
|
-
return __async(this, null, function* () {
|
6361
|
-
const response = yield this.send({ channel_desc_list_event: {} });
|
6362
|
-
return response.channel_desc_list_event;
|
6363
|
-
});
|
6364
|
-
}
|
6365
|
-
listUserClansByUserId() {
|
6366
|
-
return __async(this, null, function* () {
|
6367
|
-
const response = yield this.send({ all_user_clans: {} });
|
6368
|
-
return response.all_user_clans;
|
6369
|
-
});
|
6370
|
-
}
|
6371
|
-
listUsersAddChannelByChannelId(channelId, limit) {
|
6372
|
-
return __async(this, null, function* () {
|
6373
|
-
const response = yield this.send({ all_users_add_channel_event: { channel_id: channelId, limit } });
|
6374
|
-
return response.all_users_add_channel_event;
|
6375
|
-
});
|
6376
|
-
}
|
6377
|
-
hashtagDMList(user_id, limit) {
|
6378
|
-
return __async(this, null, function* () {
|
6379
|
-
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
6380
|
-
return response.hashtag_dm_list_event;
|
6381
|
-
});
|
6382
|
-
}
|
6383
|
-
getPermissionByRoleIdChannelId(role_id, channel_id, user_id) {
|
6384
|
-
return __async(this, null, function* () {
|
6385
|
-
const response = yield this.send({ permission_role_channel_list_event: { role_id, channel_id, user_id } });
|
6386
|
-
return response.permission_role_channel_list_event;
|
6387
|
-
});
|
6388
|
-
}
|
6389
|
-
listStickersByUserId() {
|
6390
|
-
return __async(this, null, function* () {
|
6391
|
-
const response = yield this.send({ sticker_listed_event: {} });
|
6392
|
-
return response.sticker_listed_event;
|
6393
|
-
});
|
6394
|
-
}
|
6395
|
-
getNotificationChannelSetting(channel_id) {
|
6396
|
-
return __async(this, null, function* () {
|
6397
|
-
const response = yield this.send({ notification_channel_setting_event: { channel_id } });
|
6398
|
-
return response.notification_channel_setting_event;
|
6399
|
-
});
|
6400
|
-
}
|
6401
|
-
getNotificationCategorySetting(category_id) {
|
6402
|
-
return __async(this, null, function* () {
|
6403
|
-
const response = yield this.send({ notification_category_setting_event: { category_id } });
|
6404
|
-
return response.notification_category_setting_event;
|
6405
|
-
});
|
6406
|
-
}
|
6407
|
-
getNotificationClanSetting(clan_id) {
|
6408
|
-
return __async(this, null, function* () {
|
6409
|
-
const response = yield this.send({ notification_clan_setting_event: { clan_id } });
|
6410
|
-
return response.notification_clan_setting_event;
|
6411
|
-
});
|
6412
|
-
}
|
6413
|
-
getNotificationReactMessage(channel_id) {
|
6414
|
-
return __async(this, null, function* () {
|
6415
|
-
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
6416
|
-
return response.notifi_react_message_event;
|
6417
|
-
});
|
6418
|
-
}
|
6419
|
-
getNotificationChannelCategorySetting(clan_id) {
|
6420
|
-
return __async(this, null, function* () {
|
6421
|
-
const response = yield this.send({ notification_channel_category_setting_event: { clan_id } });
|
6422
|
-
return response.notification_channel_category_setting_event;
|
6423
|
-
});
|
6424
|
-
}
|
6425
6348
|
pingPong() {
|
6426
6349
|
return __async(this, null, function* () {
|
6427
6350
|
if (!this.adapter.isOpen()) {
|
package/dist/socket.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 {
|
16
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage, Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -338,15 +338,6 @@ export interface ClanDeletedEvent {
|
|
338
338
|
clan_id: string;
|
339
339
|
deletor: string;
|
340
340
|
}
|
341
|
-
export interface PermissionRoleChannelListEvent {
|
342
|
-
role_id?: string;
|
343
|
-
channel_id?: string;
|
344
|
-
permission_role_channel?: Array<PermissionRoleChannel>;
|
345
|
-
}
|
346
|
-
export interface PermissionRoleChannel {
|
347
|
-
permission_id?: string;
|
348
|
-
active?: boolean;
|
349
|
-
}
|
350
341
|
export interface ClanUpdatedEvent {
|
351
342
|
clan_id: string;
|
352
343
|
clan_name: string;
|
@@ -436,10 +427,6 @@ export interface CheckNameExistedEvent {
|
|
436
427
|
type: number;
|
437
428
|
}
|
438
429
|
/** */
|
439
|
-
export interface StrickerListedEvent {
|
440
|
-
stickers?: Array<ClanSticker>;
|
441
|
-
}
|
442
|
-
/** */
|
443
430
|
export interface ClanSticker {
|
444
431
|
category?: string;
|
445
432
|
clan_id?: string;
|
@@ -451,25 +438,11 @@ export interface ClanSticker {
|
|
451
438
|
logo?: string;
|
452
439
|
clan_name?: string;
|
453
440
|
}
|
454
|
-
/** */
|
455
|
-
export interface EmojiListedEvent {
|
456
|
-
emoji_list?: Array<ClanEmoji>;
|
457
|
-
}
|
458
|
-
export interface RoleListEvent {
|
459
|
-
Limit: number;
|
460
|
-
State: number;
|
461
|
-
Cursor: string;
|
462
|
-
ClanId: string;
|
463
|
-
roles: ApiRoleList;
|
464
|
-
}
|
465
441
|
export interface RoleEvent {
|
466
442
|
role: ApiRole;
|
467
443
|
status: number;
|
468
444
|
user_id: string;
|
469
445
|
}
|
470
|
-
export interface AllUsersAddChannelEvent {
|
471
|
-
user_ids: Array<string>;
|
472
|
-
}
|
473
446
|
export interface EventEmoji {
|
474
447
|
id: string;
|
475
448
|
clan_id: string;
|
@@ -481,11 +454,6 @@ export interface EventEmoji {
|
|
481
454
|
logo: string;
|
482
455
|
clan_name: string;
|
483
456
|
}
|
484
|
-
export interface UserPermissionInChannelListEvent {
|
485
|
-
clan_id: string;
|
486
|
-
channel_id: string;
|
487
|
-
permissions: ApiPermissionList;
|
488
|
-
}
|
489
457
|
/** */
|
490
458
|
export interface ClanEmoji {
|
491
459
|
category?: string;
|
@@ -498,14 +466,6 @@ export interface ClanEmoji {
|
|
498
466
|
clan_id?: string;
|
499
467
|
}
|
500
468
|
/** */
|
501
|
-
export interface ChannelDescListEvent {
|
502
|
-
channeldesc?: ApiChannelDescList;
|
503
|
-
}
|
504
|
-
/** */
|
505
|
-
export interface AllUserClans {
|
506
|
-
user?: Array<ApiUser>;
|
507
|
-
}
|
508
|
-
/** */
|
509
469
|
export interface ChannelDescription {
|
510
470
|
clan_id?: string;
|
511
471
|
channel_id?: string;
|
@@ -518,11 +478,6 @@ export interface ChannelDescription {
|
|
518
478
|
parrent_id?: string;
|
519
479
|
last_sent_message?: ApiChannelMessageHeader;
|
520
480
|
}
|
521
|
-
export interface HashtagDmListEvent {
|
522
|
-
user_id?: Array<string>;
|
523
|
-
limit?: number;
|
524
|
-
hashtag_dm?: ApiHashtagDmList;
|
525
|
-
}
|
526
481
|
export interface HashtagDm {
|
527
482
|
channel_id?: string;
|
528
483
|
channel_label?: string;
|
@@ -533,37 +488,10 @@ export interface HashtagDm {
|
|
533
488
|
channel_private?: number;
|
534
489
|
parrent_id?: string;
|
535
490
|
}
|
536
|
-
export interface NotificationChannelSettingEvent {
|
537
|
-
channel_id?: string;
|
538
|
-
notification_user_channel?: NotificationUserChannel;
|
539
|
-
}
|
540
|
-
export interface NotificationUserChannel {
|
541
|
-
active?: number;
|
542
|
-
id?: string;
|
543
|
-
notification_setting_type?: number;
|
544
|
-
time_mute?: string;
|
545
|
-
}
|
546
|
-
export interface NotificationCategorySettingEvent {
|
547
|
-
category_id?: string;
|
548
|
-
notification_user_channel?: NotificationUserChannel;
|
549
|
-
}
|
550
|
-
export interface NotificationClanSettingEvent {
|
551
|
-
clan_id?: string;
|
552
|
-
notification_setting?: NotificationSetting;
|
553
|
-
}
|
554
491
|
export interface NotificationSetting {
|
555
492
|
id?: string;
|
556
493
|
notification_setting_type?: number;
|
557
494
|
}
|
558
|
-
export interface NotifiReactMessageEvent {
|
559
|
-
channel_id?: string;
|
560
|
-
notifi_react_message?: NotifiReactMessage;
|
561
|
-
}
|
562
|
-
export interface NotifiReactMessage {
|
563
|
-
id?: string;
|
564
|
-
user_id?: string;
|
565
|
-
channel_id_req?: string;
|
566
|
-
}
|
567
495
|
export interface NotificationChannelCategorySetting {
|
568
496
|
id: string;
|
569
497
|
channel_category_label: string;
|
@@ -571,10 +499,6 @@ export interface NotificationChannelCategorySetting {
|
|
571
499
|
channel_category_title: string;
|
572
500
|
action: number;
|
573
501
|
}
|
574
|
-
export interface NotificationChannelCategorySettingEvent {
|
575
|
-
clan_id?: string;
|
576
|
-
notification_channel_category_settings_list?: ApiNotificationChannelCategorySettingList;
|
577
|
-
}
|
578
502
|
export interface UserEmojiUsage {
|
579
503
|
user_id: string;
|
580
504
|
emoji_id: string;
|
@@ -656,6 +580,12 @@ export interface SetPermissionChannelEvent {
|
|
656
580
|
channel_id: string;
|
657
581
|
/** List permission update */
|
658
582
|
permission_updates: ApiPermissionUpdate[];
|
583
|
+
/** */
|
584
|
+
caller: string;
|
585
|
+
}
|
586
|
+
export interface EventUserPermissionChannel {
|
587
|
+
user_id: string;
|
588
|
+
channel_id: string;
|
659
589
|
}
|
660
590
|
/** A socket connection to Mezon server. */
|
661
591
|
export interface Socket {
|
@@ -757,20 +687,6 @@ export interface Socket {
|
|
757
687
|
setHeartbeatTimeoutMs(ms: number): void;
|
758
688
|
getHeartbeatTimeoutMs(): number;
|
759
689
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
760
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
761
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
762
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
763
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
764
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
765
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
766
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
767
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
768
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
769
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
770
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
771
|
-
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
772
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
773
|
-
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
774
690
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
775
691
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
776
692
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
@@ -780,6 +696,7 @@ export interface Socket {
|
|
780
696
|
onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
|
781
697
|
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
782
698
|
onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
|
699
|
+
onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
|
783
700
|
}
|
784
701
|
/** Reports an error received from a socket message. */
|
785
702
|
export interface SocketError {
|
@@ -851,6 +768,7 @@ export declare class DefaultSocket implements Socket {
|
|
851
768
|
onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
|
852
769
|
onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
|
853
770
|
onsetpermissionchannel(set_permission_channel_event: SetPermissionChannelEvent): void;
|
771
|
+
onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel): void;
|
854
772
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
855
773
|
followUsers(userIds: string[]): Promise<Status>;
|
856
774
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
@@ -870,20 +788,6 @@ export declare class DefaultSocket implements Socket {
|
|
870
788
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
871
789
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
872
790
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
873
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
874
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
875
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
876
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
877
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
878
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
879
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
880
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
881
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
882
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
883
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
884
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
885
|
-
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
886
|
-
getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent>;
|
887
791
|
private pingPong;
|
888
792
|
}
|
889
793
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
17
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc} from "./api.gen";
|
18
18
|
import {Session} from "./session";
|
19
19
|
import {ChannelMessage, Notification} from "./client";
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
@@ -506,24 +506,6 @@ export interface ClanDeletedEvent {
|
|
506
506
|
deletor: string;
|
507
507
|
}
|
508
508
|
|
509
|
-
// A list of permission role channel.
|
510
|
-
export interface PermissionRoleChannelListEvent {
|
511
|
-
//
|
512
|
-
role_id?: string;
|
513
|
-
//
|
514
|
-
channel_id?: string;
|
515
|
-
// A list of permission.
|
516
|
-
permission_role_channel?: Array<PermissionRoleChannel>;
|
517
|
-
}
|
518
|
-
|
519
|
-
// Permission role channel
|
520
|
-
export interface PermissionRoleChannel {
|
521
|
-
// Permission id
|
522
|
-
permission_id?: string;
|
523
|
-
// active
|
524
|
-
active?: boolean;
|
525
|
-
}
|
526
|
-
|
527
509
|
// clan updated event
|
528
510
|
export interface ClanUpdatedEvent {
|
529
511
|
// the clan id
|
@@ -627,13 +609,6 @@ export interface CheckNameExistedEvent {
|
|
627
609
|
type: number;
|
628
610
|
}
|
629
611
|
|
630
|
-
|
631
|
-
/** */
|
632
|
-
export interface StrickerListedEvent {
|
633
|
-
// sticker data
|
634
|
-
stickers?: Array<ClanSticker>;
|
635
|
-
}
|
636
|
-
|
637
612
|
/** */
|
638
613
|
export interface ClanSticker {
|
639
614
|
//
|
@@ -656,34 +631,12 @@ export interface ClanSticker {
|
|
656
631
|
clan_name?: string;
|
657
632
|
}
|
658
633
|
|
659
|
-
/** */
|
660
|
-
export interface EmojiListedEvent {
|
661
|
-
// emoji data
|
662
|
-
emoji_list?: Array<ClanEmoji>;
|
663
|
-
}
|
664
|
-
|
665
|
-
export interface RoleListEvent {
|
666
|
-
Limit: number;
|
667
|
-
// The role state to list.
|
668
|
-
State: number;
|
669
|
-
// Cursor to start from
|
670
|
-
Cursor: string;
|
671
|
-
// The clan of this role
|
672
|
-
ClanId: string;
|
673
|
-
//
|
674
|
-
roles: ApiRoleList;
|
675
|
-
}
|
676
|
-
|
677
634
|
export interface RoleEvent {
|
678
635
|
role: ApiRole;
|
679
636
|
status: number;
|
680
637
|
user_id: string;
|
681
638
|
}
|
682
639
|
|
683
|
-
export interface AllUsersAddChannelEvent {
|
684
|
-
user_ids: Array<string>;
|
685
|
-
}
|
686
|
-
|
687
640
|
export interface EventEmoji {
|
688
641
|
id : string
|
689
642
|
clan_id: string
|
@@ -696,15 +649,6 @@ export interface EventEmoji {
|
|
696
649
|
clan_name: string
|
697
650
|
}
|
698
651
|
|
699
|
-
export interface UserPermissionInChannelListEvent {
|
700
|
-
//
|
701
|
-
clan_id: string;
|
702
|
-
//
|
703
|
-
channel_id: string;
|
704
|
-
// A list of permission.
|
705
|
-
permissions: ApiPermissionList;
|
706
|
-
}
|
707
|
-
|
708
652
|
/** */
|
709
653
|
export interface ClanEmoji {
|
710
654
|
//
|
@@ -725,18 +669,6 @@ export interface ClanEmoji {
|
|
725
669
|
clan_id?: string;
|
726
670
|
}
|
727
671
|
|
728
|
-
/** */
|
729
|
-
export interface ChannelDescListEvent {
|
730
|
-
//
|
731
|
-
channeldesc?: ApiChannelDescList;
|
732
|
-
}
|
733
|
-
|
734
|
-
/** */
|
735
|
-
export interface AllUserClans {
|
736
|
-
//
|
737
|
-
user?: Array<ApiUser>;
|
738
|
-
}
|
739
|
-
|
740
672
|
/** */
|
741
673
|
export interface ChannelDescription {
|
742
674
|
// The clan of this channel
|
@@ -761,16 +693,6 @@ export interface ChannelDescription {
|
|
761
693
|
last_sent_message?: ApiChannelMessageHeader;
|
762
694
|
}
|
763
695
|
|
764
|
-
// A list of Channel
|
765
|
-
export interface HashtagDmListEvent {
|
766
|
-
// user Id
|
767
|
-
user_id?: Array<string>;
|
768
|
-
// Max number of records to return. Between 1 and 100.
|
769
|
-
limit?: number;
|
770
|
-
// A list of channel.
|
771
|
-
hashtag_dm?: ApiHashtagDmList;
|
772
|
-
}
|
773
|
-
|
774
696
|
// hashtagDM
|
775
697
|
export interface HashtagDm {
|
776
698
|
// The channel id.
|
@@ -791,38 +713,6 @@ export interface HashtagDm {
|
|
791
713
|
parrent_id?: string;
|
792
714
|
}
|
793
715
|
|
794
|
-
export interface NotificationChannelSettingEvent {
|
795
|
-
// The channel id.
|
796
|
-
channel_id?: string;
|
797
|
-
//
|
798
|
-
notification_user_channel?: NotificationUserChannel;
|
799
|
-
}
|
800
|
-
|
801
|
-
export interface NotificationUserChannel {
|
802
|
-
//
|
803
|
-
active?: number;
|
804
|
-
//
|
805
|
-
id?: string;
|
806
|
-
//
|
807
|
-
notification_setting_type?: number;
|
808
|
-
//
|
809
|
-
time_mute?: string;
|
810
|
-
}
|
811
|
-
|
812
|
-
export interface NotificationCategorySettingEvent {
|
813
|
-
//
|
814
|
-
category_id?: string;
|
815
|
-
//
|
816
|
-
notification_user_channel?: NotificationUserChannel;
|
817
|
-
}
|
818
|
-
|
819
|
-
export interface NotificationClanSettingEvent {
|
820
|
-
// The clan of this channel
|
821
|
-
clan_id?: string;
|
822
|
-
//
|
823
|
-
notification_setting?: NotificationSetting;
|
824
|
-
}
|
825
|
-
|
826
716
|
export interface NotificationSetting {
|
827
717
|
//
|
828
718
|
id?: string;
|
@@ -830,22 +720,6 @@ export interface NotificationSetting {
|
|
830
720
|
notification_setting_type?: number;
|
831
721
|
}
|
832
722
|
|
833
|
-
export interface NotifiReactMessageEvent {
|
834
|
-
//
|
835
|
-
channel_id?: string;
|
836
|
-
//
|
837
|
-
notifi_react_message?: NotifiReactMessage;
|
838
|
-
}
|
839
|
-
|
840
|
-
export interface NotifiReactMessage {
|
841
|
-
//
|
842
|
-
id?: string;
|
843
|
-
//
|
844
|
-
user_id?: string;
|
845
|
-
//
|
846
|
-
channel_id_req?: string;
|
847
|
-
}
|
848
|
-
|
849
723
|
export interface NotificationChannelCategorySetting {
|
850
724
|
// Notification id
|
851
725
|
id: string;
|
@@ -859,11 +733,6 @@ export interface NotificationChannelCategorySetting {
|
|
859
733
|
action: number
|
860
734
|
}
|
861
735
|
|
862
|
-
export interface NotificationChannelCategorySettingEvent {
|
863
|
-
clan_id? : string;
|
864
|
-
notification_channel_category_settings_list?: ApiNotificationChannelCategorySettingList
|
865
|
-
}
|
866
|
-
|
867
736
|
export interface UserEmojiUsage {
|
868
737
|
user_id: string;
|
869
738
|
emoji_id: string;
|
@@ -953,6 +822,13 @@ export interface SetPermissionChannelEvent {
|
|
953
822
|
channel_id: string;
|
954
823
|
/** List permission update */
|
955
824
|
permission_updates: ApiPermissionUpdate[];
|
825
|
+
/** */
|
826
|
+
caller: string;
|
827
|
+
}
|
828
|
+
|
829
|
+
export interface EventUserPermissionChannel{
|
830
|
+
user_id: string;
|
831
|
+
channel_id: string;
|
956
832
|
}
|
957
833
|
|
958
834
|
/** A socket connection to Mezon server. */
|
@@ -1127,34 +1003,6 @@ export interface Socket {
|
|
1127
1003
|
|
1128
1004
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
1129
1005
|
|
1130
|
-
listClanEmojiByUserId(): Promise<EmojiListedEvent>;
|
1131
|
-
|
1132
|
-
listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent>;
|
1133
|
-
|
1134
|
-
listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent>;
|
1135
|
-
|
1136
|
-
listStickersByUserId(): Promise<StrickerListedEvent>;
|
1137
|
-
|
1138
|
-
listChannelByUserId(): Promise<ChannelDescListEvent>;
|
1139
|
-
|
1140
|
-
listUserClansByUserId(): Promise<AllUserClans>;
|
1141
|
-
|
1142
|
-
listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent>;
|
1143
|
-
|
1144
|
-
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
1145
|
-
|
1146
|
-
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
1147
|
-
|
1148
|
-
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
1149
|
-
|
1150
|
-
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
1151
|
-
|
1152
|
-
getNotificationReactMessage(channel_id_req: string): Promise<NotifiReactMessageEvent>;
|
1153
|
-
|
1154
|
-
getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent>;
|
1155
|
-
|
1156
|
-
getNotificationChannelCategorySetting(clan_id : string): Promise<NotificationChannelCategorySettingEvent>;
|
1157
|
-
|
1158
1006
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
1159
1007
|
|
1160
1008
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
@@ -1172,6 +1020,8 @@ export interface Socket {
|
|
1172
1020
|
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
1173
1021
|
|
1174
1022
|
onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
|
1023
|
+
|
1024
|
+
onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
|
1175
1025
|
}
|
1176
1026
|
|
1177
1027
|
/** Reports an error received from a socket message. */
|
@@ -1371,7 +1221,9 @@ export class DefaultSocket implements Socket {
|
|
1371
1221
|
this.onstreamingchannelleaved(<StreamingLeavedEvent>message.streaming_leaved_event);
|
1372
1222
|
} else if(message.set_permission_channel_event){
|
1373
1223
|
this.onsetpermissionchannel(<SetPermissionChannelEvent>message.set_permission_channel_event);
|
1374
|
-
}else {
|
1224
|
+
} else if(message.event_user_permission_channel){
|
1225
|
+
this.onuserpermissionchannel(<EventUserPermissionChannel>message.event_user_permission_channel);
|
1226
|
+
} else {
|
1375
1227
|
if (this.verbose && window && window.console) {
|
1376
1228
|
console.log("Unrecognized message received: %o", message);
|
1377
1229
|
}
|
@@ -1685,6 +1537,12 @@ export class DefaultSocket implements Socket {
|
|
1685
1537
|
}
|
1686
1538
|
}
|
1687
1539
|
|
1540
|
+
onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel){
|
1541
|
+
if (this.verbose && window && window.console) {
|
1542
|
+
console.log(event_user_permission_channel);
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
|
1688
1546
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
1689
1547
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
1690
1548
|
const untypedMessage = message as any;
|
@@ -1839,76 +1697,6 @@ export class DefaultSocket implements Socket {
|
|
1839
1697
|
return response.check_name_existed_event
|
1840
1698
|
}
|
1841
1699
|
|
1842
|
-
async listClanEmojiByUserId(): Promise<EmojiListedEvent> {
|
1843
|
-
const response = await this.send({emojis_listed_event: {}});
|
1844
|
-
return response.emojis_listed_event
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
async listUserPermissionInChannel(clan_id: string, channel_id: string): Promise<UserPermissionInChannelListEvent> {
|
1848
|
-
const response = await this.send({user_permission_in_channel_list_event : {clan_id: clan_id, channel_id: channel_id }});
|
1849
|
-
return response.user_permission_in_channel_list_event
|
1850
|
-
}
|
1851
|
-
|
1852
|
-
async listRoles(ClanId: string, Limit: number, State: number, Cursor: string): Promise<RoleListEvent> {
|
1853
|
-
const response = await this.send({role_list_event: {ClanId: ClanId, Limit: Limit, State: State, Cursor: Cursor}});
|
1854
|
-
return response.role_list_event
|
1855
|
-
}
|
1856
|
-
|
1857
|
-
async listChannelByUserId(): Promise<ChannelDescListEvent> {
|
1858
|
-
const response = await this.send({channel_desc_list_event: {}});
|
1859
|
-
return response.channel_desc_list_event
|
1860
|
-
}
|
1861
|
-
|
1862
|
-
async listUserClansByUserId(): Promise<AllUserClans> {
|
1863
|
-
const response = await this.send({all_user_clans: {}});
|
1864
|
-
return response.all_user_clans
|
1865
|
-
}
|
1866
|
-
|
1867
|
-
async listUsersAddChannelByChannelId(channelId: string, limit: number): Promise<AllUsersAddChannelEvent> {
|
1868
|
-
const response = await this.send({all_users_add_channel_event: {channel_id: channelId, limit: limit}});
|
1869
|
-
return response.all_users_add_channel_event
|
1870
|
-
}
|
1871
|
-
|
1872
|
-
async hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent> {
|
1873
|
-
const response = await this.send({hashtag_dm_list_event: {user_id: user_id, limit: limit }});
|
1874
|
-
return response.hashtag_dm_list_event
|
1875
|
-
}
|
1876
|
-
|
1877
|
-
async getPermissionByRoleIdChannelId(role_id: string, channel_id: string, user_id: string): Promise<PermissionRoleChannelListEvent> {
|
1878
|
-
const response = await this.send({permission_role_channel_list_event: {role_id: role_id, channel_id: channel_id, user_id: user_id }});
|
1879
|
-
return response.permission_role_channel_list_event
|
1880
|
-
}
|
1881
|
-
|
1882
|
-
async listStickersByUserId(): Promise<StrickerListedEvent> {
|
1883
|
-
const response = await this.send({sticker_listed_event: {}});
|
1884
|
-
return response.sticker_listed_event
|
1885
|
-
}
|
1886
|
-
|
1887
|
-
async getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent> {
|
1888
|
-
const response = await this.send({notification_channel_setting_event: {channel_id: channel_id}})
|
1889
|
-
return response.notification_channel_setting_event
|
1890
|
-
}
|
1891
|
-
|
1892
|
-
async getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent> {
|
1893
|
-
const response = await this.send({notification_category_setting_event: {category_id: category_id}})
|
1894
|
-
return response.notification_category_setting_event
|
1895
|
-
}
|
1896
|
-
|
1897
|
-
async getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent> {
|
1898
|
-
const response = await this.send({notification_clan_setting_event: {clan_id: clan_id}})
|
1899
|
-
return response.notification_clan_setting_event
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
async getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent> {
|
1903
|
-
const response = await this.send({notifi_react_message_event: {channel_id: channel_id}})
|
1904
|
-
return response.notifi_react_message_event
|
1905
|
-
}
|
1906
|
-
|
1907
|
-
async getNotificationChannelCategorySetting(clan_id: string): Promise<NotificationChannelCategorySettingEvent> {
|
1908
|
-
const response = await this.send({notification_channel_category_setting_event: {clan_id : clan_id}})
|
1909
|
-
return response.notification_channel_category_setting_event
|
1910
|
-
}
|
1911
|
-
|
1912
1700
|
private async pingPong(): Promise<void> {
|
1913
1701
|
if (!this.adapter.isOpen()) {
|
1914
1702
|
return;
|