mezon-js 2.10.1 → 2.10.3

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
@@ -1990,6 +1990,44 @@ export interface ApiRpc {
1990
1990
  payload?: string;
1991
1991
  }
1992
1992
 
1993
+ /** */
1994
+ export interface ApiSdTopic {
1995
+ //
1996
+ channel_id?: string;
1997
+ //
1998
+ clan_id?: string;
1999
+ //
2000
+ create_time?: string;
2001
+ //
2002
+ creator_id?: string;
2003
+ //
2004
+ id?: string;
2005
+ //
2006
+ message_id?: string;
2007
+ //
2008
+ status?: number;
2009
+ //
2010
+ update_time?: string;
2011
+ }
2012
+
2013
+ /** */
2014
+ export interface ApiSdTopicList {
2015
+ //
2016
+ count?: number;
2017
+ //
2018
+ topics?: Array<ApiSdTopic>;
2019
+ }
2020
+
2021
+ /** */
2022
+ export interface ApiSdTopicRequest {
2023
+ //
2024
+ channel_id?: string;
2025
+ //
2026
+ clan_id?: string;
2027
+ //
2028
+ message_id?: string;
2029
+ }
2030
+
1993
2031
  /** */
1994
2032
  export interface ApiSearchMessageDocument {
1995
2033
  //
@@ -9127,6 +9165,81 @@ export class MezonApi {
9127
9165
  ]);
9128
9166
  }
9129
9167
 
9168
+ /** List Sd Topic */
9169
+ listSdTopic(
9170
+ bearerToken: string,
9171
+ channelId?: string,
9172
+ limit?: number,
9173
+ options: any = {}
9174
+ ): Promise<ApiSdTopicList> {
9175
+ const urlPath = "/v2/sdmtopic";
9176
+ const queryParams = new Map<string, any>();
9177
+ queryParams.set("channel_id", channelId);
9178
+ queryParams.set("limit", limit);
9179
+
9180
+ let bodyJson: string = "";
9181
+
9182
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9183
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
9184
+ if (bearerToken) {
9185
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9186
+ }
9187
+
9188
+ return Promise.race([
9189
+ fetch(fullUrl, fetchOptions).then((response) => {
9190
+ if (response.status == 204) {
9191
+ return response;
9192
+ } else if (response.status >= 200 && response.status < 300) {
9193
+ return response.json();
9194
+ } else {
9195
+ throw response;
9196
+ }
9197
+ }),
9198
+ new Promise((_, reject) =>
9199
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9200
+ ),
9201
+ ]);
9202
+ }
9203
+
9204
+ /** Create Sd Topic */
9205
+ createSdTopic(
9206
+ bearerToken: string,
9207
+ body: ApiSdTopicRequest,
9208
+ options: any = {}
9209
+ ): Promise<ApiSdTopic> {
9210
+ if (body === null || body === undefined) {
9211
+ throw new Error(
9212
+ "'body' is a required parameter but is null or undefined."
9213
+ );
9214
+ }
9215
+ const urlPath = "/v2/sdmtopic";
9216
+ const queryParams = new Map<string, any>();
9217
+
9218
+ let bodyJson: string = "";
9219
+ bodyJson = JSON.stringify(body || {});
9220
+
9221
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9222
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
9223
+ if (bearerToken) {
9224
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9225
+ }
9226
+
9227
+ return Promise.race([
9228
+ fetch(fullUrl, fetchOptions).then((response) => {
9229
+ if (response.status == 204) {
9230
+ return response;
9231
+ } else if (response.status >= 200 && response.status < 300) {
9232
+ return response.json();
9233
+ } else {
9234
+ throw response;
9235
+ }
9236
+ }),
9237
+ new Promise((_, reject) =>
9238
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
9239
+ ),
9240
+ ]);
9241
+ }
9242
+
9130
9243
  /** Delete a specific system messages. */
9131
9244
  deleteSystemMessage(
9132
9245
  bearerToken: string,
package/client.ts CHANGED
@@ -155,6 +155,9 @@ import {
155
155
  MezonUpdateOnboardingStepByClanIdBody,
156
156
  ApiPTTChannelUserList,
157
157
  ApiWalletLedgerList,
158
+ ApiSdTopicList,
159
+ ApiSdTopicRequest,
160
+ ApiSdTopic,
158
161
  } from "./api.gen";
159
162
 
160
163
  import { Session } from "./session";
@@ -4782,4 +4785,45 @@ export class Client {
4782
4785
  return Promise.resolve(response);
4783
4786
  });
4784
4787
  }
