mezon-js 2.8.24 → 2.8.25

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -807,30 +807,6 @@ export interface ApiFriendList {
807
807
  friends?: Array<ApiFriend>;
808
808
  }
809
809
 
810
- /** */
811
- export interface ApiHashtagDmVoice {
812
- //The channel id.
813
- channel_id?: string;
814
- //
815
- channel_label?: string;
816
- //
817
- channel_private?: number;
818
- //
819
- clan_id?: string;
820
- //
821
- clan_name?: string;
822
- //
823
- meeting_code?: string;
824
- //
825
- type?: number;
826
- }
827
-
828
- /** */
829
- export interface ApiHashtagDmVoiceList {
830
- //A list of channel.
831
- hashtage_voice?: Array<ApiHashtagDmVoice>;
832
- }
833
-
834
810
  /** Add link invite users to. */
835
811
  export interface ApiInviteUserRes {
836
812
  //id channel to add link to.
@@ -4488,41 +4464,6 @@ export class MezonApi {
4488
4464
  ]);
4489
4465
  }
4490
4466
 
4491
- /** List channelvoices */
4492
- hashtagDMVoiceList(bearerToken: string,
4493
- userId?:Array<string>,
4494
- limit?:number,
4495
- options: any = {}): Promise<ApiHashtagDmVoiceList> {
4496
-
4497
- const urlPath = "/v2/hashtagdmvoice";
4498
- const queryParams = new Map<string, any>();
4499
- queryParams.set("user_id", userId);
4500
- queryParams.set("limit", limit);
4501
-
4502
- let bodyJson : string = "";
4503
-
4504
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4505
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4506
- if (bearerToken) {
4507
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4508
- }
4509
-
4510
- return Promise.race([
4511
- fetch(fullUrl, fetchOptions).then((response) => {
4512
- if (response.status == 204) {
4513
- return response;
4514
- } else if (response.status >= 200 && response.status < 300) {
4515
- return response.json();
4516
- } else {
4517
- throw response;
4518
- }
4519
- }),
4520
- new Promise((_, reject) =>
4521
- setTimeout(reject, this.timeoutMs, "Request timed out.")
4522
- ),
4523
- ]);
4524
- }
4525
-
4526
4467
  /** Add users to a channel. */
4527
4468
  createLinkInviteUser(bearerToken: string,
4528
4469
  body:ApiLinkInviteUserRequest,
package/client.ts CHANGED
@@ -96,7 +96,6 @@ import {
96
96
  ApiClanStickerAddRequest,
97
97
  MezonUpdateClanStickerByIdBody,
98
98
  MezonChangeChannelCategoryBody,
99
- ApiHashtagDmVoiceList,
100
99
  ApiPermissionRoleChannelList,
101
100
  ApiUpdateRoleChannelRequest,
102
101
  } from "./api.gen";
@@ -2152,18 +2151,6 @@ async pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessag
2152
2151
  });
2153
2152
  }
2154
2153
 
2155
- async hashtagDmVoiceList(session: Session, userId:Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList> {
2156
- if (this.autoRefreshSession && session.refresh_token &&
2157
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2158
- await this.sessionRefresh(session);
2159
- }
2160
-
2161
- return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response: ApiHashtagDmVoiceList) => {
2162
- return Promise.resolve(response);
2163
- });
2164
- }
2165
-
2166
-
2167
2154
  //** */
2168
2155
  async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
2169
2156
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -461,20 +461,6 @@ export interface ApiFriendList {
461
461
  cursor?: string;
462
462
  friends?: Array<ApiFriend>;
463
463
  }
464
- /** */
465
- export interface ApiHashtagDmVoice {
466
- channel_id?: string;
467
- channel_label?: string;
468
- channel_private?: number;
469
- clan_id?: string;
470
- clan_name?: string;
471
- meeting_code?: string;
472
- type?: number;
473
- }
474
- /** */
475
- export interface ApiHashtagDmVoiceList {
476
- hashtage_voice?: Array<ApiHashtagDmVoice>;
477
- }
478
464
  /** Add link invite users to. */
479
465
  export interface ApiInviteUserRes {
480
466
  channel_id?: string;
@@ -1098,8 +1084,6 @@ export declare class MezonApi {
1098
1084
  importSteamFriends(bearerToken: string, account: ApiAccountSteam, reset?: boolean, options?: any): Promise<any>;
1099
1085
  /** */
1100
1086
  getUserProfileOnClan(bearerToken: string, clanId: string, options?: any): Promise<ApiClanProfile>;
1101
- /** List channelvoices */
1102
- hashtagDMVoiceList(bearerToken: string, userId?: Array<string>, limit?: number, options?: any): Promise<ApiHashtagDmVoiceList>;
1103
1087
  /** Add users to a channel. */
1104
1088
  createLinkInviteUser(bearerToken: string, body: ApiLinkInviteUserRequest, options?: any): Promise<ApiLinkInviteUser>;
1105
1089
  /** Add users to a channel. */
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, ApiEvent, 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, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiHashtagDmVoiceList, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } 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, ApiEvent, 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, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiPermissionRoleChannelList, ApiUpdateRoleChannelRequest } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -574,7 +574,6 @@ export declare class Client {
574
574
  /** */
575
575
  createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
576
576
  pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
577
- hashtagDmVoiceList(session: Session, userId: Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList>;
578
577
  deletePinMessage(session: Session, message_id: string): Promise<boolean>;
579
578
  /** create clan emoji */
580
579
  createClanEmoji(session: Session, request: ApiClanEmojiCreateRequest): Promise<boolean>;
@@ -2878,33 +2878,6 @@ var MezonApi = class {
2878
2878
  )
2879
2879
  ]);
