mezon-js 2.10.69 → 2.10.71

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
@@ -1783,24 +1783,6 @@ export interface ApiStreamHttpCallbackResponse {
1783
1783
  msg?: string;
1784
1784
  }
1785
1785
 
1786
- /** A list of users belonging to a channel, along with their role. */
1787
- export interface ApiSFUChannelUser {
1788
- //
1789
- channel_id?: string;
1790
- //
1791
- id?: string;
1792
- //
1793
- participant?: string;
1794
- //user for a channel.
1795
- user_id?: string;
1796
- }
1797
-
1798
- /** A list of users belonging to a channel, along with their role. */
1799
- export interface ApiSFUChannelUserList {
1800
- //
1801
- sfu_channel_users?: Array<ApiSFUChannelUser>;
1802
- }
1803
-
1804
1786
  /** */
1805
1787
  export interface ApiPermission {
1806
1788
  //
@@ -2561,6 +2543,8 @@ export interface ApiWebhook {
2561
2543
  //
2562
2544
  id?: string;
2563
2545
  //
2546
+ status?: number;
2547
+ //
2564
2548
  update_time?: string;
2565
2549
  //
2566
2550
  url?: string;
@@ -8136,50 +8120,6 @@ export class MezonApi {
8136
8120
  ]);
8137
8121
  }
8138
8122
 
8139
- /** List all users in SFU channel. */
8140
- listSFUChannelUsers(
8141
- bearerToken: string,
8142
- clanId?: string,
8143
- channelId?: string,
8144
- channelType?: number,
8145
- limit?: number,
8146
- state?: number,
8147
- cursor?: string,
8148
- options: any = {}
8149
- ): Promise<ApiSFUChannelUserList> {
8150
- const urlPath = "/v2/sfu_channels/users";
8151
- const queryParams = new Map<string, any>();
8152
- queryParams.set("clan_id", clanId);
8153
- queryParams.set("channel_id", channelId);
8154
- queryParams.set("channel_type", channelType);
8155
- queryParams.set("limit", limit);
8156
- queryParams.set("state", state);
8157
- queryParams.set("cursor", cursor);
8158
-
8159
- let bodyJson: string = "";
8160
-
8161
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
8162
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
8163
- if (bearerToken) {
8164
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
8165
- }
8166
-
8167
- return Promise.race([
8168
- fetch(fullUrl, fetchOptions).then((response) => {
8169
- if (response.status == 204) {
8170
- return response;
8171
- } else if (response.status >= 200 && response.status < 300) {
8172
- return response.json();
8173
- } else {
8174
- throw response;
8175
- }
8176
- }),
8177
- new Promise((_, reject) =>
8178
- setTimeout(reject, this.timeoutMs, "Request timed out.")
8179
- ),
8180
- ]);
8181
- }
8182
-
8183
8123
  /** get pubkey */
