mezon-js 2.9.13 → 2.9.15

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.gen.ts CHANGED
@@ -394,6 +394,12 @@ export interface ApiAllUsersAddChannelResponse {
394
394
  user_ids?: Array<string>;
395
395
  }
396
396
 
397
+ /** */
398
+ export interface ApiAllUserClans {
399
+ //
400
+ users?: Array<ApiUser>;
401
+ }
402
+
397
403
  /** App information. */
398
404
  export interface ApiApp {
399
405
  //
@@ -546,6 +552,8 @@ export interface ApiChannelDescription {
546
552
  //
547
553
  clan_id?: string;
548
554
  //
555
+ clan_name?: string;
556
+ //
549
557
  count_mess_unread?: number;
550
558
  //
551
559
  create_time_seconds?: number;
@@ -1084,6 +1092,32 @@ export interface ApiGiveCoffeeEvent {
1084
1092
  token_count?: number;
1085
1093
  }
1086
1094
 
1095
+ /** */
1096
+ export interface ApiHashtagDm {
1097
+ //The channel id.
1098
+ channel_id?: string;
1099
+ //
1100
+ channel_label?: string;
1101
+ //
1102
+ channel_private?: number;
1103
+ //
1104
+ clan_id?: string;
1105
+ //
1106
+ clan_name?: string;
1107
+ //
1108
+ meeting_code?: string;
1109
+ //
1110
+ parrent_id?: string;
1111
+ //
1112
+ type?: number;
1113
+ }
1114
+
1115
+ /** */
1116
+ export interface ApiHashtagDmList {
1117
+ //
1118
+ hashtag_dm?: Array<ApiHashtagDm>;
1119
+ }
1120
+
1087
1121
  /** Add link invite users to. */
1088
1122
  export interface ApiInviteUserRes {
1089
1123
  //id channel to add link to.
@@ -1316,6 +1350,26 @@ export interface ApiNotificationChannel {
1316
1350
  channel_id?: string;
1317
1351
  }
1318
1352
 
1353
+ /** */
1354
+ export interface ApiNotificationChannelCategorySetting {
1355
+ //
1356
+ action?: number;
1357
+ //
1358
+ channel_category_label?: string;
1359
+ //
1360
+ channel_category_title?: string;
1361
+ //
1362
+ id?: string;
1363
+ //
1364
+ notification_setting_type?: number;
1365
+ }
1366
+
1367
+ /** */
1368
+ export interface ApiNotificationChannelCategorySettingList {
1369
+ //
1370
+ notification_channel_category_settings_list?: Array<ApiNotificationChannelCategorySetting>;
1371
+ }
1372
+
1319
1373
  /** A collection of zero or more notifications. */
1320
1374
  export interface ApiNotificationList {
1321
1375
  //Use this cursor to paginate notifications. Cache this to catch up to new notifications.
@@ -1531,6 +1585,20 @@ export interface ApiRoleList {
1531
1585
  roles?: Array<ApiRole>;
1532
1586
  }
1533
1587
 
1588
+ /** */
1589
+ export interface ApiRoleListEventResponse {
1590
+ //
1591
+ clan_id?: string;
1592
+ //
1593
+ cursor?: string;
1594
+ //
1595
+ limit?: string;
1596
+ //
1597
+ roles?: ApiRoleList;
1598
+ //
1599
+ state?: string;
1600
+ }
1601
+
1534
1602
  /** */
1535
1603
  export interface ApiRoleUserList {
1536
1604
  //Cursor for the next page of results, if any.
@@ -5272,6 +5340,39 @@ export class MezonApi {
5272
5340
  ]);
5273
5341
  }
5274
5342
 
5343
+ /** List GetChannelCategoryNotiSettingsList */
5344
+ getChannelCategoryNotiSettingsList(bearerToken: string,
5345
+ clanId?:string,
5346
+ options: any = {}): Promise<ApiNotificationChannelCategorySettingList> {
5347
+
5348
+ const urlPath = "/v2/getChannelCategoryNotiSettingsList";
5349
+ const queryParams = new Map<string, any>();
5350
+ queryParams.set("clan_id", clanId);
5351
+
5352
+ let bodyJson : string = "";
5353
+
5354
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5355
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5356
+ if (bearerToken) {
5357
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5358
+ }
5359
+
5360
+ return Promise.race([
5361
+ fetch(fullUrl, fetchOptions).then((response) => {
5362
+ if (response.status == 204) {
5363
+ return response;
5364
+ } else if (response.status >= 200 && response.status < 300) {
5365
+ return response.json();
5366
+ } else {
5367
+ throw response;
5368
+ }
5369
+ }),
5370
+ new Promise((_, reject) =>
5371
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5372
+ ),
5373
+ ]);
5374
+ }
5375
+
5275
5376
  /** */
5276
5377
  getUserProfileOnClan(bearerToken: string,
5277
5378
  clanId:string,
@@ -5308,6 +5409,138 @@ export class MezonApi {
5308
5409
  ]);
5309
5410
  }
5310
5411
 
5412
+ /** List GetNotificationChannel */
5413
+ getNotificationCategory(bearerToken: string,
5414
+ categoryId?:string,
5415
+ options: any = {}): Promise<ApiNotificationUserChannel> {
5416
+
5417
+ const urlPath = "/v2/getnotificationcategory";
5418
+ const queryParams = new Map<string, any>();
5419
+ queryParams.set("category_id", categoryId);
5420
+
5421
+ let bodyJson : string = "";
5422
+
5423
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5424
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5425
+ if (bearerToken) {
5426
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5427
+ }
5428
+
5429
+ return Promise.race([
5430
+ fetch(fullUrl, fetchOptions).then((response) => {
5431
+ if (response.status == 204) {
5432
+ return response;
5433
+ } else if (response.status >= 200 && response.status < 300) {
5434
+ return response.json();
5435
+ } else {
5436
+ throw response;
5437
+ }
5438
+ }),
5439
+ new Promise((_, reject) =>
5440
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5441
+ ),
5442
+ ]);
5443
+ }
5444
+
5445
+ /** List GetNotificationChannel */
5446
+ getNotificationChannel(bearerToken: string,
5447
+ channelId?:string,
5448
+ options: any = {}): Promise<ApiNotificationUserChannel> {
5449
+
5450
+ const urlPath = "/v2/getnotificationchannel";
5451
+ const queryParams = new Map<string, any>();
5452
+ queryParams.set("channel_id", channelId);
5453
+
5454
+ let bodyJson : string = "";
5455
+
5456
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5457
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5458
+ if (bearerToken) {
5459
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5460
+ }
5461
+
5462
+ return Promise.race([
5463
+ fetch(fullUrl, fetchOptions).then((response) => {
5464
+ if (response.status == 204) {
5465
+ return response;
5466
+ } else if (response.status >= 200 && response.status < 300) {
5467
+ return response.json();
5468
+ } else {
5469
+ throw response;
5470
+ }
5471
+ }),
5472
+ new Promise((_, reject) =>
5473
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5474
+ ),
5475
+ ]);
5476
+ }
5477
+
5478
+ /** List GetNotificationClan */
5479
+ getNotificationClan(bearerToken: string,
5480
+ clanId?:string,
5481
+ options: any = {}): Promise<ApiNotificationSetting> {
5482
+
5483
+ const urlPath = "/v2/getnotificationclan";
5484
+ const queryParams = new Map<string, any>();
5485
+ queryParams.set("clan_id", clanId);
5486
+
5487
+ let bodyJson : string = "";
5488
+
5489
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5490
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5491
+ if (bearerToken) {
5492
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5493
+ }
5494
+
5495
+ return Promise.race([
5496
+ fetch(fullUrl, fetchOptions).then((response) => {
5497
+ if (response.status == 204) {
5498
+ return response;
5499
+ } else if (response.status >= 200 && response.status < 300) {
5500
+ return response.json();
5501
+ } else {
5502
+ throw response;
5503
+ }
5504
+ }),
5505
+ new Promise((_, reject) =>
5506
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5507
+ ),
5508
+ ]);
5509
+ }
5510
+
5511
+ /** List GetNotificationReactMessage */
5512
+ getNotificationReactMessage(bearerToken: string,
5513
+ channelId?:string,
5514
+ options: any = {}): Promise<ApiNotifiReactMessage> {
5515
+
5516
+ const urlPath = "/v2/getnotificationreactmessage";
5517
+ const queryParams = new Map<string, any>();
5518
+ queryParams.set("channel_id", channelId);
5519
+
5520
+ let bodyJson : string = "";
5521
+
5522
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5523
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5524
+ if (bearerToken) {
5525
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5526
+ }
5527
+
5528
+ return Promise.race([
5529
+ fetch(fullUrl, fetchOptions).then((response) => {
5530
+ if (response.status == 204) {
5531
+ return response;
5532
+ } else if (response.status >= 200 && response.status < 300) {
5533
+ return response.json();
5534
+ } else {
5535
+ throw response;
5536
+ }
5537
+ }),
5538
+ new Promise((_, reject) =>
5539
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5540
+ ),
5541
+ ]);
5542
+ }
5543
+
5311
5544
  /** Give a coffee */
5312
5545
  giveMeACoffee(bearerToken: string,
5313
5546
  body:ApiGiveCoffeeEvent,
@@ -5344,6 +5577,41 @@ export class MezonApi {
5344
5577
  ]);
5345
5578
  }
5346
5579
 
5580
+ /** List HashtagDMList */
5581
+ hashtagDMList(bearerToken: string,
5582
+ userId?:Array<string>,
5583
+ limit?:number,
5584
+ options: any = {}): Promise<ApiHashtagDmList> {
5585
+
5586
+ const urlPath = "/v2/hashtagdmlist";
5587
+ const queryParams = new Map<string, any>();
5588
+ queryParams.set("user_id", userId);
5589
+ queryParams.set("limit", limit);
5590
+
5591
+ let bodyJson : string = "";
5592
+
5593
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5594
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5595
+ if (bearerToken) {
5596
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5597
+ }
5598
+
5599
+ return Promise.race([
5600
+ fetch(fullUrl, fetchOptions).then((response) => {
5601
+ if (response.status == 204) {
5602
+ return response;
5603
+ } else if (response.status >= 200 && response.status < 300) {
5604
+ return response.json();
5605
+ } else {
5606
+ throw response;
5607
+ }
5608
+ }),
5609
+ new Promise((_, reject) =>
5610
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5611
+ ),
5612
+ ]);
5613
+ }
5614
+
5347
5615
  /** Add users to a channel. */
5348
5616
  createLinkInviteUser(bearerToken: string,
5349
5617
  body:ApiLinkInviteUserRequest,
@@ -5452,6 +5720,37 @@ export class MezonApi {
5452
5720
  ]);
5453
5721
  }
