mezon-sdk 2.7.2 → 2.7.3
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.ts +59 -0
- package/client.ts +230 -19
- package/dist/api.d.ts +15 -0
- package/dist/client.d.ts +123 -10
- package/dist/mezon-sdk.cjs.js +62 -19
- package/dist/mezon-sdk.esm.mjs +62 -19
- package/dist/mezon-sdk.iife.js +62 -19
- package/dist/mezon-sdk.umd.js +101 -47
- package/dist/socket.d.ts +3 -105
- package/package.json +1 -1
- package/socket.ts +5 -186
package/socket.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ChannelMessage } from "./client";
|
|
17
18
|
import {Session} from "./session";
|
|
18
19
|
import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
|
|
19
20
|
|
|
@@ -86,186 +87,6 @@ interface ChannelLeave {
|
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
/** A message sent on a channel. */
|
|
91
|
-
export interface ChannelMessage {
|
|
92
|
-
//The unique ID of this message.
|
|
93
|
-
id: string;
|
|
94
|
-
//
|
|
95
|
-
avatar?: string;
|
|
96
|
-
//The channel this message belongs to.
|
|
97
|
-
channel_id: string;
|
|
98
|
-
//The name of the chat room, or an empty string if this message was not sent through a chat room.
|
|
99
|
-
channel_label: string;
|
|
100
|
-
//The clan this message belong to.
|
|
101
|
-
clan_id?: string;
|
|
102
|
-
//The code representing a message type or category.
|
|
103
|
-
code: number;
|
|
104
|
-
//The content payload.
|
|
105
|
-
content: string;
|
|
106
|
-
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
|
|
107
|
-
create_time: string;
|
|
108
|
-
//
|
|
109
|
-
reactions?: Array<ApiMessageReaction>;
|
|
110
|
-
//
|
|
111
|
-
mentions?: Array<ApiMessageMention>;
|
|
112
|
-
//
|
|
113
|
-
attachments?: Array<ApiMessageAttachment>;
|
|
114
|
-
//
|
|
115
|
-
references?: Array<ApiMessageRef>;
|
|
116
|
-
//
|
|
117
|
-
referenced_message?: ChannelMessage;
|
|
118
|
-
//True if the message was persisted to the channel's history, false otherwise.
|
|
119
|
-
persistent?: boolean;
|
|
120
|
-
//Message sender, usually a user ID.
|
|
121
|
-
sender_id: string;
|
|
122
|
-
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated.
|
|
123
|
-
update_time?: string;
|
|
124
|
-
//The ID of the first DM user, or an empty string if this message was not sent through a DM chat.
|
|
125
|
-
clan_logo?: string;
|
|
126
|
-
//The ID of the second DM user, or an empty string if this message was not sent through a DM chat.
|
|
127
|
-
category_name?: string;
|
|
128
|
-
//The username of the message sender, if any.
|
|
129
|
-
username?: string;
|
|
130
|
-
// The clan nick name
|
|
131
|
-
clan_nick?: string;
|
|
132
|
-
// The clan avatar
|
|
133
|
-
clan_avatar?: string;
|
|
134
|
-
//
|
|
135
|
-
display_name?: string;
|
|
136
|
-
//
|
|
137
|
-
create_time_ms?: number;
|
|
138
|
-
//
|
|
139
|
-
update_time_ms?: number;
|
|
140
|
-
//
|
|
141
|
-
mode?: number;
|
|
142
|
-
//
|
|
143
|
-
message_id?: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/** */
|
|
148
|
-
export interface ApiMessageAttachment {
|
|
149
|
-
//
|
|
150
|
-
filename?: string;
|
|
151
|
-
//
|
|
152
|
-
filetype?: string;
|
|
153
|
-
//
|
|
154
|
-
height?: number;
|
|
155
|
-
//
|
|
156
|
-
size?: number;
|
|
157
|
-
//
|
|
158
|
-
url?: string;
|
|
159
|
-
//
|
|
160
|
-
width?: number;
|
|
161
|
-
/** The channel this message belongs to. */
|
|
162
|
-
channel_id?:string;
|
|
163
|
-
// The mode
|
|
164
|
-
mode?: number;
|
|
165
|
-
// The channel label
|
|
166
|
-
channel_label?: string;
|
|
167
|
-
/** The message that user react */
|
|
168
|
-
message_id?: string;
|
|
169
|
-
/** Message sender, usually a user ID. */
|
|
170
|
-
sender_id?: string;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/** */
|
|
174
|
-
export interface ApiMessageDeleted {
|
|
175
|
-
//
|
|
176
|
-
deletor?: string;
|
|
177
|
-
//
|
|
178
|
-
message_id?: string;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** */
|
|
182
|
-
export interface ApiMessageMention {
|
|
183
|
-
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
|
|
184
|
-
create_time?: string;
|
|
185
|
-
//
|
|
186
|
-
id?: string;
|
|
187
|
-
//
|
|
188
|
-
user_id?: string;
|
|
189
|
-
//
|
|
190
|
-
username?: string;
|
|
191
|
-
// role id
|
|
192
|
-
role_id?: string;
|
|
193
|
-
// role name
|
|
194
|
-
rolename?: string;
|
|
195
|
-
// start position
|
|
196
|
-
s?: number;
|
|
197
|
-
// end position
|
|
198
|
-
e?: number;
|
|
199
|
-
/** The channel this message belongs to. */
|
|
200
|
-
channel_id?:string;
|
|
201
|
-
// The mode
|
|
202
|
-
mode?: number;
|
|
203
|
-
// The channel label
|
|
204
|
-
channel_label?: string;
|
|
205
|
-
/** The message that user react */
|
|
206
|
-
message_id?: string;
|
|
207
|
-
/** Message sender, usually a user ID. */
|
|
208
|
-
sender_id?: string;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/** */
|
|
212
|
-
export interface ApiMessageReaction {
|
|
213
|
-
//
|
|
214
|
-
action?: boolean;
|
|
215
|
-
//
|
|
216
|
-
emoji_id: string;
|
|
217
|
-
//
|
|
218
|
-
emoji: string;
|
|
219
|
-
//
|
|
220
|
-
id?: string;
|
|
221
|
-
//
|
|
222
|
-
sender_id?: string;
|
|
223
|
-
//
|
|
224
|
-
sender_name?: string;
|
|
225
|
-
//
|
|
226
|
-
sender_avatar?: string;
|
|
227
|
-
// count of emoji
|
|
228
|
-
count: number;
|
|
229
|
-
/** The channel this message belongs to. */
|
|
230
|
-
channel_id:string;
|
|
231
|
-
// The mode
|
|
232
|
-
mode: number;
|
|
233
|
-
// The channel label
|
|
234
|
-
channel_label: string;
|
|
235
|
-
/** The message that user react */
|
|
236
|
-
message_id: string;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/** */
|
|
240
|
-
export interface ApiMessageRef {
|
|
241
|
-
//
|
|
242
|
-
message_id?: string;
|
|
243
|
-
//
|
|
244
|
-
message_ref_id?: string;
|
|
245
|
-
//
|
|
246
|
-
ref_type?: number;
|
|
247
|
-
//
|
|
248
|
-
message_sender_id?: string;
|
|
249
|
-
// original message sendre username
|
|
250
|
-
message_sender_username?: string;
|
|
251
|
-
// original message sender avatar
|
|
252
|
-
mesages_sender_avatar?: string;
|
|
253
|
-
// original sender clan nick name
|
|
254
|
-
message_sender_clan_nick?: string;
|
|
255
|
-
// original sender display name
|
|
256
|
-
message_sender_display_name?:string;
|
|
257
|
-
//
|
|
258
|
-
content?:string;
|
|
259
|
-
//
|
|
260
|
-
has_attachment: boolean;
|
|
261
|
-
/** The channel this message belongs to. */
|
|
262
|
-
channel_id:string;
|
|
263
|
-
// The mode
|
|
264
|
-
mode: number;
|
|
265
|
-
// The channel label
|
|
266
|
-
channel_label: string;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
90
|
/** UserChannelAddedEvent */
|
|
270
91
|
export interface UserChannelAddedEvent {
|
|
271
92
|
// the channel id
|
|
@@ -845,6 +666,9 @@ export interface Socket {
|
|
|
845
666
|
/** Disconnect from the server. */
|
|
846
667
|
disconnect(fireDisconnectEvent: boolean): void;
|
|
847
668
|
|
|
669
|
+
/** Join clan chat */
|
|
670
|
+
joinClanChat(clan_id: string) : Promise<ClanJoin>;
|
|
671
|
+
|
|
848
672
|
/** Join a chat channel on the server. */
|
|
849
673
|
joinChat(clan_id: string, channel_id: string, channel_type: number) : Promise<Channel>;
|
|
850
674
|
|
|
@@ -1329,13 +1153,8 @@ export class DefaultSocket implements Socket {
|
|
|
1329
1153
|
});
|
|
1330
1154
|
}
|
|
1331
1155
|
|
|
1332
|
-
async followUsers(userIds : string[]): Promise<Status> {
|
|
1333
|
-
const response = await this.send({status_follow: {user_ids: userIds}});
|
|
1334
|
-
return response.status;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
1156
|
async joinClanChat(clan_id: string): Promise<ClanJoin> {
|
|
1338
|
-
|
|
1157
|
+
|
|
1339
1158
|
const response = await this.send({
|
|
1340
1159
|
clan_join: {
|
|
1341
1160
|
clan_id: clan_id,
|