8184
8124
  getPubKeys(
8185
8125
  bearerToken: string,
package/client.ts CHANGED
@@ -156,7 +156,6 @@ import {
156
156
  ApiSdTopicList,
157
157
  ApiSdTopicRequest,
158
158
  ApiSdTopic,
159
- ApiSFUChannelUserList,
160
159
  MezonUpdateEventBody,
161
160
  } from "./api.gen";
162
161
 
@@ -175,12 +174,13 @@ export enum ChannelType {
175
174
  CHANNEL_TYPE_CHANNEL = 1,
176
175
  CHANNEL_TYPE_GROUP = 2,
177
176
  CHANNEL_TYPE_DM = 3,
178
- CHANNEL_TYPE_VOICE = 4,
177
+ CHANNEL_TYPE_GMEET_VOICE = 4,
179
178
  CHANNEL_TYPE_FORUM = 5,
180
179
  CHANNEL_TYPE_STREAMING = 6,
181
180
  CHANNEL_TYPE_THREAD = 7,
182
181
  CHANNEL_TYPE_APP = 8,
183
182
  CHANNEL_TYPE_ANNOUNCEMENT = 9,
183
+ CHANNEL_TYPE_MEZON_VOICE = 10,
184
184
  }
185
185
  export enum ChannelStreamMode {
186
186
  STREAM_MODE_CHANNEL = 2,
@@ -204,12 +204,6 @@ export enum WebrtcSignalingType {
204
204
  WEBRTC_SDP_QUIT = 4,
205
205
  }
206
206
 
207
- export enum SFUSignalingType {
208
- JOINE = 0,
209
- LEAVE = 1,
210
- TALK = 2,
211
- }
212
-
213
207
  /** Response for an RPC function executed on the server. */
214
208
  export interface RpcResponse {
215
209
  /** The identifier of the function. */
@@ -4769,55 +4763,6 @@ export class Client {
4769
4763
  });
4770
4764
  }
4771
4765
 
4772
- /** List a ptt channel's users. */
4773
- async listSFUChannelUsers(
4774
- session: Session,
4775
- clanId: string,
4776
- channelId: string,
4777
- channelType: number,
4778
- state?: number,
4779
- limit?: number,
4780
- cursor?: string
4781
- ): Promise<ApiSFUChannelUserList> {
4782
- if (
4783
- this.autoRefreshSession &&
4784
- session.refresh_token &&
4785
- session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4786
- ) {
4787
- await this.sessionRefresh(session);
4788
- }
4789
-
4790
- return this.apiClient
4791
- .listSFUChannelUsers(
4792
- session.token,
4793
- clanId,
4794
- channelId,
4795
- channelType,
4796
- limit,
4797
- state,
4798
- cursor
4799
- )
4800
- .then((response: ApiSFUChannelUserList) => {
4801
- var result: ApiSFUChannelUserList = {
4802
- sfu_channel_users: [],
4803
- };
4804
-
4805
- if (response.sfu_channel_users == null) {
4806
- return Promise.resolve(result);
4807
- }
4808
-
4809
- response.sfu_channel_users!.forEach((gu) => {
4810
- result.sfu_channel_users!.push({
4811
- id: gu.id,
4812
- channel_id: gu.channel_id,
4813
- user_id: gu.user_id,
4814
- participant: gu.participant,
4815
- });
4816
- });
4817
- return Promise.resolve(result);
4818
- });
4819
- }
4820
-
4821
4766
  //**list wallet ledger */
4822
4767
  async listWalletLedger(
4823
4768
  session: Session,
package/dist/api.gen.d.ts CHANGED
@@ -1030,17 +1030,6 @@ export interface ApiStreamHttpCallbackResponse {
1030
1030
  code?: number;
1031
1031
  msg?: string;
1032
1032
  }
1033
- /** A list of users belonging to a channel, along with their role. */
1034
- export interface ApiSFUChannelUser {
1035
- channel_id?: string;
1036
- id?: string;
1037
- participant?: string;
1038
- user_id?: string;
1039
- }
1040
- /** A list of users belonging to a channel, along with their role. */
1041
- export interface ApiSFUChannelUserList {
1042
- sfu_channel_users?: Array<ApiSFUChannelUser>;
1043
- }
1044
1033
  /** */
1045
1034
  export interface ApiPermission {
1046
1035
  active?: number;
@@ -1481,6 +1470,7 @@ export interface ApiWebhook {
1481
1470
  create_time?: string;
1482
1471
  creator_id?: string;
1483
1472
  id?: string;
1473
+ status?: number;
1484
1474
  update_time?: string;
1485
1475
  url?: string;
1486
1476
  webhook_name?: string;
@@ -1903,8 +1893,6 @@ export declare class MezonApi {
1903
1893
  getPinMessagesList(bearerToken: string, messageId?: string, channelId?: string, clanId?: string, options?: any): Promise<ApiPinMessagesList>;
1904
1894
  /** set notification user channel. */
1905
1895
  createPinMessage(bearerToken: string, body: ApiPinMessageRequest, options?: any): Promise<ApiChannelMessageHeader>;
1906
- /** List all users in SFU channel. */
1907
- listSFUChannelUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiSFUChannelUserList>;
1908
1896
  /** get pubkey */
1909
1897
  getPubKeys(bearerToken: string, userIds?: Array<string>, options?: any): Promise<ApiGetPubKeysResponse>;
1910
1898
  /** store pubkey for e2ee */
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, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, ApiSFUChannelUserList, MezonUpdateEventBody } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiChannelCanvasListResponse, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity, ApiChanEncryptionMethod, ApiGetPubKeysResponse, ApiPubKey, ApiGetKeyServerResp, MezonapiListAuditLog, ApiTokenSentEvent, MezonDeleteWebhookByIdBody, ApiWithdrawTokenRequest, ApiListOnboardingResponse, ApiCreateOnboardingRequest, MezonUpdateOnboardingBody, ApiOnboardingItem, ApiGenerateClanWebhookRequest, ApiGenerateClanWebhookResponse, ApiListClanWebhookResponse, MezonUpdateClanWebhookByIdBody, MezonUpdateClanDescBody, ApiUserStatusUpdate, ApiUserStatus, ApiListOnboardingStepResponse, MezonUpdateOnboardingStepByClanIdBody, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic, MezonUpdateEventBody } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -21,12 +21,13 @@ export declare enum ChannelType {
21
21
  CHANNEL_TYPE_CHANNEL = 1,
22
22
  CHANNEL_TYPE_GROUP = 2,
23
23
  CHANNEL_TYPE_DM = 3,
24
- CHANNEL_TYPE_VOICE = 4,
24
+ CHANNEL_TYPE_GMEET_VOICE = 4,
25
25
  CHANNEL_TYPE_FORUM = 5,
26
26
  CHANNEL_TYPE_STREAMING = 6,
27
27
  CHANNEL_TYPE_THREAD = 7,
28
28
  CHANNEL_TYPE_APP = 8,
29
- CHANNEL_TYPE_ANNOUNCEMENT = 9
29
+ CHANNEL_TYPE_ANNOUNCEMENT = 9,
30
+ CHANNEL_TYPE_MEZON_VOICE = 10
30
31
  }
31
32
  export declare enum ChannelStreamMode {
32
33
  STREAM_MODE_CHANNEL = 2,
@@ -47,11 +48,6 @@ export declare enum WebrtcSignalingType {
47
48
  WEBRTC_ICE_CANDIDATE = 3,
48
49
  WEBRTC_SDP_QUIT = 4
49
50
  }
50
- export declare enum SFUSignalingType {
51
- JOINE = 0,
52
- LEAVE = 1,
53
- TALK = 2
54
- }
55
51
  /** Response for an RPC function executed on the server. */
56
52
  export interface RpcResponse {
57
53
  /** The identifier of the function. */
@@ -637,8 +633,6 @@ export declare class Client {
637
633
  updateOnboardingStepByClanId(session: Session, clan_id: string, request: MezonUpdateOnboardingStepByClanIdBody): Promise<boolean>;
638
634
  updateUserStatus(session: Session, request: ApiUserStatusUpdate): Promise<boolean>;
639
635
  getUserStatus(session: Session): Promise<ApiUserStatus>;
640
- /** List a ptt channel's users. */
641
- listSFUChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiSFUChannelUserList>;
642
636
  listWalletLedger(session: Session, limit?: number, cursor?: string, transactionId?: string): Promise<ApiWalletLedgerList>;
643
637
  listSdTopic(session: Session, clanId?: string, limit?: number): Promise<ApiSdTopicList>;
644
638
  createSdTopic(session: Session, request: ApiSdTopicRequest): Promise<ApiSdTopic>;
@@ -59,7 +59,6 @@ __export(mezon_js_exports, {
59
59
  Client: () => Client,
60
60
  DefaultSocket: () => DefaultSocket,
61
61
  NotificationType: () => NotificationType,
62
- SFUSignalingType: () => SFUSignalingType,
63
62
  Session: () => Session,
64
63
  WebSocketAdapterText: () => WebSocketAdapterText,
65
64
  WebrtcSignalingType: () => WebrtcSignalingType,
@@ -4879,37 +4878,6 @@ var MezonApi = class {
4879
4878
  )
4880
4879
  ]);
4881
4880
  }
4882
- /** List all users in SFU channel. */
4883
- listSFUChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
4884
- const urlPath = "/v2/sfu_channels/users";
4885
- const queryParams = /* @__PURE__ */ new Map();
4886
- queryParams.set("clan_id", clanId);
4887
- queryParams.set("channel_id", channelId);
4888
- queryParams.set("channel_type", channelType);
4889
- queryParams.set("limit", limit);
4890
- queryParams.set("state", state);
4891
- queryParams.set("cursor", cursor);
4892
- let bodyJson = "";
4893
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4894
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4895
- if (bearerToken) {
4896
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4897
- }
4898
- return Promise.race([
4899
- fetch(fullUrl, fetchOptions).then((response) => {
4900
- if (response.status == 204) {
4901
- return response;
4902
- } else if (response.status >= 200 && response.status < 300) {
4903
- return response.json();
4904
- } else {
4905
- throw response;
4906
- }
4907
- }),
4908
- new Promise(
4909
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4910
- )
4911
- ]);
4912
- }
4913
4881
  /** get pubkey */
4914
4882
  getPubKeys(bearerToken, userIds, options = {}) {
4915
4883
  const urlPath = "/v2/pubkey";
@@ -7187,6 +7155,8 @@ var _DefaultSocket = class _DefaultSocket {
7187
7155
  this.onroleevent(message.role_event);
7188
7156
  } else if (message.event_emoji) {
7189
7157
  this.oneventemoji(message.event_emoji);
7158
+ } else if (message.webhook_event) {
7159
+ this.oneventwebhook(message.webhook_event);
7190
7160
  } else if (message.channel_deleted_event) {
7191
7161
  this.onchanneldeleted(message.channel_deleted_event);
7192
7162
  } else if (message.clan_deleted_event) {
@@ -7530,6 +7500,11 @@ var _DefaultSocket = class _DefaultSocket {
7530
7500
  console.log(eventEmoji);
7531
7501
  }
7532
7502
  }
7503
+ oneventwebhook(webhook_event) {
7504
+ if (this.verbose && window && window.console) {
7505
+ console.log(webhook_event);
7506
+ }
7507
+ }
7533
7508
  onchanneldeleted(channelDeleted) {
7534
7509
  if (this.verbose && window && window.console) {
7535
7510
  console.log(channelDeleted);
@@ -8068,12 +8043,13 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
8068
8043
  ChannelType2[ChannelType2["CHANNEL_TYPE_CHANNEL"] = 1] = "CHANNEL_TYPE_CHANNEL";
8069
8044
  ChannelType2[ChannelType2["CHANNEL_TYPE_GROUP"] = 2] = "CHANNEL_TYPE_GROUP";
8070
8045
  ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
8071
- ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
8046
+ ChannelType2[ChannelType2["CHANNEL_TYPE_GMEET_VOICE"] = 4] = "CHANNEL_TYPE_GMEET_VOICE";
8072
8047
  ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
8073
8048
  ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
8074
8049
  ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
8075
8050
  ChannelType2[ChannelType2["CHANNEL_TYPE_APP"] = 8] = "CHANNEL_TYPE_APP";
8076
8051
  ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 9] = "CHANNEL_TYPE_ANNOUNCEMENT";
8052
+ ChannelType2[ChannelType2["CHANNEL_TYPE_MEZON_VOICE"] = 10] = "CHANNEL_TYPE_MEZON_VOICE";
8077
8053
  return ChannelType2;
8078
8054
  })(ChannelType || {});
8079
8055
  var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
@@ -8098,12 +8074,6 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
8098
8074
  WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
8099
8075
  return WebrtcSignalingType2;
8100
8076
  })(WebrtcSignalingType || {});
8101
- var SFUSignalingType = /* @__PURE__ */ ((SFUSignalingType2) => {
8102
- SFUSignalingType2[SFUSignalingType2["JOINE"] = 0] = "JOINE";
8103
- SFUSignalingType2[SFUSignalingType2["LEAVE"] = 1] = "LEAVE";
8104
- SFUSignalingType2[SFUSignalingType2["TALK"] = 2] = "TALK";
8105
- return SFUSignalingType2;
8106
- })(SFUSignalingType || {});
8107
8077
  var Client = class {
8108
8078
  constructor(serverkey = DEFAULT_SERVER_KEY, host = DEFAULT_HOST, port = DEFAULT_PORT, useSSL = false, timeout = DEFAULT_TIMEOUT_MS, autoRefreshSession = true) {
8109
8079
  this.serverkey = serverkey;
@@ -10597,39 +10567,6 @@ var Client = class {
10597
10567
  });
10598
10568
  });
10599
10569
  }
