mezon-js 2.7.45 → 2.7.46

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -210,6 +210,8 @@ export interface ApiChannelDescList {
210
210
 
211
211
  /** */
212
212
  export interface ApiChannelDescription {
213
+ //
214
+ active?: number;
213
215
  //
214
216
  category_id?: string;
215
217
  //
@@ -488,6 +490,12 @@ export interface ApiCreateWebhookRequest {
488
490
  hook_name?: string;
489
491
  }
490
492
 
493
+ /** Delete a channel the user has access to. */
494
+ export interface ApiDeleteChannelDescRequest {
495
+ //The id of a channel.
496
+ channel_id?: string;
497
+ }
498
+
491
499
  /** */
492
500
  export interface ApiDeleteEventRequest {
493
501
  //The id of a event.
@@ -3365,6 +3373,42 @@ export class MezonApi {
3365
3373
  ]);
3366
3374
  }
3367
3375
 
3376
+ /** close direct message. */
3377
+ closeDirectMess(bearerToken: string,
3378
+ body:ApiDeleteChannelDescRequest,
3379
+ options: any = {}): Promise<any> {
3380
+
3381
+ if (body === null || body === undefined) {
3382
+ throw new Error("'body' is a required parameter but is null or undefined.");
3383
+ }
3384
+ const urlPath = "/v2/direct/close";
3385
+ const queryParams = new Map<string, any>();
3386
+
3387
+ let bodyJson : string = "";
3388
+ bodyJson = JSON.stringify(body || {});
3389
+
3390
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3391
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
3392
+ if (bearerToken) {
3393
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3394
+ }
3395
+
3396
+ return Promise.race([
3397
+ fetch(fullUrl, fetchOptions).then((response) => {
3398
+ if (response.status == 204) {
3399
+ return response;
3400
+ } else if (response.status >= 200 && response.status < 300) {
3401
+ return response.json();
3402
+ } else {
3403
+ throw response;
3404
+ }
3405
+ }),
3406
+ new Promise((_, reject) =>
3407
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3408
+ ),
3409
+ ]);
3410
+ }
3411
+
3368
3412
  /** Search message from elasticsearch service. */
3369
3413
  searchMessage(bearerToken: string,
3370
3414
  body:ApiSearchMessageRequest,
package/client.ts CHANGED
@@ -92,6 +92,7 @@ import {
92
92
  ApiPinMessagesList,
93
93
  ApiCreateWebhookRequest,
94
94
  ApiWebhookResponse,
95
+ ApiDeleteChannelDescRequest,
95
96
  } from "./api.gen";
96
97
 
97
98
  import { Session } from "./session";
@@ -1407,6 +1408,18 @@ export class Client {
1407
1408
  });
1408
1409
  }
1409
1410
 
1411
+ //
1412
+ async closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean> {
1413
+ if (this.autoRefreshSession && session.refresh_token &&
1414
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1415
+ await this.sessionRefresh(session);
1416
+ }
1417
+
1418
+ return this.apiClient.closeDirectMess(session.token, request).then((response: any) => {
1419
+ return response !== undefined;
1420
+ });
1421
+ }
1422
+
1410
1423
  /** Add a custom ID to the social profiles on the current user's account. */