5454
5722
 
5723
+ /** List HashtagDMList */
5724
+ listChannelByUserId(bearerToken: string,
5725
+ options: any = {}): Promise<ApiChannelDescList> {
5726
+
5727
+ const urlPath = "/v2/listchannelbyuserid";
5728
+ const queryParams = new Map<string, any>();
5729
+
5730
+ let bodyJson : string = "";
5731
+
5732
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5733
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5734
+ if (bearerToken) {
5735
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5736
+ }
5737
+
5738
+ return Promise.race([
5739
+ fetch(fullUrl, fetchOptions).then((response) => {
5740
+ if (response.status == 204) {
5741
+ return response;
5742
+ } else if (response.status >= 200 && response.status < 300) {
5743
+ return response.json();
5744
+ } else {
5745
+ throw response;
5746
+ }
5747
+ }),
5748
+ new Promise((_, reject) =>
5749
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5750
+ ),
5751
+ ]);
5752
+ }
5753
+
5455
5754
  /** set mute notification user channel. */
5456
5755
  setMuteNotificationCategory(bearerToken: string,
5457
5756
  body:ApiSetMuteNotificationRequest,
@@ -6156,6 +6455,45 @@ export class MezonApi {
6156
6455
  ]);
6157
6456
  }
6158
6457
 
