mezon-js-protobuf 1.10.21 → 1.10.22

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,43 +1,43 @@
1
- Mezon JavaScript Protobuf adapter
2
- ========================
3
-
4
- > Websocket adapter adding protocol buffer support to the [mezon-js](https://www.npmjs.com/package/mezon-js) client.
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
-
9
- ## Getting Started
10
-
11
- 1. Import the adapter into your project:
12
-
13
- ```shell
14
- yarn add "mezon-js-protobuf"
15
- ```
16
-
17
- 2. Pass the Protobuf adapter to build the socket object.
18
-
19
- ```js
20
- import {Client} from "mezon-js";
21
- import {WebSocketAdapterPb} from "mezon-js-protobuf"
22
-
23
- const useSSL = false; // Enable if server is run with an SSL certificate.
24
- const client = new Client("defaultkey", "127.0.0.1", 7350, useSSL);
25
-
26
- const trace = false;
27
- const socket = client.createSocket(useSSL, trace, new WebSocketAdapterPb());
28
- ```
29
-
30
- 3. Use the WebSocket:
31
-
32
- ```js
33
- socket.ondisconnect = (evt) => {
34
- console.info("Disconnected", evt);
35
- };
36
-
37
- const session = await socket.connect(session);
38
- // Socket is open.
39
- ```
40
-
41
- ### License
42
-
43
- This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
1
+ Mezon JavaScript Protobuf adapter
2
+ ========================
3
+
4
+ > Websocket adapter adding protocol buffer support to the [mezon-js](https://www.npmjs.com/package/mezon-js) client.
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
+
9
+ ## Getting Started
10
+
11
+ 1. Import the adapter into your project:
12
+
13
+ ```shell
14
+ yarn add "mezon-js-protobuf"
15
+ ```
16
+
17
+ 2. Pass the Protobuf adapter to build the socket object.
18
+
19
+ ```js
20
+ import {Client} from "mezon-js";
21
+ import {WebSocketAdapterPb} from "mezon-js-protobuf"
22
+
23
+ const useSSL = false; // Enable if server is run with an SSL certificate.
24
+ const client = new Client("defaultkey", "127.0.0.1", 7350, useSSL);
25
+
26
+ const trace = false;
27
+ const socket = client.createSocket(useSSL, trace, new WebSocketAdapterPb());
28
+ ```
29
+
30
+ 3. Use the WebSocket:
31
+
32
+ ```js
33
+ socket.ondisconnect = (evt) => {
34
+ console.info("Disconnected", evt);
35
+ };
36
+
37
+ const session = await socket.connect(session);
38
+ // Socket is open.
39
+ ```
40
+
41
+ ### License
42
+
43
+ This project is licensed under the [Apache-2 License](https://github.com/nccasia/mezon-js/blob/master/LICENSE).
package/dist/api/api.d.ts CHANGED
@@ -27,6 +27,13 @@ export declare enum Operator {
27
27
  }
28
28
  export declare function operatorFromJSON(object: any): Operator;
29
29
  export declare function operatorToJSON(object: Operator): string;
30
+ export declare enum PollType {
31
+ SINGLE = 0,
32
+ MULTIPLE = 1,
33
+ UNRECOGNIZED = -1
34
+ }
35
+ export declare function pollTypeFromJSON(object: any): PollType;
36
+ export declare function pollTypeToJSON(object: PollType): string;
30
37
  export interface Account {
31
38
  user: User | undefined;
32
39
  email: string;
@@ -1067,6 +1074,19 @@ export interface UploadAttachment {
1067
1074
  filename: string;
1068
1075
  url: string;
1069
1076
  }
1077
+ export interface MultipartUploadAttachment {
1078
+ filename: string;
1079
+ urls: string[];
1080
+ upload_id: string;
1081
+ }
1082
+ export interface MultipartUploadAttachmentPart {
1083
+ part_number: number;
1084
+ e_tag: string;
1085
+ }
1086
+ export interface MultipartUploadAttachmentFinishRequest {
1087
+ upload_id: string;
1088
+ parts: MultipartUploadAttachmentPart[];
1089
+ }
1070
1090
  export interface SearchMessageRequest {
1071
1091
  filters: FilterParam[];
1072
1092
  from: number;
@@ -2212,6 +2232,72 @@ export interface ListMutedChannelRequest {
2212
2232
  export interface MutedChannelList {
2213
2233
  muted_list: string[];
2214
2234
  }
2235
+ export interface NotificationBatchRequest {
2236
+ notifications: {
2237
+ [key: string]: NotificationList;
2238
+ };
2239
+ }
2240
+ export interface NotificationBatchRequest_NotificationsEntry {
2241
+ key: string;
2242
+ value: NotificationList | undefined;
2243
+ }
2244
+ export interface CreatePollRequest {
2245
+ channel_id: string;
2246
+ clan_id: string;
2247
+ question: string;
2248
+ answers: string[];
2249
+ expire_hours: number;
2250
+ type: PollType;
2251
+ }
2252
+ export interface CreatePollResponse {
2253
+ poll_id: string;
2254
+ message_id: string;
2255
+ question: string;
2256
+ answers: PollAnswer[];
2257
+ answer_counts: number[];
2258
+ exp: string;
2259
+ is_closed: boolean;
2260
+ creator_id: string;
2261
+ type: PollType;
2262
+ total_votes: number;
2263
+ }
2264
+ export interface VotePollRequest {
2265
+ poll_id: string;
2266
+ message_id: string;
2267
+ channel_id: string;
2268
+ answer_indices: number[];
2269
+ }
2270
+ export interface ClosePollRequest {
2271
+ poll_id: string;
2272
+ message_id: string;
2273
+ channel_id: string;
2274
+ }
2275
+ export interface GetPollRequest {
2276
+ poll_id: string;
2277
+ message_id: string;
2278
+ channel_id: string;
2279
+ }
2280
+ export interface PollAnswer {
2281
+ index: number;
2282
+ label: string;
2283
+ }
2284
+ export interface PollVoterDetail {
2285
+ answer_index: number;
2286
+ user_ids: string[];
2287
+ }
2288
+ export interface GetPollResponse {
2289
+ poll_id: string;
2290
+ message_id: string;
2291
+ question: string;
2292
+ answers: PollAnswer[];
2293
+ answer_counts: number[];
2294
+ exp: string;
2295
+ is_closed: boolean;
2296
+ creator_id: string;
2297
+ type: PollType;
2298
+ total_votes: number;
2299
+ voter_details: PollVoterDetail[];
2300
+ }
2215
2301
  export declare const Account: {
2216
2302
  encode(message: Account, writer?: _m0.Writer): _m0.Writer;
2217
2303
  decode(input: _m0.Reader | Uint8Array, length?: number): Account;
@@ -3444,6 +3530,30 @@ export declare const UploadAttachment: {
3444
3530
  create<I extends Exact<DeepPartial<UploadAttachment>, I>>(base?: I): UploadAttachment;
3445
3531
  fromPartial<I extends Exact<DeepPartial<UploadAttachment>, I>>(object: I): UploadAttachment;
3446
3532
  };
3533
+ export declare const MultipartUploadAttachment: {
3534
+ encode(message: MultipartUploadAttachment, writer?: _m0.Writer): _m0.Writer;
3535
+ decode(input: _m0.Reader | Uint8Array, length?: number): MultipartUploadAttachment;
3536
+ fromJSON(object: any): MultipartUploadAttachment;
3537
+ toJSON(message: MultipartUploadAttachment): unknown;
3538
+ create<I extends Exact<DeepPartial<MultipartUploadAttachment>, I>>(base?: I): MultipartUploadAttachment;
3539
+ fromPartial<I extends Exact<DeepPartial<MultipartUploadAttachment>, I>>(object: I): MultipartUploadAttachment;
3540
+ };
3541
+ export declare const MultipartUploadAttachmentPart: {
3542
+ encode(message: MultipartUploadAttachmentPart, writer?: _m0.Writer): _m0.Writer;
3543
+ decode(input: _m0.Reader | Uint8Array, length?: number): MultipartUploadAttachmentPart;
3544
+ fromJSON(object: any): MultipartUploadAttachmentPart;
3545
+ toJSON(message: MultipartUploadAttachmentPart): unknown;
3546
+ create<I extends Exact<DeepPartial<MultipartUploadAttachmentPart>, I>>(base?: I): MultipartUploadAttachmentPart;
3547
+ fromPartial<I extends Exact<DeepPartial<MultipartUploadAttachmentPart>, I>>(object: I): MultipartUploadAttachmentPart;
3548
+ };
3549
+ export declare const MultipartUploadAttachmentFinishRequest: {
3550
+ encode(message: MultipartUploadAttachmentFinishRequest, writer?: _m0.Writer): _m0.Writer;
3551
+ decode(input: _m0.Reader | Uint8Array, length?: number): MultipartUploadAttachmentFinishRequest;
3552
+ fromJSON(object: any): MultipartUploadAttachmentFinishRequest;
3553
+ toJSON(message: MultipartUploadAttachmentFinishRequest): unknown;
3554
+ create<I extends Exact<DeepPartial<MultipartUploadAttachmentFinishRequest>, I>>(base?: I): MultipartUploadAttachmentFinishRequest;
3555
+ fromPartial<I extends Exact<DeepPartial<MultipartUploadAttachmentFinishRequest>, I>>(object: I): MultipartUploadAttachmentFinishRequest;
3556
+ };
3447
3557
  export declare const SearchMessageRequest: {
3448
3558
  encode(message: SearchMessageRequest, writer?: _m0.Writer): _m0.Writer;
3449
3559
  decode(input: _m0.Reader | Uint8Array, length?: number): SearchMessageRequest;
@@ -4940,45 +5050,22 @@ export declare const MutedChannelList: {
4940
5050
  create<I extends Exact<DeepPartial<MutedChannelList>, I>>(base?: I): MutedChannelList;
4941
5051
  fromPartial<I extends Exact<DeepPartial<MutedChannelList>, I>>(object: I): MutedChannelList;
4942
5052
  };
4943
- export declare enum PollType {
4944
- SINGLE = 0,
4945
- MULTIPLE = 1,
4946
- UNRECOGNIZED = -1
4947
- }
4948
- export declare function pollTypeFromJSON(object: any): PollType;
4949
- export declare function pollTypeToJSON(object: PollType): string;
4950
- export interface PollAnswer {
4951
- index: number;
4952
- label: string;
4953
- }
4954
- export declare const PollAnswer: {
4955
- encode(message: PollAnswer, writer?: _m0.Writer): _m0.Writer;
4956
- decode(input: _m0.Reader | Uint8Array, length?: number): PollAnswer;
4957
- fromJSON(object: any): PollAnswer;
4958
- toJSON(message: PollAnswer): unknown;
4959
- create<I extends Exact<DeepPartial<PollAnswer>, I>>(base?: I): PollAnswer;
4960
- fromPartial<I extends Exact<DeepPartial<PollAnswer>, I>>(object: I): PollAnswer;
4961
- };
4962
- export interface PollVoterDetail {
4963
- answer_index: number;
4964
- user_ids: string[];
4965
- }
4966
- export declare const PollVoterDetail: {
4967
- encode(message: PollVoterDetail, writer?: _m0.Writer): _m0.Writer;
4968
- decode(input: _m0.Reader | Uint8Array, length?: number): PollVoterDetail;
4969
- fromJSON(object: any): PollVoterDetail;
4970
- toJSON(message: PollVoterDetail): unknown;
4971
- create<I extends Exact<DeepPartial<PollVoterDetail>, I>>(base?: I): PollVoterDetail;
4972
- fromPartial<I extends Exact<DeepPartial<PollVoterDetail>, I>>(object: I): PollVoterDetail;
5053
+ export declare const NotificationBatchRequest: {
5054
+ encode(message: NotificationBatchRequest, writer?: _m0.Writer): _m0.Writer;
5055
+ decode(input: _m0.Reader | Uint8Array, length?: number): NotificationBatchRequest;
5056
+ fromJSON(object: any): NotificationBatchRequest;
5057
+ toJSON(message: NotificationBatchRequest): unknown;
5058
+ create<I extends Exact<DeepPartial<NotificationBatchRequest>, I>>(base?: I): NotificationBatchRequest;
5059
+ fromPartial<I extends Exact<DeepPartial<NotificationBatchRequest>, I>>(object: I): NotificationBatchRequest;
5060
+ };
5061
+ export declare const NotificationBatchRequest_NotificationsEntry: {
5062
+ encode(message: NotificationBatchRequest_NotificationsEntry, writer?: _m0.Writer): _m0.Writer;
5063
+ decode(input: _m0.Reader | Uint8Array, length?: number): NotificationBatchRequest_NotificationsEntry;
5064
+ fromJSON(object: any): NotificationBatchRequest_NotificationsEntry;
5065
+ toJSON(message: NotificationBatchRequest_NotificationsEntry): unknown;
5066
+ create<I extends Exact<DeepPartial<NotificationBatchRequest_NotificationsEntry>, I>>(base?: I): NotificationBatchRequest_NotificationsEntry;
5067
+ fromPartial<I extends Exact<DeepPartial<NotificationBatchRequest_NotificationsEntry>, I>>(object: I): NotificationBatchRequest_NotificationsEntry;
4973
5068
  };
4974
- export interface CreatePollRequest {
4975
- channel_id: string;
4976
- clan_id: string;
4977
- question: string;
4978
- answers: string[];
4979
- expire_hours: number;
4980
- type: PollType;
4981
- }
4982
5069
  export declare const CreatePollRequest: {
4983
5070
  encode(message: CreatePollRequest, writer?: _m0.Writer): _m0.Writer;
4984
5071
  decode(input: _m0.Reader | Uint8Array, length?: number): CreatePollRequest;
@@ -4987,18 +5074,6 @@ export declare const CreatePollRequest: {
4987
5074
  create<I extends Exact<DeepPartial<CreatePollRequest>, I>>(base?: I): CreatePollRequest;
4988
5075
  fromPartial<I extends Exact<DeepPartial<CreatePollRequest>, I>>(object: I): CreatePollRequest;
4989
5076
  };
4990
- export interface CreatePollResponse {
4991
- poll_id: string;
4992
- message_id: string;
4993
- question: string;
4994
- answers: PollAnswer[];
4995
- answer_counts: number[];
4996
- exp: string;
4997
- is_closed: boolean;
4998
- creator_id: string;
4999
- type: PollType;
5000
- total_votes: number;
5001
- }
5002
5077
  export declare const CreatePollResponse: {
5003
5078
  encode(message: CreatePollResponse, writer?: _m0.Writer): _m0.Writer;
5004
5079
  decode(input: _m0.Reader | Uint8Array, length?: number): CreatePollResponse;
@@ -5007,12 +5082,6 @@ export declare const CreatePollResponse: {
5007
5082
  create<I extends Exact<DeepPartial<CreatePollResponse>, I>>(base?: I): CreatePollResponse;
5008
5083
  fromPartial<I extends Exact<DeepPartial<CreatePollResponse>, I>>(object: I): CreatePollResponse;
5009
5084
  };
5010
- export interface VotePollRequest {
5011
- poll_id: string;
5012
- message_id: string;
5013
- channel_id: string;
5014
- answer_indices: number[];
5015
- }
5016
5085
  export declare const VotePollRequest: {
5017
5086
  encode(message: VotePollRequest, writer?: _m0.Writer): _m0.Writer;
5018
5087
  decode(input: _m0.Reader | Uint8Array, length?: number): VotePollRequest;
@@ -5021,11 +5090,6 @@ export declare const VotePollRequest: {
5021
5090
  create<I extends Exact<DeepPartial<VotePollRequest>, I>>(base?: I): VotePollRequest;
5022
5091
  fromPartial<I extends Exact<DeepPartial<VotePollRequest>, I>>(object: I): VotePollRequest;
5023
5092
  };
5024
- export interface ClosePollRequest {
5025
- poll_id: string;
5026
- message_id: string;
5027
- channel_id: string;
5028
- }
5029
5093
  export declare const ClosePollRequest: {
5030
5094
  encode(message: ClosePollRequest, writer?: _m0.Writer): _m0.Writer;
5031
5095
  decode(input: _m0.Reader | Uint8Array, length?: number): ClosePollRequest;
@@ -5034,11 +5098,6 @@ export declare const ClosePollRequest: {
5034
5098
  create<I extends Exact<DeepPartial<ClosePollRequest>, I>>(base?: I): ClosePollRequest;
5035
5099
  fromPartial<I extends Exact<DeepPartial<ClosePollRequest>, I>>(object: I): ClosePollRequest;
5036
5100
  };
5037
- export interface GetPollRequest {
5038
- poll_id: string;
5039
- message_id: string;
5040
- channel_id: string;
5041
- }
5042
5101
  export declare const GetPollRequest: {
5043
5102
  encode(message: GetPollRequest, writer?: _m0.Writer): _m0.Writer;
5044
5103
  decode(input: _m0.Reader | Uint8Array, length?: number): GetPollRequest;
@@ -5047,19 +5106,22 @@ export declare const GetPollRequest: {
5047
5106
  create<I extends Exact<DeepPartial<GetPollRequest>, I>>(base?: I): GetPollRequest;
5048
5107
  fromPartial<I extends Exact<DeepPartial<GetPollRequest>, I>>(object: I): GetPollRequest;
5049
5108
  };
5050
- export interface GetPollResponse {
5051
- poll_id: string;
5052
- message_id: string;
5053
- question: string;
5054
- answers: PollAnswer[];
5055
- answer_counts: number[];
5056
- exp: string;
5057
- is_closed: boolean;
5058
- creator_id: string;
5059
- type: PollType;
5060
- total_votes: number;
5061
- voter_details: PollVoterDetail[];
5062
- }
5109
+ export declare const PollAnswer: {
5110
+ encode(message: PollAnswer, writer?: _m0.Writer): _m0.Writer;
5111
+ decode(input: _m0.Reader | Uint8Array, length?: number): PollAnswer;
5112
+ fromJSON(object: any): PollAnswer;
5113
+ toJSON(message: PollAnswer): unknown;
5114
+ create<I extends Exact<DeepPartial<PollAnswer>, I>>(base?: I): PollAnswer;
5115
+ fromPartial<I extends Exact<DeepPartial<PollAnswer>, I>>(object: I): PollAnswer;
5116
+ };
5117
+ export declare const PollVoterDetail: {
5118
+ encode(message: PollVoterDetail, writer?: _m0.Writer): _m0.Writer;
5119
+ decode(input: _m0.Reader | Uint8Array, length?: number): PollVoterDetail;
5120
+ fromJSON(object: any): PollVoterDetail;
5121
+ toJSON(message: PollVoterDetail): unknown;
5122
+ create<I extends Exact<DeepPartial<PollVoterDetail>, I>>(base?: I): PollVoterDetail;
5123
+ fromPartial<I extends Exact<DeepPartial<PollVoterDetail>, I>>(object: I): PollVoterDetail;
5124
+ };
5063
5125
  export declare const GetPollResponse: {
5064
5126
  encode(message: GetPollResponse, writer?: _m0.Writer): _m0.Writer;
5065
5127
  decode(input: _m0.Reader | Uint8Array, length?: number): GetPollResponse;