1411
1424
  async linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean> {
1412
1425
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -122,6 +122,7 @@ export interface ApiChannelDescList {
122
122
  }
123
123
  /** */
124
124
  export interface ApiChannelDescription {
125
+ active?: number;
125
126
  category_id?: string;
126
127
  category_name?: string;
127
128
  channel_avatar?: Array<string>;
@@ -277,6 +278,10 @@ export interface ApiCreateWebhookRequest {
277
278
  clan_id?: string;
278
279
  hook_name?: string;
279
280
  }
281
+ /** Delete a channel the user has access to. */
282
+ export interface ApiDeleteChannelDescRequest {
283
+ channel_id?: string;
284
+ }
280
285
  /** */
281
286
  export interface ApiDeleteEventRequest {
282
287
  event_id?: string;
@@ -853,6 +858,8 @@ export declare class MezonApi {
853
858
  deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
854
859
  /** regist fcm device token */
855
860
  registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
861
+ /** close direct message. */
862
+ closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
856
863
  /** Search message from elasticsearch service. */
857
864
  searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
858
865
  /** Submit an event for processing in the server's registered runtime custom events handler. */
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -470,6 +470,7 @@ export declare class Client {
470
470
  getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
471
471
  /** Add an Apple ID to the social profiles on the current user's account. */
472
472
  linkApple(session: Session, request: ApiAccountApple): Promise<boolean>;
473
+ closeDirectMess(session: Session, request: ApiDeleteChannelDescRequest): Promise<boolean>;
473
474
  /** Add a custom ID to the social profiles on the current user's account. */
474
475
  linkCustom(session: Session, request: ApiAccountCustom): Promise<boolean>;
475
476
  /** Add a device ID to the social profiles on the current user's account. */
@@ -2291,6 +2291,35 @@ var MezonApi = class {
2291
2291
  )
2292
2292
  ]);
2293
2293
  }
2294
+ /** close direct message. */
2295
+ closeDirectMess(bearerToken, body, options = {}) {
2296
+ if (body === null || body === void 0) {
2297
+ throw new Error("'body' is a required parameter but is null or undefined.");
2298
+ }
2299
+ const urlPath = "/v2/direct/close";
2300
+ const queryParams = /* @__PURE__ */ new Map();
2301
+ let bodyJson = "";
2302
+ bodyJson = JSON.stringify(body || {});
2303
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2304
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2305
+ if (bearerToken) {
2306
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2307
+ }
2308
+ return Promise.race([
2309
+ fetch(fullUrl, fetchOptions).then((response) => {
2310
+ if (response.status == 204) {
2311
+ return response;
2312
+ } else if (response.status >= 200 && response.status < 300) {
2313
+ return response.json();
2314
+ } else {
2315
+ throw response;
2316
+ }
2317
+ }),
2318
+ new Promise(
2319
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2320
+ )
2321
+ ]);
2322
+ }
2294
2323
  /** Search message from elasticsearch service. */
2295
2324
  searchMessage(bearerToken, body, options = {}) {
2296
2325
  if (body === null || body === void 0) {
@@ -5522,6 +5551,17 @@ var Client = class {
5522
5551
  });
5523
5552
  });
5524
5553
  }
5554
+ //
5555
+ closeDirectMess(session, request) {
5556
+ return __async(this, null, function* () {
5557
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5558
+ yield this.sessionRefresh(session);
5559
+ }
5560
+ return this.apiClient.closeDirectMess(session.token, request).then((response) => {
5561
+ return response !== void 0;
5562
+ });
5563
+ });
5564
+ }
5525
5565
  /** Add a custom ID to the social profiles on the current user's account. */
5526
5566
  linkCustom(session, request) {
5527
5567
  return __async(this, null, function* () {
@@ -2262,6 +2262,35 @@ var MezonApi = class {
2262
2262
  )
2263
2263
  ]);
2264
2264
  }
2265
+ /** close direct message. */
2266
+ closeDirectMess(bearerToken, body, options = {}) {
2267
+ if (body === null || body === void 0) {
2268
+ throw new Error("'body' is a required parameter but is null or undefined.");
2269
+ }
2270
+ const urlPath = "/v2/direct/close";
2271
+ const queryParams = /* @__PURE__ */ new Map();
2272
+ let bodyJson = "";
2273
+ bodyJson = JSON.stringify(body || {});
2274
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2275
+ const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
2276
+ if (bearerToken) {
2277
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2278
+ }
2279
+ return Promise.race([
2280
+ fetch(fullUrl, fetchOptions).then((response) => {
2281
+ if (response.status == 204) {
2282
+ return response;
2283
+ } else if (response.status >= 200 && response.status < 300) {
2284
+ return response.json();
2285
+ } else {
2286
+ throw response;
2287
+ }
2288
+ }),
2289
+ new Promise(
2290
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2291
+ )
2292
+ ]);
2293
+ }
2265
2294
  /** Search message from elasticsearch service. */
2266
2295
  searchMessage(bearerToken, body, options = {}) {
2267
2296
  if (body === null || body === void 0) {
@@ -5493,6 +5522,17 @@ var Client = class {
5493
5522
  });
5494
5523
  });
5495
5524
  }
5525
+ //
5526
+ closeDirectMess(session, request) {
5527
+ return __async(this, null, function* () {
5528
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
5529
+ yield this.sessionRefresh(session);
5530
+ }
5531
+ return this.apiClient.closeDirectMess(session.token, request).then((response) => {
5532
+ return response !== void 0;
5533
+ });
5534
+ });
5535
+ }
5496
5536
  /** Add a custom ID to the social profiles on the current user's account. */
5497
5537
  linkCustom(session, request) {
5498
5538
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.45",
3
+ "version": "2.7.46",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },