mezon-js 2.7.50 → 2.7.52
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +80 -35
- package/client.ts +13 -0
- package/dist/api.gen.d.ts +9 -2
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +86 -164
- package/dist/mezon-js.esm.mjs +86 -164
- package/dist/socket.d.ts +17 -222
- package/package.json +1 -1
- package/socket.ts +36 -374
package/socket.ts
CHANGED
@@ -14,8 +14,6 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { decode } from 'js-base64'
|
18
|
-
|
19
17
|
import {ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiRpc} from "./api.gen";
|
20
18
|
import {Session} from "./session";
|
21
19
|
import {Notification} from "./client";
|
@@ -293,7 +291,7 @@ interface ChannelMessageUpdate {
|
|
293
291
|
/** The server-assigned channel ID. */
|
294
292
|
channel_id: string,
|
295
293
|
/** The server-assigned channel label. */
|
296
|
-
|
294
|
+
|
297
295
|
/** A unique ID for the chat message to be updated. */
|
298
296
|
message_id: string,
|
299
297
|
/** The content payload. */
|
@@ -464,180 +462,6 @@ export interface StreamPresenceEvent {
|
|
464
462
|
leaves: Presence[];
|
465
463
|
}
|
466
464
|
|
467
|
-
/** Incoming information about a party. */
|
468
|
-
export interface Party {
|
469
|
-
/** The unique party identifier. */
|
470
|
-
party_id : string;
|
471
|
-
/** True, if the party is open to join. */
|
472
|
-
open : boolean;
|
473
|
-
/** The maximum number of party members. */
|
474
|
-
max_size : number;
|
475
|
-
/** The current user in this party, i.e. yourself. */
|
476
|
-
self : Presence;
|
477
|
-
/** The current party leader. */
|
478
|
-
leader : Presence;
|
479
|
-
/** All members currently in the party. */
|
480
|
-
presences : Presence[];
|
481
|
-
}
|
482
|
-
|
483
|
-
/** Create a party. */
|
484
|
-
export interface PartyCreate {
|
485
|
-
party_create: {
|
486
|
-
/** True, if the party is open to join. */
|
487
|
-
open : boolean;
|
488
|
-
/** The maximum number of party members. */
|
489
|
-
max_size : number;
|
490
|
-
}
|
491
|
-
}
|
492
|
-
|
493
|
-
/** Join a party. */
|
494
|
-
interface PartyJoin {
|
495
|
-
party_join: {
|
496
|
-
/** The unique party identifier. */
|
497
|
-
party_id : string;
|
498
|
-
}
|
499
|
-
}
|
500
|
-
|
501
|
-
/** Leave a party. */
|
502
|
-
interface PartyLeave {
|
503
|
-
party_leave: {
|
504
|
-
/** The unique party identifier. */
|
505
|
-
party_id : string;
|
506
|
-
}
|
507
|
-
}
|
508
|
-
|
509
|
-
/** Promote a new party leader. */
|
510
|
-
interface PartyPromote {
|
511
|
-
party_promote: {
|
512
|
-
/** The unique party identifier. */
|
513
|
-
party_id : string;
|
514
|
-
/** The user presence being promoted to leader. */
|
515
|
-
presence : Presence;
|
516
|
-
}
|
517
|
-
}
|
518
|
-
|
519
|
-
/** Announcement of a new party leader. */
|
520
|
-
export interface PartyLeader {
|
521
|
-
/** The unique party identifier. */
|
522
|
-
party_id : string;
|
523
|
-
/** The presence of the new party leader. */
|
524
|
-
presence : Presence;
|
525
|
-
}
|
526
|
-
|
527
|
-
/** Accept a request to join. */
|
528
|
-
interface PartyAccept {
|
529
|
-
party_accept: {
|
530
|
-
/** The unique party identifier. */
|
531
|
-
party_id : string;
|
532
|
-
/** The presence being accepted to join the party. */
|
533
|
-
presence : Presence;
|
534
|
-
}
|
535
|
-
}
|
536
|
-
|
537
|
-
/** End a party, kicking all party members and closing it. */
|
538
|
-
interface PartyClose {
|
539
|
-
party_close: {
|
540
|
-
/** The unique party identifier. */
|
541
|
-
party_id : string;
|
542
|
-
}
|
543
|
-
}
|
544
|
-
|
545
|
-
/** Incoming party data delivered from the server. */
|
546
|
-
export interface PartyData {
|
547
|
-
/** The unique party identifier. */
|
548
|
-
party_id: string;
|
549
|
-
/** A reference to the user presence that sent this data, if any. */
|
550
|
-
presence: Presence;
|
551
|
-
/** The operation code the message was sent with. */
|
552
|
-
op_code: number;
|
553
|
-
/** Data payload, if any. */
|
554
|
-
data: Uint8Array;
|
555
|
-
}
|
556
|
-
|
557
|
-
/** A client to server request to send data to a party. */
|
558
|
-
interface PartyDataSend {
|
559
|
-
party_data_send: {
|
560
|
-
/** The unique party identifier. */
|
561
|
-
party_id : string;
|
562
|
-
/** The operation code the message was sent with. */
|
563
|
-
op_code : number;
|
564
|
-
/** Data payload, if any. */
|
565
|
-
data : string | Uint8Array;
|
566
|
-
}
|
567
|
-
}
|
568
|
-
|
569
|
-
/** Incoming notification for one or more new presences attempting to join the party. */
|
570
|
-
export interface PartyJoinRequest {
|
571
|
-
/** The ID of the party to get a list of join requests for. */
|
572
|
-
party_id : string;
|
573
|
-
/** Presences attempting to join, or who have joined. */
|
574
|
-
presences : Presence[];
|
575
|
-
}
|
576
|
-
|
577
|
-
/** Request a list of pending join requests for a party. */
|
578
|
-
export interface PartyJoinRequestList {
|
579
|
-
party_join_request_list: {
|
580
|
-
/** The ID of the party to get a list of join requests for. */
|
581
|
-
party_id : string;
|
582
|
-
}
|
583
|
-
}
|
584
|
-
|
585
|
-
/** Begin matchmaking as a party. */
|
586
|
-
interface PartyMatchmakerAdd {
|
587
|
-
party_matchmaker_add: {
|
588
|
-
/** The ID of the party to create a matchmaker ticket for. */
|
589
|
-
party_id : string;
|
590
|
-
/** Minimum total user count to match together. */
|
591
|
-
min_count : number;
|
592
|
-
/** Maximum total user count to match together. */
|
593
|
-
max_count : number;
|
594
|
-
/** Filter query used to identify suitable users. */
|
595
|
-
query : string;
|
596
|
-
/** String properties describing the party (e.g. region). */
|
597
|
-
string_properties? : Record<string, string>;
|
598
|
-
/** Numeric properties describing the party (e.g. rank). */
|
599
|
-
numeric_properties? : Record<string, number>;
|
600
|
-
}
|
601
|
-
}
|
602
|
-
|
603
|
-
/** Cancel a party matchmaking process using a ticket. */
|
604
|
-
interface PartyMatchmakerRemove {
|
605
|
-
party_matchmaker_remove: {
|
606
|
-
/** The ID of the party to cancel a matchmaker ticket for. */
|
607
|
-
party_id : string;
|
608
|
-
/** The ticket to remove. */
|
609
|
-
ticket : string;
|
610
|
-
}
|
611
|
-
}
|
612
|
-
|
613
|
-
/** A response from starting a new party matchmaking process. */
|
614
|
-
export interface PartyMatchmakerTicket {
|
615
|
-
/** The ID of the party. */
|
616
|
-
party_id: string;
|
617
|
-
/** The matchmaker ticket created. */
|
618
|
-
ticket: string;
|
619
|
-
}
|
620
|
-
|
621
|
-
/** Presence update for a particular party. */
|
622
|
-
export interface PartyPresenceEvent {
|
623
|
-
/** The ID of the party. */
|
624
|
-
party_id : string;
|
625
|
-
/** The user presences that have just joined the party. */
|
626
|
-
joins : Presence[];
|
627
|
-
/** The user presences that have just left the party. */
|
628
|
-
leaves : Presence[];
|
629
|
-
}
|
630
|
-
|
631
|
-
/** Kick a party member, or decline a request to join. */
|
632
|
-
interface PartyRemove {
|
633
|
-
party_remove: {
|
634
|
-
/** The ID of the party to remove/reject from. */
|
635
|
-
party_id : string;
|
636
|
-
/** The presence to remove/reject. */
|
637
|
-
presence : Presence;
|
638
|
-
}
|
639
|
-
}
|
640
|
-
|
641
465
|
/** Execute an Lua function on the server. */
|
642
466
|
interface Rpc {
|
643
467
|
rpc: ApiRpc;
|
@@ -688,15 +512,6 @@ export interface Socket {
|
|
688
512
|
/** Disconnect from the server. */
|
689
513
|
disconnect(fireDisconnectEvent: boolean): void;
|
690
514
|
|
691
|
-
/** Accept a request to join. */
|
692
|
-
acceptPartyMember(party_id : string, presence : Presence) : Promise<void>;
|
693
|
-
|
694
|
-
/** End a party, kicking all party members and closing it. */
|
695
|
-
closeParty(party_id : string) : Promise<void>;
|
696
|
-
|
697
|
-
/** Create a party. */
|
698
|
-
createParty(open : boolean, max_size : number) : Promise<Party>;
|
699
|
-
|
700
515
|
/** Subscribe to one or more users for their status updates. */
|
701
516
|
followUsers(user_ids: string[]) : Promise<Status>;
|
702
517
|
|
@@ -704,58 +519,37 @@ export interface Socket {
|
|
704
519
|
joinClanChat(clan_id: string) : Promise<ClanJoin>;
|
705
520
|
|
706
521
|
/** Join a chat channel on the server. */
|
707
|
-
joinChat(channel_id: string,
|
708
|
-
|
709
|
-
/** Join a party. */
|
710
|
-
joinParty(party_id: string) : Promise<void>;
|
522
|
+
joinChat(channel_id: string, mode: number, type: number, persistence: boolean, hidden: boolean) : Promise<Channel>;
|
711
523
|
|
712
524
|
/** Leave a chat channel on the server. */
|
713
|
-
leaveChat(channel_id: string,
|
714
|
-
|
715
|
-
/** Leave a multiplayer match on the server. */
|
716
|
-
leaveMatch(matchId : string) : Promise<void>;
|
717
|
-
|
718
|
-
/** Leave a party. */
|
719
|
-
leaveParty(party_id: string) : Promise<void>;
|
720
|
-
|
721
|
-
/** Request a list of pending join requests for a party. */
|
722
|
-
listPartyJoinRequests(party_id : string) : Promise<PartyJoinRequest>;
|
723
|
-
|
724
|
-
/** Promote a new party leader. */
|
725
|
-
promotePartyMember(party_id : string, party_member : Presence) : Promise<PartyLeader>;
|
525
|
+
leaveChat(channel_id: string, mode: number) : Promise<void>;
|
726
526
|
|
727
527
|
/** Remove a chat message from a chat channel on the server. */
|
728
|
-
removeChatMessage(channel_id: string,
|
729
|
-
|
730
|
-
/** Kick a party member, or decline a request to join. */
|
731
|
-
removePartyMember(party_id : string, presence : Presence) : Promise<void>;
|
528
|
+
removeChatMessage(channel_id: string, mode: number, message_id: string) : Promise<ChannelMessageAck>;
|
732
529
|
|
733
530
|
/** Execute an RPC function to the server. */
|
734
531
|
rpc(id?: string, payload?: string, http_key?: string) : Promise<ApiRpc>
|
735
532
|
|
736
|
-
/** Send data to a party. */
|
737
|
-
sendPartyData(party_id : string, opcode : number, data : string | Uint8Array) : Promise<void>;
|
738
|
-
|
739
533
|
/** Unfollow one or more users from their status updates. */
|
740
534
|
unfollowUsers(user_ids : string[]) : Promise<void>;
|
741
535
|
|
742
536
|
/** Update a chat message on a chat channel in the server. */
|
743
|
-
updateChatMessage(channel_id: string,
|
537
|
+
updateChatMessage(channel_id: string, mode: number, message_id : string, content: any) : Promise<ChannelMessageAck>;
|
744
538
|
|
745
539
|
/** Update the status for the current user online. */
|
746
540
|
updateStatus(status? : string) : Promise<void>;
|
747
541
|
|
748
542
|
/** Send a chat message to a chat channel on the server. */
|
749
|
-
writeChatMessage(clan_id: string, channel_id: string,
|
543
|
+
writeChatMessage(clan_id: string, channel_id: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean, notifi_content?: any) : Promise<ChannelMessageAck>;
|
750
544
|
|
751
545
|
/** Send message typing */
|
752
|
-
writeMessageTyping(channel_id: string,
|
546
|
+
writeMessageTyping(channel_id: string, mode: number) : Promise<MessageTypingEvent>;
|
753
547
|
|
754
548
|
/** Send message reaction */
|
755
|
-
writeMessageReaction(id: string, channel_id: string,
|
549
|
+
writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<MessageReactionEvent>;
|
756
550
|
|
757
551
|
/** Send last seen message */
|
758
|
-
writeLastSeenMessage(channel_id: string,
|
552
|
+
writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent>;
|
759
553
|
|
760
554
|
/** send voice joined */
|
761
555
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent>;
|
@@ -772,24 +566,6 @@ export interface Socket {
|
|
772
566
|
/** Receive notifications from the socket. */
|
773
567
|
onnotification: (notification: Notification) => void;
|
774
568
|
|
775
|
-
/** Receive party events. */
|
776
|
-
onparty: (party : Party) => void;
|
777
|
-
|
778
|
-
/** Receive party close events. */
|
779
|
-
onpartyclose: (partyClose : PartyClose) => void;
|
780
|
-
|
781
|
-
/** Receive party data updates. */
|
782
|
-
onpartydata: (partyData: PartyData) => void;
|
783
|
-
|
784
|
-
/** Receive party join requests, if party leader. */
|
785
|
-
onpartyjoinrequest: (partyJoinRequest: PartyJoinRequest) => void;
|
786
|
-
|
787
|
-
/** Receive announcements of a new party leader. */
|
788
|
-
onpartyleader: (partyLeader : PartyLeader) => void;
|
789
|
-
|
790
|
-
/** Receive a presence update for a party. */
|
791
|
-
onpartypresence: (partyPresence : PartyPresenceEvent) => void;
|
792
|
-
|
793
569
|
/** Receive status presence updates. */
|
794
570
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
795
571
|
|
@@ -970,19 +746,6 @@ export class DefaultSocket implements Socket {
|
|
970
746
|
this.onmessagereaction(<MessageReactionEvent>message.message_reaction_event);
|
971
747
|
} else if (message.channel_presence_event) {
|
972
748
|
this.onchannelpresence(<ChannelPresenceEvent>message.channel_presence_event);
|
973
|
-
} else if (message.party_data) {
|
974
|
-
message.party_data.op_code = parseInt(message.party_data.op_code);
|
975
|
-
this.onpartydata(<PartyData>message.party_data);
|
976
|
-
} else if (message.party_close) {
|
977
|
-
this.onpartyclose(<PartyClose>message.party_close);
|
978
|
-
} else if (message.party_join_request) {
|
979
|
-
this.onpartyjoinrequest(message.party_join_request);
|
980
|
-
} else if (message.party_leader) {
|
981
|
-
this.onpartyleader(<PartyLeader> message.party_leader);
|
982
|
-
} else if (message.party_presence_event) {
|
983
|
-
this.onpartypresence(<PartyPresenceEvent> message.party_presence_event);
|
984
|
-
} else if (message.party) {
|
985
|
-
this.onparty(<Party> message.party);
|
986
749
|
} else {
|
987
750
|
if (this.verbose && window && window.console) {
|
988
751
|
console.log("Unrecognized message received: %o", message);
|
@@ -1086,49 +849,6 @@ export class DefaultSocket implements Socket {
|
|
1086
849
|
}
|
1087
850
|
}
|
1088
851
|
|
1089
|
-
onparty(party : Party) {
|
1090
|
-
if (this.verbose && window && window.console) {
|
1091
|
-
console.log(party);
|
1092
|
-
}
|
1093
|
-
}
|
1094
|
-
|
1095
|
-
onpartyclose(close: PartyClose) {
|
1096
|
-
if (this.verbose && window && window.console) {
|
1097
|
-
console.log("Party closed: " + close);
|
1098
|
-
}
|
1099
|
-
}
|
1100
|
-
|
1101
|
-
onpartyjoinrequest(partyJoinRequest : PartyJoinRequest) {
|
1102
|
-
if (this.verbose && window && window.console) {
|
1103
|
-
console.log(partyJoinRequest);
|
1104
|
-
}
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
onpartydata(partyData: PartyData) {
|
1108
|
-
if (this.verbose && window && window.console) {
|
1109
|
-
console.log(partyData);
|
1110
|
-
}
|
1111
|
-
}
|
1112
|
-
|
1113
|
-
onpartyleader(partyLeader: PartyLeader) {
|
1114
|
-
if (this.verbose && window && window.console) {
|
1115
|
-
console.log(partyLeader);
|
1116
|
-
}
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
onpartymatchmakerticket(partyMatched: PartyMatchmakerTicket) {
|
1120
|
-
if (this.verbose && window && window.console) {
|
1121
|
-
console.log(partyMatched);
|
1122
|
-
}
|
1123
|
-
}
|
1124
|
-
|
1125
|
-
|
1126
|
-
onpartypresence(partyPresence: PartyPresenceEvent) {
|
1127
|
-
if (this.verbose && window && window.console) {
|
1128
|
-
console.log(partyPresence);
|
1129
|
-
}
|
1130
|
-
}
|
1131
|
-
|
1132
852
|
onstatuspresence(statusPresence: StatusPresenceEvent) {
|
1133
853
|
if (this.verbose && window && window.console) {
|
1134
854
|
console.log(statusPresence);
|
@@ -1196,9 +916,7 @@ export class DefaultSocket implements Socket {
|
|
1196
916
|
}
|
1197
917
|
|
1198
918
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate |
|
1199
|
-
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent |
|
1200
|
-
PartyJoinRequestList | PartyLeave | PartyMatchmakerAdd | PartyMatchmakerRemove | PartyPromote |
|
1201
|
-
PartyRemove | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
919
|
+
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
1202
920
|
const untypedMessage = message as any;
|
1203
921
|
|
1204
922
|
return new Promise<void>((resolve, reject) => {
|
@@ -1206,57 +924,25 @@ export class DefaultSocket implements Socket {
|
|
1206
924
|
reject("Socket connection has not been established yet.");
|
1207
925
|
}
|
1208
926
|
else {
|
1209
|
-
if (untypedMessage.
|
1210
|
-
|
1211
|
-
|
927
|
+
if (untypedMessage.channel_message_send) {
|
928
|
+
untypedMessage.channel_message_send.content = JSON.stringify(untypedMessage.channel_message_send.content);
|
929
|
+
} else if (untypedMessage.channel_message_update) {
|
930
|
+
untypedMessage.channel_message_update.content = JSON.stringify(untypedMessage.channel_message_update.content);
|
1212
931
|
}
|
1213
|
-
else {
|
1214
932
|
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
const cid = this.generatecid();
|
1222
|
-
this.cIds[cid] = {resolve, reject};
|
1223
|
-
setTimeout(() => {
|
1224
|
-
reject("The socket timed out while waiting for a response.")
|
1225
|
-
}, sendTimeout);
|
933
|
+
const cid = this.generatecid();
|
934
|
+
this.cIds[cid] = {resolve, reject};
|
935
|
+
setTimeout(() => {
|
936
|
+
reject("The socket timed out while waiting for a response.")
|
937
|
+
}, sendTimeout);
|
1226
938
|
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
}
|
1231
|
-
}
|
1232
|
-
|
1233
|
-
if (this.verbose && window && window.console) {
|
1234
|
-
const loggedMessage = { ...untypedMessage };
|
1235
|
-
|
1236
|
-
if (loggedMessage.match_data_send && loggedMessage.match_data_send.data) {
|
1237
|
-
loggedMessage.match_data_send.data = decode(loggedMessage.match_data_send.data);
|
1238
|
-
} else if (loggedMessage.party_data_send && loggedMessage.party_data_send.data) {
|
1239
|
-
loggedMessage.party_data_send.data = decode(loggedMessage.party_data_send.data);
|
1240
|
-
}
|
1241
|
-
|
1242
|
-
console.log("Sent message: %o", JSON.stringify(loggedMessage));
|
939
|
+
/** Add id for promise executor. */
|
940
|
+
untypedMessage.cid = cid;
|
941
|
+
this.adapter.send(untypedMessage);
|
1243
942
|
}
|
1244
943
|
});
|
1245
944
|
}
|
1246
945
|
|
1247
|
-
acceptPartyMember(party_id: string, presence: Presence): Promise<void> {
|
1248
|
-
return this.send({party_accept: {party_id: party_id, presence: presence}});
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
async closeParty(party_id: string): Promise<void> {
|
1252
|
-
return await this.send({party_close: {party_id: party_id}});
|
1253
|
-
}
|
1254
|
-
|
1255
|
-
async createParty(open: boolean, max_size: number): Promise<Party> {
|
1256
|
-
const response = await this.send({party_create: {open: open, max_size: max_size}});
|
1257
|
-
return response.party;
|
1258
|
-
}
|
1259
|
-
|
1260
946
|
async followUsers(userIds : string[]): Promise<Status> {
|
1261
947
|
const response = await this.send({status_follow: {user_ids: userIds}});
|
1262
948
|
return response.status;
|
@@ -1273,12 +959,11 @@ export class DefaultSocket implements Socket {
|
|
1273
959
|
return response.clan_join;
|
1274
960
|
}
|
1275
961
|
|
1276
|
-
async joinChat(channel_id: string,
|
962
|
+
async joinChat(channel_id: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel> {
|
1277
963
|
|
1278
964
|
const response = await this.send({
|
1279
965
|
channel_join: {
|
1280
966
|
channel_id: channel_id,
|
1281
|
-
channel_label: channel_label,
|
1282
967
|
mode: mode,
|
1283
968
|
type: type,
|
1284
969
|
persistence: persistence,
|
@@ -1290,38 +975,15 @@ export class DefaultSocket implements Socket {
|
|
1290
975
|
return response.channel;
|
1291
976
|
}
|
1292
977
|
|
1293
|
-
|
1294
|
-
return
|
1295
|
-
}
|
1296
|
-
|
1297
|
-
leaveChat(channel_id: string, channel_label: string, mode: number): Promise<void> {
|
1298
|
-
return this.send({channel_leave: {channel_id: channel_id, channel_label: channel_label, mode:mode}});
|
1299
|
-
}
|
1300
|
-
|
1301
|
-
leaveMatch(matchId: string): Promise<void> {
|
1302
|
-
return this.send({match_leave: {match_id: matchId}});
|
1303
|
-
}
|
1304
|
-
|
1305
|
-
leaveParty(party_id: string): Promise<void> {
|
1306
|
-
return this.send({party_leave: {party_id: party_id}});
|
1307
|
-
}
|
1308
|
-
|
1309
|
-
async listPartyJoinRequests(party_id: string): Promise<PartyJoinRequest> {
|
1310
|
-
const response = await this.send({party_join_request_list: {party_id: party_id}});
|
1311
|
-
return response.party_join_request;
|
1312
|
-
}
|
1313
|
-
|
1314
|
-
async promotePartyMember(party_id: string, party_member: Presence): Promise<PartyLeader> {
|
1315
|
-
const response = await this.send({party_promote: {party_id: party_id, presence: party_member}});
|
1316
|
-
return response.party_leader;
|
978
|
+
leaveChat(channel_id: string, mode: number): Promise<void> {
|
979
|
+
return this.send({channel_leave: {channel_id: channel_id, mode:mode}});
|
1317
980
|
}
|
1318
981
|
|
1319
|
-
async removeChatMessage(channel_id: string,
|
982
|
+
async removeChatMessage(channel_id: string, mode: number, message_id: string): Promise<ChannelMessageAck> {
|
1320
983
|
const response = await this.send(
|
1321
984
|
{
|
1322
985
|
channel_message_remove: {
|
1323
986
|
channel_id: channel_id,
|
1324
|
-
channel_label: channel_label,
|
1325
987
|
mode: mode,
|
1326
988
|
message_id: message_id
|
1327
989
|
}
|
@@ -1359,8 +1021,8 @@ export class DefaultSocket implements Socket {
|
|
1359
1021
|
return this.send({status_unfollow: {user_ids: user_ids}});
|
1360
1022
|
}
|
1361
1023
|
|
1362
|
-
async updateChatMessage(channel_id: string,
|
1363
|
-
const response = await this.send({channel_message_update: {channel_id: channel_id,
|
1024
|
+
async updateChatMessage(channel_id: string, mode: number, message_id : string, content: any): Promise<ChannelMessageAck> {
|
1025
|
+
const response = await this.send({channel_message_update: {channel_id: channel_id, message_id: message_id, content: content, mode: mode}});
|
1364
1026
|
return response.channel_message_ack;
|
1365
1027
|
}
|
1366
1028
|
|
@@ -1368,23 +1030,23 @@ export class DefaultSocket implements Socket {
|
|
1368
1030
|
return this.send({status_update: {status: status}});
|
1369
1031
|
}
|
1370
1032
|
|
1371
|
-
async writeChatMessage(clan_id: string, channel_id: string,
|
1372
|
-
const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id,
|
1033
|
+
async writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean, notifi_content?: any ): Promise<ChannelMessageAck> {
|
1034
|
+
const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone:mention_everyone, notifi_content:notifi_content}});
|
1373
1035
|
return response.channel_message_ack;
|
1374
1036
|
}
|
1375
1037
|
|
1376
|
-
async writeMessageReaction(id: string, channel_id: string,
|
1377
|
-
const response = await this.send({message_reaction_event: {id: id, channel_id: channel_id,
|
1038
|
+
async writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean) : Promise<MessageReactionEvent> {
|
1039
|
+
const response = await this.send({message_reaction_event: {id: id, channel_id: channel_id, mode: mode, message_id: message_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
|
1378
1040
|
return response.message_reaction_event
|
1379
1041
|
}
|
1380
1042
|
|
1381
|
-
async writeMessageTyping(channel_id: string,
|
1382
|
-
const response = await this.send({message_typing_event: {channel_id: channel_id,
|
1043
|
+
async writeMessageTyping(channel_id: string, mode: number) : Promise<MessageTypingEvent> {
|
1044
|
+
const response = await this.send({message_typing_event: {channel_id: channel_id, mode:mode}});
|
1383
1045
|
return response.message_typing_event
|
1384
1046
|
}
|
1385
1047
|
|
1386
|
-
async writeLastSeenMessage(channel_id: string,
|
1387
|
-
const response = await this.send({last_seen_message_event: {channel_id: channel_id,
|
1048
|
+
async writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent> {
|
1049
|
+
const response = await this.send({last_seen_message_event: {channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp}});
|
1388
1050
|
return response.last_seen_message_event
|
1389
1051
|
}
|
1390
1052
|
|