mezon-js 2.9.58 → 2.9.61

Sign up to get free protection for your applications and to get access to all the features.
@@ -2110,6 +2110,36 @@ var MezonApi = class {
2110
2110
  ]);
2111
2111
  }
2112
2112
  /** */
2113
+ listAuditLog(bearerToken, actionLog, userId, clanId, page, pageSize, options = {}) {
2114
+ const urlPath = "/v2/audit_log";
2115
+ const queryParams = /* @__PURE__ */ new Map();
2116
+ queryParams.set("action_log", actionLog);
2117
+ queryParams.set("user_id", userId);
2118
+ queryParams.set("clan_id", clanId);
2119
+ queryParams.set("page", page);
2120
+ queryParams.set("page_size", pageSize);
2121
+ let bodyJson = "";
2122
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2123
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2124
+ if (bearerToken) {
2125
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2126
+ }
2127
+ return Promise.race([
2128
+ fetch(fullUrl, fetchOptions).then((response) => {
2129
+ if (response.status == 204) {
2130
+ return response;
2131
+ } else if (response.status >= 200 && response.status < 300) {
2132
+ return response.json();
2133
+ } else {
2134
+ throw response;
2135
+ }
2136
+ }),
2137
+ new Promise(
2138
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2139
+ )
2140
+ ]);
2141
+ }
2142
+ /** */
2113
2143
  updateCategoryOrder(bearerToken, body, options = {}) {
2114
2144
  if (body === null || body === void 0) {
2115
2145
  throw new Error(
@@ -2428,6 +2458,67 @@ var MezonApi = class {
2428
2458
  )
2429
2459
  ]);
2430
2460
  }
2461
+ /** get channel encryption method */
2462
+ getChanEncryptionMethod(bearerToken, channelId, method, options = {}) {
2463
+ if (channelId === null || channelId === void 0) {
2464
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2465
+ }
2466
+ const urlPath = "/v2/channel/{channelId}/encrypt_method".replace("{channelId}", encodeURIComponent(String(channelId)));
2467
+ const queryParams = /* @__PURE__ */ new Map();
2468
+ queryParams.set("method", method);
2469
+ let bodyJson = "";
2470
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2471
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2472
+ if (bearerToken) {
2473
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2474
+ }
2475
+ return Promise.race([
2476
+ fetch(fullUrl, fetchOptions).then((response) => {
2477
+ if (response.status == 204) {
2478
+ return response;
2479
+ } else if (response.status >= 200 && response.status < 300) {
2480
+ return response.json();
2481
+ } else {
2482
+ throw response;
2483
+ }
2484
+ }),
2485
+ new Promise(
2486
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2487
+ )
2488
+ ]);
2489
+ }
2490
+ /** store channel encryption method */
2491
+ setChanEncryptionMethod(bearerToken, channelId, body, options = {}) {
2492
+ if (channelId === null || channelId === void 0) {
2493
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2494
+ }
2495
+ if (body === null || body === void 0) {
2496
+ throw new Error("'body' is a required parameter but is null or undefined.");
2497
+ }
2498
+ const urlPath = "/v2/channel/{channelId}/encrypt_method".replace("{channelId}", encodeURIComponent(String(channelId)));
2499
+ const queryParams = /* @__PURE__ */ new Map();
2500
+ let bodyJson = "";
2501
+ bodyJson = JSON.stringify(body || {});
2502
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2503
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2504
+ if (bearerToken) {
2505
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2506
+ }
2507
+ return Promise.race([
2508
+ fetch(fullUrl, fetchOptions).then((response) => {
2509
+ if (response.status == 204) {
2510
+ return response;
2511
+ } else if (response.status >= 200 && response.status < 300) {
2512
+ return response.json();
2513
+ } else {
2514
+ throw response;
2515
+ }
2516
+ }),
2517
+ new Promise(
2518
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2519
+ )
2520
+ ]);
2521
+ }
2431
2522
  /** Leave a channel the user is a member of. */
2432
2523
  leaveThread(bearerToken, channelId, options = {}) {
2433
2524
  if (channelId === null || channelId === void 0) {
@@ -3969,6 +4060,31 @@ var MezonApi = class {
3969
4060
  )
3970
4061
  ]);