10600
- /** List a ptt channel's users. */
10601
- listSFUChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
10602
- return __async(this, null, function* () {
10603
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10604
- yield this.sessionRefresh(session);
10605
- }
10606
- return this.apiClient.listSFUChannelUsers(
10607
- session.token,
10608
- clanId,
10609
- channelId,
10610
- channelType,
10611
- limit,
10612
- state,
10613
- cursor
10614
- ).then((response) => {
10615
- var result = {
10616
- sfu_channel_users: []
10617
- };
10618
- if (response.sfu_channel_users == null) {
10619
- return Promise.resolve(result);
10620
- }
10621
- response.sfu_channel_users.forEach((gu) => {
10622
- result.sfu_channel_users.push({
10623
- id: gu.id,
10624
- channel_id: gu.channel_id,
10625
- user_id: gu.user_id,
10626
- participant: gu.participant
10627
- });
10628
- });
10629
- return Promise.resolve(result);
10630
- });
10631
- });
10632
- }
10633
10570
  //**list wallet ledger */
10634
10571
  listWalletLedger(session, limit, cursor, transactionId) {
10635
10572
  return __async(this, null, function* () {
@@ -4844,37 +4844,6 @@ var MezonApi = class {
4844
4844
  )
4845
4845
  ]);
4846
4846
  }
