mezon-sdk 2.7.3 → 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/client.ts +80 -1
- package/package.json +1 -1
- package/socket.ts +1 -1
- package/dist/api.d.ts +0 -68
- package/dist/client.d.ts +0 -173
- package/dist/index.d.ts +0 -18
- package/dist/mezon-sdk.esm.mjs +0 -10326
- package/dist/mezon-sdk.iife.js +0 -10348
- package/dist/mezon-sdk.umd.js +0 -11033
- package/dist/session.d.ts +0 -52
- package/dist/socket.d.ts +0 -594
- package/dist/utils.d.ts +0 -3
- package/dist/web_socket_adapter.d.ts +0 -83
package/client.ts
CHANGED
|
@@ -27,6 +27,42 @@ const DEFAULT_TIMEOUT_MS = 7000;
|
|
|
27
27
|
const DEFAULT_EXPIRED_TIMESPAN_MS = 5 * 60 * 1000;
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
/** */
|
|
31
|
+
export interface ClanDesc {
|
|
32
|
+
//
|
|
33
|
+
banner?: string;
|
|
34
|
+
//
|
|
35
|
+
clan_id?: string;
|
|
36
|
+
//
|
|
37
|
+
clan_name?: string;
|
|
38
|
+
//
|
|
39
|
+
creator_id?: string;
|
|
40
|
+
//
|
|
41
|
+
logo?: string;
|
|
42
|
+
//
|
|
43
|
+
status?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** */
|
|
47
|
+
export interface ChannelDescription {
|
|
48
|
+
// The clan of this channel
|
|
49
|
+
clan_id?: string;
|
|
50
|
+
// The channel this message belongs to.
|
|
51
|
+
channel_id?: string;
|
|
52
|
+
// The channel type.
|
|
53
|
+
type?: number;
|
|
54
|
+
// The channel lable
|
|
55
|
+
channel_label?: string;
|
|
56
|
+
// The channel private
|
|
57
|
+
channel_private?: number;
|
|
58
|
+
// meeting code
|
|
59
|
+
meeting_code?: string;
|
|
60
|
+
//
|
|
61
|
+
clan_name?: string;
|
|
62
|
+
//
|
|
63
|
+
parrent_id?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
30
66
|
/** */
|
|
31
67
|
export interface ApiMessageAttachment {
|
|
32
68
|
//
|
|
@@ -81,7 +117,7 @@ export interface ApiMessageMention {
|
|
|
81
117
|
e?: number;
|
|
82
118
|
/** The channel this message belongs to. */
|
|
83
119
|
channel_id?:string;
|
|
84
|
-
// The mode
|
|
120
|
+
// The mode
|
|
85
121
|
mode?: number;
|
|
86
122
|
// The channel label
|
|
87
123
|
channel_label?: string;
|
|
@@ -205,6 +241,49 @@ export interface ChannelMessage {
|
|
|
205
241
|
message_id?: string;
|
|
206
242
|
}
|
|
207
243
|
|
|
244
|
+
|
|
245
|
+
/** A user in the server. */
|
|
246
|
+
export interface ApiUser {
|
|
247
|
+
//
|
|
248
|
+
about_me?: string;
|
|
249
|
+
//The Apple Sign In ID in the user's account.
|
|
250
|
+
apple_id?: string;
|
|
251
|
+
//A URL for an avatar image.
|
|
252
|
+
avatar_url?: string;
|
|
253
|
+
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
|
|
254
|
+
create_time?: string;
|
|
255
|
+
//The display name of the user.
|
|
256
|
+
display_name?: string;
|
|
257
|
+
//Number of related edges to this user.
|
|
258
|
+
edge_count?: number;
|
|
259
|
+
//The Facebook id in the user's account.
|
|
260
|
+
facebook_id?: string;
|
|
261
|
+
//The Apple Game Center in of the user's account.
|
|
262
|
+
gamecenter_id?: string;
|
|
263
|
+
//The Google id in the user's account.
|
|
264
|
+
google_id?: string;
|
|
265
|
+
//The id of the user's account.
|
|
266
|
+
id?: string;
|
|
267
|
+
//
|
|
268
|
+
join_time?: string;
|
|
269
|
+
//The language expected to be a tag which follows the BCP-47 spec.
|
|
270
|
+
lang_tag?: string;
|
|
271
|
+
//The location set by the user.
|
|
272
|
+
location?: string;
|
|
273
|
+
//Additional information stored as a JSON object.
|
|
274
|
+
metadata?: string;
|
|
275
|
+
//Indicates whether the user is currently online.
|
|
276
|
+
online?: boolean;
|
|
277
|
+
//The Steam id in the user's account.
|
|
278
|
+
steam_id?: string;
|
|
279
|
+
//The timezone set by the user.
|
|
280
|
+
timezone?: string;
|
|
281
|
+
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was last updated.
|
|
282
|
+
update_time?: string;
|
|
283
|
+
//The username of the user's account.
|
|
284
|
+
username?: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
208
287
|
export interface Client {
|
|
209
288
|
authenticate: () => Promise<string>;
|
|
210
289
|
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -490,12 +490,12 @@ interface StatusUpdate {
|
|
|
490
490
|
/** Status string to set, if not present the user will appear offline. */
|
|
491
491
|
status_update: {status?: string;};
|
|
492
492
|
}
|
|
493
|
+
|
|
493
494
|
export interface ClanNameExistedEvent {
|
|
494
495
|
clan_name: string;
|
|
495
496
|
exist: boolean;
|
|
496
497
|
}
|
|
497
498
|
|
|
498
|
-
|
|
499
499
|
/** */
|
|
500
500
|
export interface StrickerListedEvent {
|
|
501
501
|
// clan id
|
package/dist/api.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/** */
|
|
2
|
-
export interface ApiClanDescList {
|
|
3
|
-
clandesc?: Array<ApiClanDesc>;
|
|
4
|
-
}
|
|
5
|
-
/** */
|
|
6
|
-
export interface ApiClanDesc {
|
|
7
|
-
banner?: string;
|
|
8
|
-
clan_id?: string;
|
|
9
|
-
clan_name?: string;
|
|
10
|
-
creator_id?: string;
|
|
11
|
-
logo?: string;
|
|
12
|
-
status?: number;
|
|
13
|
-
}
|
|
14
|
-
/** A user's session used to authenticate messages. */
|
|
15
|
-
export interface ApiSession {
|
|
16
|
-
created?: boolean;
|
|
17
|
-
refresh_token?: string;
|
|
18
|
-
token?: string;
|
|
19
|
-
}
|
|
20
|
-
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
|
21
|
-
export interface ApiAuthenticateLogoutRequest {
|
|
22
|
-
refresh_token?: string;
|
|
23
|
-
token?: string;
|
|
24
|
-
}
|
|
25
|
-
/** Authenticate against the server with a refresh token. */
|
|
26
|
-
export interface ApiAuthenticateRefreshRequest {
|
|
27
|
-
refresh_token?: string;
|
|
28
|
-
}
|
|
29
|
-
/** Authenticate against the server with a device ID. */
|
|
30
|
-
export interface ApiAuthenticateRequest {
|
|
31
|
-
account?: ApiAccountApp;
|
|
32
|
-
}
|
|
33
|
-
/** Send a app token to the server. Used with authenticate/link/unlink. */
|
|
34
|
-
export interface ApiAccountApp {
|
|
35
|
-
appid?: string;
|
|
36
|
-
appname?: string;
|
|
37
|
-
token?: string;
|
|
38
|
-
vars?: Record<string, string>;
|
|
39
|
-
}
|
|
40
|
-
/** The request to update the status of a message. */
|
|
41
|
-
export interface ApiUpdateMessageRequest {
|
|
42
|
-
consume_time?: string;
|
|
43
|
-
id?: string;
|
|
44
|
-
read_time?: string;
|
|
45
|
-
}
|
|
46
|
-
export declare class MezonApi {
|
|
47
|
-
readonly apiKey: string;
|
|
48
|
-
readonly basePath: string;
|
|
49
|
-
readonly timeoutMs: number;
|
|
50
|
-
constructor(apiKey: string, basePath: string, timeoutMs: number);
|
|
51
|
-
/** A healthcheck which load balancers can use to check the service. */
|
|
52
|
-
mezonHealthcheck(bearerToken: string, options?: any): Promise<any>;
|
|
53
|
-
/** A readycheck which load balancers can use to check the service. */
|
|
54
|
-
mezonReadycheck(bearerToken: string, options?: any): Promise<any>;
|
|
55
|
-
/** Authenticate a app with a token against the server. */
|
|
56
|
-
mezonAuthenticate(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateRequest, options?: any): Promise<ApiSession>;
|
|
57
|
-
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
|
58
|
-
mezonAuthenticateLogout(bearerToken: string, body: ApiAuthenticateLogoutRequest, options?: any): Promise<any>;
|
|
59
|
-
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
60
|
-
mezonAuthenticateRefresh(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateRefreshRequest, options?: any): Promise<ApiSession>;
|
|
61
|
-
/** Deletes a message for an identity. */
|
|
62
|
-
mezonDeleteMessage(bearerToken: string, id: string, options?: any): Promise<any>;
|
|
63
|
-
/** Updates a message for an identity. */
|
|
64
|
-
mezonUpdateMessage(bearerToken: string, id: string, body: ApiUpdateMessageRequest, options?: any): Promise<any>;
|
|
65
|
-
/** List clans */
|
|
66
|
-
listClanDescs(bearerToken: string, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiClanDescList>;
|
|
67
|
-
buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>): string;
|
|
68
|
-
}
|
package/dist/client.d.ts
DELETED
|
@@ -1,173 +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 { ChannelCreatedEvent, ChannelDeletedEvent, ChannelUpdatedEvent, Socket, UserChannelAddedEvent, UserChannelRemovedEvent, UserClanRemovedEvent, VoiceJoinedEvent } from "./socket";
|
|
18
|
-
import { WebSocketAdapter } from "./web_socket_adapter";
|
|
19
|
-
/** */
|
|
20
|
-
export interface ApiMessageAttachment {
|
|
21
|
-
filename?: string;
|
|
22
|
-
filetype?: string;
|
|
23
|
-
height?: number;
|
|
24
|
-
size?: number;
|
|
25
|
-
url?: string;
|
|
26
|
-
width?: number;
|
|
27
|
-
/** The channel this message belongs to. */
|
|
28
|
-
channel_id?: string;
|
|
29
|
-
mode?: number;
|
|
30
|
-
channel_label?: string;
|
|
31
|
-
/** The message that user react */
|
|
32
|
-
message_id?: string;
|
|
33
|
-
/** Message sender, usually a user ID. */
|
|
34
|
-
sender_id?: string;
|
|
35
|
-
}
|
|
36
|
-
/** */
|
|
37
|
-
export interface ApiMessageDeleted {
|
|
38
|
-
deletor?: string;
|
|
39
|
-
message_id?: string;
|
|
40
|
-
}
|
|
41
|
-
/** */
|
|
42
|
-
export interface ApiMessageMention {
|
|
43
|
-
create_time?: string;
|
|
44
|
-
id?: string;
|
|
45
|
-
user_id?: string;
|
|
46
|
-
username?: string;
|
|
47
|
-
role_id?: string;
|
|
48
|
-
rolename?: string;
|
|
49
|
-
s?: number;
|
|
50
|
-
e?: number;
|
|
51
|
-
/** The channel this message belongs to. */
|
|
52
|
-
channel_id?: string;
|
|
53
|
-
mode?: number;
|
|
54
|
-
channel_label?: string;
|
|
55
|
-
/** The message that user react */
|
|
56
|
-
message_id?: string;
|
|
57
|
-
/** Message sender, usually a user ID. */
|
|
58
|
-
sender_id?: string;
|
|
59
|
-
}
|
|
60
|
-
/** */
|
|
61
|
-
export interface ApiMessageReaction {
|
|
62
|
-
action?: boolean;
|
|
63
|
-
emoji_id: string;
|
|
64
|
-
emoji: string;
|
|
65
|
-
id?: string;
|
|
66
|
-
sender_id?: string;
|
|
67
|
-
sender_name?: string;
|
|
68
|
-
sender_avatar?: string;
|
|
69
|
-
count: number;
|
|
70
|
-
/** The channel this message belongs to. */
|
|
71
|
-
channel_id: string;
|
|
72
|
-
mode: number;
|
|
73
|
-
channel_label: string;
|
|
74
|
-
/** The message that user react */
|
|
75
|
-
message_id: string;
|
|
76
|
-
}
|
|
77
|
-
/** */
|
|
78
|
-
export interface ApiMessageRef {
|
|
79
|
-
message_id?: string;
|
|
80
|
-
message_ref_id?: string;
|
|
81
|
-
ref_type?: number;
|
|
82
|
-
message_sender_id?: string;
|
|
83
|
-
message_sender_username?: string;
|
|
84
|
-
mesages_sender_avatar?: string;
|
|
85
|
-
message_sender_clan_nick?: string;
|
|
86
|
-
message_sender_display_name?: string;
|
|
87
|
-
content?: string;
|
|
88
|
-
has_attachment: boolean;
|
|
89
|
-
/** The channel this message belongs to. */
|
|
90
|
-
channel_id: string;
|
|
91
|
-
mode: number;
|
|
92
|
-
channel_label: string;
|
|
93
|
-
}
|
|
94
|
-
/** A message sent on a channel. */
|
|
95
|
-
export interface ChannelMessage {
|
|
96
|
-
id: string;
|
|
97
|
-
avatar?: string;
|
|
98
|
-
channel_id: string;
|
|
99
|
-
channel_label: string;
|
|
100
|
-
clan_id?: string;
|
|
101
|
-
code: number;
|
|
102
|
-
content: string;
|
|
103
|
-
create_time: string;
|
|
104
|
-
reactions?: Array<ApiMessageReaction>;
|
|
105
|
-
mentions?: Array<ApiMessageMention>;
|
|
106
|
-
attachments?: Array<ApiMessageAttachment>;
|
|
107
|
-
references?: Array<ApiMessageRef>;
|
|
108
|
-
referenced_message?: ChannelMessage;
|
|
109
|
-
persistent?: boolean;
|
|
110
|
-
sender_id: string;
|
|
111
|
-
update_time?: string;
|
|
112
|
-
clan_logo?: string;
|
|
113
|
-
category_name?: string;
|
|
114
|
-
username?: string;
|
|
115
|
-
clan_nick?: string;
|
|
116
|
-
clan_avatar?: string;
|
|
117
|
-
display_name?: string;
|
|
118
|
-
create_time_ms?: number;
|
|
119
|
-
update_time_ms?: number;
|
|
120
|
-
mode?: number;
|
|
121
|
-
message_id?: string;
|
|
122
|
-
}
|
|
123
|
-
export interface Client {
|
|
124
|
-
authenticate: () => Promise<string>;
|
|
125
|
-
/** Receive clan evnet. */
|
|
126
|
-
onMessage: (channelMessage: ChannelMessage) => void;
|
|
127
|
-
onClanMemberUpdate: (member_id: Array<string>, leave: boolean) => void;
|
|
128
|
-
onMessageDelete: (channelMessage: ChannelMessage) => void;
|
|
129
|
-
onMessageReactionAdd: (messageReactionEvent: ApiMessageReaction) => void;
|
|
130
|
-
onVoiceStateUpdate: (voiceState: VoiceJoinedEvent) => void;
|
|
131
|
-
onMessageReactionRemove: (messageReactionEvent: ApiMessageReaction) => void;
|
|
132
|
-
}
|
|
133
|
-
/** A client for Mezon server. */
|
|
134
|
-
export declare class MezonClient implements Client {
|
|
135
|
-
readonly apiKey: string;
|
|
136
|
-
readonly host: string;
|
|
137
|
-
readonly port: string;
|
|
138
|
-
readonly useSSL: boolean;
|
|
139
|
-
readonly timeout: number;
|
|
140
|
-
readonly autoRefreshSession: boolean;
|
|
141
|
-
/** The expired timespan used to check session lifetime. */
|
|
142
|
-
expiredTimespanMs: number;
|
|
143
|
-
/** The low level API client for Nakama server. */
|
|
144
|
-
private readonly apiClient;
|
|
145
|
-
constructor(apiKey?: string, host?: string, port?: string, useSSL?: boolean, timeout?: number, autoRefreshSession?: boolean);
|
|
146
|
-
/** Authenticate a user with an ID against the server. */
|
|
147
|
-
authenticate(): Promise<string>;
|
|
148
|
-
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
|
149
|
-
sessionRefresh(session: Session): Promise<Session>;
|
|
150
|
-
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
|
151
|
-
logout(session: Session): Promise<boolean>;
|
|
152
|
-
deleteMessage(session: Session, id: string): Promise<boolean>;
|
|
153
|
-
updateMessage(session: Session, id: string, consume_time?: string, read_time?: string): Promise<boolean>;
|
|
154
|
-
/** A socket created with the client's configuration. */
|
|
155
|
-
createSocket(useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number): Socket;
|
|
156
|
-
onerror(evt: Event): void;
|
|
157
|
-
onmessagereaction(messagereaction: ApiMessageReaction): void;
|
|
158
|
-
ondisconnect(e: Event): void;
|
|
159
|
-
onuserchanneladded(user: UserChannelAddedEvent): void;
|
|
160
|
-
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
|
161
|
-
onuserclanremoved(user: UserClanRemovedEvent): void;
|
|
162
|
-
onchannelcreated(channelCreated: ChannelCreatedEvent): void;
|
|
163
|
-
onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
|
|
164
|
-
onchannelupdated(channelUpdated: ChannelUpdatedEvent): void;
|
|
165
|
-
onheartbeattimeout(): void;
|
|
166
|
-
/** Receive clan evnet. */
|
|
167
|
-
onMessage(channelMessage: ChannelMessage): void;
|
|
168
|
-
onClanMemberUpdate(member_id: Array<string>, leave: boolean): void;
|
|
169
|
-
onMessageDelete(channelMessage: ChannelMessage): void;
|
|
170
|
-
onMessageReactionAdd(messageReactionEvent: ApiMessageReaction): void;
|
|
171
|
-
onVoiceStateUpdate(voiceState: VoiceJoinedEvent): void;
|
|
172
|
-
onMessageReactionRemove(messageReactionEvent: ApiMessageReaction): void;
|
|
173
|
-
}
|
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";
|