mezon-js 2.14.61 → 2.14.63

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/api/api.ts CHANGED
@@ -41305,4 +41305,292 @@ export const HandleParticipantMeetStateEvent = {
41305
41305
  message.room_name = object.room_name ?? "";
41306
41306
  return message;
41307
41307
  },
41308
+ };
41309
+
41310
+ export interface MessageButtonClicked {
41311
+ message_id: string;
41312
+ channel_id: string;
41313
+ button_id: string;
41314
+ sender_id: string;
41315
+ user_id: string;
41316
+ extra_data: string;
41317
+ }
41318
+
41319
+ export interface DropdownBoxSelected {
41320
+ message_id: string;
41321
+ channel_id: string;
41322
+ selectbox_id: string;
41323
+ sender_id: string;
41324
+ user_id: string;
41325
+ values: string[];
41326
+ }
41327
+
41328
+
41329
+ function createBaseMessageButtonClicked(): MessageButtonClicked {
41330
+ return { message_id: "0", channel_id: "0", button_id: "", sender_id: "0", user_id: "0", extra_data: "" };
41331
+ }
41332
+
41333
+ export const MessageButtonClicked = {
41334
+ encode(message: MessageButtonClicked, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
41335
+ if (message.message_id !== "0") {
41336
+ writer.uint32(8).int64(message.message_id);
41337
+ }
41338
+ if (message.channel_id !== "0") {
41339
+ writer.uint32(16).int64(message.channel_id);
41340
+ }
41341
+ if (message.button_id !== "") {
41342
+ writer.uint32(26).string(message.button_id);
41343
+ }
41344
+ if (message.sender_id !== "0") {
41345
+ writer.uint32(32).int64(message.sender_id);
41346
+ }
41347
+ if (message.user_id !== "0") {
41348
+ writer.uint32(40).int64(message.user_id);
41349
+ }
41350
+ if (message.extra_data !== "") {
41351
+ writer.uint32(50).string(message.extra_data);
41352
+ }
41353
+ return writer;
41354
+ },
41355
+
41356
+ decode(input: _m0.Reader | Uint8Array, length?: number): MessageButtonClicked {
41357
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
41358
+ let end = length === undefined ? reader.len : reader.pos + length;
41359
+ const message = createBaseMessageButtonClicked();
41360
+ while (reader.pos < end) {
41361
+ const tag = reader.uint32();
41362
+ switch (tag >>> 3) {
41363
+ case 1:
41364
+ if (tag !== 8) {
41365
+ break;
41366
+ }
41367
+
41368
+ message.message_id = longToString(reader.int64() as Long);
41369
+ continue;
41370
+ case 2:
41371
+ if (tag !== 16) {
41372
+ break;
41373
+ }
41374
+
41375
+ message.channel_id = longToString(reader.int64() as Long);
41376
+ continue;
41377
+ case 3:
41378
+ if (tag !== 26) {
41379
+ break;
41380
+ }
41381
+
41382
+ message.button_id = reader.string();
41383
+ continue;
41384
+ case 4:
41385
+ if (tag !== 32) {
41386
+ break;
41387
+ }
41388
+
41389
+ message.sender_id = longToString(reader.int64() as Long);
41390
+ continue;
41391
+ case 5:
41392
+ if (tag !== 40) {
41393
+ break;
41394
+ }
41395
+
41396
+ message.user_id = longToString(reader.int64() as Long);
41397
+ continue;
41398
+ case 6:
41399
+ if (tag !== 50) {
41400
+ break;
41401
+ }
41402
+
41403
+ message.extra_data = reader.string();
41404
+ continue;
41405
+ }
41406
+ if ((tag & 7) === 4 || tag === 0) {
41407
+ break;
41408
+ }
41409
+ reader.skipType(tag & 7);
41410
+ }
41411
+ return message;
41412
+ },
41413
+
41414
+ fromJSON(object: any): MessageButtonClicked {
41415
+ return {
41416
+ message_id: isSet(object.message_id) ? globalThis.String(object.message_id) : "0",
41417
+ channel_id: isSet(object.channel_id) ? globalThis.String(object.channel_id) : "0",
41418
+ button_id: isSet(object.button_id) ? globalThis.String(object.button_id) : "",
41419
+ sender_id: isSet(object.sender_id) ? globalThis.String(object.sender_id) : "0",
41420
+ user_id: isSet(object.user_id) ? globalThis.String(object.user_id) : "0",
41421
+ extra_data: isSet(object.extra_data) ? globalThis.String(object.extra_data) : "",
41422
+ };
41423
+ },
41424
+
41425
+ toJSON(message: MessageButtonClicked): unknown {
41426
+ const obj: any = {};
41427
+ if (message.message_id !== "0") {
41428
+ obj.message_id = message.message_id;
41429
+ }
41430
+ if (message.channel_id !== "0") {
41431
+ obj.channel_id = message.channel_id;
41432
+ }
41433
+ if (message.button_id !== "") {
41434
+ obj.button_id = message.button_id;
41435
+ }
41436
+ if (message.sender_id !== "0") {
41437
+ obj.sender_id = message.sender_id;
41438
+ }
41439
+ if (message.user_id !== "0") {
41440
+ obj.user_id = message.user_id;
41441
+ }
41442
+ if (message.extra_data !== "") {
41443
+ obj.extra_data = message.extra_data;
41444
+ }
41445
+ return obj;
41446
+ },
41447
+
41448
+ create<I extends Exact<DeepPartial<MessageButtonClicked>, I>>(base?: I): MessageButtonClicked {
41449
+ return MessageButtonClicked.fromPartial(base ?? ({} as any));
41450
+ },
41451
+ fromPartial<I extends Exact<DeepPartial<MessageButtonClicked>, I>>(object: I): MessageButtonClicked {
41452
+ const message = createBaseMessageButtonClicked();
41453
+ message.message_id = object.message_id ?? "0";
41454
+ message.channel_id = object.channel_id ?? "0";
41455
+ message.button_id = object.button_id ?? "";
41456
+ message.sender_id = object.sender_id ?? "0";
41457
+ message.user_id = object.user_id ?? "0";
41458
+ message.extra_data = object.extra_data ?? "";
41459
+ return message;
41460
+ },
41461
+ };
41462
+
41463
+
41464
+ function createBaseDropdownBoxSelected(): DropdownBoxSelected {
41465
+ return { message_id: "0", channel_id: "0", selectbox_id: "", sender_id: "0", user_id: "0", values: [] };
41466
+ }
41467
+
41468
+ export const DropdownBoxSelected = {
41469
+ encode(message: DropdownBoxSelected, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
41470
+ if (message.message_id !== "0") {
41471
+ writer.uint32(8).int64(message.message_id);
41472
+ }
41473
+ if (message.channel_id !== "0") {
41474
+ writer.uint32(16).int64(message.channel_id);
41475
+ }
41476
+ if (message.selectbox_id !== "") {
41477
+ writer.uint32(26).string(message.selectbox_id);
41478
+ }
41479
+ if (message.sender_id !== "0") {
41480
+ writer.uint32(32).int64(message.sender_id);
41481
+ }
41482
+ if (message.user_id !== "0") {
41483
+ writer.uint32(40).int64(message.user_id);
41484
+ }
41485
+ for (const v of message.values) {
41486
+ writer.uint32(50).string(v!);
41487
+ }
41488
+ return writer;
41489
+ },
41490
+
41491
+ decode(input: _m0.Reader | Uint8Array, length?: number): DropdownBoxSelected {
41492
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
41493
+ let end = length === undefined ? reader.len : reader.pos + length;
41494
+ const message = createBaseDropdownBoxSelected();
41495
+ while (reader.pos < end) {
41496
+ const tag = reader.uint32();
41497
+ switch (tag >>> 3) {
41498
+ case 1:
41499
+ if (tag !== 8) {
41500
+ break;
41501
+ }
41502
+
41503
+ message.message_id = longToString(reader.int64() as Long);
41504
+ continue;
41505
+ case 2:
41506
+ if (tag !== 16) {
41507
+ break;
41508
+ }
41509
+
41510
+ message.channel_id = longToString(reader.int64() as Long);
41511
+ continue;
41512
+ case 3:
41513
+ if (tag !== 26) {
41514
+ break;
41515
+ }
41516
+
41517
+ message.selectbox_id = reader.string();
41518
+ continue;
41519
+ case 4:
41520
+ if (tag !== 32) {
41521
+ break;
41522
+ }
41523
+
41524
+ message.sender_id = longToString(reader.int64() as Long);
41525
+ continue;
41526
+ case 5:
41527
+ if (tag !== 40) {
41528
+ break;
41529
+ }
41530
+
41531
+ message.user_id = longToString(reader.int64() as Long);
41532
+ continue;
41533
+ case 6:
41534
+ if (tag !== 50) {
41535
+ break;
41536
+ }
41537
+
41538
+ message.values.push(reader.string());
41539
+ continue;
41540
+ }
41541
+ if ((tag & 7) === 4 || tag === 0) {
41542
+ break;
41543
+ }
41544
+ reader.skipType(tag & 7);
41545
+ }
41546
+ return message;
41547
+ },
41548
+
41549
+ fromJSON(object: any): DropdownBoxSelected {
41550
+ return {
41551
+ message_id: isSet(object.message_id) ? globalThis.String(object.message_id) : "0",
41552
+ channel_id: isSet(object.channel_id) ? globalThis.String(object.channel_id) : "0",
41553
+ selectbox_id: isSet(object.selectbox_id) ? globalThis.String(object.selectbox_id) : "",
41554
+ sender_id: isSet(object.sender_id) ? globalThis.String(object.sender_id) : "0",
41555
+ user_id: isSet(object.user_id) ? globalThis.String(object.user_id) : "0",
41556
+ values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [],
41557
+ };
41558
+ },
41559
+
41560
+ toJSON(message: DropdownBoxSelected): unknown {
41561
+ const obj: any = {};
41562
+ if (message.message_id !== "0") {
41563
+ obj.message_id = message.message_id;
41564
+ }
41565
+ if (message.channel_id !== "0") {
41566
+ obj.channel_id = message.channel_id;
41567
+ }
41568
+ if (message.selectbox_id !== "") {
41569
+ obj.selectbox_id = message.selectbox_id;
41570
+ }
41571
+ if (message.sender_id !== "0") {
41572
+ obj.sender_id = message.sender_id;
41573
+ }
41574
+ if (message.user_id !== "0") {
41575
+ obj.user_id = message.user_id;
41576
+ }
41577
+ if (message.values?.length) {
41578
+ obj.values = message.values;
41579
+ }
41580
+ return obj;
41581
+ },
41582
+
41583
+ create<I extends Exact<DeepPartial<DropdownBoxSelected>, I>>(base?: I): DropdownBoxSelected {
41584
+ return DropdownBoxSelected.fromPartial(base ?? ({} as any));
41585
+ },
41586
+ fromPartial<I extends Exact<DeepPartial<DropdownBoxSelected>, I>>(object: I): DropdownBoxSelected {
41587
+ const message = createBaseDropdownBoxSelected();
41588
+ message.message_id = object.message_id ?? "0";
41589
+ message.channel_id = object.channel_id ?? "0";
41590
+ message.selectbox_id = object.selectbox_id ?? "";
41591
+ message.sender_id = object.sender_id ?? "0";
41592
+ message.user_id = object.user_id ?? "0";
41593
+ message.values = object.values?.map((e) => e) || [];
41594
+ return message;
41595
+ },
41308
41596
  };