4788
+
4789
+ //**list sd topic */
4790
+ async listSdTopic(
4791
+ session: Session,
4792
+ channelId?: string,
4793
+ limit?: number
4794
+ ): Promise<ApiSdTopicList> {
4795
+ if (
4796
+ this.autoRefreshSession &&
4797
+ session.refresh_token &&
4798
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4799
+ ) {
4800
+ await this.sessionRefresh(session);
4801
+ }
4802
+
4803
+ return this.apiClient
4804
+ .listSdTopic(session.token, channelId, limit)
4805
+ .then((response: ApiSdTopicList) => {
4806
+ return Promise.resolve(response);
4807
+ });
4808
+ }
4809
+
4810
+ //**post sd topic */
4811
+ async createSdTopic(
4812
+ session: Session,
4813
+ request: ApiSdTopicRequest
4814
+ ): Promise<ApiSdTopic> {
4815
+ if (
4816
+ this.autoRefreshSession &&
4817
+ session.refresh_token &&
4818
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4819
+ ) {
4820
+ await this.sessionRefresh(session);
4821
+ }
4822
+
4823
+ return this.apiClient
4824
+ .createSdTopic(session.token, request)
4825
+ .then((response: ApiSdTopic) => {
4826
+ return response;
4827
+ });
4828
+ }
4785
4829
  }
package/dist/api.gen.d.ts CHANGED
@@ -1158,6 +1158,28 @@ export interface ApiRpc {
1158
1158
  payload?: string;
1159
1159
  }
1160
1160
  /** */
1161
+ export interface ApiSdTopic {
1162
+ channel_id?: string;
1163
+ clan_id?: string;
1164
+ create_time?: string;
1165
+ creator_id?: string;
1166
+ id?: string;
1167
+ message_id?: string;
1168
+ status?: number;
1169
+ update_time?: string;
1170
+ }
1171
+ /** */
1172
+ export interface ApiSdTopicList {
1173
+ count?: number;
1174
+ topics?: Array<ApiSdTopic>;
1175
+ }
1176
+ /** */
1177
+ export interface ApiSdTopicRequest {
1178
+ channel_id?: string;
1179
+ clan_id?: string;
1180
+ message_id?: string;
1181
+ }
1182
+ /** */
1161
1183
  export interface ApiSearchMessageDocument {
1162
1184
  attachments?: Array<ApiMessageAttachment>;
1163
1185
  avatar_url?: string;
@@ -1898,6 +1920,10 @@ export declare class MezonApi {
1898
1920
  getSystemMessagesList(bearerToken: string, options?: any): Promise<ApiSystemMessagesList>;
1899
1921
  /** Create a system messages. */
1900
1922
  createSystemMessage(bearerToken: string, body: ApiSystemMessageRequest, options?: any): Promise<any>;
1923
+ /** List Sd Topic */
1924
+ listSdTopic(bearerToken: string, channelId?: string, limit?: number, options?: any): Promise<ApiSdTopicList>;
1925
+ /** Create Sd Topic */
1926
+ createSdTopic(bearerToken: string, body: ApiSdTopicRequest, options?: any): Promise<ApiSdTopic>;
1901
1927
  /** Delete a specific system messages. */
1902
1928
  deleteSystemMessage(bearerToken: string, clanId: string, options?: any): Promise<any>;
1903
1929
  /** Get details of a specific system messages. */
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, ApiUpdateEventRequest, 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, 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, ApiPTTChannelUserList, ApiWalletLedgerList } 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, ApiUpdateEventRequest, 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, 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, ApiPTTChannelUserList, ApiWalletLedgerList, ApiSdTopicList, ApiSdTopicRequest, ApiSdTopic } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -630,4 +630,6 @@ export declare class Client {
630
630
  /** List a ptt channel's users. */
631
631
  listPTTChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiPTTChannelUserList>;
632
632
  listWalletLedger(session: Session, limit?: number, cursor?: string, transactionId?: string): Promise<ApiWalletLedgerList>;
633
+ listSdTopic(session: Session, channelId?: string, limit?: number): Promise<ApiSdTopicList>;
634
+ createSdTopic(session: Session, request: ApiSdTopicRequest): Promise<ApiSdTopic>;
633
635
  }
@@ -5741,6 +5741,64 @@ var MezonApi = class {
5741
5741
  )
5742
5742
  ]);
5743
5743
  }
