mezon-js 2.7.50 → 2.7.52

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -172,6 +172,14 @@ export interface ApiCategoryDescList {
172
172
  categorydesc?: Array<ApiCategoryDesc>;
173
173
  }
174
174
 
175
+ /** Update fields in a given channel. */
176
+ export interface ApiChangeChannelPrivateRequest {
177
+ //The ID of the channel to update.
178
+ channel_id?: string;
179
+ //
180
+ channel_private?: number;
181
+ }
182
+
175
183
  /** */
176
184
  export interface ApiChannelAttachment {
177
185
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
@@ -3336,41 +3344,6 @@ export class MezonApi {
3336
3344
  ]);
3337
3345
  }
3338
3346
 
3339
- /** open direct message. */
3340
- openDirectMess(bearerToken: string,
3341
- body:ApiDeleteChannelDescRequest,
3342
- options: any = {}): Promise<any> {
3343
-
3344
- if (body === null || body === undefined) {
3345
- throw new Error("'body' is a required parameter but is null or undefined.");
3346
- }
3347
- const urlPath = "/v2/direct/open";
3348
- const queryParams = new Map<string, any>();
3349
-
3350
- let bodyJson : string = "";
3351
- bodyJson = JSON.stringify(body || {});
3352
-
3353
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3354
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3355
- if (bearerToken) {
3356
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3357
- }
3358
-
3359
- return Promise.race([
3360
- fetch(fullUrl, fetchOptions).then((response) => {
3361
- if (response.status == 204) {
3362
- return response;
3363
- } else if (response.status >= 200 && response.status < 300) {
3364
- return response.json();
3365
- } else {
3366
- throw response;
3367
- }
3368
- }),
3369
- new Promise((_, reject) =>
3370
- setTimeout(reject, this.timeoutMs, "Request timed out.")
3371
- ),
3372
- ]);
3373
- }
3374
3347
  /** regist fcm device token */
3375
3348
  registFCMDeviceToken(bearerToken: string,
3376
3349
  token?:string,
@@ -3444,6 +3417,42 @@ export class MezonApi {
3444
3417
  ]);
3445
3418
  }
3446
3419
 
3420
+ /** open direct message. */
3421
+ openDirectMess(bearerToken: string,
3422
+ body:ApiDeleteChannelDescRequest,
3423
+ options: any = {}): Promise<any> {
3424
+
3425
+ if (body === null || body === undefined) {
3426
+ throw new Error("'body' is a required parameter but is null or undefined.");
3427
+ }
3428
+ const urlPath = "/v2/direct/open";
3429
+ const queryParams = new Map<string, any>();
3430
+
3431
+ let bodyJson : string = "";
3432
+ bodyJson = JSON.stringify(body || {});
3433
+
3434
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3435
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3436
+ if (bearerToken) {
3437
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3438
+ }
3439
+
3440
+ return Promise.race([
3441
+ fetch(fullUrl, fetchOptions).then((response) => {
3442
+ if (response.status == 204) {
3443
+ return response;
3444
+ } else if (response.status >= 200 && response.status < 300) {
3445
+ return response.json();
3446
+ } else {
3447
+ throw response;
3448
+ }
3449
+ }),
3450
+ new Promise((_, reject) =>
3451
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3452
+ ),
3453
+ ]);
3454
+ }
3455
+
3447
3456
  /** Search message from elasticsearch service. */
3448
3457
  searchMessage(bearerToken: string,
3449
3458
  body:ApiSearchMessageRequest,
@@ -5442,6 +5451,42 @@ export class MezonApi {
5442
5451
  ]);
5443
5452
  }
5444
5453
 
5454
+ /** Update channel private. */
5455
+ updateChannelPrivate(bearerToken: string,
5456
+ body:ApiChangeChannelPrivateRequest,
5457
+ options: any = {}): Promise<any> {
5458
+
5459
+ if (body === null || body === undefined) {
5460
+ throw new Error("'body' is a required parameter but is null or undefined.");
5461
+ }
5462
+ const urlPath = "/v2/updatechannelprivate";
5463
+ const queryParams = new Map<string, any>();
5464
+
5465
+ let bodyJson : string = "";
5466
+ bodyJson = JSON.stringify(body || {});
5467
+
5468
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5469
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
5470
+ if (bearerToken) {
5471
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5472
+ }
5473
+
5474
+ return Promise.race([
5475
+ fetch(fullUrl, fetchOptions).then((response) => {
5476
+ if (response.status == 204) {
5477
+ return response;
5478
+ } else if (response.status >= 200 && response.status < 300) {
5479
+ return response.json();
5480
+ } else {
5481
+ throw response;
5482
+ }
5483
+ }),
5484
+ new Promise((_, reject) =>
5485
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5486
+ ),
5487
+ ]);
5488
+ }
5489
+
5445
5490
  /** */