package/api.gen.ts CHANGED
@@ -609,7 +609,7 @@ export interface ApiApp {
609
609
  //The UNIX time when the app was disabled.
610
610
  disable_time?: string;
611
611
  //The UNIX time when the app was created.
612
- create_time?: string;
612
+ create_time_seconds?: number;
613
613
  //
614
614
  id?: string;
615
615
  //
@@ -814,7 +814,7 @@ export interface ApiChannelCanvasItem {
814
814
  // update time
815
815
  update_time?: string;
816
816
  // create time
817
- create_time?: string;
817
+ create_time_seconds?: number;
818
818
  }
819
819
 
820
820
  /** */
@@ -1130,7 +1130,7 @@ export interface ApiClanSticker {
1130
1130
  //
1131
1131
  clan_name?: string;
1132
1132
  //
1133
- create_time?: string;
1133
+ create_time_seconds?: number;
1134
1134
  //
1135
1135
  creator_id?: string;
1136
1136
  //
@@ -1468,7 +1468,7 @@ export interface ApiEventManagement {
1468
1468
  //
1469
1469
  user_ids?: Array<string>;
1470
1470
  //
1471
- create_time?: string;
1471
+ create_time_seconds?: number;
1472
1472
  //
1473
1473
  channel_id?: string;
1474
1474
  //
@@ -1634,7 +1634,7 @@ export interface ApiLinkInviteUser {
1634
1634
  //
1635
1635
  clan_id?: string;
1636
1636
  //
1637
- create_time?: string;
1637
+ create_time_seconds?: number;
1638
1638
  //The user to add.
1639
1639
  creator_id?: string;
1640
1640
  //
@@ -1762,7 +1762,7 @@ export interface ApiMarkAsReadRequest {
1762
1762
  /** */
1763
1763
  export interface ApiMessageMention {
1764
1764
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
1765
- create_time?: string;
1765
+ create_time_seconds?: number;
1766
1766
  //
1767
1767
  id?: string;
1768
1768
  //
@@ -2166,8 +2166,6 @@ export interface ApiPinMessage {
2166
2166
  channel_id?: string;
2167
2167
  //
2168
2168
  content?: string;
2169
- //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
2170
- create_time?: string;
2171
2169
  //
2172
2170
  create_time_seconds?: number;
2173
2171
  //
@@ -2381,7 +2379,7 @@ export interface ApiSdTopic {
2381
2379
  //
2382
2380
  clan_id?: string;
2383
2381
  //
2384
- create_time?: string;
2382
+ create_time_seconds?: number;
2385
2383
  //
2386
2384
  creator_id?: string;
2387
2385
  //
@@ -2435,7 +2433,7 @@ export interface ApiSearchMessageDocument {
2435
2433
  //
2436
2434
  content?: string;
2437
2435
  //
2438
- create_time?: string;
2436
+ create_time_seconds?: number;
2439
2437
  //
2440
2438
  display_name?: string;
2441
2439
  //
@@ -2657,7 +2655,7 @@ export interface ApiTransactionDetail {
2657
2655
  //
2658
2656
  amount?: number;
2659
2657
  //
2660
- create_time?: string;
2658
+ create_time_seconds?: number;
2661
2659
  //
2662
2660
  update_time?: string;
2663
2661
  //
@@ -2772,7 +2770,7 @@ export interface ApiUser {
2772
2770
  //
2773
2771
  dob_seconds?: number;
2774
2772
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
2775
- create_time?: string;
2773
+ create_time_seconds?: number;
2776
2774
  //The display name of the user.
2777
2775
  display_name?: string;
2778
2776
  //Number of related edges to this user.
@@ -2934,7 +2932,7 @@ export interface ApiWebhook {
2934
2932
  //
2935
2933
  channel_id?: string;
2936
2934
  //
2937
- create_time?: string;
2935
+ create_time_seconds?: number;
2938
2936
  //
2939
2937
  creator_id?: string;
2940
2938
  //
@@ -3101,7 +3099,7 @@ export interface ApiOnboardingItem {
3101
3099
  //
3102
3100
  content?: string;
3103
3101
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
3104
- create_time?: string;
3102
+ create_time_seconds?: number;
3105
3103
  //
3106
3104
  guide_type?: number;
3107
3105
  //
@@ -3137,7 +3135,7 @@ export interface ApiClanWebhook {
3137
3135
  //clan id.
3138
3136
  clan_id?: string;
3139
3137
  //create time.
3140
- create_time?: string;
3138
+ create_time_seconds?: number;
3141
3139
  //creator id.
3142
3140
  creator_id?: string;
3143
3141
  //id.
@@ -3375,7 +3373,7 @@ export interface ApiClanDiscover {
3375
3373
  //
3376
3374
  short_url?: string;
3377
3375
  //
3378
- create_time?: string;
3376
+ create_time_seconds?: number;
3379
3377
  }
3380
3378
 
3381
3379
  /** */
@@ -12202,5 +12200,105 @@ export class MezonApi {
12202
12200
  ]);
12203
12201
  }
12204
12202
 
12203
+ /** */
12204
+ messageButtonClick(bearerToken: string,
12205
+ messageId?:string,
12206
+ channelId?:string,
12207
+ buttonId?:string,
12208
+ senderId?: string,
12209
+ userId?: string,
12210
+ extraData?: string,
12211
+ options: any = {}): Promise<any> {
12212
+
12213
+ const urlPath = "/mezon.api.Mezon/MessageButtonClick";
12214
+ const queryParams = new Map<string, any>();
12215
+
12216
+ const body = {
12217
+ message_id: messageId,
12218
+ channel_id: channelId,
12219
+ button_id: buttonId,
12220
+ sender_id: senderId,
12221
+ user_id: userId,
12222
+ extra_data: extraData
12223
+ };
12224
+
12225
+ const bodyWriter = tsproto.MessageButtonClicked.encode(
12226
+ tsproto.MessageButtonClicked.fromPartial(body)
12227
+ );
12228
+ const encodedBody = bodyWriter.finish();
12229
+
12230
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
12231
+ const fetchOptions = buildFetchOptions("POST", options, '');
12232
+ fetchOptions.body = encodedBody;
12233
+ if (bearerToken) {
12234
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
12235
+ }
12236
+
12237
+ return Promise.race([
12238
+ getFetcher()(fullUrl, fetchOptions).then((response) => {
12239
+ if (response.status == 204) {
12240
+ return response;
12241
+ } else if (response.status >= 200 && response.status < 300) {
12242
+ return response;
12243
+ } else {
12244
+ throw response;
12245
+ }
12246
+ }),
12247
+ new Promise((_, reject) =>
12248
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
12249
+ ),
12250
+ ]);
12251
+ }
12252
+
12253
+ /** */
12254
+ dropdownBoxSelected(bearerToken: string,
12255
+ messageId?:string,
12256
+ channelId?:string,
12257
+ selectboxId?:string,
12258
+ senderId?: string,
12259
+ userId?: string,
12260
+ values?: string[],
12261
+ options: any = {}): Promise<any> {
12262
+
12263
+ const urlPath = "/mezon.api.Mezon/DropdownBoxSelected";
12264
+ const queryParams = new Map<string, any>();
12265
+
12266
+ const body = {
12267
+ message_id: messageId,
12268
+ channel_id: channelId,
12269
+ selectbox_id: selectboxId,
12270
+ sender_id: senderId,
12271
+ user_id: userId,
12272
+ values: values
12273
+ };
12274
+
12275
+ const bodyWriter = tsproto.DropdownBoxSelected.encode(
12276
+ tsproto.DropdownBoxSelected.fromPartial(body)
12277
+ );
12278
+ const encodedBody = bodyWriter.finish();
12279
+
12280
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
12281
+ const fetchOptions = buildFetchOptions("POST", options, '');
12282
+ fetchOptions.body = encodedBody;
12283
+ if (bearerToken) {
12284
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
12285
+ }
12286
+
12287
+ return Promise.race([
12288
+ getFetcher()(fullUrl, fetchOptions).then((response) => {
12289
+ if (response.status == 204) {
12290
+ return response;
12291
+ } else if (response.status >= 200 && response.status < 300) {
12292
+ return response;
12293
+ } else {
12294
+ throw response;
12295
+ }
12296
+ }),
12297
+ new Promise((_, reject) =>
12298
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
12299
+ ),
12300
+ ]);
12301
+ }
12302
+
12205
12303
  }
12206
12304
 
package/client.ts CHANGED
@@ -267,7 +267,7 @@ export interface Notification {
267
267
  /** Content of the notification in JSON. */
268
268
  content?: {};
269
269
  /** The UNIX time when the notification was created. */
270
- create_time?: string;
270
+ create_time_seconds?: number;
271
271
  /** ID of the Notification. */
272
272
  id?: string;
273
273
  /** True if this notification was persisted to the database. */
@@ -1459,7 +1459,7 @@ export class Client {
1459
1459
  result.clan_users!.push({
1460
1460
  user: {
1461
1461
  avatar_url: gu.user!.avatar_url,
1462
- create_time: gu.user!.create_time,
1462
+ create_time_seconds: gu.user!.create_time_seconds,
1463
1463
  display_name: gu.user!.display_name,
1464
1464
  edge_count: gu.user!.edge_count ? Number(gu.user!.edge_count) : 0,
1465
1465
  id: gu.user!.id,
@@ -1878,7 +1878,7 @@ export class Client {
1878
1878
  result.friends!.push({
1879
1879
  user: {
1880
1880
  avatar_url: f.user!.avatar_url,
1881
- create_time: f.user!.create_time,
1881
+ create_time_seconds: f.user!.create_time_seconds,
1882
1882
  display_name: f.user!.display_name,
1883
1883
  edge_count: f.user!.edge_count ? Number(f.user!.edge_count) : 0,
1884
1884
  id: f.user!.id,
@@ -4942,6 +4942,70 @@ export class Client {
4942
4942
  return Promise.resolve(response);
4943
4943
  });
4944
4944
  }
4945
+
4946
+ async messageButtonClick(session: Session,
4947
+ messageId?:string,
4948
+ channelId?:string,
4949
+ buttonId?:string,
4950
+ senderId?: string,
4951
+ userId?: string,
4952
+ extraData?: string
4953
+ ): Promise<any> {
4954
+
4955
+ if (
4956
+ this.autoRefreshSession &&
4957
+ session.refresh_token &&
4958
+ session.isexpired(Date.now() / 1000)
4959
+ ) {
4960
+ await this.sessionRefresh(session);
4961
+ }
4962
+
4963
+ return this.apiClient
4964
+ .messageButtonClick(
4965
+ session.token,
4966
+ messageId,
4967
+ channelId,
4968
+ buttonId,
4969
+ senderId,
4970
+ userId,
4971
+ extraData
4972
+ )
4973
+ .then((response: any) => {
4974
+ return Promise.resolve(response);
4975
+ });
4976
+ }
4977
+
4978
+ async dropdownBoxSelected(session: Session,
4979
+ messageId?:string,
4980
+ channelId?:string,
4981
+ selectboxId?:string,
4982
+ senderId?: string,
4983
+ userId?: string,
4984
+ values?: string[]
4985
+ ): Promise<any> {
4986
+
4987
+ if (
4988
+ this.autoRefreshSession &&
4989
+ session.refresh_token &&
4990
+ session.isexpired(Date.now() / 1000)
4991
+ ) {
4992
+ await this.sessionRefresh(session);
4993
+ }
4994
+
4995
+ return this.apiClient
4996
+ .dropdownBoxSelected(
4997
+ session.token,
4998
+ messageId,
4999
+ channelId,
5000
+ selectboxId,
5001
+ senderId,
5002
+ userId,
5003
+ values
5004
+ )
5005
+ .then((response: any) => {
5006
+ return Promise.resolve(response);
5007
+ });
5008
+ }
4945
5009
  }
4946
5010
 
4947
5011