3971
4062
  }
4063
+ /** get key server */
4064
+ getKeyServer(bearerToken, options = {}) {
4065
+ const urlPath = "/v2/e2ee/key_server";
4066
+ const queryParams = /* @__PURE__ */ new Map();
4067
+ let bodyJson = "";
4068
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4069
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4070
+ if (bearerToken) {
4071
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4072
+ }
4073
+ return Promise.race([
4074
+ fetch(fullUrl, fetchOptions).then((response) => {
4075
+ if (response.status == 204) {
4076
+ return response;
4077
+ } else if (response.status >= 200 && response.status < 300) {
4078
+ return response.json();
4079
+ } else {
4080
+ throw response;
4081
+ }
4082
+ }),
4083
+ new Promise(
4084
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4085
+ )
4086
+ ]);
4087
+ }
3972
4088
  /** List HashtagDMList */
3973
4089
  hashtagDMList(bearerToken, userId, limit, options = {}) {
3974
4090
  const urlPath = "/v2/hashtagdmlist";
@@ -4663,6 +4779,61 @@ var MezonApi = class {
4663
4779
  )
4664
4780
  ]);
4665
4781
  }
4782
+ /** get pubkey */
4783
+ getPubKeys(bearerToken, userIds, options = {}) {
4784
+ const urlPath = "/v2/pubkey";
4785
+ const queryParams = /* @__PURE__ */ new Map();
4786
+ queryParams.set("user_ids", userIds);
4787
+ let bodyJson = "";
4788
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4789
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4790
+ if (bearerToken) {
4791
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4792
+ }
4793
+ return Promise.race([
4794
+ fetch(fullUrl, fetchOptions).then((response) => {
4795
+ if (response.status == 204) {
4796
+ return response;
4797
+ } else if (response.status >= 200 && response.status < 300) {
4798
+ return response.json();
4799
+ } else {
4800
+ throw response;
4801
+ }
4802
+ }),
4803
+ new Promise(
4804
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4805
+ )
4806
+ ]);
4807
+ }
4808
+ /** store pubkey for e2ee */
4809
+ pushPubKey(bearerToken, body, options = {}) {
4810
+ if (body === null || body === void 0) {
4811
+ throw new Error("'body' is a required parameter but is null or undefined.");
4812
+ }
4813
+ const urlPath = "/v2/pubkey/push";
4814
+ const queryParams = /* @__PURE__ */ new Map();
4815
+ let bodyJson = "";
4816
+ bodyJson = JSON.stringify(body || {});
4817
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4818
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4819
+ if (bearerToken) {
4820
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4821
+ }
4822
+ return Promise.race([
4823
+ fetch(fullUrl, fetchOptions).then((response) => {
4824
+ if (response.status == 204) {
4825
+ return response;
4826
+ } else if (response.status >= 200 && response.status < 300) {
4827
+ return response.json();
4828
+ } else {
4829
+ throw response;
4830
+ }
4831
+ }),
4832
+ new Promise(
4833
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4834
+ )
4835
+ ]);
4836
+ }
4666
4837
  /** */