5446
5491
  updateUserProfileByClan(bearerToken: string,
5447
5492
  clanId:string,
package/client.ts CHANGED
@@ -93,6 +93,7 @@ import {
93
93
  ApiCreateWebhookRequest,
94
94
  ApiWebhookResponse,
95
95
  ApiDeleteChannelDescRequest,
96
+ ApiChangeChannelPrivateRequest,
96
97
  } from "./api.gen";
97
98
 
98
99
  import { Session } from "./session";
@@ -2055,6 +2056,18 @@ async setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificati
2055
2056
  });
2056
2057
  }
2057
2058
 
2059
+ /** update channel private*/
2060
+ async updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean> {
2061
+ if (this.autoRefreshSession && session.refresh_token &&
2062
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2063
+ await this.sessionRefresh(session);
2064
+ }
2065
+
2066
+ return this.apiClient.updateChannelPrivate(session.token, request).then((response: any) => {
2067
+ return response !== undefined;
2068
+ });
2069
+ }
2070
+
2058
2071
  /** get default notification clan */
2059
2072
  async getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel> {
2060
2073
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -99,6 +99,11 @@ export interface ApiCategoryDesc {
99
99
  export interface ApiCategoryDescList {
100
100
  categorydesc?: Array<ApiCategoryDesc>;
101
101
  }
102
+ /** Update fields in a given channel. */
103
+ export interface ApiChangeChannelPrivateRequest {
104
+ channel_id?: string;
105
+ channel_private?: number;
106
+ }
102
107
  /** */
103
108
  export interface ApiChannelAttachment {
104
109
  create_time?: string;
@@ -856,12 +861,12 @@ export declare class MezonApi {
856
861
  createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
857
862
  /** */
858
863
  deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
859
- /** open direct message. */
860
- openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
861
864
  /** regist fcm device token */
862
865
  registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
863
866
  /** close direct message. */
864
867
  closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
868
+ /** open direct message. */
869
+ openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
865
870
  /** Search message from elasticsearch service. */
866
871
  searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
867
872
  /** Submit an event for processing in the server's registered runtime custom events handler. */
@@ -972,6 +977,8 @@ export declare class MezonApi {
972
977
  listStorageObjects2(bearerToken: string, collection: string, userId: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
973
978
  /** Update fields in a given category. */
974
979
  updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
980
+ /** Update channel private. */
981
+ updateChannelPrivate(bearerToken: string, body: ApiChangeChannelPrivateRequest, options?: any): Promise<any>;
975
982
  /** */
976
983
  updateUserProfileByClan(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
977
984
  /** Upload attachment */
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, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -555,6 +555,8 @@ export declare class Client {
555
555
  setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
556
556
  /** Set notification channel*/
557
557
  setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean>;
558
+ /** update channel private*/
559
+ updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean>;
558
560
  /** get default notification clan */
559
561
  getNotificationChannel(session: Session, channelId: string): Promise<ApiNotificationUserChannel>;
560
562
  /** Set default notification category*/
@@ -606,19 +606,6 @@ var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
606
606
  var utob = (u) => u.replace(re_utob, cb_utob);
607
607
  var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
608
608
  var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
609
- var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
610
- var cb_btou = (cccc) => {
611
- switch (cccc.length) {
612
- case 4:
613
- var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
614
- return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
615
- case 3:
616
- return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
617
- default:
618
- return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
619
- }
620
- };
621
- var btou = (b) => b.replace(re_btou, cb_btou);
622
609
  var atobPolyfill = (asc) => {
623
610
  asc = asc.replace(/\s+/g, "");
624
611
  if (!b64re.test(asc))
@@ -632,10 +619,6 @@ var atobPolyfill = (asc) => {
632
619
  return bin;
633
620
  };
634
621
  var _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
635
- var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a), (c) => c.charCodeAt(0));
636
- var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
637
- var _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
638
- var decode2 = (src) => _decode(_unURI(src));
639
622
 
640
623
  // utils.ts
641
624
  function buildFetchOptions(method, options, bodyJson) {
@@ -2263,17 +2246,16 @@ var MezonApi = class {
2263
2246
  )
2264
2247
  ]);
2265
2248
  }
2266
- /** open direct message. */
2267
- openDirectMess(bearerToken, body, options = {}) {
2268
- if (body === null || body === void 0) {
2269
- throw new Error("'body' is a required parameter but is null or undefined.");
2270
- }
2271
- const urlPath = "/v2/direct/open";
2249
+ /** regist fcm device token */
2250
+ registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
2251
+ const urlPath = "/v2/devicetoken";
2272
2252
  const queryParams = /* @__PURE__ */ new Map();
2253
+ queryParams.set("token", token);
2254
+ queryParams.set("device_id", deviceId);
2255
+ queryParams.set("platform", platform);
2273
2256
  let bodyJson = "";
2274
- bodyJson = JSON.stringify(body || {});
2275
2257
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2276
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2258
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2277
2259
  if (bearerToken) {
2278
2260
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2279
2261
  }
@@ -2292,16 +2274,17 @@ var MezonApi = class {
2292
2274
  )
2293
2275
  ]);
2294
2276
  }
2295
- /** regist fcm device token */
2296
- registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
2297
- const urlPath = "/v2/devicetoken";
2277
+ /** close direct message. */
2278
+ closeDirectMess(bearerToken, body, options = {}) {
2279
+ if (body === null || body === void 0) {
2280
+ throw new Error("'body' is a required parameter but is null or undefined.");
2281
+ }
2282
+ const urlPath = "/v2/direct/close";
2298
2283
  const queryParams = /* @__PURE__ */ new Map();
2299
- queryParams.set("token", token);
2300
- queryParams.set("device_id", deviceId);
2301
- queryParams.set("platform", platform);
2302
2284
  let bodyJson = "";
2285
+ bodyJson = JSON.stringify(body || {});
2303
2286
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2304
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
2287
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2305
2288
  if (bearerToken) {
2306
2289
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2307
2290
  }
@@ -2320,12 +2303,12 @@ var MezonApi = class {
2320
2303
  )
2321
2304
  ]);
2322
2305
  }
2323
- /** close direct message. */
2324
- closeDirectMess(bearerToken, body, options = {}) {
2306
+ /** open direct message. */
2307
+ openDirectMess(bearerToken, body, options = {}) {
2325
2308
  if (body === null || body === void 0) {
2326
2309
  throw new Error("'body' is a required parameter but is null or undefined.");
2327
2310
  }
2328
- const urlPath = "/v2/direct/close";
2311
+ const urlPath = "/v2/direct/open";
2329
2312
  const queryParams = /* @__PURE__ */ new Map();
2330
2313
  let bodyJson = "";
2331
2314
  bodyJson = JSON.stringify(body || {});
@@ -3918,6 +3901,35 @@ var MezonApi = class {
3918
3901
  )
3919
3902
  ]);
3920
3903
  }
