mezon-sdk 2.7.2 → 2.7.4

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/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
@@ -669,12 +490,12 @@ interface StatusUpdate {
669
490
  /** Status string to set, if not present the user will appear offline. */
670
491
  status_update: {status?: string;};
671
492
  }
493
+
672
494
  export interface ClanNameExistedEvent {
673
495
  clan_name: string;
674
496
  exist: boolean;
675
497
  }
676
498
 
677
-
678
499
  /** */
679
500
  export interface StrickerListedEvent {
680
501
  // clan 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,
package/dist/api.d.ts DELETED
@@ -1,53 +0,0 @@
1
- /** A user's session used to authenticate messages. */
2
- export interface ApiSession {
3
- created?: boolean;
4
- refresh_token?: string;
5
- token?: string;
6
- }
7
- /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
8
- export interface ApiAuthenticateLogoutRequest {
9
- refresh_token?: string;
10
- token?: string;
11
- }
12
- /** Authenticate against the server with a refresh token. */
13
- export interface ApiAuthenticateRefreshRequest {
14
- refresh_token?: string;
15
- }
16
- /** Authenticate against the server with a device ID. */
17
- export interface ApiAuthenticateRequest {
18
- account?: ApiAccountApp;
19
- }
20
- /** Send a app token to the server. Used with authenticate/link/unlink. */
21
- export interface ApiAccountApp {
22
- appid?: string;
23
- appname?: string;
24
- token?: string;
25
- vars?: Record<string, string>;
26
- }
27
- /** The request to update the status of a message. */
28
- export interface ApiUpdateMessageRequest {
29
- consume_time?: string;
30
- id?: string;
31
- read_time?: string;
32
- }
33
- export declare class MezonApi {
34
- readonly apiKey: string;
35
- readonly basePath: string;
36
- readonly timeoutMs: number;
37
- constructor(apiKey: string, basePath: string, timeoutMs: number);
38
- /** A healthcheck which load balancers can use to check the service. */
39
- mezonHealthcheck(bearerToken: string, options?: any): Promise<any>;
40
- /** A readycheck which load balancers can use to check the service. */
41
- mezonReadycheck(bearerToken: string, options?: any): Promise<any>;
42
- /** Authenticate a app with a token against the server. */
43
- mezonAuthenticate(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateRequest, options?: any): Promise<ApiSession>;
44
- /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
45
- mezonAuthenticateLogout(bearerToken: string, body: ApiAuthenticateLogoutRequest, options?: any): Promise<any>;
46
- /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
47
- mezonAuthenticateRefresh(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateRefreshRequest, options?: any): Promise<ApiSession>;
48
- /** Deletes a message for an identity. */
49
- mezonDeleteMessage(bearerToken: string, id: string, options?: any): Promise<any>;
50
- /** Updates a message for an identity. */
51
- mezonUpdateMessage(bearerToken: string, id: string, body: ApiUpdateMessageRequest, options?: any): Promise<any>;
52
- buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
53
- }
package/dist/client.d.ts DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * Copyright 2020 The Nakama Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Session } from "./session";
17
- import { ApiMessageReaction, ChannelCreatedEvent, ChannelDeletedEvent, ChannelMessage, ChannelUpdatedEvent, Socket, UserChannelAddedEvent, UserChannelRemovedEvent, UserClanRemovedEvent, VoiceJoinedEvent } from "./socket";
18
- import { WebSocketAdapter } from "./web_socket_adapter";
19
- /** A client for Mezon server. */
20
- export declare class Client {
21
- readonly apiKey: string;
22
- readonly host: string;
23
- readonly port: string;
24
- readonly useSSL: boolean;
25
- readonly timeout: number;
26
- readonly autoRefreshSession: boolean;
27
- /** The expired timespan used to check session lifetime. */
28
- expiredTimespanMs: number;
29
- /** The low level API client for Nakama server. */
30
- private readonly apiClient;
31
- constructor(apiKey?: string, host?: string, port?: string, useSSL?: boolean, timeout?: number, autoRefreshSession?: boolean);
32
- /** Authenticate a user with an ID against the server. */
33
- authenticate(): Promise<string | undefined>;
34
- /** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
35
- sessionRefresh(session: Session): Promise<Session>;
36
- /** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
37
- logout(session: Session): Promise<boolean>;
38
- deleteMessage(session: Session, id: string): Promise<boolean>;
39
- updateMessage(session: Session, id: string, consume_time?: string, read_time?: string): Promise<boolean>;
40
- /** A socket created with the client's configuration. */
41
- createSocket(useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number): Socket;
42
- onerror(evt: Event): void;
43
- onmessagereaction(messagereaction: ApiMessageReaction): void;
44
- onchannelmessage(channelMessage: ChannelMessage): void;
45
- ondisconnect(e: Event): void;
46
- onuserchanneladded(user: UserChannelAddedEvent): void;
47
- onuserchannelremoved(user: UserChannelRemovedEvent): void;
48
- onuserclanremoved(user: UserClanRemovedEvent): void;
49
- onchannelcreated(channelCreated: ChannelCreatedEvent): void;
50
- onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
51
- onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
52
- onheartbeattimeout(): void;
53
- /** Receive clan evnet. */
54
- onMessage: (channelMessage: ChannelMessage) => void;
55
- onClanMemberUpdate: (member_id: Array<string>, leave: boolean) => void;
56
- onMessageDelete: (channelMessage: ChannelMessage) => void;
57
- onMessageReactionAdd: (messageReactionEvent: ApiMessageReaction) => void;
58
- onVoiceStateUpdate: (voiceState: VoiceJoinedEvent) => void;
59
- onMessageReactionRemove: (messageReactionEvent: ApiMessageReaction) => void;
60
- }
package/dist/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright 2020 The Nakama Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import "whatwg-fetch";
17
- export * from "./client";
18
- export * from "./session";