mezon-js 2.8.22 → 2.8.23
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 +0 -44
- package/dist/api.gen.d.ts +0 -26
- package/dist/mezon-js.cjs.js +4 -4
- package/dist/mezon-js.esm.mjs +4 -4
- package/dist/socket.d.ts +33 -5
- package/package.json +1 -1
- package/socket.ts +68 -18
package/api.gen.ts
CHANGED
@@ -557,26 +557,6 @@ export interface ApiClanEmojiCreateRequest {
|
|
557
557
|
source?: string;
|
558
558
|
}
|
559
559
|
|
560
|
-
/** */
|
561
|
-
export interface ApiClanEmojiList {
|
562
|
-
//
|
563
|
-
emoji_list?: Array<ApiClanEmojiListResponse>;
|
564
|
-
}
|
565
|
-
|
566
|
-
/** */
|
567
|
-
export interface ApiClanEmojiListResponse {
|
568
|
-
//
|
569
|
-
category?: string;
|
570
|
-
//
|
571
|
-
creator_id?: string;
|
572
|
-
//
|
573
|
-
id?: string;
|
574
|
-
//
|
575
|
-
shortname?: string;
|
576
|
-
//
|
577
|
-
src?: string;
|
578
|
-
}
|
579
|
-
|
580
560
|
/** Get clan profile. */
|
581
561
|
export interface ApiClanProfile {
|
582
562
|
//
|
@@ -589,24 +569,6 @@ export interface ApiClanProfile {
|
|
589
569
|
user_id?: string;
|
590
570
|
}
|
591
571
|
|
592
|
-
/** */
|
593
|
-
export interface ApiClanSticker {
|
594
|
-
//
|
595
|
-
category?: string;
|
596
|
-
//
|
597
|
-
clan_id?: string;
|
598
|
-
//
|
599
|
-
create_time?: string;
|
600
|
-
//
|
601
|
-
creator_id?: string;
|
602
|
-
//
|
603
|
-
id?: string;
|
604
|
-
//
|
605
|
-
shortname?: string;
|
606
|
-
//
|
607
|
-
source?: string;
|
608
|
-
}
|
609
|
-
|
610
572
|
/** */
|
611
573
|
export interface ApiClanStickerAddRequest {
|
612
574
|
//
|
@@ -621,12 +583,6 @@ export interface ApiClanStickerAddRequest {
|
|
621
583
|
source?: string;
|
622
584
|
}
|
623
585
|
|
624
|
-
/** */
|
625
|
-
export interface ApiClanStickerListByClanIdResponse {
|
626
|
-
//
|
627
|
-
stickers?: Array<ApiClanSticker>;
|
628
|
-
}
|
629
|
-
|
630
586
|
/** A list of users belonging to a clan, along with their role. */
|
631
587
|
export interface ApiClanUserList {
|
632
588
|
//
|
package/dist/api.gen.d.ts
CHANGED
@@ -316,18 +316,6 @@ export interface ApiClanEmojiCreateRequest {
|
|
316
316
|
shortname?: string;
|
317
317
|
source?: string;
|
318
318
|
}
|
319
|
-
/** */
|
320
|
-
export interface ApiClanEmojiList {
|
321
|
-
emoji_list?: Array<ApiClanEmojiListResponse>;
|
322
|
-
}
|
323
|
-
/** */
|
324
|
-
export interface ApiClanEmojiListResponse {
|
325
|
-
category?: string;
|
326
|
-
creator_id?: string;
|
327
|
-
id?: string;
|
328
|
-
shortname?: string;
|
329
|
-
src?: string;
|
330
|
-
}
|
331
319
|
/** Get clan profile. */
|
332
320
|
export interface ApiClanProfile {
|
333
321
|
avartar?: string;
|
@@ -336,16 +324,6 @@ export interface ApiClanProfile {
|
|
336
324
|
user_id?: string;
|
337
325
|
}
|
338
326
|
/** */
|
339
|
-
export interface ApiClanSticker {
|
340
|
-
category?: string;
|
341
|
-
clan_id?: string;
|
342
|
-
create_time?: string;
|
343
|
-
creator_id?: string;
|
344
|
-
id?: string;
|
345
|
-
shortname?: string;
|
346
|
-
source?: string;
|
347
|
-
}
|
348
|
-
/** */
|
349
327
|
export interface ApiClanStickerAddRequest {
|
350
328
|
category?: string;
|
351
329
|
clan_id?: string;
|
@@ -353,10 +331,6 @@ export interface ApiClanStickerAddRequest {
|
|
353
331
|
shortname?: string;
|
354
332
|
source?: string;
|
355
333
|
}
|
356
|
-
/** */
|
357
|
-
export interface ApiClanStickerListByClanIdResponse {
|
358
|
-
stickers?: Array<ApiClanSticker>;
|
359
|
-
}
|
360
334
|
/** A list of users belonging to a clan, along with their role. */
|
361
335
|
export interface ApiClanUserList {
|
362
336
|
clan_id?: string;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -5158,14 +5158,14 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5158
5158
|
}
|
5159
5159
|
listClanEmojiByClanId(clan_id) {
|
5160
5160
|
return __async(this, null, function* () {
|
5161
|
-
const response = yield this.send({
|
5162
|
-
return response.
|
5161
|
+
const response = yield this.send({ emojis_listed_event: { clan_id } });
|
5162
|
+
return response.emojis_listed_event;
|
5163
5163
|
});
|
5164
5164
|
}
|
5165
5165
|
listClanStickersByClanId(clan_id) {
|
5166
5166
|
return __async(this, null, function* () {
|
5167
|
-
const response = yield this.send({
|
5168
|
-
return response.
|
5167
|
+
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
5168
|
+
return response.sticker_listed_event;
|
5169
5169
|
});
|
5170
5170
|
}
|
5171
5171
|
pingPong() {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -5129,14 +5129,14 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5129
5129
|
}
|
5130
5130
|
listClanEmojiByClanId(clan_id) {
|
5131
5131
|
return __async(this, null, function* () {
|
5132
|
-
const response = yield this.send({
|
5133
|
-
return response.
|
5132
|
+
const response = yield this.send({ emojis_listed_event: { clan_id } });
|
5133
|
+
return response.emojis_listed_event;
|
5134
5134
|
});
|
5135
5135
|
}
|
5136
5136
|
listClanStickersByClanId(clan_id) {
|
5137
5137
|
return __async(this, null, function* () {
|
5138
|
-
const response = yield this.send({
|
5139
|
-
return response.
|
5138
|
+
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
5139
|
+
return response.sticker_listed_event;
|
5140
5140
|
});
|
5141
5141
|
}
|
5142
5142
|
pingPong() {
|
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 { ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -441,6 +441,34 @@ interface StatusUpdate {
|
|
441
441
|
export interface ClanNameExistedEvent {
|
442
442
|
clan_name: string;
|
443
443
|
}
|
444
|
+
/** */
|
445
|
+
export interface StrickerListedEvent {
|
446
|
+
clan_id: string;
|
447
|
+
stickers?: Array<ClanSticker>;
|
448
|
+
}
|
449
|
+
/** */
|
450
|
+
export interface ClanSticker {
|
451
|
+
category?: string;
|
452
|
+
clan_id?: string;
|
453
|
+
create_time?: string;
|
454
|
+
creator_id?: string;
|
455
|
+
id?: string;
|
456
|
+
shortname?: string;
|
457
|
+
source?: string;
|
458
|
+
}
|
459
|
+
/** */
|
460
|
+
export interface EmojiListedEvent {
|
461
|
+
clan_id: string;
|
462
|
+
emoji_list?: Array<ClanEmoji>;
|
463
|
+
}
|
464
|
+
/** */
|
465
|
+
export interface ClanEmoji {
|
466
|
+
category?: string;
|
467
|
+
creator_id?: string;
|
468
|
+
id?: string;
|
469
|
+
shortname?: string;
|
470
|
+
src?: string;
|
471
|
+
}
|
444
472
|
/** A socket connection to Mezon server. */
|
445
473
|
export interface Socket {
|
446
474
|
/** Connection is Open */
|
@@ -533,8 +561,8 @@ export interface Socket {
|
|
533
561
|
setHeartbeatTimeoutMs(ms: number): void;
|
534
562
|
getHeartbeatTimeoutMs(): number;
|
535
563
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
536
|
-
listClanEmojiByClanId(clan_id: string): Promise<
|
537
|
-
listClanStickersByClanId(clan_id: string): Promise<
|
564
|
+
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
565
|
+
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
538
566
|
}
|
539
567
|
/** Reports an error received from a socket message. */
|
540
568
|
export interface SocketError {
|
@@ -611,8 +639,8 @@ export declare class DefaultSocket implements Socket {
|
|
611
639
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
612
640
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
613
641
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
614
|
-
listClanEmojiByClanId(clan_id: string): Promise<
|
615
|
-
listClanStickersByClanId(clan_id: string): Promise<
|
642
|
+
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
643
|
+
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
616
644
|
private pingPong;
|
617
645
|
}
|
618
646
|
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 {ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
18
18
|
import {Session} from "./session";
|
19
19
|
import {Notification} from "./client";
|
20
20
|
import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
|
@@ -623,6 +623,56 @@ interface StatusUpdate {
|
|
623
623
|
export interface ClanNameExistedEvent {
|
624
624
|
clan_name: string;
|
625
625
|
}
|
626
|
+
|
627
|
+
|
628
|
+
/** */
|
629
|
+
export interface StrickerListedEvent {
|
630
|
+
// clan id
|
631
|
+
clan_id: string;
|
632
|
+
// sticker data
|
633
|
+
stickers?: Array<ClanSticker>;
|
634
|
+
}
|
635
|
+
|
636
|
+
/** */
|
637
|
+
export interface ClanSticker {
|
638
|
+
//
|
639
|
+
category?: string;
|
640
|
+
//
|
641
|
+
clan_id?: string;
|
642
|
+
//
|
643
|
+
create_time?: string;
|
644
|
+
//
|
645
|
+
creator_id?: string;
|
646
|
+
//
|
647
|
+
id?: string;
|
648
|
+
//
|
649
|
+
shortname?: string;
|
650
|
+
//
|
651
|
+
source?: string;
|
652
|
+
}
|
653
|
+
|
654
|
+
/** */
|
655
|
+
export interface EmojiListedEvent {
|
656
|
+
// clan id
|
657
|
+
clan_id: string;
|
658
|
+
// emoji data
|
659
|
+
emoji_list?: Array<ClanEmoji>;
|
660
|
+
}
|
661
|
+
|
662
|
+
/** */
|
663
|
+
export interface ClanEmoji {
|
664
|
+
//
|
665
|
+
category?: string;
|
666
|
+
//
|
667
|
+
creator_id?: string;
|
668
|
+
//
|
669
|
+
id?: string;
|
670
|
+
//
|
671
|
+
shortname?: string;
|
672
|
+
//
|
673
|
+
src?: string;
|
674
|
+
}
|
675
|
+
|
626
676
|
/** A socket connection to Mezon server. */
|
627
677
|
export interface Socket {
|
628
678
|
/** Connection is Open */
|
@@ -775,9 +825,9 @@ export interface Socket {
|
|
775
825
|
|
776
826
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
777
827
|
|
778
|
-
listClanEmojiByClanId(clan_id: string): Promise<
|
828
|
+
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
779
829
|
|
780
|
-
listClanStickersByClanId(clan_id: string): Promise<
|
830
|
+
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
781
831
|
}
|
782
832
|
|
783
833
|
/** Reports an error received from a socket message. */
|
@@ -1241,7 +1291,7 @@ export class DefaultSocket implements Socket {
|
|
1241
1291
|
}});
|
1242
1292
|
}
|
1243
1293
|
|
1244
|
-
async rpc(id?: string, payload?: string, http_key?: string)
|
1294
|
+
async rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc> {
|
1245
1295
|
const response = await this.send(
|
1246
1296
|
{
|
1247
1297
|
rpc: {
|
@@ -1276,37 +1326,37 @@ export class DefaultSocket implements Socket {
|
|
1276
1326
|
return response.channel_message_ack;
|
1277
1327
|
}
|
1278
1328
|
|
1279
|
-
async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean)
|
1329
|
+
async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent> {
|
1280
1330
|
const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
|
1281
1331
|
return response.message_reaction_event
|
1282
1332
|
}
|
1283
1333
|
|
1284
|
-
async writeMessageTyping(clan_id: string, channel_id: string, mode: number)
|
1334
|
+
async writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent> {
|
1285
1335
|
const response = await this.send({message_typing_event: {clan_id: clan_id, channel_id: channel_id, mode:mode}});
|
1286
1336
|
return response.message_typing_event
|
1287
1337
|
}
|
1288
1338
|
|
1289
|
-
async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string)
|
1339
|
+
async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent> {
|
1290
1340
|
const response = await this.send({last_seen_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp}});
|
1291
1341
|
return response.last_seen_message_event
|
1292
1342
|
}
|
1293
1343
|
|
1294
|
-
async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number)
|
1344
|
+
async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number): Promise<LastPinMessageEvent> {
|
1295
1345
|
const response = await this.send({last_pin_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp, operation: operation}});
|
1296
1346
|
return response.last_pin_message_event
|
1297
1347
|
}
|
1298
1348
|
|
1299
|
-
async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string)
|
1349
|
+
async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent> {
|
1300
1350
|
const response = await this.send({voice_joined_event: {clan_id: clanId, clan_name: clanName, id: id, participant: participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot}});
|
1301
1351
|
return response.voice_joined_event
|
1302
1352
|
}
|
1303
1353
|
|
1304
|
-
async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string)
|
1354
|
+
async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent> {
|
1305
1355
|
const response = await this.send({voice_leaved_event: {id: id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId}});
|
1306
1356
|
return response.voice_leaved_event
|
1307
1357
|
}
|
1308
1358
|
|
1309
|
-
async writeCustomStatus(clan_id: string, status: string)
|
1359
|
+
async writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent> {
|
1310
1360
|
const response = await this.send({custom_status_event: {clan_id: clan_id, status: status}});
|
1311
1361
|
return response.custom_status_event
|
1312
1362
|
}
|
@@ -1316,17 +1366,17 @@ export class DefaultSocket implements Socket {
|
|
1316
1366
|
return response.clan_name_existed_event
|
1317
1367
|
}
|
1318
1368
|
|
1319
|
-
async listClanEmojiByClanId(clan_id: string): Promise<
|
1320
|
-
const response = await this.send({
|
1321
|
-
return response.
|
1369
|
+
async listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent> {
|
1370
|
+
const response = await this.send({emojis_listed_event: {clan_id: clan_id}});
|
1371
|
+
return response.emojis_listed_event
|
1322
1372
|
}
|
1323
1373
|
|
1324
|
-
async listClanStickersByClanId(clan_id: string): Promise<
|
1325
|
-
const response = await this.send({
|
1326
|
-
return response.
|
1374
|
+
async listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent> {
|
1375
|
+
const response = await this.send({sticker_listed_event: {clan_id: clan_id}});
|
1376
|
+
return response.sticker_listed_event
|
1327
1377
|
}
|
1328
1378
|
|
1329
|
-
private async pingPong()
|
1379
|
+
private async pingPong(): Promise<void> {
|
1330
1380
|
if (!this.adapter.isOpen()) {
|
1331
1381
|
return;
|
1332
1382
|
}
|