6458
+ /** ListRoles */
6459
+ listRoles(bearerToken: string,
6460
+ clanId?:string,
6461
+ limit?:string,
6462
+ state?:string,
6463
+ cursor?:string,
6464
+ options: any = {}): Promise<ApiRoleListEventResponse> {
6465
+
6466
+ const urlPath = "/v2/roles";
6467
+ const queryParams = new Map<string, any>();
6468
+ queryParams.set("clan_id", clanId);
6469
+ queryParams.set("limit", limit);
6470
+ queryParams.set("state", state);
6471
+ queryParams.set("cursor", cursor);
6472
+
6473
+ let bodyJson : string = "";
6474
+
6475
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6476
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6477
+ if (bearerToken) {
6478
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6479
+ }
6480
+
6481
+ return Promise.race([
6482
+ fetch(fullUrl, fetchOptions).then((response) => {
6483
+ if (response.status == 204) {
6484
+ return response;
6485
+ } else if (response.status >= 200 && response.status < 300) {
6486
+ return response.json();
6487
+ } else {
6488
+ throw response;
6489
+ }
6490
+ }),
6491
+ new Promise((_, reject) =>
6492
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
6493
+ ),
6494
+ ]);
6495
+ }
6496
+
6159
6497
  /** Create a new role for clan. */