4667
4838
  addRolesChannelDesc(bearerToken, body, options = {}) {
4668
4839
  if (body === null || body === void 0) {
@@ -6378,10 +6549,12 @@ var _DefaultSocket = class _DefaultSocket {
6378
6549
  this.onstreamingchanneljoined(message.streaming_joined_event);
6379
6550
  } else if (message.streaming_leaved_event) {
6380
6551
  this.onstreamingchannelleaved(message.streaming_leaved_event);
6381
- } else if (message.set_permission_channel_event) {
6382
- this.onsetpermissionchannel(message.set_permission_channel_event);
6383
- } else if (message.event_user_permission_channel) {
6384
- this.onuserpermissionchannel(message.event_user_permission_channel);
6552
+ } else if (message.permission_set_event) {
6553
+ this.onpermissionset(message.permission_set_event);
6554
+ } else if (message.permission_changed_event) {
6555
+ this.onpermissionchanged(message.permission_changed_event);
6556
+ } else if (message.token_sent_event) {
6557
+ this.ontokensent(message.token_sent_event);
6385
6558
  } else {
6386
6559
  if (this.verbose && window && window.console) {
6387
6560
  console.log("Unrecognized message received: %o", message);
@@ -6639,14 +6812,19 @@ var _DefaultSocket = class _DefaultSocket {
6639
6812
  console.log(streaming_leaved_event);
6640
6813
  }
6641
6814
  }
6642
- onsetpermissionchannel(set_permission_channel_event) {
6815
+ onpermissionset(permission_set_event) {
6816
+ if (this.verbose && window && window.console) {
6817
+ console.log(permission_set_event);
6818
+ }
6819
+ }
6820
+ onpermissionchanged(permission_changed_event) {
6643
6821
  if (this.verbose && window && window.console) {
6644
- console.log(set_permission_channel_event);
6822
+ console.log(permission_changed_event);
6645
6823
  }
6646
6824
  }
6647
- onuserpermissionchannel(event_user_permission_channel) {
6825
+ ontokensent(tokenSentEvent) {
6648
6826
  if (this.verbose && window && window.console) {
6649
- console.log(event_user_permission_channel);
6827
+ console.log(tokenSentEvent);
6650
6828
  }
6651
6829
  }
6652
6830
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
@@ -6800,6 +6978,12 @@ var _DefaultSocket = class _DefaultSocket {
6800
6978
  return response.check_name_existed_event;
6801
6979
  });
6802
6980
  }
6981
+ sendToken(receiver_id, amount) {
6982
+ return __async(this, null, function* () {
6983
+ const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6984
+ return response.token_sent_event;
6985
+ });
6986
+ }
6803
6987
  pingPong() {
6804
6988
  return __async(this, null, function* () {
6805
6989
  if (!this.adapter.isOpen()) {
@@ -9106,4 +9290,64 @@ var Client = class {
9106
9290
  });
9107
9291
  });
9108
9292
  }
9293
+ getChanEncryptionMethod(session, channelId) {
9294
+ return __async(this, null, function* () {
9295
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9296
+ yield this.sessionRefresh(session);
9297
+ }
9298
+ return this.apiClient.getChanEncryptionMethod(session.token, channelId).then((response) => {
9299
+ return response;
9300
+ });
9301
+ });
9302
+ }
9303
+ setChanEncryptionMethod(session, channelId, method) {
9304
+ return __async(this, null, function* () {
9305
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9306
+ yield this.sessionRefresh(session);
9307
+ }
9308
+ return this.apiClient.setChanEncryptionMethod(session.token, channelId, { method }).then((response) => {
9309
+ return response;
9310
+ });
9311
+ });
9312
+ }
9313
+ getPubKeys(session, userIds) {
9314
+ return __async(this, null, function* () {
9315
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9316
+ yield this.sessionRefresh(session);
9317
+ }
9318
+ return this.apiClient.getPubKeys(session.token, userIds).then((response) => {
9319
+ return response;
9320
+ });
9321
+ });
9322
+ }
9323
+ pushPubKey(session, PK) {
9324
+ return __async(this, null, function* () {
9325
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9326
+ yield this.sessionRefresh(session);
9327
+ }
9328
+ return this.apiClient.pushPubKey(session.token, { PK }).then((response) => {
9329
+ return response;
9330
+ });
9331
+ });
9332
+ }
9333
+ getKeyServer(session) {
9334
+ return __async(this, null, function* () {
9335
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9336
+ yield this.sessionRefresh(session);
9337
+ }
9338
+ return this.apiClient.getKeyServer(session.token).then((response) => {
9339
+ return response;
9340
+ });
9341
+ });
9342
+ }
9343
+ listAuditLog(session) {
9344
+ return __async(this, null, function* () {
9345
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9346
+ yield this.sessionRefresh(session);
9347
+ }
9348
+ return this.apiClient.listAuditLog(session.token).then((response) => {
9349
+ return response;
9350
+ });
9351
+ });
9352
+ }
9109
9353
  };
