mezon-js 2.14.94 → 2.14.96

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/README.md CHANGED
@@ -1,244 +1,244 @@
1
- Mezon JavaScript client
2
- ========================
3
-
4
- > JavaScript client for Mezon server written in TypeScript. For browser and React Native projects.
5
-
6
- [Mezon](https://github.com/mezon/mezon) is an open-source server designed to power modern games and apps. Features include user accounts, chat, social, matchmaker, realtime multiplayer, and much [more](https://mezon.vn).
7
-
8
- This client implements the full API and socket options with the server. It's written in TypeScript with minimal dependencies to be compatible with all modern browsers and React Native.
9
-
10
- Full documentation is online - https://mezon.vn/docs/javascript-client-guide
11
-
12
- ## Getting Started
13
-
14
- You'll need to setup the server and database before you can connect with the client. The simplest way is to use Docker but have a look at the [server documentation](https://github.com/mezon/mezon#getting-started) for other options.
15
-
16
- 1. Install and run the servers. Follow these [instructions](https://mezon.vn/docs/install-docker-quickstart).
17
-
18
- 2. Import the client into your project. It's [available on NPM](https://www.npmjs.com/package/mezon-js) and can be also be added to a project with Bower or other package managers.
19
-
20
- ```shell
21
- npm install mezon-js
22
- ```
23
-
24
- You'll now see the code in the "node_modules" folder and package listed in your "package.json".
25
-
26
- Optionally, if you would like to use the Protocol Buffers wire format with your sockets, you can import the adapter found in this package:
27
-
28
- ```shell
29
- npm install mezon-js-protobuf
30
- ```
31
-
32
- 3. Use the connection credentials to build a client object.
33
-
34
- ```js
35
- import {Client} from "mezon-js";
36
-
37
- var useSSL = false; // Enable if server is run with an SSL certificate.
38
- var client = new Client("defaultkey", "127.0.0.1", "7350", useSSL);
39
- ```
40
-
41
- ## Usage
42
-
43
- The client object has many methods to execute various features in the server or open realtime socket connections with the server.
44
-
45
- ### Authenticate
46
-
47
- There's a variety of ways to [authenticate](https://mezon.vn/docs/authentication) with the server. Authentication can create a user if they don't already exist with those credentials. It's also easy to authenticate with a social profile from Google Play Games, Facebook, Game Center, etc.
48
-
49
- ```js
50
- var email = "super@heroes.com";
51
- var password = "batsignal";
52
- const session = await client.authenticateEmail(email, password);
53
- console.info(session);
54
- ```
55
-
56
- ### Sessions
57
-
58
- When authenticated the server responds with an auth token (JWT) which contains useful properties and gets deserialized into a `Session` object.
59
-
60
- ```js
61
- console.info(session.token); // raw JWT token
62
- console.info(session.refreshToken); // refresh token
63
- console.info(session.userId);
64
- console.info(session.username);
65
- console.info("Session has expired?", session.isexpired(Date.now() / 1000));
66
- const expiresat = session.expires_at;
67
- console.warn("Session will expire at", new Date(expiresat * 1000).toISOString());
68
- ```
69
-
70
- It is recommended to store the auth token from the session and check at startup if it has expired. If the token has expired you must reauthenticate. The expiry time of the token can be changed as a setting in the server.
71
-
72
- ```js
73
- // Assume we've stored the auth token in browser Web Storage.
74
- const authtoken = window.localStorage.getItem("nkauthtoken");
75
- const refreshtoken = window.localStorage.getItem("nkrefreshtoken");
76
-
77
- let session = mezonjs.Session.restore(authtoken, refreshtoken);
78
-
79
- // Check whether a session is close to expiry.
80
-
81
- const unixTimeInFuture = Date.now() + 8.64e+7; // one day from now
82
-
83
- if (session.isexpired(unixTimeInFuture / 1000)) {
84
- try
85
- {
86
- session = await client.sessionRefresh(session);
87
- }
88
- catch (e)
89
- {
90
- console.info("Session can no longer be refreshed. Must reauthenticate!");
91
- }
92
- }
93
- ```
94
-
95
- ### Requests
96
-
97
- The client includes lots of builtin APIs for various features of the game server. These can be accessed with the methods which return Promise objects. It can also call custom logic as RPC functions on the server. These can also be executed with a socket object.
98
-
99
- All requests are sent with a session object which authorizes the client.
100
-
101
- ```js
102
- const account = await client.getAccount(session);
103
- console.info(account.user.id);
104
- console.info(account.user.username);
105
- console.info(account.wallet);
106
- ```
107
-
108
- ### Socket
109
-
110
- The client can create one or more sockets with the server. Each socket can have it's own event listeners registered for responses received from the server.
111
-
112
- ```js
113
- const secure = false; // Enable if server is run with an SSL certificate
114
- const trace = false;
115
- const socket = client.createSocket(secure, trace);
116
- socket.ondisconnect = (evt) => {
117
- console.info("Disconnected", evt);
118
- };
119
-
120
- const session = await socket.connect(session);
121
- // Socket is open.
122
- ```
123
-
124
- If you are using the optional protocol buffer adapter, pass the adapter to the Socket object during construction:
125
-
126
- ```js
127
- import {WebSocketAdapterPb} from "mezon-js-protobuf"
128
-
129
- const secure = false; // Enable if server is run with an SSL certificate
130
- const trace = false;
131
- const socket = client.createSocket(secure, trace, new WebSocketAdapterPb());
132
- ```
133
-
134
- There's many messages for chat, realtime, status events, notifications, etc. which can be sent or received from the socket.
135
-
136
- ```js
137
- socket.onchannelmessage = (message) => {
138
- console.info("Message received from channel", message.channel_id);
139
- console.info("Received message", message);
140
- };
141
-
142
-
143
- // 1 = channel, 2 = Direct Message, 3 = Group
144
- const type : number = 1;
145
- const roomname = "mychannel";
146
- const persistence : boolean = false;
147
- const hidden : boolean = false;
148
-
149
- const channel = await socket.joinChat(type, roomname, persistence, hidden);
150
-
151
- const message = { "hello": "world" };
152
- socket.writeChatMessage(channel.channel.id, message);
153
- ```
154
-
155
- ## Handling errors
156
-
157
- For any errors in client requests, we return the original error objects from the Fetch API: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
158
-
159
- In order to capture the Mezon server response associated with the error, when you wrap your client requests in a `try...catch` statement you can invoke `await error.json()` on the `error` object in the catch block:
160
-
161
- ```js
162
- try {
163
- const account = await client.getAccount(session);
164
- console.info(account.user.id);
165
- console.info(account.user.username);
166
- console.info(account.wallet);
167
- } catch (error) {
168
- console.info("Inner Mezon error", await error.json());
169
- }
170
- ```
171
-
172
- ## Contribute
173
-
174
- The development roadmap is managed as GitHub issues and pull requests are welcome. If you're interested in enhancing the code please open an issue to discuss the changes or drop in and discuss it in the [community forum](https://forum.mezon.vn).
175
-
176
- ### Source Builds
177
-
178
- Ensure you are using Node v18>.
179
-
180
- The codebase is multi-package monorepo written in TypeScript and can be built with [esbuild](https://github.com/evanw/esbuild). All dependencies are managed with NPM.
181
-
182
- To build from source, first install all workspace dependencies from the repository root with `npm install`.
183
-
184
- Then to build a specific workspace, pass the `--workspace` flag to your build command, for example:
185
-
186
- ```shell
187
- npm run build --workspace=mezon-js
188
- ```
189
-
190
- ### Run Tests
191
-
192
- To run tests you will need to run the server and database. Most tests are written as integration tests which execute against the server. A quick approach we use with our test workflow is to use the Docker compose file described in the [documentation](https://mezon.vn/docs/install-docker-quickstart).
193
-
194
- Tests are run against each workspace bundle; if you have made source code changes, you should `npm run build --workspace=<workspace>` prior to running tests.
195
-
196
- ```shell
197
- docker-compose -f ./docker-compose.yml up
198
- npm run test --workspace=mezon-js-test
199
- ```
200
-
201
- ### Protocol Buffer Web Socket Adapter
202
-
203
- To update the generated Typescript required for using the protocol buffer adapter, `cd` into
204
- `packages/mezon-js-protobuf` and run the following:
205
-
206
- ```shell
207
- npx protoc \
208
- --plugin="./node_modules/.bin/protoc-gen-ts_proto" \
209
- --proto_path=$GOPATH/src/github.com/mezon/mezon-common \
210
- --ts_proto_out=. \
211
- --ts_proto_opt=snakeToCamel=false \
212
- --ts_proto_opt=esModuleInterop=true \
213
- $GOPATH/src/github.com/mezon/mezon-common/rtapi/realtime.proto \
214
- $GOPATH/src/github.com/mezon/mezon-common/api/api.proto
215
- ```
216
- ```shell
217
- npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=../../../mezon-common --ts_proto_out=./ --ts_proto_opt=snakeToCamel=false --ts_proto_opt=esModuleInterop=true ../../../mezon-common/rtapi/realtime.proto ../../../mezon-common/api/api.proto
218
- ```
219
-
220
- ```shell
221
- npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=../mezon-common --ts_proto_out=. --ts_proto_opt=snakeToCamel=false --ts_proto_opt=esModuleInterop=true ../mezon-common/rtapi/realtime.proto ../mezon-common/api/api.proto
222
- ```
223
-
224
- ### Release Process
225
-
226
- To release onto NPM if you have access to the "@mezon" organization you can use NPM.
227
-
228
- ```shell
229
- npm run build --workspace=<workspace> && npm publish --access=public --workspace=<workspace>
230
- ```
231
-
232
- ### Generate Docs
233
-
234
- API docs are generated with typedoc and deployed to GitHub pages.
235
-
236
- To run typedoc:
237
-
238
- ```
239
- npm install && npm run docs
240
- ```
241
-
242
- ### License
243
-
244
- This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
1
+ Mezon JavaScript client
2
+ ========================
3
+
4
+ > JavaScript client for Mezon server written in TypeScript. For browser and React Native projects.
5
+
6
+ [Mezon](https://github.com/mezon/mezon) is an open-source server designed to power modern games and apps. Features include user accounts, chat, social, matchmaker, realtime multiplayer, and much [more](https://mezon.vn).
7
+
8
+ This client implements the full API and socket options with the server. It's written in TypeScript with minimal dependencies to be compatible with all modern browsers and React Native.
9
+
10
+ Full documentation is online - https://mezon.vn/docs/javascript-client-guide
11
+
12
+ ## Getting Started
13
+
14
+ You'll need to setup the server and database before you can connect with the client. The simplest way is to use Docker but have a look at the [server documentation](https://github.com/mezon/mezon#getting-started) for other options.
15
+
16
+ 1. Install and run the servers. Follow these [instructions](https://mezon.vn/docs/install-docker-quickstart).
17
+
18
+ 2. Import the client into your project. It's [available on NPM](https://www.npmjs.com/package/mezon-js) and can be also be added to a project with Bower or other package managers.
19
+
20
+ ```shell
21
+ npm install mezon-js
22
+ ```
23
+
24
+ You'll now see the code in the "node_modules" folder and package listed in your "package.json".
25
+
26
+ Optionally, if you would like to use the Protocol Buffers wire format with your sockets, you can import the adapter found in this package:
27
+
28
+ ```shell
29
+ npm install mezon-js-protobuf
30
+ ```
31
+
32
+ 3. Use the connection credentials to build a client object.
33
+
34
+ ```js
35
+ import {Client} from "mezon-js";
36
+
37
+ var useSSL = false; // Enable if server is run with an SSL certificate.
38
+ var client = new Client("defaultkey", "127.0.0.1", "7350", useSSL);
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ The client object has many methods to execute various features in the server or open realtime socket connections with the server.
44
+
45
+ ### Authenticate
46
+
47
+ There's a variety of ways to [authenticate](https://mezon.vn/docs/authentication) with the server. Authentication can create a user if they don't already exist with those credentials. It's also easy to authenticate with a social profile from Google Play Games, Facebook, Game Center, etc.
48
+
49
+ ```js
50
+ var email = "super@heroes.com";
51
+ var password = "batsignal";
52
+ const session = await client.authenticateEmail(email, password);
53
+ console.info(session);
54
+ ```
55
+
56
+ ### Sessions
57
+
58
+ When authenticated the server responds with an auth token (JWT) which contains useful properties and gets deserialized into a `Session` object.
59
+
60
+ ```js
61
+ console.info(session.token); // raw JWT token
62
+ console.info(session.refreshToken); // refresh token
63
+ console.info(session.userId);
64
+ console.info(session.username);
65
+ console.info("Session has expired?", session.isexpired(Date.now() / 1000));
66
+ const expiresat = session.expires_at;
67
+ console.warn("Session will expire at", new Date(expiresat * 1000).toISOString());
68
+ ```
69
+
70
+ It is recommended to store the auth token from the session and check at startup if it has expired. If the token has expired you must reauthenticate. The expiry time of the token can be changed as a setting in the server.
71
+
72
+ ```js
73
+ // Assume we've stored the auth token in browser Web Storage.
74
+ const authtoken = window.localStorage.getItem("nkauthtoken");
75
+ const refreshtoken = window.localStorage.getItem("nkrefreshtoken");
76
+
77
+ let session = mezonjs.Session.restore(authtoken, refreshtoken);
78
+
79
+ // Check whether a session is close to expiry.
80
+
81
+ const unixTimeInFuture = Date.now() + 8.64e+7; // one day from now
82
+
83
+ if (session.isexpired(unixTimeInFuture / 1000)) {
84
+ try
85
+ {
86
+ session = await client.sessionRefresh(session);
87
+ }
88
+ catch (e)
89
+ {
90
+ console.info("Session can no longer be refreshed. Must reauthenticate!");
91
+ }
92
+ }
93
+ ```
94
+
95
+ ### Requests
96
+
97
+ The client includes lots of builtin APIs for various features of the game server. These can be accessed with the methods which return Promise objects. It can also call custom logic as RPC functions on the server. These can also be executed with a socket object.
98
+
99
+ All requests are sent with a session object which authorizes the client.
100
+
101
+ ```js
102
+ const account = await client.getAccount(session);
103
+ console.info(account.user.id);
104
+ console.info(account.user.username);
105
+ console.info(account.wallet);
106
+ ```
107
+
108
+ ### Socket
109
+
110
+ The client can create one or more sockets with the server. Each socket can have it's own event listeners registered for responses received from the server.
111
+
112
+ ```js
113
+ const secure = false; // Enable if server is run with an SSL certificate
114
+ const trace = false;
115
+ const socket = client.createSocket(secure, trace);
116
+ socket.ondisconnect = (evt) => {
117
+ console.info("Disconnected", evt);
118
+ };
119
+
120
+ const session = await socket.connect(session);
121
+ // Socket is open.
122
+ ```
123
+
124
+ If you are using the optional protocol buffer adapter, pass the adapter to the Socket object during construction:
125
+
126
+ ```js
127
+ import {WebSocketAdapterPb} from "mezon-js-protobuf"
128
+
129
+ const secure = false; // Enable if server is run with an SSL certificate
130
+ const trace = false;
131
+ const socket = client.createSocket(secure, trace, new WebSocketAdapterPb());
132
+ ```
133
+
134
+ There's many messages for chat, realtime, status events, notifications, etc. which can be sent or received from the socket.
135
+
136
+ ```js
137
+ socket.onchannelmessage = (message) => {
138
+ console.info("Message received from channel", message.channel_id);
139
+ console.info("Received message", message);
140
+ };
141
+
142
+
143
+ // 1 = channel, 2 = Direct Message, 3 = Group
144
+ const type : number = 1;
145
+ const roomname = "mychannel";
146
+ const persistence : boolean = false;
147
+ const hidden : boolean = false;
148
+
149
+ const channel = await socket.joinChat(type, roomname, persistence, hidden);
150
+
151
+ const message = { "hello": "world" };
152
+ socket.writeChatMessage(channel.channel.id, message);
153
+ ```
154
+
155
+ ## Handling errors
156
+
157
+ For any errors in client requests, we return the original error objects from the Fetch API: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
158
+
159
+ In order to capture the Mezon server response associated with the error, when you wrap your client requests in a `try...catch` statement you can invoke `await error.json()` on the `error` object in the catch block:
160
+
161
+ ```js
162
+ try {
163
+ const account = await client.getAccount(session);
164
+ console.info(account.user.id);
165
+ console.info(account.user.username);
166
+ console.info(account.wallet);
167
+ } catch (error) {
168
+ console.info("Inner Mezon error", await error.json());
169
+ }
170
+ ```
171
+
172
+ ## Contribute
173
+
174
+ The development roadmap is managed as GitHub issues and pull requests are welcome. If you're interested in enhancing the code please open an issue to discuss the changes or drop in and discuss it in the [community forum](https://forum.mezon.vn).
175
+
176
+ ### Source Builds
177
+
178
+ Ensure you are using Node v18>.
179
+
180
+ The codebase is multi-package monorepo written in TypeScript and can be built with [esbuild](https://github.com/evanw/esbuild). All dependencies are managed with NPM.
181
+
182
+ To build from source, first install all workspace dependencies from the repository root with `npm install`.
183
+
184
+ Then to build a specific workspace, pass the `--workspace` flag to your build command, for example:
185
+
186
+ ```shell
187
+ npm run build --workspace=mezon-js
188
+ ```
189
+
190
+ ### Run Tests
191
+
192
+ To run tests you will need to run the server and database. Most tests are written as integration tests which execute against the server. A quick approach we use with our test workflow is to use the Docker compose file described in the [documentation](https://mezon.vn/docs/install-docker-quickstart).
193
+
194
+ Tests are run against each workspace bundle; if you have made source code changes, you should `npm run build --workspace=<workspace>` prior to running tests.
195
+
196
+ ```shell
197
+ docker-compose -f ./docker-compose.yml up
198
+ npm run test --workspace=mezon-js-test
199
+ ```
200
+
201
+ ### Protocol Buffer Web Socket Adapter
202
+
203
+ To update the generated Typescript required for using the protocol buffer adapter, `cd` into
204
+ `packages/mezon-js-protobuf` and run the following:
205
+
206
+ ```shell
207
+ npx protoc \
208
+ --plugin="./node_modules/.bin/protoc-gen-ts_proto" \
209
+ --proto_path=$GOPATH/src/github.com/mezon/mezon-common \
210
+ --ts_proto_out=. \
211
+ --ts_proto_opt=snakeToCamel=false \
212
+ --ts_proto_opt=esModuleInterop=true \
213
+ $GOPATH/src/github.com/mezon/mezon-common/rtapi/realtime.proto \
214
+ $GOPATH/src/github.com/mezon/mezon-common/api/api.proto
215
+ ```
216
+ ```shell
217
+ npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=../../../mezon-common --ts_proto_out=./ --ts_proto_opt=snakeToCamel=false --ts_proto_opt=esModuleInterop=true ../../../mezon-common/rtapi/realtime.proto ../../../mezon-common/api/api.proto
218
+ ```
219
+
220
+ ```shell
221
+ npx protoc --plugin="./node_modules/.bin/protoc-gen-ts_proto.cmd" --proto_path=../mezon-common --ts_proto_out=. --ts_proto_opt=snakeToCamel=false --ts_proto_opt=esModuleInterop=true ../mezon-common/rtapi/realtime.proto ../mezon-common/api/api.proto
222
+ ```
223
+
224
+ ### Release Process
225
+
226
+ To release onto NPM if you have access to the "@mezon" organization you can use NPM.
227
+
228
+ ```shell
229
+ npm run build --workspace=<workspace> && npm publish --access=public --workspace=<workspace>
230
+ ```
231
+
232
+ ### Generate Docs
233
+
234
+ API docs are generated with typedoc and deployed to GitHub pages.
235
+
236
+ To run typedoc:
237
+
238
+ ```
239
+ npm install && npm run docs
240
+ ```
241
+
242
+ ### License
243
+
244
+ This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
package/dist/api.d.ts CHANGED
@@ -78,6 +78,53 @@ export interface ApiChannelTimeline {
78
78
  export interface ApiListChannelTimelineResponse {
79
79
  events?: Array<ApiChannelTimeline>;
80
80
  }
81
+ export interface ApiCreatePollRequest {
82
+ channel_id?: string;
83
+ clan_id?: string;
84
+ question?: string;
85
+ answers?: string[];
86
+ expire_hours?: number;
87
+ type?: number;
88
+ }
89
+ export interface ApiPollAnswer {
90
+ index?: number;
91
+ label?: string;
92
+ }
93
+ export interface ApiPollVoterDetail {
94
+ answer_index?: number;
95
+ user_ids?: string[];
96
+ }
97
+ export interface ApiCreatePollResponse {
98
+ poll_id?: string;
99
+ message_id?: string;
100
+ question?: string;
101
+ answers?: ApiPollAnswer[];
102
+ answer_counts?: number[];
103
+ exp?: string;
104
+ is_closed?: boolean;
105
+ creator_id?: string;
106
+ type?: number;
107
+ total_votes?: number;
108
+ }
109
+ export interface ApiGetPollRequest {
110
+ poll_id?: string;
111
+ message_id?: string;
112
+ channel_id?: string;
113
+ }
114
+ export interface ApiVotePollRequest {
115
+ poll_id?: string;
116
+ message_id?: string;
117
+ channel_id?: string;
118
+ answer_indices?: number[];
119
+ }
120
+ export interface ApiClosePollRequest {
121
+ poll_id?: string;
122
+ message_id?: string;
123
+ channel_id?: string;
124
+ }
125
+ export interface ApiGetPollResponse extends ApiCreatePollResponse {
126
+ voter_details?: ApiPollVoterDetail[];
127
+ }
81
128
  /** A single user-role pair. */
82
129
  export interface ChannelUserListChannelUser {
83
130
  clan_avatar?: string;
@@ -2506,4 +2553,12 @@ export declare class MezonApi {
2506
2553
  disconnectAgent(bearerToken: string, roomName?: string, channelId?: string, options?: {}): Promise<any>;
2507
2554
  listMutedChannel(bearerToken: string, clanId: string, options?: {}): Promise<ApiMutedChannelList>;
2508
2555
  channelMessageReact(bearerToken: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean, topic_id?: string, emoji_recent_id?: string, sender_name?: string): Promise<ChannelMessageAck>;
2556
+ /** Create a poll in a channel. */
2557
+ createPoll(bearerToken: string, body: ApiCreatePollRequest, options?: {}): Promise<ApiCreatePollResponse>;
2558
+ /** Vote on a poll. */
2559
+ votePoll(bearerToken: string, body: ApiVotePollRequest, options?: {}): Promise<any>;
2560
+ /** Close a poll (creator only). */
2561
+ closePoll(bearerToken: string, body: ApiClosePollRequest, options?: {}): Promise<any>;
2562
+ /** Get poll details. */
2563
+ getPoll(bearerToken: string, body: ApiGetPollRequest, options?: {}): Promise<ApiGetPollResponse>;
2509
2564
  }
package/dist/api.gen.d.ts CHANGED
@@ -926,12 +926,9 @@ export interface ApiInviteUserRes {
926
926
  clan_id?: string;
927
927
  clan_name?: string;
928
928
  user_joined?: boolean;
929
- expiry_time_seconds?: number;
929
+ expiry_time?: string;
930
930
  clan_logo: string;
931
931
  member_count: number;
932
- banner: string;
933
- community_banner: string;
934
- is_community: boolean;
935
932
  }
936
933
  /** Add link invite users to. */
937
934
  export interface ApiLinkInviteUser {
@@ -1595,7 +1592,7 @@ export interface ApiUser {
1595
1592
  edge_count?: number;
1596
1593
  id?: string;
1597
1594
  is_mobile?: boolean;
1598
- join_time_seconds?: number;
1595
+ join_time?: string;
1599
1596
  lang_tag?: string;
1600
1597
  location?: string;
1601
1598
  user_status?: string;
@@ -2091,7 +2088,7 @@ export declare class MezonApi {
2091
2088
  /** List all users that are part of a channel. */
2092
2089
  listChannelUsers(bearerToken: string, clanId: string, channelId: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: {}): Promise<ApiChannelUserList>;
2093
2090
  /** List user channels */
2094
- listChannelDescs(bearerToken: string, limit?: number, state?: number, page?: number, clanId?: string, channelType?: number, isMobile?: boolean, options?: {}): Promise<ApiChannelDescList>;
2091
+ listChannelDescs(bearerToken: string, limit?: number, state?: number, cursor?: string, clanId?: string, channelType?: number, isMobile?: boolean, options?: {}): Promise<ApiChannelDescList>;
2095
2092
  /** Create a new channel with the current user as the owner. */
2096
2093
  createChannelDesc(bearerToken: string, body: ApiCreateChannelDescRequest, options?: {}): Promise<ApiChannelDescription>;
2097
2094
  /** list user add channel by channel ids */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiForSaleItemList, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest, ApiBannedUserList, ApiIsBannedResponse, ChannelMessage, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiListChannelTimelineRequest, ApiListChannelTimelineResponse, ApiCreateChannelTimelineRequest, ApiCreateChannelTimelineResponse, ApiUpdateChannelTimelineRequest, ApiUpdateChannelTimelineResponse, ApiDetailChannelTimelineRequest, ApiDetailChannelTimelineResponse, ApiMutedChannelList } from "./api";
16
+ import { ApiAccount, ApiAccountEmail, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiNotificationList, ApiUpdateAccountRequest, ApiSession, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiCreatePollRequest, ApiCreatePollResponse, ApiGetPollRequest, ApiGetPollResponse, ApiVotePollRequest, ApiClosePollRequest, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiMezonOauthClientList, ApiMezonOauthClient, ApiCreateHashChannelAppsResponse, ApiEmojiRecentList, ApiUserEventRequest, ApiUpdateRoleOrderRequest, ApiGenerateMezonMeetResponse, ApiGenerateMeetTokenExternalResponse, ApiUpdateClanOrderRequest, ApiMessage2InboxRequest, ApiListClanDiscover, ApiClanDiscoverRequest, ApiQuickMenuAccessList, ApiQuickMenuAccessRequest, ApiForSaleItemList, ApiIsFollowerResponse, ApiIsFollowerRequest, ApiTransferOwnershipRequest, ApiMeetParticipantRequest, ApiLinkAccountConfirmRequest, ApiLinkAccountMezon, ApiUser, ApiFriend, ApiListClanUnreadMsgIndicatorResponse, ApiAddFriendsResponse, ApiUpdateUsernameRequest, ApiBannedUserList, ApiIsBannedResponse, ChannelMessage, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiListChannelTimelineRequest, ApiListChannelTimelineResponse, ApiCreateChannelTimelineRequest, ApiCreateChannelTimelineResponse, ApiUpdateChannelTimelineRequest, ApiUpdateChannelTimelineResponse, ApiDetailChannelTimelineRequest, ApiDetailChannelTimelineResponse, ApiMutedChannelList } from "./api";
17
17
  import { Session } from "./session";
18
18
  import { Socket, ChannelMessageAck } from "./socket";
19
19
  import { WebSocketAdapter } from "mezon-js-protobuf";
@@ -502,4 +502,12 @@ export declare class Client {
502
502
  disconnectAgent(session: Session, roomName?: string, channelId?: string): Promise<any>;
503
503
  listMutedChannel(session: Session, clanId: string): Promise<ApiMutedChannelList>;
504
504
  channelMessageReact(session: Session, clanId: string, channelId: string, mode: number, isPublic: boolean, messageId: string, emojiId: string, emoji: string, count: number, messageSenderId: string, actionDelete: boolean, topicId?: string, emojiRecentId?: string, senderName?: string): Promise<ChannelMessageAck>;
505
+ /** Create a poll in a channel. */
506
+ createPoll(session: Session, request: ApiCreatePollRequest): Promise<ApiCreatePollResponse>;
507
+ /** Vote on a poll. */
508
+ votePoll(session: Session, request: ApiVotePollRequest): Promise<any>;
509
+ /** Close a poll (creator only). */
510
+ closePoll(session: Session, request: ApiClosePollRequest): Promise<any>;
511
+ /** Get poll details. */
512
+ getPoll(session: Session, request: ApiGetPollRequest): Promise<ApiGetPollResponse>;
505
513
  }