6160
6498
  createRole(bearerToken: string,
6161
6499
  body:ApiCreateRoleRequest,
@@ -7219,6 +7557,37 @@ export class MezonApi {
7219
7557
  ]);
7220
7558
  }
7221
7559
 
7560
+ /** ListUserClansByUserId */
7561
+ listUserClansByUserId(bearerToken: string,
7562
+ options: any = {}): Promise<ApiAllUserClans> {
7563
+
7564
+ const urlPath = "/v2/users/clans";
7565
+ const queryParams = new Map<string, any>();
7566
+
7567
+ let bodyJson : string = "";
7568
+
7569
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7570
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
7571
+ if (bearerToken) {
7572
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7573
+ }
7574
+
7575
+ return Promise.race([
7576
+ fetch(fullUrl, fetchOptions).then((response) => {
7577
+ if (response.status == 204) {
7578
+ return response;
7579
+ } else if (response.status >= 200 && response.status < 300) {
7580
+ return response.json();
7581
+ } else {
7582
+ throw response;
7583
+ }
7584
+ }),
7585
+ new Promise((_, reject) =>
7586
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
7587
+ ),
7588
+ ]);
7589
+ }
7590
+
7222
7591
  /** create webhook */
7223
7592
  generateWebhook(bearerToken: string,
7224
7593
  body:ApiWebhookCreateRequest,
package/client.ts CHANGED
@@ -108,9 +108,16 @@ import {
108
108
  ApiRegisterStreamingChannelResponse,
109
109
  ApiRoleList,
110
110
  ApiListChannelAppsResponse,
111
- ApiStickerListedResponse,
111
+ ApiNotificationChannelCategorySettingList,
112
+ ApiNotificationUserChannel,
113
+ ApiNotificationSetting,
114
+ ApiNotifiReactMessage,
115
+ ApiHashtagDmList,
112
116
  ApiEmojiListedResponse,
117
+ ApiStickerListedResponse,
113
118
  ApiAllUsersAddChannelResponse,
119
+ ApiRoleListEventResponse,
120
+ ApiAllUserClans,
114
121
  } from "./api.gen";
115
122
 
116
123
  import { Session } from "./session";
@@ -3603,7 +3610,10 @@ export class Client {
3603
3610
  });
3604
3611
  }
3605
3612
 