5744
+ /** List Sd Topic */
5745
+ listSdTopic(bearerToken, channelId, limit, options = {}) {
5746
+ const urlPath = "/v2/sdmtopic";
5747
+ const queryParams = /* @__PURE__ */ new Map();
5748
+ queryParams.set("channel_id", channelId);
5749
+ queryParams.set("limit", limit);
5750
+ let bodyJson = "";
5751
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5752
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5753
+ if (bearerToken) {
5754
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5755
+ }
5756
+ return Promise.race([
5757
+ fetch(fullUrl, fetchOptions).then((response) => {
5758
+ if (response.status == 204) {
5759
+ return response;
5760
+ } else if (response.status >= 200 && response.status < 300) {
5761
+ return response.json();
5762
+ } else {
5763
+ throw response;
5764
+ }
5765
+ }),
5766
+ new Promise(
5767
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5768
+ )
5769
+ ]);
5770
+ }
5771
+ /** Create Sd Topic */
5772
+ createSdTopic(bearerToken, body, options = {}) {
5773
+ if (body === null || body === void 0) {
5774
+ throw new Error(
5775
+ "'body' is a required parameter but is null or undefined."
5776
+ );
5777
+ }
5778
+ const urlPath = "/v2/sdmtopic";
5779
+ const queryParams = /* @__PURE__ */ new Map();
5780
+ let bodyJson = "";
5781
+ bodyJson = JSON.stringify(body || {});
5782
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5783
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5784
+ if (bearerToken) {
5785
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5786
+ }
5787
+ return Promise.race([
5788
+ fetch(fullUrl, fetchOptions).then((response) => {
5789
+ if (response.status == 204) {
5790
+ return response;
5791
+ } else if (response.status >= 200 && response.status < 300) {
5792
+ return response.json();
5793
+ } else {
5794
+ throw response;
5795
+ }
5796
+ }),
5797
+ new Promise(
5798
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5799
+ )
5800
+ ]);
5801
+ }
5744
5802
  /** Delete a specific system messages. */
5745
5803
  deleteSystemMessage(bearerToken, clanId, options = {}) {
5746
5804
  if (clanId === null || clanId === void 0) {
@@ -7890,7 +7948,7 @@ var _DefaultSocket = class _DefaultSocket {
7890
7948
  return response.webrtc_signaling_fwd;
7891
7949
  });
7892
7950
  }
7893
- joinPTTChannel(clanId, channelId, dataType, jsonData, isTalk) {
7951
+ joinPTTChannel(clanId, channelId, dataType, jsonData) {
7894
7952
  return __async(this, null, function* () {
7895
7953
  const response = yield this.send({
7896
7954
  join_ptt_channel: {
@@ -7898,8 +7956,7 @@ var _DefaultSocket = class _DefaultSocket {
7898
7956
  channel_id: channelId,
7899
7957
  data_type: dataType,
7900
7958
  json_data: jsonData,
7901
- receiver_id: "",
7902
- is_talk: isTalk
7959
+ receiver_id: ""
7903
7960
  }
7904
7961
  });
7905
7962
  return response.join_ptt_channel;
@@ -10493,4 +10550,26 @@ var Client = class {
10493
10550
  });
10494
10551
  });
10495
10552
  }
10553
+ //**list sd topic */
10554
+ listSdTopic(session, channelId, limit) {
10555
+ return __async(this, null, function* () {
10556
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10557
+ yield this.sessionRefresh(session);
10558
+ }
10559
+ return this.apiClient.listSdTopic(session.token, channelId, limit).then((response) => {
10560
+ return Promise.resolve(response);
10561
+ });
10562
+ });
10563
+ }
10564
+ //**post sd topic */
10565
+ createSdTopic(session, request) {
10566
+ return __async(this, null, function* () {
10567
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10568
+ yield this.sessionRefresh(session);
10569
+ }
10570
+ return this.apiClient.createSdTopic(session.token, request).then((response) => {
10571
+ return response;
10572
+ });
10573
+ });
10574
+ }
10496
10575
  };
@@ -5707,6 +5707,64 @@ var MezonApi = class {
5707
5707
  )
5708
5708
  ]);
5709
5709
  }
5710
+ /** List Sd Topic */
5711
+ listSdTopic(bearerToken, channelId, limit, options = {}) {
5712
+ const urlPath = "/v2/sdmtopic";
5713
+ const queryParams = /* @__PURE__ */ new Map();
5714
+ queryParams.set("channel_id", channelId);
5715
+ queryParams.set("limit", limit);
5716
+ let bodyJson = "";
5717
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5718
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
5719
+ if (bearerToken) {
5720
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5721
+ }
5722
+ return Promise.race([
5723
+ fetch(fullUrl, fetchOptions).then((response) => {
5724
+ if (response.status == 204) {
5725
+ return response;
5726
+ } else if (response.status >= 200 && response.status < 300) {
5727
+ return response.json();
5728
+ } else {
5729
+ throw response;
5730
+ }
5731
+ }),
5732
+ new Promise(
5733
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5734
+ )
5735
+ ]);
5736
+ }
5737
+ /** Create Sd Topic */
5738
+ createSdTopic(bearerToken, body, options = {}) {
5739
+ if (body === null || body === void 0) {
5740
+ throw new Error(
5741
+ "'body' is a required parameter but is null or undefined."
5742
+ );
5743
+ }
5744
+ const urlPath = "/v2/sdmtopic";
5745
+ const queryParams = /* @__PURE__ */ new Map();
5746
+ let bodyJson = "";
5747
+ bodyJson = JSON.stringify(body || {});
5748
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5749
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5750
+ if (bearerToken) {
5751
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5752
+ }
5753
+ return Promise.race([
5754
+ fetch(fullUrl, fetchOptions).then((response) => {
5755
+ if (response.status == 204) {
5756
+ return response;
5757
+ } else if (response.status >= 200 && response.status < 300) {
5758
+ return response.json();
5759
+ } else {
5760
+ throw response;
5761
+ }
5762
+ }),
5763
+ new Promise(
5764
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
5765
+ )
5766
+ ]);
5767
+ }
5710
5768
  /** Delete a specific system messages. */