2880
2880
  }
2881
- /** List channelvoices */
2882
- hashtagDMVoiceList(bearerToken, userId, limit, options = {}) {
2883
- const urlPath = "/v2/hashtagdmvoice";
2884
- const queryParams = /* @__PURE__ */ new Map();
2885
- queryParams.set("user_id", userId);
2886
- queryParams.set("limit", limit);
2887
- let bodyJson = "";
2888
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2889
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2890
- if (bearerToken) {
2891
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2892
- }
2893
- return Promise.race([
2894
- fetch(fullUrl, fetchOptions).then((response) => {
2895
- if (response.status == 204) {
2896
- return response;
2897
- } else if (response.status >= 200 && response.status < 300) {
2898
- return response.json();
2899
- } else {
2900
- throw response;
2901
- }
2902
- }),
2903
- new Promise(
2904
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2905
- )
2906
- ]);
2907
- }
2908
2881
  /** Add users to a channel. */
2909
2882
  createLinkInviteUser(bearerToken, body, options = {}) {
2910
2883
  if (body === null || body === void 0) {
@@ -5012,6 +4985,18 @@ var _DefaultSocket = class _DefaultSocket {
5012
4985
  return response.emojis_listed_event;
5013
4986
  });
5014
4987
  }
4988
+ ListChannelByUserId() {
4989
+ return __async(this, null, function* () {
4990
+ const response = yield this.send({ channel_desc_list_event: {} });
4991
+ return response.channel_desc_list_event;
4992
+ });
4993
+ }
4994
+ hashtagDMList(user_id, limit) {
4995
+ return __async(this, null, function* () {
4996
+ const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
4997
+ return response.hashtag_dm_list_event;
4998
+ });
4999
+ }
5015
5000
  listClanStickersByClanId(clan_id) {
5016
5001
  return __async(this, null, function* () {
5017
5002
  const response = yield this.send({ sticker_listed_event: { clan_id } });
@@ -6556,16 +6541,6 @@ var Client = class {
6556
6541
  });
6557
6542
  });
6558
6543
  }
6559
- hashtagDmVoiceList(session, userId, limit) {
6560
- return __async(this, null, function* () {
6561
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6562
- yield this.sessionRefresh(session);
6563
- }
6564
- return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response) => {
6565
- return Promise.resolve(response);
6566
- });
6567
- });
6568
- }
6569
6544
  //** */
6570
6545
  deletePinMessage(session, message_id) {
6571
6546
  return __async(this, null, function* () {
@@ -2849,33 +2849,6 @@ var MezonApi = class {
2849
2849
  )
2850
2850
  ]);
2851
2851
  }
2852
- /** List channelvoices */
2853
- hashtagDMVoiceList(bearerToken, userId, limit, options = {}) {
2854
- const urlPath = "/v2/hashtagdmvoice";
2855
- const queryParams = /* @__PURE__ */ new Map();
2856
- queryParams.set("user_id", userId);
2857
- queryParams.set("limit", limit);
2858
- let bodyJson = "";
2859
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2860
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2861
- if (bearerToken) {
2862
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2863
- }
2864
- return Promise.race([
2865
- fetch(fullUrl, fetchOptions).then((response) => {
2866
- if (response.status == 204) {
2867
- return response;
2868
- } else if (response.status >= 200 && response.status < 300) {
2869
- return response.json();
2870
- } else {
2871
- throw response;
2872
- }
2873
- }),
2874
- new Promise(
2875
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2876
- )
2877
- ]);
2878
- }
2879
2852
  /** Add users to a channel. */
2880
2853
  createLinkInviteUser(bearerToken, body, options = {}) {
2881
2854
  if (body === null || body === void 0) {
@@ -4983,6 +4956,18 @@ var _DefaultSocket = class _DefaultSocket {
4983
4956
  return response.emojis_listed_event;
4984
4957
  });
4985
4958
  }
4959
+ ListChannelByUserId() {
4960
+ return __async(this, null, function* () {
4961
+ const response = yield this.send({ channel_desc_list_event: {} });
4962
+ return response.channel_desc_list_event;
4963
+ });
4964
+ }
4965
+ hashtagDMList(user_id, limit) {
4966
+ return __async(this, null, function* () {
4967
+ const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
4968
+ return response.hashtag_dm_list_event;
4969
+ });
4970
+ }
4986
4971
  listClanStickersByClanId(clan_id) {
4987
4972
  return __async(this, null, function* () {
4988
4973
  const response = yield this.send({ sticker_listed_event: { clan_id } });
@@ -6527,16 +6512,6 @@ var Client = class {
6527
6512
  });
6528
6513
  });