3606
- async getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse> {
3613
+ async getChannelCategoryNotiSettingsList(
3614
+ session: Session,
3615
+ clanId: string
3616
+ ): Promise<ApiNotificationChannelCategorySettingList> {
3607
3617
  if (
3608
3618
  this.autoRefreshSession &&
3609
3619
  session.refresh_token &&
@@ -3613,13 +3623,147 @@ export class Client {
3613
3623
  }
3614
3624
 
3615
3625
  return this.apiClient
3616
- .getListStickersByUserId(session.token)
3626
+ .getChannelCategoryNotiSettingsList(session.token, clanId)
3627
+ .then((response: ApiNotificationChannelCategorySettingList) => {
3628
+ return Promise.resolve(response);
3629
+ });
3630
+ }
3631
+
3632
+ async getNotificationCategory(
3633
+ session: Session,
3634
+ categoryId: string
3635
+ ): Promise<ApiNotificationUserChannel> {
3636
+ if (
3637
+ this.autoRefreshSession &&
3638
+ session.refresh_token &&
3639
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3640
+ ) {
3641
+ await this.sessionRefresh(session);
3642
+ }
3643
+
3644
+ return this.apiClient
3645
+ .getNotificationCategory(session.token, categoryId)
3646
+ .then((response: ApiNotificationUserChannel) => {
3647
+ return Promise.resolve(response);
3648
+ });
3649
+ }
3650
+
3651
+ async getNotificationChannel(
3652
+ session: Session,
3653
+ channelId: string
3654
+ ): Promise<ApiNotificationUserChannel> {
3655
+ if (
3656
+ this.autoRefreshSession &&
3657
+ session.refresh_token &&
3658
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3659
+ ) {
3660
+ await this.sessionRefresh(session);
3661
+ }
3662
+
3663
+ return this.apiClient
3664
+ .getNotificationChannel(session.token, channelId)
3665
+ .then((response: ApiNotificationUserChannel) => {
3666
+ return Promise.resolve(response);
3667
+ });
3668
+ }
3669
+
3670
+ async getNotificationClan(
3671
+ session: Session,
3672
+ clanId: string
3673
+ ): Promise<ApiNotificationSetting> {
3674
+ if (
3675
+ this.autoRefreshSession &&
3676
+ session.refresh_token &&
3677
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3678
+ ) {
3679
+ await this.sessionRefresh(session);
3680
+ }
3681
+
3682
+ return this.apiClient
3683
+ .getNotificationClan(session.token, clanId)
3684
+ .then((response: ApiNotificationSetting) => {
3685
+ return Promise.resolve(response);
3686
+ });
3687
+ }
3688
+
3689
+ async getNotificationReactMessage(
3690
+ session: Session,
3691
+ channelId: string
3692
+ ): Promise<ApiNotifiReactMessage> {
3693
+ if (
3694
+ this.autoRefreshSession &&
3695
+ session.refresh_token &&
3696
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3697
+ ) {
3698
+ await this.sessionRefresh(session);
3699
+ }
3700
+
3701
+ return this.apiClient
3702
+ .getNotificationReactMessage(session.token, channelId)
3703
+ .then((response: ApiNotifiReactMessage) => {
3704
+ return Promise.resolve(response);
3705
+ });
3706
+ }
3707
+
3708
+ async hashtagDMList(
3709
+ session: Session,
3710
+ userId: Array<string>,
3711
+ limit: number
3712
+ ): Promise<ApiHashtagDmList> {
3713
+ if (
3714
+ this.autoRefreshSession &&
3715
+ session.refresh_token &&
3716
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3717
+ ) {
3718
+ await this.sessionRefresh(session);
3719
+ }
3720
+
3721
+ return this.apiClient
3722
+ .hashtagDMList(session.token, userId, limit)
3723
+ .then((response: ApiHashtagDmList) => {
3724
+ return Promise.resolve(response);
3725
+ });
3726
+ }
3727
+
3728
+ async listChannelByUserId(session: Session): Promise<ApiChannelDescList> {
3729
+ if (
3730
+ this.autoRefreshSession &&
3731
+ session.refresh_token &&
3732
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3733
+ ) {
3734
+ await this.sessionRefresh(session);
3735
+ }
3736
+
3737
+ return this.apiClient
3738
+ .listChannelByUserId(session.token)
3739
+ .then((response: ApiChannelDescList) => {
3740
+ return Promise.resolve(response);
3741
+ });
3742
+ }
3743
+
3744
+ async listUsersAddChannelByChannelId(
3745
+ session: Session,
3746
+ channel_id: string,
3747
+ limit: number
3748
+ ): Promise<ApiAllUsersAddChannelResponse> {
3749
+ if (
3750
+ this.autoRefreshSession &&
3751
+ session.refresh_token &&
3752
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3753
+ ) {
3754
+ await this.sessionRefresh(session);
3755
+ }
3756
+
3757
+ return this.apiClient
3758
+ .listUsersAddChannelByChannelId(session.token, channel_id, limit)
3617
3759
  .then((response: any) => {
3618
3760
  return Promise.resolve(response);
3619
3761
  });
3620
3762
  }
3621
3763
 
3622
- async getListEmojisByUserId(session: Session): Promise<ApiEmojiListedResponse> {
3764
+ async getListEmojisByUserId(
3765
+ session: Session
3766
+ ): Promise<ApiEmojiListedResponse> {
3623
3767
  if (
3624
3768
  this.autoRefreshSession &&
3625
3769
  session.refresh_token &&
@@ -3635,7 +3779,9 @@ export class Client {
3635
3779
  });
3636
3780
  }
3637
3781
 
3638
- async listUsersAddChannelByChannelId(session: Session, channel_id : string, limit : number): Promise<ApiAllUsersAddChannelResponse> {
3782
+ async getListStickersByUserId(
3783
+ session: Session
3784
+ ): Promise<ApiStickerListedResponse> {
3639
3785
  if (
3640
3786
  this.autoRefreshSession &&
3641
3787
  session.refresh_token &&
@@ -3645,9 +3791,52 @@ export class Client {
3645
3791
  }
3646
3792
 
3647
3793
  return this.apiClient
3648
- .listUsersAddChannelByChannelId(session.token, channel_id, limit)
3794
+ .getListStickersByUserId(session.token)
3649
3795
  .then((response: any) => {
3650
3796
  return Promise.resolve(response);
3651
3797
  });
3652
3798
  }
3799
+
3800
+ async listUserClansByUserId(session: Session): Promise<ApiAllUserClans> {
3801
+ if (
3802
+ this.autoRefreshSession &&
3803
+ session.refresh_token &&
3804
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3805
+ ) {
3806
+ await this.sessionRefresh(session);
3807
+ }
3808
+
3809
+ return this.apiClient
3810
+ .listUserClansByUserId(session.token)
3811
+ .then((response: ApiAllUserClans) => {
3812
+ return Promise.resolve(response);
3813
+ });
3814
+ }
3815
+
3816
+ async listRoles(
3817
+ session: Session,
3818
+ clanId?: string,
3819
+ limit?: string,
3820
+ state?: string,
3821
+ cursor?: string
3822
+ ): Promise<ApiRoleListEventResponse> {
3823
+ if (
3824
+ this.autoRefreshSession &&
3825
+ session.refresh_token &&
3826
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3827
+ ) {
3828
+ await this.sessionRefresh(session);
3829
+ }
3830
+
3831
+ return this.apiClient
3832
+ .listRoles(session.token, clanId, limit, state, cursor)
3833
+ .then((response: ApiRoleListEventResponse) => {
3834
+ var result: ApiRoleListEventResponse = {
3835
+ clan_id: clanId,
3836
+ roles: response.roles,
3837
+ };
3838
+
3839
+ return Promise.resolve(result);
3840
+ });
3841
+ }
3653
3842
  }