5711
5769
  deleteSystemMessage(bearerToken, clanId, options = {}) {
5712
5770
  if (clanId === null || clanId === void 0) {
@@ -7856,7 +7914,7 @@ var _DefaultSocket = class _DefaultSocket {
7856
7914
  return response.webrtc_signaling_fwd;
7857
7915
  });
7858
7916
  }
7859
- joinPTTChannel(clanId, channelId, dataType, jsonData, isTalk) {
7917
+ joinPTTChannel(clanId, channelId, dataType, jsonData) {
7860
7918
  return __async(this, null, function* () {
7861
7919
  const response = yield this.send({
7862
7920
  join_ptt_channel: {
@@ -7864,8 +7922,7 @@ var _DefaultSocket = class _DefaultSocket {
7864
7922
  channel_id: channelId,
7865
7923
  data_type: dataType,
7866
7924
  json_data: jsonData,
7867
- receiver_id: "",
7868
- is_talk: isTalk
7925
+ receiver_id: ""
7869
7926
  }
7870
7927
  });
7871
7928
  return response.join_ptt_channel;
@@ -10459,6 +10516,28 @@ var Client = class {
10459
10516
  });
10460
10517
  });
10461
10518
  }
10519
+ //**list sd topic */
10520
+ listSdTopic(session, channelId, limit) {
10521
+ return __async(this, null, function* () {
10522
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10523
+ yield this.sessionRefresh(session);
10524
+ }
10525
+ return this.apiClient.listSdTopic(session.token, channelId, limit).then((response) => {
10526
+ return Promise.resolve(response);
10527
+ });
10528
+ });
10529
+ }
10530
+ //**post sd topic */
10531
+ createSdTopic(session, request) {
10532
+ return __async(this, null, function* () {
10533
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10534
+ yield this.sessionRefresh(session);
10535
+ }
10536
+ return this.apiClient.createSdTopic(session.token, request).then((response) => {
10537
+ return response;
10538
+ });
10539
+ });
10540
+ }
10462
10541
  };
10463
10542
  export {
10464
10543
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -704,7 +704,7 @@ export interface Socket {
704
704
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
705
705
  /** send voice leaved */
706
706
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
707
- joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string, isTalk: boolean): Promise<JoinPTTChannel>;
707
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
708
708
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
709
709
  setHeartbeatTimeoutMs(ms: number): void;
710
710
  getHeartbeatTimeoutMs(): number;
@@ -893,7 +893,7 @@ export declare class DefaultSocket implements Socket {
893
893
  makeCallPush(receiver_id: string, json_data: string, channel_id: string, caller_id: string): Promise<IncomingCallPush>;
894
894
  handleDropdownBoxSelected(message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>): Promise<DropdownBoxSelected>;
895
895
  handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string, extra_data: string): Promise<MessageButtonClicked>;
896
- joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string, isTalk: boolean): Promise<JoinPTTChannel>;
896
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
897
897
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
898
898
  private pingPong;
899
899
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.10.1",
4
+ "version": "2.10.3",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -1083,7 +1083,6 @@ export interface Socket {
1083
1083
  channelId: string,
1084
1084
  dataType: number,
1085
1085
  jsonData: string,
1086
- isTalk: boolean,
1087
1086
  ): Promise<JoinPTTChannel>;
1088
1087
 
1089
1088
  talkPTTChannel(
@@ -2376,7 +2375,6 @@ export class DefaultSocket implements Socket {
2376
2375
  channelId: string,
2377
2376
  dataType: number,
2378
2377
  jsonData: string,
2379
- isTalk: boolean,
2380
2378
  ): Promise<JoinPTTChannel> {
2381
2379
  const response = await this.send({
2382
2380
  join_ptt_channel: {
@@ -2385,7 +2383,6 @@ export class DefaultSocket implements Socket {
2385
2383
  data_type: dataType,
2386
2384
  json_data: jsonData,
2387
2385
  receiver_id: "",
2388
- is_talk: isTalk,
2389
2386
  },
2390
2387
  });
2391
2388
  return response.join_ptt_channel;