6529
6514
  }
6530
- hashtagDmVoiceList(session, userId, limit) {
6531
- return __async(this, null, function* () {
6532
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6533
- yield this.sessionRefresh(session);
6534
- }
6535
- return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response) => {
6536
- return Promise.resolve(response);
6537
- });
6538
- });
6539
- }
6540
6515
  //** */
6541
6516
  deletePinMessage(session, message_id) {
6542
6517
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -471,6 +471,34 @@ export interface ClanEmoji {
471
471
  shortname?: string;
472
472
  src?: string;
473
473
  }
474
+ /** */
475
+ export interface ChannelDescListEvent {
476
+ channeldesc?: Array<ChannelDescription>;
477
+ }
478
+ /** */
479
+ export interface ChannelDescription {
480
+ clan_id?: string;
481
+ channel_id?: string;
482
+ type?: number;
483
+ channel_label?: string;
484
+ channel_private?: number;
485
+ meeting_code?: string;
486
+ clan_name?: string;
487
+ }
488
+ export interface HashtagDmListEvent {
489
+ user_id?: Array<string>;
490
+ limit?: number;
491
+ hashtag_dm?: Array<HashtagDm>;
492
+ }
493
+ export interface HashtagDm {
494
+ channel_id?: string;
495
+ channel_label?: string;
496
+ clan_id?: string;
497
+ clan_name?: string;
498
+ meeting_code?: string;
499
+ type?: number;
500
+ channel_private?: number;
501
+ }
474
502
  /** A socket connection to Mezon server. */
475
503
  export interface Socket {
476
504
  /** Connection is Open */
@@ -565,6 +593,8 @@ export interface Socket {
565
593
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
566
594
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
567
595
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
596
+ ListChannelByUserId(): Promise<ChannelDescListEvent>;
597
+ hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
568
598
  }
569
599
  /** Reports an error received from a socket message. */
570
600
  export interface SocketError {
@@ -642,6 +672,8 @@ export declare class DefaultSocket implements Socket {
642
672
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
643
673
  checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
644
674
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
675
+ ListChannelByUserId(): Promise<ChannelDescListEvent>;
676
+ hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
645
677
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
646
678
  private pingPong;
647
679
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.24",
3
+ "version": "2.8.25",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -675,6 +675,58 @@ export interface ClanEmoji {
675
675
  src?: string;
676
676
  }
677
677
 
678
+ /** */
679
+ export interface ChannelDescListEvent {
680
+ //
681
+ channeldesc?: Array<ChannelDescription>;
682
+ }
683
+
684
+ /** */
685
+ export interface ChannelDescription {
686
+ // The clan of this channel
687
+ clan_id?: string;
688
+ // The channel this message belongs to.
689
+ channel_id?: string;
690
+ // The channel type.
691
+ type?: number;
692
+ // The channel lable
693
+ channel_label?: string;
694
+ // The channel private
695
+ channel_private?: number;
696
+ // meeting code
697
+ meeting_code?: string;
698
+ //
699
+ clan_name?: string;
700
+ }
701
+
702
+ // A list of Channel
703
+ export interface HashtagDmListEvent {
704
+ // user Id
705
+ user_id?: Array<string>;
706
+ // Max number of records to return. Between 1 and 100.
707
+ limit?: number;
708
+ // A list of channel.
709
+ hashtag_dm?: Array<HashtagDm>;
710
+ }
711
+
712
+ // hashtagDM
713
+ export interface HashtagDm {
714
+ // The channel id.
715
+ channel_id?: string;
716
+ // The channel lable
717
+ channel_label?: string;
718
+ // The clan of this channel
719
+ clan_id?: string;
720
+ // The clan name
721
+ clan_name?: string;
722
+ //
723
+ meeting_code?: string;
724
+ //
725
+ type?: number;
726
+ //
727
+ channel_private?: number;
728
+ }
729
+
678
730
  /** A socket connection to Mezon server. */
679
731
  export interface Socket {
680
732
  /** Connection is Open */
@@ -830,6 +882,10 @@ export interface Socket {
830
882
  listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
831
883
 
832
884
  listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
885
+
886
+ ListChannelByUserId(): Promise<ChannelDescListEvent>;
887
+
888
+ hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
833
889
  }
834
890
 
835
891
  /** Reports an error received from a socket message. */
@@ -1373,6 +1429,16 @@ export class DefaultSocket implements Socket {
1373
1429
  return response.emojis_listed_event
1374
1430
  }
1375
1431
 
1432
+ async ListChannelByUserId(): Promise<ChannelDescListEvent> {
1433
+ const response = await this.send({channel_desc_list_event: {}});
1434
+ return response.channel_desc_list_event
1435
+ }
1436
+
1437
+ async hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent> {
1438
+ const response = await this.send({hashtag_dm_list_event: {user_id: user_id, limit: limit }});
1439
+ return response.hashtag_dm_list_event
1440
+ }
1441
+
1376
1442
  async listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent> {
1377
1443
  const response = await this.send({sticker_listed_event: {clan_id: clan_id}});
1378
1444
  return response.sticker_listed_event