@@ -2081,6 +2081,36 @@ var MezonApi = class {
2081
2081
  ]);
2082
2082
  }
2083
2083
  /** */
2084
+ listAuditLog(bearerToken, actionLog, userId, clanId, page, pageSize, options = {}) {
2085
+ const urlPath = "/v2/audit_log";
2086
+ const queryParams = /* @__PURE__ */ new Map();
2087
+ queryParams.set("action_log", actionLog);
2088
+ queryParams.set("user_id", userId);
2089
+ queryParams.set("clan_id", clanId);
2090
+ queryParams.set("page", page);
2091
+ queryParams.set("page_size", pageSize);
2092
+ let bodyJson = "";
2093
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2094
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2095
+ if (bearerToken) {
2096
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2097
+ }
2098
+ return Promise.race([
2099
+ fetch(fullUrl, fetchOptions).then((response) => {
2100
+ if (response.status == 204) {
2101
+ return response;
2102
+ } else if (response.status >= 200 && response.status < 300) {
2103
+ return response.json();
2104
+ } else {
2105
+ throw response;
2106
+ }
2107
+ }),
2108
+ new Promise(
2109
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2110
+ )
2111
+ ]);
2112
+ }
2113
+ /** */
2084
2114
  updateCategoryOrder(bearerToken, body, options = {}) {
2085
2115
  if (body === null || body === void 0) {
2086
2116
  throw new Error(
@@ -2399,6 +2429,67 @@ var MezonApi = class {
2399
2429
  )
2400
2430
  ]);
2401
2431
  }
2432
+ /** get channel encryption method */
2433
+ getChanEncryptionMethod(bearerToken, channelId, method, options = {}) {
2434
+ if (channelId === null || channelId === void 0) {
2435
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2436
+ }
2437
+ const urlPath = "/v2/channel/{channelId}/encrypt_method".replace("{channelId}", encodeURIComponent(String(channelId)));
2438
+ const queryParams = /* @__PURE__ */ new Map();
2439
+ queryParams.set("method", method);
2440
+ let bodyJson = "";
2441
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2442
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2443
+ if (bearerToken) {
2444
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2445
+ }
2446
+ return Promise.race([
2447
+ fetch(fullUrl, fetchOptions).then((response) => {
2448
+ if (response.status == 204) {
2449
+ return response;
2450
+ } else if (response.status >= 200 && response.status < 300) {
2451
+ return response.json();
2452
+ } else {
2453
+ throw response;
2454
+ }
2455
+ }),
2456
+ new Promise(
2457
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2458
+ )
2459
+ ]);
2460
+ }
2461
+ /** store channel encryption method */
2462
+ setChanEncryptionMethod(bearerToken, channelId, body, options = {}) {
2463
+ if (channelId === null || channelId === void 0) {
2464
+ throw new Error("'channelId' is a required parameter but is null or undefined.");
2465
+ }
2466
+ if (body === null || body === void 0) {
2467
+ throw new Error("'body' is a required parameter but is null or undefined.");
2468
+ }
2469
+ const urlPath = "/v2/channel/{channelId}/encrypt_method".replace("{channelId}", encodeURIComponent(String(channelId)));
2470
+ const queryParams = /* @__PURE__ */ new Map();
2471
+ let bodyJson = "";
2472
+ bodyJson = JSON.stringify(body || {});
2473
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2474
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2475
+ if (bearerToken) {
2476
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2477
+ }
2478
+ return Promise.race([
2479
+ fetch(fullUrl, fetchOptions).then((response) => {
2480
+ if (response.status == 204) {
2481
+ return response;
2482
+ } else if (response.status >= 200 && response.status < 300) {
2483
+ return response.json();
2484
+ } else {
2485
+ throw response;
2486
+ }
2487
+ }),
2488
+ new Promise(
2489
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2490
+ )
2491
+ ]);
2492
+ }
2402
2493
  /** Leave a channel the user is a member of. */
2403
2494
  leaveThread(bearerToken, channelId, options = {}) {
2404
2495
  if (channelId === null || channelId === void 0) {
@@ -3940,6 +4031,31 @@ var MezonApi = class {
3940
4031
  )
3941
4032
  ]);