4847
- /** List all users in SFU channel. */
4848
- listSFUChannelUsers(bearerToken, clanId, channelId, channelType, limit, state, cursor, options = {}) {
4849
- const urlPath = "/v2/sfu_channels/users";
4850
- const queryParams = /* @__PURE__ */ new Map();
4851
- queryParams.set("clan_id", clanId);
4852
- queryParams.set("channel_id", channelId);
4853
- queryParams.set("channel_type", channelType);
4854
- queryParams.set("limit", limit);
4855
- queryParams.set("state", state);
4856
- queryParams.set("cursor", cursor);
4857
- let bodyJson = "";
4858
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4859
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4860
- if (bearerToken) {
4861
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4862
- }
4863
- return Promise.race([
4864
- fetch(fullUrl, fetchOptions).then((response) => {
4865
- if (response.status == 204) {
4866
- return response;
4867
- } else if (response.status >= 200 && response.status < 300) {
4868
- return response.json();
4869
- } else {
4870
- throw response;
4871
- }
4872
- }),
4873
- new Promise(
4874
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4875
- )
4876
- ]);
4877
- }
4878
4847
  /** get pubkey */
4879
4848
  getPubKeys(bearerToken, userIds, options = {}) {
4880
4849
  const urlPath = "/v2/pubkey";
@@ -7152,6 +7121,8 @@ var _DefaultSocket = class _DefaultSocket {
7152
7121
  this.onroleevent(message.role_event);
7153
7122
  } else if (message.event_emoji) {
7154
7123
  this.oneventemoji(message.event_emoji);
7124
+ } else if (message.webhook_event) {
7125
+ this.oneventwebhook(message.webhook_event);
7155
7126
  } else if (message.channel_deleted_event) {
7156
7127
  this.onchanneldeleted(message.channel_deleted_event);
7157
7128
  } else if (message.clan_deleted_event) {
@@ -7495,6 +7466,11 @@ var _DefaultSocket = class _DefaultSocket {
7495
7466
  console.log(eventEmoji);
7496
7467
  }
7497
7468
  }
7469
+ oneventwebhook(webhook_event) {
7470
+ if (this.verbose && window && window.console) {
7471
+ console.log(webhook_event);
7472
+ }
7473
+ }
7498
7474
  onchanneldeleted(channelDeleted) {
7499
7475
  if (this.verbose && window && window.console) {
7500
7476
  console.log(channelDeleted);
@@ -8033,12 +8009,13 @@ var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
8033
8009
  ChannelType2[ChannelType2["CHANNEL_TYPE_CHANNEL"] = 1] = "CHANNEL_TYPE_CHANNEL";
8034
8010
  ChannelType2[ChannelType2["CHANNEL_TYPE_GROUP"] = 2] = "CHANNEL_TYPE_GROUP";
8035
8011
  ChannelType2[ChannelType2["CHANNEL_TYPE_DM"] = 3] = "CHANNEL_TYPE_DM";
8036
- ChannelType2[ChannelType2["CHANNEL_TYPE_VOICE"] = 4] = "CHANNEL_TYPE_VOICE";
8012
+ ChannelType2[ChannelType2["CHANNEL_TYPE_GMEET_VOICE"] = 4] = "CHANNEL_TYPE_GMEET_VOICE";
8037
8013
  ChannelType2[ChannelType2["CHANNEL_TYPE_FORUM"] = 5] = "CHANNEL_TYPE_FORUM";
8038
8014
  ChannelType2[ChannelType2["CHANNEL_TYPE_STREAMING"] = 6] = "CHANNEL_TYPE_STREAMING";
8039
8015
  ChannelType2[ChannelType2["CHANNEL_TYPE_THREAD"] = 7] = "CHANNEL_TYPE_THREAD";
8040
8016
  ChannelType2[ChannelType2["CHANNEL_TYPE_APP"] = 8] = "CHANNEL_TYPE_APP";
8041
8017
  ChannelType2[ChannelType2["CHANNEL_TYPE_ANNOUNCEMENT"] = 9] = "CHANNEL_TYPE_ANNOUNCEMENT";
8018
+ ChannelType2[ChannelType2["CHANNEL_TYPE_MEZON_VOICE"] = 10] = "CHANNEL_TYPE_MEZON_VOICE";
8042
8019
  return ChannelType2;
8043
8020
  })(ChannelType || {});
8044
8021
  var ChannelStreamMode = /* @__PURE__ */ ((ChannelStreamMode2) => {
@@ -8063,12 +8040,6 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
8063
8040
  WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
8064
8041
  return WebrtcSignalingType2;
8065
8042
  })(WebrtcSignalingType || {});
8066
- var SFUSignalingType = /* @__PURE__ */ ((SFUSignalingType2) => {
8067
- SFUSignalingType2[SFUSignalingType2["JOINE"] = 0] = "JOINE";
8068
- SFUSignalingType2[SFUSignalingType2["LEAVE"] = 1] = "LEAVE";
8069
- SFUSignalingType2[SFUSignalingType2["TALK"] = 2] = "TALK";
8070
- return SFUSignalingType2;
8071
- })(SFUSignalingType || {});
8072
8043
  var Client = class {
8073
8044
  constructor(serverkey = DEFAULT_SERVER_KEY, host = DEFAULT_HOST, port = DEFAULT_PORT, useSSL = false, timeout = DEFAULT_TIMEOUT_MS, autoRefreshSession = true) {
8074
8045
  this.serverkey = serverkey;
@@ -10562,39 +10533,6 @@ var Client = class {
10562
10533
  });
10563
10534
  });