3904
+ /** Update channel private. */
3905
+ updateChannelPrivate(bearerToken, body, options = {}) {
3906
+ if (body === null || body === void 0) {
3907
+ throw new Error("'body' is a required parameter but is null or undefined.");
3908
+ }
3909
+ const urlPath = "/v2/updatechannelprivate";
3910
+ const queryParams = /* @__PURE__ */ new Map();
3911
+ let bodyJson = "";
3912
+ bodyJson = JSON.stringify(body || {});
3913
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3914
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3915
+ if (bearerToken) {
3916
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3917
+ }
3918
+ return Promise.race([
3919
+ fetch(fullUrl, fetchOptions).then((response) => {
3920
+ if (response.status == 204) {
3921
+ return response;
3922
+ } else if (response.status >= 200 && response.status < 300) {
3923
+ return response.json();
3924
+ } else {
3925
+ throw response;
3926
+ }
3927
+ }),
3928
+ new Promise(
3929
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3930
+ )
3931
+ ]);
3932
+ }
3921
3933
  /** */
3922
3934
  updateUserProfileByClan(bearerToken, clanId, body, options = {}) {
3923
3935
  if (clanId === null || clanId === void 0) {
@@ -4147,7 +4159,7 @@ var encode2 = function(arraybuffer) {
4147
4159
  }
4148
4160
  return base64;
4149
4161
  };
4150
- var decode3 = function(base64) {
4162
+ var decode2 = function(base64) {
4151
4163
  var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
4152
4164
  if (base64[base64.length - 1] === "=") {
4153
4165
  bufferLength--;
@@ -4190,7 +4202,7 @@ var WebSocketAdapterText = class {
4190
4202
  this._socket.onmessage = (evt) => {
4191
4203
  const message = JSON.parse(evt.data);
4192
4204
  if (message.party_data && message.party_data.data) {
4193
- message.party_data.data = new Uint8Array(decode3(message.party_data.data));
4205
+ message.party_data.data = new Uint8Array(decode2(message.party_data.data));
4194
4206
  }
4195
4207
  value(message);
4196
4208
  };
@@ -4327,19 +4339,6 @@ var _DefaultSocket = class _DefaultSocket {
4327
4339
  this.onmessagereaction(message.message_reaction_event);
4328
4340
  } else if (message.channel_presence_event) {
4329
4341
  this.onchannelpresence(message.channel_presence_event);
4330
- } else if (message.party_data) {
4331
- message.party_data.op_code = parseInt(message.party_data.op_code);
4332
- this.onpartydata(message.party_data);
4333
- } else if (message.party_close) {
4334
- this.onpartyclose(message.party_close);
4335
- } else if (message.party_join_request) {
4336
- this.onpartyjoinrequest(message.party_join_request);
4337
- } else if (message.party_leader) {
4338
- this.onpartyleader(message.party_leader);
4339
- } else if (message.party_presence_event) {
4340
- this.onpartypresence(message.party_presence_event);
4341
- } else if (message.party) {
4342
- this.onparty(message.party);
4343
4342
  } else {
4344
4343
  if (this.verbose && window && window.console) {
4345
4344
  console.log("Unrecognized message received: %o", message);
@@ -4427,41 +4426,6 @@ var _DefaultSocket = class _DefaultSocket {
4427
4426
  console.log(notification);
4428
4427
  }
4429
4428
  }
4430
- onparty(party) {
4431
- if (this.verbose && window && window.console) {
4432
- console.log(party);
4433
- }
4434
- }
4435
- onpartyclose(close) {
4436
- if (this.verbose && window && window.console) {
4437
- console.log("Party closed: " + close);
4438
- }
4439
- }
4440
- onpartyjoinrequest(partyJoinRequest) {
4441
- if (this.verbose && window && window.console) {
4442
- console.log(partyJoinRequest);
4443
- }
4444
- }
4445
- onpartydata(partyData) {
4446
- if (this.verbose && window && window.console) {
4447
- console.log(partyData);
4448
- }
4449
- }
4450
- onpartyleader(partyLeader) {
4451
- if (this.verbose && window && window.console) {
4452
- console.log(partyLeader);
4453
- }
4454
- }
4455
- onpartymatchmakerticket(partyMatched) {
4456
- if (this.verbose && window && window.console) {
4457
- console.log(partyMatched);
4458
- }
4459
- }
4460
- onpartypresence(partyPresence) {
4461
- if (this.verbose && window && window.console) {
4462
- console.log(partyPresence);
4463
- }
4464
- }
4465
4429
  onstatuspresence(statusPresence) {
4466
4430
  if (this.verbose && window && window.console) {
4467
4431
  console.log(statusPresence);
@@ -4523,47 +4487,19 @@ var _DefaultSocket = class _DefaultSocket {
4523
4487
  if (!this.adapter.isOpen()) {
4524
4488
  reject("Socket connection has not been established yet.");
4525
4489
  } else {
4526
- if (untypedMessage.party_data_send) {
4527
- this.adapter.send(untypedMessage);
4528
- resolve();
4529
- } else {
4530
- if (untypedMessage.channel_message_send) {
4531
- untypedMessage.channel_message_send.content = JSON.stringify(untypedMessage.channel_message_send.content);
4532
- } else if (untypedMessage.channel_message_update) {
4533
- untypedMessage.channel_message_update.content = JSON.stringify(untypedMessage.channel_message_update.content);
4534
- }
4535
- const cid = this.generatecid();
4536
- this.cIds[cid] = { resolve, reject };
4537
- setTimeout(() => {
4538
- reject("The socket timed out while waiting for a response.");
4539
- }, sendTimeout);
4540
- untypedMessage.cid = cid;
4541
- this.adapter.send(untypedMessage);
4542
- }
4490
+ if (untypedMessage.channel_message_send) {
4491
+ untypedMessage.channel_message_send.content = JSON.stringify(untypedMessage.channel_message_send.content);
4492
+ } else if (untypedMessage.channel_message_update) {
4493
+ untypedMessage.channel_message_update.content = JSON.stringify(untypedMessage.channel_message_update.content);
4494
+ }
4495
+ const cid = this.generatecid();
4496
+ this.cIds[cid] = { resolve, reject };
4497
+ setTimeout(() => {
4498
+ reject("The socket timed out while waiting for a response.");
4499
+ }, sendTimeout);
4500
+ untypedMessage.cid = cid;
4501
+ this.adapter.send(untypedMessage);
4543
4502
  }
4544
- if (this.verbose && window && window.console) {
4545
- const loggedMessage = __spreadValues({}, untypedMessage);
4546
- if (loggedMessage.match_data_send && loggedMessage.match_data_send.data) {
4547
- loggedMessage.match_data_send.data = decode2(loggedMessage.match_data_send.data);
4548
- } else if (loggedMessage.party_data_send && loggedMessage.party_data_send.data) {
4549
- loggedMessage.party_data_send.data = decode2(loggedMessage.party_data_send.data);
4550
- }
4551
- console.log("Sent message: %o", JSON.stringify(loggedMessage));
4552
- }
4553
- });
4554
- }
4555
- acceptPartyMember(party_id, presence) {
4556
- return this.send({ party_accept: { party_id, presence } });
4557
- }
4558
- closeParty(party_id) {
4559
- return __async(this, null, function* () {
4560
- return yield this.send({ party_close: { party_id } });
4561
- });
4562
- }
4563
- createParty(open, max_size) {
4564
- return __async(this, null, function* () {
4565
- const response = yield this.send({ party_create: { open, max_size } });
4566
- return response.party;
4567
4503
  });
4568
4504
  }
4569
4505
  followUsers(userIds) {
@@ -4582,13 +4518,12 @@ var _DefaultSocket = class _DefaultSocket {
4582
4518
  return response.clan_join;
4583
4519
  });
4584
4520
  }
4585
- joinChat(channel_id, channel_label, mode, type, persistence, hidden) {
4521
+ joinChat(channel_id, mode, type, persistence, hidden) {
4586
4522
  return __async(this, null, function* () {
4587
4523
  const response = yield this.send(
4588
4524
  {
4589
4525
  channel_join: {
4590
4526
  channel_id,
4591
- channel_label,
4592
4527
  mode,
4593
4528
  type,
4594
4529
  persistence,
@@ -4599,39 +4534,15 @@ var _DefaultSocket = class _DefaultSocket {
4599
4534
  return response.channel;
4600
4535
  });
4601
4536
  }
4602
- joinParty(party_id) {
4603
- return __async(this, null, function* () {
4604
- return yield this.send({ party_join: { party_id } });
4605
- });
4606
- }
4607
- leaveChat(channel_id, channel_label, mode) {
4608
- return this.send({ channel_leave: { channel_id, channel_label, mode } });
4609
- }
4610
- leaveMatch(matchId) {
4611
- return this.send({ match_leave: { match_id: matchId } });
4612
- }
4613
- leaveParty(party_id) {
4614
- return this.send({ party_leave: { party_id } });
4537
+ leaveChat(channel_id, mode) {
4538
+ return this.send({ channel_leave: { channel_id, mode } });
4615
4539
  }
4616
- listPartyJoinRequests(party_id) {
4617
- return __async(this, null, function* () {
4618
- const response = yield this.send({ party_join_request_list: { party_id } });
4619
- return response.party_join_request;
4620
- });
4621
- }
4622
- promotePartyMember(party_id, party_member) {
4623
- return __async(this, null, function* () {
4624
- const response = yield this.send({ party_promote: { party_id, presence: party_member } });
4625
- return response.party_leader;
4626
- });
4627
- }
4628
- removeChatMessage(channel_id, channel_label, mode, message_id) {
4540
+ removeChatMessage(channel_id, mode, message_id) {
4629
4541
  return __async(this, null, function* () {
4630
4542
  const response = yield this.send(
4631
4543
  {
4632
4544
  channel_message_remove: {
4633
4545
  channel_id,
4634
- channel_label,
4635
4546
  mode,
4636
4547
  message_id
4637
4548
  }
@@ -4668,36 +4579,36 @@ var _DefaultSocket = class _DefaultSocket {
4668
4579
  unfollowUsers(user_ids) {
4669
4580
  return this.send({ status_unfollow: { user_ids } });
4670
4581
  }
4671
- updateChatMessage(channel_id, channel_label, mode, message_id, content) {
4582
+ updateChatMessage(channel_id, mode, message_id, content) {
4672
4583
  return __async(this, null, function* () {
4673
- const response = yield this.send({ channel_message_update: { channel_id, channel_label, message_id, content, mode } });
4584
+ const response = yield this.send({ channel_message_update: { channel_id, message_id, content, mode } });
4674
4585
  return response.channel_message_ack;
4675
4586
  });
4676
4587
  }
4677
4588
  updateStatus(status) {
4678
4589
  return this.send({ status_update: { status } });
4679
4590
  }
4680
- writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4591
+ writeChatMessage(clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4681
4592
  return __async(this, null, function* () {
4682
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4593
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4683
4594
  return response.channel_message_ack;
4684
4595
  });
4685
4596
  }
4686
- writeMessageReaction(id, channel_id, channel_label, mode, message_id, emoji, count, message_sender_id, action_delete) {
4597
+ writeMessageReaction(id, channel_id, mode, message_id, emoji, count, message_sender_id, action_delete) {
4687
4598
  return __async(this, null, function* () {
4688
- const response = yield this.send({ message_reaction_event: { id, channel_id, channel_label, mode, message_id, emoji, count, message_sender_id, action: action_delete } });
4599
+ const response = yield this.send({ message_reaction_event: { id, channel_id, mode, message_id, emoji, count, message_sender_id, action: action_delete } });
4689
4600
  return response.message_reaction_event;
4690
4601
  });
4691
4602
  }
4692
- writeMessageTyping(channel_id, channel_label, mode) {
4603
+ writeMessageTyping(channel_id, mode) {
4693
4604
  return __async(this, null, function* () {
4694
- const response = yield this.send({ message_typing_event: { channel_id, channel_label, mode } });
4605
+ const response = yield this.send({ message_typing_event: { channel_id, mode } });
4695
4606
  return response.message_typing_event;
4696
4607
  });
4697
4608
  }
4698
- writeLastSeenMessage(channel_id, channel_label, mode, message_id, timestamp) {
4609
+ writeLastSeenMessage(channel_id, mode, message_id, timestamp) {
4699
4610
  return __async(this, null, function* () {
4700
- const response = yield this.send({ last_seen_message_event: { channel_id, channel_label, mode, message_id, timestamp } });
4611
+ const response = yield this.send({ last_seen_message_event: { channel_id, mode, message_id, timestamp } });
4701
4612
  return response.last_seen_message_event;
4702
4613
  });
4703
4614
  }
@@ -6179,6 +6090,17 @@ var Client = class {
6179
6090
  });
6180
6091
  });
6181
6092
  }
6093
+ /** update channel private*/
6094
+ updateChannelPrivate(session, request) {
6095
+ return __async(this, null, function* () {
6096
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6097
+ yield this.sessionRefresh(session);
6098
+ }
6099
+ return this.apiClient.updateChannelPrivate(session.token, request).then((response) => {
6100
+ return response !== void 0;
6101
+ });
6102
+ });
6103
+ }
6182
6104
  /** get default notification clan */
6183
6105
  getNotificationChannel(session, channelId) {
6184
6106
  return __async(this, null, function* () {