3942
4033
  }
4034
+ /** get key server */
4035
+ getKeyServer(bearerToken, options = {}) {
4036
+ const urlPath = "/v2/e2ee/key_server";
4037
+ const queryParams = /* @__PURE__ */ new Map();
4038
+ let bodyJson = "";
4039
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4040
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4041
+ if (bearerToken) {
4042
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4043
+ }
4044
+ return Promise.race([
4045
+ fetch(fullUrl, fetchOptions).then((response) => {
4046
+ if (response.status == 204) {
4047
+ return response;
4048
+ } else if (response.status >= 200 && response.status < 300) {
4049
+ return response.json();
4050
+ } else {
4051
+ throw response;
4052
+ }
4053
+ }),
4054
+ new Promise(
4055
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4056
+ )
4057
+ ]);
4058
+ }
3943
4059
  /** List HashtagDMList */
3944
4060
  hashtagDMList(bearerToken, userId, limit, options = {}) {
3945
4061
  const urlPath = "/v2/hashtagdmlist";
@@ -4634,6 +4750,61 @@ var MezonApi = class {
4634
4750
  )
4635
4751
  ]);
4636
4752
  }
4753
+ /** get pubkey */
4754
+ getPubKeys(bearerToken, userIds, options = {}) {
4755
+ const urlPath = "/v2/pubkey";
4756
+ const queryParams = /* @__PURE__ */ new Map();
4757
+ queryParams.set("user_ids", userIds);
4758
+ let bodyJson = "";
4759
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4760
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4761
+ if (bearerToken) {
4762
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4763
+ }
4764
+ return Promise.race([
4765
+ fetch(fullUrl, fetchOptions).then((response) => {
4766
+ if (response.status == 204) {
4767
+ return response;
4768
+ } else if (response.status >= 200 && response.status < 300) {
4769
+ return response.json();
4770
+ } else {
4771
+ throw response;
4772
+ }
4773
+ }),
4774
+ new Promise(
4775
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4776
+ )
4777
+ ]);
4778
+ }
4779
+ /** store pubkey for e2ee */
4780
+ pushPubKey(bearerToken, body, options = {}) {
4781
+ if (body === null || body === void 0) {
4782
+ throw new Error("'body' is a required parameter but is null or undefined.");
4783
+ }
4784
+ const urlPath = "/v2/pubkey/push";
4785
+ const queryParams = /* @__PURE__ */ new Map();
4786
+ let bodyJson = "";
4787
+ bodyJson = JSON.stringify(body || {});
4788
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4789
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4790
+ if (bearerToken) {
4791
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4792
+ }
4793
+ return Promise.race([
4794
+ fetch(fullUrl, fetchOptions).then((response) => {
4795
+ if (response.status == 204) {
4796
+ return response;
4797
+ } else if (response.status >= 200 && response.status < 300) {
4798
+ return response.json();
4799
+ } else {
4800
+ throw response;
4801
+ }
4802
+ }),
4803
+ new Promise(
4804
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4805
+ )
4806
+ ]);
4807
+ }
4637
4808
  /** */