10564
10535
  }
10565
- /** List a ptt channel's users. */
10566
- listSFUChannelUsers(session, clanId, channelId, channelType, state, limit, cursor) {
10567
- return __async(this, null, function* () {
10568
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10569
- yield this.sessionRefresh(session);
10570
- }
10571
- return this.apiClient.listSFUChannelUsers(
10572
- session.token,
10573
- clanId,
10574
- channelId,
10575
- channelType,
10576
- limit,
10577
- state,
10578
- cursor
10579
- ).then((response) => {
10580
- var result = {
10581
- sfu_channel_users: []
10582
- };
10583
- if (response.sfu_channel_users == null) {
10584
- return Promise.resolve(result);
10585
- }
10586
- response.sfu_channel_users.forEach((gu) => {
10587
- result.sfu_channel_users.push({
10588
- id: gu.id,
10589
- channel_id: gu.channel_id,
10590
- user_id: gu.user_id,
10591
- participant: gu.participant
10592
- });
10593
- });
10594
- return Promise.resolve(result);
10595
- });
10596
- });
10597
- }
10598
10536
  //**list wallet ledger */
10599
10537
  listWalletLedger(session, limit, cursor, transactionId) {
10600
10538
  return __async(this, null, function* () {
@@ -10646,7 +10584,6 @@ export {
10646
10584
  Client,
10647
10585
  DefaultSocket,
10648
10586
  NotificationType,
10649
- SFUSignalingType,
10650
10587
  Session,
10651
10588
  WebSocketAdapterText,
10652
10589
  WebrtcSignalingType,
package/dist/socket.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 { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity } from "./api.gen";
16
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity, ApiWebhook } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { ChannelMessage, Notification } from "./client";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -770,6 +770,7 @@ export interface Socket {
770
770
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
771
771
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
772
772
  oneventemoji: (event_emoji: EventEmoji) => void;
773
+ oneventwebhook: (webhook_event: ApiWebhook) => void;
773
774
  onroleassign: (role_assign_event: RoleAssignedEvent) => void;
774
775
  onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
775
776
  onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
@@ -834,6 +835,7 @@ export declare class DefaultSocket implements Socket {
834
835
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
835
836
  onroleevent(roleEvent: RoleEvent): void;
836
837
  oneventemoji(eventEmoji: EventEmoji): void;
838
+ oneventwebhook(webhook_event: ApiWebhook): void;
837
839
  onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
838
840
  onclandeleted(clanDeleted: ClanDeletedEvent): void;
839
841
  onstickercreated(stickerCreated: StickerCreateEvent): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.10.69",
4
+ "version": "2.10.71",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  ApiRpc,
29
29
  ApiTokenSentEvent,
30
30
  ApiUserActivity,
31
+ ApiWebhook,
31
32
  } from "./api.gen";
32
33
  import { Session } from "./session";
33
34
  import { ChannelMessage, Notification } from "./client";
@@ -1256,6 +1257,8 @@ export interface Socket {
1256
1257
 
1257
1258
  oneventemoji: (event_emoji: EventEmoji) => void;
1258
1259
 
1260
+ oneventwebhook: (webhook_event: ApiWebhook) => void;
1261
+
1259
1262
  onroleassign: (role_assign_event: RoleAssignedEvent) => void;
1260
1263
 
1261
1264
  onstreamingchannelstarted: (
@@ -1387,6 +1390,8 @@ export class DefaultSocket implements Socket {
1387
1390
  this.onroleevent(message.role_event);
1388
1391
  } else if (message.event_emoji) {
1389
1392
  this.oneventemoji(message.event_emoji);
1393
+ } else if (message.webhook_event) {
1394
+ this.oneventwebhook(message.webhook_event);
1390
1395
  } else if (message.channel_deleted_event) {
1391
1396
  this.onchanneldeleted(message.channel_deleted_event);
1392
1397
  } else if (message.clan_deleted_event) {
@@ -1761,6 +1766,12 @@ export class DefaultSocket implements Socket {
1761
1766
  }
1762
1767
  }
1763
1768
 
1769
+ oneventwebhook(webhook_event: ApiWebhook) {
1770
+ if (this.verbose && window && window.console) {
1771
+ console.log(webhook_event);
1772
+ }
1773
+ }
1774
+
1764
1775
  onchanneldeleted(channelDeleted: ChannelDeletedEvent) {
1765
1776
  if (this.verbose && window && window.console) {
1766
1777
  console.log(channelDeleted);