mezon-js 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +244 -0
- package/api.gen.ts +4351 -0
- package/build.mjs +45 -0
- package/client.ts +1848 -0
- package/dist/api.gen.d.ts +735 -0
- package/dist/client.d.ts +527 -0
- package/dist/index.d.ts +24 -0
- package/dist/mezon-js.cjs.js +5204 -0
- package/dist/mezon-js.esm.mjs +5184 -0
- package/dist/session.d.ts +58 -0
- package/dist/socket.d.ts +673 -0
- package/dist/utils.d.ts +3 -0
- package/dist/web_socket_adapter.d.ts +83 -0
- package/index.ts +27 -0
- package/package.json +54 -0
- package/rollup.config.js +40 -0
- package/session.ts +114 -0
- package/socket.ts +1303 -0
- package/tsconfig.json +10 -0
- package/utils.ts +49 -0
- package/web_socket_adapter.ts +159 -0
package/dist/client.d.ts
ADDED
@@ -0,0 +1,527 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2020 The Mezon 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 { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList } from "./api.gen";
|
17
|
+
import { Session } from "./session";
|
18
|
+
import { Socket } from "./socket";
|
19
|
+
import { WebSocketAdapter } from "./web_socket_adapter";
|
20
|
+
export declare enum ChannelType {
|
21
|
+
CHANNEL_TYPE_TEXT = 1,
|
22
|
+
CHANNEL_TYPE_GROUP = 2,
|
23
|
+
CHANNEL_TYPE_DM = 3,
|
24
|
+
CHANNEL_TYPE_VOICE = 4,
|
25
|
+
CHANNEL_TYPE_FORUM = 5,
|
26
|
+
CHANNEL_TYPE_ANNOUNCEMENT = 6
|
27
|
+
}
|
28
|
+
export declare enum ChannelStreamMode {
|
29
|
+
STREAM_MODE_CHANNEL = 2,
|
30
|
+
STREAM_MODE_GROUP = 3,
|
31
|
+
STREAM_MODE_DM = 4
|
32
|
+
}
|
33
|
+
/** Response for an RPC function executed on the server. */
|
34
|
+
export interface RpcResponse {
|
35
|
+
/** The identifier of the function. */
|
36
|
+
id?: string;
|
37
|
+
/** The payload of the function which must be a JSON object. */
|
38
|
+
payload?: object;
|
39
|
+
}
|
40
|
+
/** The object to store. */
|
41
|
+
export interface WriteStorageObject {
|
42
|
+
/** The collection to store the object. */
|
43
|
+
collection?: string;
|
44
|
+
/** The key for the object within the collection. */
|
45
|
+
key?: string;
|
46
|
+
/** The read access permissions for the object. */
|
47
|
+
permission_read?: number;
|
48
|
+
/** The write access permissions for the object. */
|
49
|
+
permission_write?: number;
|
50
|
+
/** The value of the object. */
|
51
|
+
value?: object;
|
52
|
+
/** The version hash of the object to check. Possible values are: ["", "*", "#hash#"]. */
|
53
|
+
version?: string;
|
54
|
+
}
|
55
|
+
/** An object within the storage engine. */
|
56
|
+
export interface StorageObject {
|
57
|
+
/** The collection which stores the object. */
|
58
|
+
collection?: string;
|
59
|
+
/** The UNIX time when the object was created. */
|
60
|
+
create_time?: string;
|
61
|
+
/** The key of the object within the collection. */
|
62
|
+
key?: string;
|
63
|
+
/** The read access permissions for the object. */
|
64
|
+
permission_read?: number;
|
65
|
+
/** The write access permissions for the object. */
|
66
|
+
permission_write?: number;
|
67
|
+
/** The UNIX time when the object was last updated. */
|
68
|
+
update_time?: string;
|
69
|
+
/** The user owner of the object. */
|
70
|
+
user_id?: string;
|
71
|
+
/** The value of the object. */
|
72
|
+
value?: object;
|
73
|
+
/** The version hash of the object. */
|
74
|
+
version?: string;
|
75
|
+
}
|
76
|
+
/** List of storage objects. */
|
77
|
+
export interface StorageObjectList {
|
78
|
+
/** The cursor associated with the query a page of results. */
|
79
|
+
cursor?: string;
|
80
|
+
/** The list of storage objects. */
|
81
|
+
objects: Array<StorageObject>;
|
82
|
+
}
|
83
|
+
/** Batch of storage objects. */
|
84
|
+
export interface StorageObjects {
|
85
|
+
/** The batch of storage objects. */
|
86
|
+
objects: Array<StorageObject>;
|
87
|
+
}
|
88
|
+
/** A message sent on a channel. */
|
89
|
+
export interface ChannelMessage {
|
90
|
+
avatar?: string;
|
91
|
+
channel_id: string;
|
92
|
+
channel_label: string;
|
93
|
+
clan_id?: string;
|
94
|
+
code: number;
|
95
|
+
content: string;
|
96
|
+
create_time: string;
|
97
|
+
reactions?: Array<ApiMessageReaction>;
|
98
|
+
mentions?: Array<ApiMessageMention>;
|
99
|
+
attachments?: Array<ApiMessageAttachment>;
|
100
|
+
references?: Array<ApiMessageRef>;
|
101
|
+
referenced_message?: ChannelMessage;
|
102
|
+
id: string;
|
103
|
+
persistent?: boolean;
|
104
|
+
sender_id: string;
|
105
|
+
update_time?: string;
|
106
|
+
user_id_one?: string;
|
107
|
+
user_id_two?: string;
|
108
|
+
username?: string;
|
109
|
+
}
|
110
|
+
/** A list of channel messages, usually a result of a list operation. */
|
111
|
+
export interface ChannelMessageList {
|
112
|
+
/** Cacheable cursor to list newer messages. Durable and designed to be stored, unlike next/prev cursors. */
|
113
|
+
cacheable_cursor?: string;
|
114
|
+
/**last seen message from user on channel */
|
115
|
+
last_seen_message?: ApiChannelMessageHeader;
|
116
|
+
/** A list of messages. */
|
117
|
+
messages?: Array<ChannelMessage>;
|
118
|
+
/** The cursor to send when retireving the next page, if any. */
|
119
|
+
next_cursor?: string;
|
120
|
+
/** The cursor to send when retrieving the previous page, if any. */
|
121
|
+
prev_cursor?: string;
|
122
|
+
}
|
123
|
+
/** A user in the system. */
|
124
|
+
export interface User {
|
125
|
+
/** A URL for an avatar image. */
|
126
|
+
avatar_url?: string;
|
127
|
+
/** The UNIX time when the user was created. */
|
128
|
+
create_time?: string;
|
129
|
+
/** The display name of the user. */
|
130
|
+
display_name?: string;
|
131
|
+
/** Number of related edges to this user. */
|
132
|
+
edge_count?: number;
|
133
|
+
/** The Facebook id in the user's account. */
|
134
|
+
facebook_id?: string;
|
135
|
+
/** The Facebook Instant Game ID in the user's account. */
|
136
|
+
facebook_instant_game_id?: string;
|
137
|
+
/** The Apple Game Center in of the user's account. */
|
138
|
+
gamecenter_id?: string;
|
139
|
+
/** The Google id in the user's account. */
|
140
|
+
google_id?: string;
|
141
|
+
/** The id of the user's account. */
|
142
|
+
id?: string;
|
143
|
+
/** The language expected to be a tag which follows the BCP-47 spec. */
|
144
|
+
lang_tag?: string;
|
145
|
+
/** The location set by the user. */
|
146
|
+
location?: string;
|
147
|
+
/** Additional information stored as a JSON object. */
|
148
|
+
metadata?: {};
|
149
|
+
/** Indicates whether the user is currently online. */
|
150
|
+
online?: boolean;
|
151
|
+
/** The Steam id in the user's account. */
|
152
|
+
steam_id?: string;
|
153
|
+
/** The timezone set by the user. */
|
154
|
+
timezone?: string;
|
155
|
+
/** The UNIX time when the user was last updated. */
|
156
|
+
update_time?: string;
|
157
|
+
/** The username of the user's account. */
|
158
|
+
username?: string;
|
159
|
+
}
|
160
|
+
/** A collection of zero or more users. */
|
161
|
+
export interface Users {
|
162
|
+
/** The User objects. */
|
163
|
+
users?: Array<User>;
|
164
|
+
}
|
165
|
+
/** A friend of a user. */
|
166
|
+
export interface Friend {
|
167
|
+
/** The friend status. */
|
168
|
+
state?: number;
|
169
|
+
/** The user object. */
|
170
|
+
user?: User;
|
171
|
+
}
|
172
|
+
/** A collection of zero or more friends of the user. */
|
173
|
+
export interface Friends {
|
174
|
+
/** The Friend objects. */
|
175
|
+
friends?: Array<Friend>;
|
176
|
+
/** Cursor for the next page of results, if any. */
|
177
|
+
cursor?: string;
|
178
|
+
}
|
179
|
+
/** A user-role pair representing the user's role in a group. */
|
180
|
+
export interface GroupUser {
|
181
|
+
/** The user. */
|
182
|
+
user?: User;
|
183
|
+
/** Their role within the group. */
|
184
|
+
state?: number;
|
185
|
+
}
|
186
|
+
/** A list of users belonging to a group along with their role in it. */
|
187
|
+
export interface GroupUserList {
|
188
|
+
/** The user-role pairs. */
|
189
|
+
group_users?: Array<GroupUser>;
|
190
|
+
/** Cursor for the next page of results, if any. */
|
191
|
+
cursor?: string;
|
192
|
+
}
|
193
|
+
/** A group in the server. */
|
194
|
+
export interface Group {
|
195
|
+
/** A URL for an avatar image. */
|
196
|
+
avatar_url?: string;
|
197
|
+
/** The UNIX time when the group was created. */
|
198
|
+
create_time?: string;
|
199
|
+
/** The id of the user who created the group. */
|
200
|
+
creator_id?: string;
|
201
|
+
/** A description for the group. */
|
202
|
+
description?: string;
|
203
|
+
/** The current count of all members in the group. */
|
204
|
+
edge_count?: number;
|
205
|
+
/** The id of a group. */
|
206
|
+
id?: string;
|
207
|
+
/** The language expected to be a tag which follows the BCP-47 spec. */
|
208
|
+
lang_tag?: string;
|
209
|
+
/** The maximum number of members allowed. */
|
210
|
+
max_count?: number;
|
211
|
+
/** Additional information stored as a JSON object. */
|
212
|
+
metadata?: {};
|
213
|
+
/** The unique name of the group. */
|
214
|
+
name?: string;
|
215
|
+
/** Anyone can join open groups, otherwise only admins can accept members. */
|
216
|
+
open?: boolean;
|
217
|
+
/** The UNIX time when the group was last updated. */
|
218
|
+
update_time?: string;
|
219
|
+
}
|
220
|
+
/** One or more groups returned from a listing operation. */
|
221
|
+
export interface GroupList {
|
222
|
+
/** A cursor used to get the next page. */
|
223
|
+
cursor?: string;
|
224
|
+
/** One or more groups. */
|
225
|
+
groups?: Array<Group>;
|
226
|
+
}
|
227
|
+
/** A group-role pair representing the user's groups and their role in each. */
|
228
|
+
export interface UserGroup {
|
229
|
+
/** The group. */
|
230
|
+
group?: Group;
|
231
|
+
/** The user's role within the group. */
|
232
|
+
state?: number;
|
233
|
+
}
|
234
|
+
/** A list of groups belonging to a user along with their role in it. */
|
235
|
+
export interface UserGroupList {
|
236
|
+
/** The group-role pairs. */
|
237
|
+
user_groups?: Array<UserGroup>;
|
238
|
+
/** Cursor for the next page of results, if any. */
|
239
|
+
cursor?: string;
|
240
|
+
}
|
241
|
+
/** A notification in the server. */
|
242
|
+
export interface Notification {
|
243
|
+
/** Category code for this notification. */
|
244
|
+
code?: number;
|
245
|
+
/** Content of the notification in JSON. */
|
246
|
+
content?: {};
|
247
|
+
/** The UNIX time when the notification was created. */
|
248
|
+
create_time?: string;
|
249
|
+
/** ID of the Notification. */
|
250
|
+
id?: string;
|
251
|
+
/** True if this notification was persisted to the database. */
|
252
|
+
persistent?: boolean;
|
253
|
+
/** ID of the sender, if a user. Otherwise 'null'. */
|
254
|
+
sender_id?: string;
|
255
|
+
/** Subject of the notification. */
|
256
|
+
subject?: string;
|
257
|
+
}
|
258
|
+
/** A collection of zero or more notifications. */
|
259
|
+
export interface NotificationList {
|
260
|
+
/** Use this cursor to paginate notifications. Cache this to catch up to new notifications. */
|
261
|
+
cacheable_cursor?: string;
|
262
|
+
/** Collection of notifications. */
|
263
|
+
notifications?: Array<Notification>;
|
264
|
+
}
|
265
|
+
/** Update fields in a given channel. */
|
266
|
+
export interface ApiUpdateChannelDescRequest {
|
267
|
+
/** The ID of the channel to update. */
|
268
|
+
channel_id: string;
|
269
|
+
/** The channel lable */
|
270
|
+
channel_lable: string | undefined;
|
271
|
+
/** The category of channel */
|
272
|
+
category_id: string | undefined;
|
273
|
+
}
|
274
|
+
/** Add users to a channel. */
|
275
|
+
export interface ApiAddChannelUsersRequest {
|
276
|
+
/** The channel to add users to. */
|
277
|
+
channel_id: string;
|
278
|
+
/** The users to add. */
|
279
|
+
user_ids: string[];
|
280
|
+
}
|
281
|
+
/** Kick a set of users from a channel. */
|
282
|
+
export interface ApiKickChannelUsersRequest {
|
283
|
+
/** The channel ID to kick from. */
|
284
|
+
channel_id: string;
|
285
|
+
/** The users to kick. */
|
286
|
+
user_ids: string[];
|
287
|
+
}
|
288
|
+
/** Leave a channel. */
|
289
|
+
export interface ApiLeaveChannelRequest {
|
290
|
+
/** The channel ID to leave. */
|
291
|
+
channel_id: string;
|
292
|
+
}
|
293
|
+
/** Update Clan information */
|
294
|
+
export interface ApiUpdateClanDescRequest {
|
295
|
+
clan_id: string;
|
296
|
+
/** Clan creator */
|
297
|
+
creator_id: string;
|
298
|
+
/** Clan name */
|
299
|
+
clan_name: string;
|
300
|
+
/** Clan logo */
|
301
|
+
logo: string;
|
302
|
+
/** Clan banner */
|
303
|
+
banner: string;
|
304
|
+
}
|
305
|
+
/** Update Clan profile information */
|
306
|
+
export interface ApiUpdateClanDescProfileRequest {
|
307
|
+
/** Clan id */
|
308
|
+
clan_id: string;
|
309
|
+
/** Clan nick name */
|
310
|
+
nick_name: string;
|
311
|
+
/** Clan profile banner */
|
312
|
+
profile_banner: string;
|
313
|
+
/** Clan profile theme */
|
314
|
+
profile_theme: string;
|
315
|
+
/** Clan profile avatar */
|
316
|
+
avatar_url: string;
|
317
|
+
}
|
318
|
+
export interface ApiUpdateClanProfileRequest {
|
319
|
+
/** Clan id*/
|
320
|
+
clan_id: string;
|
321
|
+
/** Clan nick name */
|
322
|
+
nick_name: string;
|
323
|
+
/** Clan profile avatar */
|
324
|
+
avatar: string;
|
325
|
+
}
|
326
|
+
/** Update fields in a given role. */
|
327
|
+
export interface ApiUpdateRoleRequest {
|
328
|
+
/** The ID of the role to update. */
|
329
|
+
role_id: string;
|
330
|
+
title: string | undefined;
|
331
|
+
color: string | undefined;
|
332
|
+
role_icon: string | undefined;
|
333
|
+
description: string | undefined;
|
334
|
+
display_online: number | undefined;
|
335
|
+
allow_mention: number | undefined;
|
336
|
+
/** The users to add. */
|
337
|
+
add_user_ids: string[];
|
338
|
+
/** The permissions to add. */
|
339
|
+
active_permission_ids: string[];
|
340
|
+
/** The users to remove. */
|
341
|
+
remove_user_ids: string[];
|
342
|
+
/** The permissions to remove. */
|
343
|
+
remove_permission_ids: string[];
|
344
|
+
}
|
345
|
+
/** A client for Mezon server. */
|
346
|
+
export declare class Client {
|
347
|
+
readonly serverkey: string;
|
348
|
+
readonly host: string;
|
349
|
+
readonly port: string;
|
350
|
+
readonly useSSL: boolean;
|
351
|
+
readonly timeout: number;
|
352
|
+
readonly autoRefreshSession: boolean;
|
353
|
+
/** The expired timespan used to check session lifetime. */
|
354
|
+
expiredTimespanMs: number;
|
355
|
+
/** The low level API client for Mezon server. */
|
356
|
+
private readonly apiClient;
|
357
|
+
constructor(serverkey?: string, host?: string, port?: string, useSSL?: boolean, timeout?: number, autoRefreshSession?: boolean);
|
358
|
+
/** Add users to a channel, or accept their join requests. */
|
359
|
+
addChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
360
|
+
/** Add friends by ID or username to a user's account. */
|
361
|
+
addFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
362
|
+
/** Authenticate a user with an Apple ID against the server. */
|
363
|
+
authenticateApple(token: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
364
|
+
/** Authenticate a user with a custom id against the server. */
|
365
|
+
authenticateCustom(id: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
366
|
+
/** Authenticate a user with a device id against the server. */
|
367
|
+
authenticateDevice(id: string, create?: boolean, username?: string, vars?: Record<string, string>): Promise<Session>;
|
368
|
+
/** Authenticate a user with an email+password against the server. */
|
369
|
+
authenticateEmail(email: string, password: string, create?: boolean, username?: string, vars?: Record<string, string>): Promise<Session>;
|
370
|
+
/** Authenticate a user with a Facebook Instant Game token against the server. */
|
371
|
+
authenticateFacebookInstantGame(signedPlayerInfo: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
372
|
+
/** Authenticate a user with a Facebook OAuth token against the server. */
|
373
|
+
authenticateFacebook(token: string, create?: boolean, username?: string, sync?: boolean, vars?: Record<string, string>, options?: any): Promise<Session>;
|
374
|
+
/** Authenticate a user with Google against the server. */
|
375
|
+
authenticateGoogle(token: string, create?: boolean, username?: string, vars?: Record<string, string>, options?: any): Promise<Session>;
|
376
|
+
/** Authenticate a user with GameCenter against the server. */
|
377
|
+
authenticateGameCenter(bundleId: string, playerId: string, publicKeyUrl: string, salt: string, signature: string, timestamp: string, username?: string, create?: boolean, vars?: Record<string, string>, options?: any): Promise<Session>;
|
378
|
+
/** Authenticate a user with Steam against the server. */
|
379
|
+
authenticateSteam(token: string, create?: boolean, username?: string, sync?: boolean, vars?: Record<string, string>): Promise<Session>;
|
380
|
+
/** Block one or more users by ID or username. */
|
381
|
+
blockFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
382
|
+
/** Create a new group with the current user as the creator and superadmin. */
|
383
|
+
uploadAttachmentFile(session: Session, request: ApiUploadAttachmentRequest): Promise<ApiUploadAttachment>;
|
384
|
+
/** Create a channel within clan */
|
385
|
+
createChannelDesc(session: Session, request: ApiCreateChannelDescRequest): Promise<ApiChannelDescription>;
|
386
|
+
/** Create a clan */
|
387
|
+
createClanDesc(session: Session, request: ApiCreateClanDescRequest): Promise<ApiClanDesc>;
|
388
|
+
/** */
|
389
|
+
createCategoryDesc(session: Session, request: ApiCreateCategoryDescRequest): Promise<ApiCategoryDesc>;
|
390
|
+
/** Create a new role for clan. */
|
391
|
+
createRole(session: Session, request: ApiCreateRoleRequest): Promise<ApiRole>;
|
392
|
+
/** add role for channel. */
|
393
|
+
addRolesChannelDesc(session: Session, request: ApiAddRoleChannelDescRequest): Promise<boolean>;
|
394
|
+
/** Update action role when delete role */
|
395
|
+
deleteRoleChannelDesc(session: Session, request: ApiDeleteRoleRequest): Promise<boolean>;
|
396
|
+
/** A socket created with the client's configuration. */
|
397
|
+
createSocket(useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number): Socket;
|
398
|
+
/** Delete one or more users by ID or username. */
|
399
|
+
deleteFriends(session: Session, ids?: Array<string>, usernames?: Array<string>): Promise<boolean>;
|
400
|
+
/** Delete a channel by ID. */
|
401
|
+
deleteChannelDesc(session: Session, channelId: string): Promise<boolean>;
|
402
|
+
/** Delete a clan desc by ID. */
|
403
|
+
deleteClanDesc(session: Session, clanDescId: string): Promise<boolean>;
|
404
|
+
/** Delete a category by ID. */
|
405
|
+
deleteCategoryDesc(session: Session, creatorId: string): Promise<boolean>;
|
406
|
+
/** Delete one or more notifications */
|
407
|
+
deleteNotifications(session: Session, ids?: Array<string>): Promise<boolean>;
|
408
|
+
/** Delete one or more storage objects */
|
409
|
+
deleteStorageObjects(session: Session, request: ApiDeleteStorageObjectsRequest): Promise<boolean>;
|
410
|
+
/** Delete a role by ID. */
|
411
|
+
deleteRole(session: Session, roleId: string): Promise<boolean>;
|
412
|
+
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
413
|
+
emitEvent(session: Session, request: ApiEvent): Promise<boolean>;
|
414
|
+
/** Fetch the current user's account. */
|
415
|
+
getAccount(session: Session): Promise<ApiAccount>;
|
416
|
+
/** Import Facebook friends and add them to a user's account. */
|
417
|
+
importFacebookFriends(session: Session, request: ApiAccountFacebook): Promise<boolean>;
|
418
|
+
/** Import Steam friends and add them to a user's account. */
|
419
|
+
importSteamFriends(session: Session, request: ApiAccountSteam, reset: boolean): Promise<boolean>;
|
420
|
+
/** Fetch zero or more users by ID and/or username. */
|
421
|
+
getUsers(session: Session, ids?: Array<string>, usernames?: Array<string>, facebookIds?: Array<string>): Promise<Users>;
|
422
|
+
/** Kick users from a channel, or decline their join requests. */
|
423
|
+
removeChannelUsers(session: Session, channelId: string, ids?: Array<string>): Promise<boolean>;
|
424
|
+
/** List a channel's message history. */
|
425
|
+
listChannelMessages(session: Session, channelId: string, messageId?: string, direction?: number, limit?: number): Promise<ChannelMessageList>;
|
426
|
+
/** List a channel's users. */
|
427
|
+
listChannelVoiceUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiVoiceChannelUserList>;
|
428
|
+
/** List a channel's users. */
|
429
|
+
listChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiChannelUserList>;
|
430
|
+
/** List a channel's users. */
|
431
|
+
listClanUsers(session: Session, clanId: string): Promise<ApiClanUserList>;
|
432
|
+
/** List channels. */
|
433
|
+
listChannelDescs(session: Session, limit?: number, state?: number, cursor?: string, clanId?: string, channelType?: number): Promise<ApiChannelDescList>;
|
434
|
+
/** List clans */
|
435
|
+
listClanDescs(session: Session, limit?: number, state?: number, cursor?: string): Promise<ApiClanDescList>;
|
436
|
+
/** List categories. */
|
437
|
+
listCategoryDescs(session: Session, clanId: string, creatorId?: string, categoryName?: string): Promise<ApiCategoryDescList>;
|
438
|
+
/** List user roles */
|
439
|
+
listRoles(session: Session, limit?: number, state?: number, cursor?: string, clanId?: string): Promise<ApiRoleList>;
|
440
|
+
/** List permission */
|
441
|
+
getListPermission(session: Session): Promise<ApiPermissionList>;
|
442
|
+
/** Update action role when delete role */
|
443
|
+
updateRoleDelete(session: Session, roleId: string, request: {}): Promise<boolean>;
|
444
|
+
/** List user roles */
|
445
|
+
listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
|
446
|
+
/** List user roles */
|
447
|
+
listRoleUsers(session: Session, roleId: string, limit?: number, cursor?: string): Promise<ApiRoleUserList>;
|
448
|
+
registFCMDeviceToken(session: Session, tokenId: string): Promise<boolean>;
|
449
|
+
/** Get a clan desc profile */
|
450
|
+
getClanDescProfile(session: Session, clanId: string): Promise<ApiClanDescProfile>;
|
451
|
+
getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
|
452
|
+
/** Add an Apple ID to the social profiles on the current user's account. */
|
453
|
+
linkApple(session: Session, request: ApiAccountApple): Promise<boolean>;
|
454
|
+
/** Add a custom ID to the social profiles on the current user's account. */
|
455
|
+
linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean>;
|
456
|
+
/** Add a device ID to the social profiles on the current user's account. */
|
457
|
+
linkDevice(session: Session, request: ApiAccountDevice): Promise<boolean>;
|
458
|
+
/** Add an email+password to the social profiles on the current user's account. */
|
459
|
+
linkEmail(session: Session, request: ApiAccountEmail): Promise<boolean>;
|
460
|
+
/** Add Facebook to the social profiles on the current user's account. */
|
461
|
+
linkFacebook(session: Session, request: ApiAccountFacebook): Promise<boolean>;
|
462
|
+
/** Add Facebook Instant to the social profiles on the current user's account. */
|
463
|
+
linkFacebookInstantGame(session: Session, request: ApiAccountFacebookInstantGame): Promise<boolean>;
|
464
|
+
/** Add Google to the social profiles on the current user's account. */
|
465
|
+
linkGoogle(session: Session, request: ApiAccountGoogle): Promise<boolean>;
|
466
|
+
/** Add GameCenter to the social profiles on the current user's account. */
|
467
|
+
linkGameCenter(session: Session, request: ApiAccountGameCenter): Promise<boolean>;
|
468
|
+
/** Add Steam to the social profiles on the current user's account. */
|
469
|
+
linkSteam(session: Session, request: ApiLinkSteamRequest): Promise<boolean>;
|
470
|
+
/** List all friends for the current user. */
|
471
|
+
listFriends(session: Session, state?: number, limit?: number, cursor?: string): Promise<Friends>;
|
472
|
+
/** Fetch list of notifications. */
|
473
|
+
listNotifications(session: Session, limit?: number, cacheableCursor?: string): Promise<NotificationList>;
|
474
|
+
/** List storage objects. */
|
475
|
+
listStorageObjects(session: Session, collection: string, userId?: string, limit?: number, cursor?: string): Promise<StorageObjectList>;
|
476
|
+
/** Fetch storage objects. */
|
477
|
+
readStorageObjects(session: Session, request: ApiReadStorageObjectsRequest): Promise<StorageObjects>;
|
478
|
+
/** Execute an RPC function on the server. */
|
479
|
+
rpc(session: Session, basicAuthUsername: string, basicAuthPassword: string, id: string, input: object): Promise<RpcResponse>;
|
480
|
+
/** Execute an RPC function on the server. */
|
481
|
+
rpcHttpKey(httpKey: string, id: string, input?: object): Promise<RpcResponse>;
|
482
|
+
/** Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user. */
|
483
|
+
sessionLogout(session: Session, token: string, refreshToken: string): Promise<boolean>;
|
484
|
+
/** Refresh a user's session using a refresh token retrieved from a previous authentication request. */
|
485
|
+
sessionRefresh(session: Session, vars?: Record<string, string>): Promise<Session>;
|
486
|
+
/** Remove the Apple ID from the social profiles on the current user's account. */
|
487
|
+
unlinkApple(session: Session, request: ApiAccountApple): Promise<boolean>;
|
488
|
+
/** Remove custom ID from the social profiles on the current user's account. */
|
489
|
+
unlinkCustom(session: Session, request: ApiAccountCustom): Promise<boolean>;
|
490
|
+
/** Remove a device ID from the social profiles on the current user's account. */
|
491
|
+
unlinkDevice(session: Session, request: ApiAccountDevice): Promise<boolean>;
|
492
|
+
/** Remove an email+password from the social profiles on the current user's account. */
|
493
|
+
unlinkEmail(session: Session, request: ApiAccountEmail): Promise<boolean>;
|
494
|
+
/** Remove Facebook from the social profiles on the current user's account. */
|
495
|
+
unlinkFacebook(session: Session, request: ApiAccountFacebook): Promise<boolean>;
|
496
|
+
/** Remove Facebook Instant social profiles from the current user's account. */
|
497
|
+
unlinkFacebookInstantGame(session: Session, request: ApiAccountFacebookInstantGame): Promise<boolean>;
|
498
|
+
/** Remove Google from the social profiles on the current user's account. */
|
499
|
+
unlinkGoogle(session: Session, request: ApiAccountGoogle): Promise<boolean>;
|
500
|
+
/** Remove GameCenter from the social profiles on the current user's account. */
|
501
|
+
unlinkGameCenter(session: Session, request: ApiAccountGameCenter): Promise<boolean>;
|
502
|
+
/** Remove Steam from the social profiles on the current user's account. */
|
503
|
+
unlinkSteam(session: Session, request: ApiAccountSteam): Promise<boolean>;
|
504
|
+
/** Update fields in the current user's account. */
|
505
|
+
updateAccount(session: Session, request: ApiUpdateAccountRequest): Promise<boolean>;
|
506
|
+
/** Update fields in a given channel */
|
507
|
+
updateChannelDesc(session: Session, channelId: string, request: ApiUpdateChannelDescRequest): Promise<boolean>;
|
508
|
+
/** Update fields in a given clan. */
|
509
|
+
updateClanDesc(session: Session, clanId: string, request: ApiUpdateClanDescRequest): Promise<boolean>;
|
510
|
+
/** Update fields in a given category. */
|
511
|
+
updateCategory(session: Session, request: ApiUpdateCategoryDescRequest): Promise<boolean>;
|
512
|
+
/** Update fields in a given clan profile. */
|
513
|
+
updateClanDescProfile(session: Session, clanId: string, request: ApiUpdateClanDescProfileRequest): Promise<boolean>;
|
514
|
+
updateUserProfileByClan(session: Session, clanId: string, request: ApiUpdateClanProfileRequest): Promise<boolean>;
|
515
|
+
/** Update fields in a given role. */
|
516
|
+
updateRole(session: Session, roleId: string, request: ApiUpdateRoleRequest): Promise<boolean>;
|
517
|
+
/** Update fields in a given clan profile. */
|
518
|
+
createLinkInviteUser(session: Session, request: ApiLinkInviteUserRequest): Promise<ApiLinkInviteUser>;
|
519
|
+
/** Get link invite user */
|
520
|
+
getLinkInvite(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
521
|
+
/** Get permission of user in the clan */
|
522
|
+
GetPermissionOfUserInTheClan(session: Session, clanId: string): Promise<ApiPermissionList>;
|
523
|
+
/** invite user */
|
524
|
+
inviteUser(session: Session, inviteId: string): Promise<ApiInviteUserRes>;
|
525
|
+
/** Write storage objects. */
|
526
|
+
writeStorageObjects(session: Session, objects: Array<WriteStorageObject>): Promise<ApiStorageObjectAcks>;
|
527
|
+
}
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2020 The Mezon 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";
|
19
|
+
export * from "./socket";
|
20
|
+
export * from "./web_socket_adapter";
|
21
|
+
/**
|
22
|
+
* Reexported due to duplicate definition of ChannelMessage in [Client]{@link ./client.ts} and [Session]{@link ./session.ts}
|
23
|
+
*/
|
24
|
+
export { ChannelMessage } from "./client";
|