4638
4809
  addRolesChannelDesc(bearerToken, body, options = {}) {
4639
4810
  if (body === null || body === void 0) {
@@ -6349,10 +6520,12 @@ var _DefaultSocket = class _DefaultSocket {
6349
6520
  this.onstreamingchanneljoined(message.streaming_joined_event);
6350
6521
  } else if (message.streaming_leaved_event) {
6351
6522
  this.onstreamingchannelleaved(message.streaming_leaved_event);
6352
- } else if (message.set_permission_channel_event) {
6353
- this.onsetpermissionchannel(message.set_permission_channel_event);
6354
- } else if (message.event_user_permission_channel) {
6355
- this.onuserpermissionchannel(message.event_user_permission_channel);
6523
+ } else if (message.permission_set_event) {
6524
+ this.onpermissionset(message.permission_set_event);
6525
+ } else if (message.permission_changed_event) {
6526
+ this.onpermissionchanged(message.permission_changed_event);
6527
+ } else if (message.token_sent_event) {
6528
+ this.ontokensent(message.token_sent_event);
6356
6529
  } else {
6357
6530
  if (this.verbose && window && window.console) {
6358
6531
  console.log("Unrecognized message received: %o", message);
@@ -6610,14 +6783,19 @@ var _DefaultSocket = class _DefaultSocket {
6610
6783
  console.log(streaming_leaved_event);
6611
6784
  }
6612
6785
  }
6613
- onsetpermissionchannel(set_permission_channel_event) {
6786
+ onpermissionset(permission_set_event) {
6787
+ if (this.verbose && window && window.console) {
6788
+ console.log(permission_set_event);
6789
+ }
6790
+ }
6791
+ onpermissionchanged(permission_changed_event) {
6614
6792
  if (this.verbose && window && window.console) {
6615
- console.log(set_permission_channel_event);
6793
+ console.log(permission_changed_event);
6616
6794
  }
6617
6795
  }
6618
- onuserpermissionchannel(event_user_permission_channel) {
6796
+ ontokensent(tokenSentEvent) {
6619
6797
  if (this.verbose && window && window.console) {
6620
- console.log(event_user_permission_channel);
6798
+ console.log(tokenSentEvent);
6621
6799
  }
6622
6800
  }
6623
6801
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
@@ -6771,6 +6949,12 @@ var _DefaultSocket = class _DefaultSocket {
6771
6949
  return response.check_name_existed_event;
6772
6950
  });
6773
6951
  }
6952
+ sendToken(receiver_id, amount) {
6953
+ return __async(this, null, function* () {
6954
+ const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6955
+ return response.token_sent_event;
6956
+ });
6957
+ }
6774
6958
  pingPong() {
6775
6959
  return __async(this, null, function* () {
6776
6960
  if (!this.adapter.isOpen()) {
@@ -9077,6 +9261,66 @@ var Client = class {
9077
9261
  });
9078
9262
  });
9079
9263
  }
9264
+ getChanEncryptionMethod(session, channelId) {
9265
+ return __async(this, null, function* () {
9266
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9267
+ yield this.sessionRefresh(session);
9268
+ }
9269
+ return this.apiClient.getChanEncryptionMethod(session.token, channelId).then((response) => {
9270
+ return response;
9271
+ });
9272
+ });
9273
+ }
9274
+ setChanEncryptionMethod(session, channelId, method) {
9275
+ return __async(this, null, function* () {
9276
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9277
+ yield this.sessionRefresh(session);
9278
+ }
9279
+ return this.apiClient.setChanEncryptionMethod(session.token, channelId, { method }).then((response) => {
9280
+ return response;
9281
+ });
9282
+ });
9283
+ }
9284
+ getPubKeys(session, userIds) {
9285
+ return __async(this, null, function* () {
9286
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9287
+ yield this.sessionRefresh(session);
9288
+ }
9289
+ return this.apiClient.getPubKeys(session.token, userIds).then((response) => {
9290
+ return response;
9291
+ });
9292
+ });
9293
+ }
9294
+ pushPubKey(session, PK) {
9295
+ return __async(this, null, function* () {
9296
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9297
+ yield this.sessionRefresh(session);
9298
+ }
9299
+ return this.apiClient.pushPubKey(session.token, { PK }).then((response) => {
9300
+ return response;
9301
+ });
9302
+ });
9303
+ }
9304
+ getKeyServer(session) {
9305
+ return __async(this, null, function* () {
9306
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9307
+ yield this.sessionRefresh(session);
9308
+ }
9309
+ return this.apiClient.getKeyServer(session.token).then((response) => {
9310
+ return response;
9311
+ });
9312
+ });
9313
+ }
9314
+ listAuditLog(session) {
9315
+ return __async(this, null, function* () {
9316
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9317
+ yield this.sessionRefresh(session);
9318
+ }
9319
+ return this.apiClient.listAuditLog(session.token).then((response) => {
9320
+ return response;
9321
+ });
9322
+ });
9323
+ }
9080
9324
  };
9081
9325
  export {
9082
9326
  ChannelStreamMode,