mezon-js 2.9.99 → 2.10.2

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) {
7951
+ joinPTTChannel(clanId, channelId, dataType, jsonData, isTalk) {
7894
7952
  return __async(this, null, function* () {
7895
7953
  const response = yield this.send({
7896
7954
  join_ptt_channel: {
@@ -7898,7 +7956,8 @@ var _DefaultSocket = class _DefaultSocket {
7898
7956
  channel_id: channelId,
7899
7957
  data_type: dataType,
7900
7958
  json_data: jsonData,
7901
- receiver_id: ""
7959
+ receiver_id: "",
7960
+ is_talk: isTalk
7902
7961
  }
7903
7962
  });
7904
7963
  return response.join_ptt_channel;
@@ -10492,4 +10551,26 @@ var Client = class {
10492
10551
  });
10493
10552
  });
10494
10553
  }
10554
+ //**list sd topic */
10555
+ listSdTopic(session, channelId, limit) {
10556
+ return __async(this, null, function* () {
10557
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10558
+ yield this.sessionRefresh(session);
10559
+ }
10560
+ return this.apiClient.listSdTopic(session.token, channelId, limit).then((response) => {
10561
+ return Promise.resolve(response);
10562
+ });
10563
+ });
10564
+ }
10565
+ //**post sd topic */
10566
+ createSdTopic(session, request) {
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.createSdTopic(session.token, request).then((response) => {
10572
+ return response;
10573
+ });
10574
+ });
10575
+ }
10495
10576
  };
@@ -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) {
7917
+ joinPTTChannel(clanId, channelId, dataType, jsonData, isTalk) {
7860
7918
  return __async(this, null, function* () {
7861
7919
  const response = yield this.send({
7862
7920
  join_ptt_channel: {
@@ -7864,7 +7922,8 @@ var _DefaultSocket = class _DefaultSocket {
7864
7922
  channel_id: channelId,
7865
7923
  data_type: dataType,
7866
7924
  json_data: jsonData,
7867
- receiver_id: ""
7925
+ receiver_id: "",
7926
+ is_talk: isTalk
7868
7927
  }
7869
7928
  });
7870
7929
  return response.join_ptt_channel;
@@ -10458,6 +10517,28 @@ var Client = class {
10458
10517
  });
10459
10518
  });
10460
10519
  }
10520
+ //**list sd topic */
10521
+ listSdTopic(session, channelId, limit) {
10522
+ return __async(this, null, function* () {
10523
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10524
+ yield this.sessionRefresh(session);
10525
+ }
10526
+ return this.apiClient.listSdTopic(session.token, channelId, limit).then((response) => {
10527
+ return Promise.resolve(response);
10528
+ });
10529
+ });
10530
+ }
10531
+ //**post sd topic */
10532
+ createSdTopic(session, request) {
10533
+ return __async(this, null, function* () {
10534
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10535
+ yield this.sessionRefresh(session);
10536
+ }
10537
+ return this.apiClient.createSdTopic(session.token, request).then((response) => {
10538
+ return response;
10539
+ });
10540
+ });
10541
+ }
10461
10542
  };
10462
10543
  export {
10463
10544
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -622,6 +622,8 @@ export interface JoinPTTChannel {
622
622
  receiver_id: string;
623
623
  /** clan id */
624
624
  clan_id: string;
625
+ /** is talk */
626
+ is_talk: boolean;
625
627
  }
626
628
  export interface TalkPTTChannel {
627
629
  channel_id: string;
@@ -702,7 +704,7 @@ export interface Socket {
702
704
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
703
705
  /** send voice leaved */
704
706
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
705
- joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
707
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string, isTalk: boolean): Promise<JoinPTTChannel>;
706
708
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
707
709
  setHeartbeatTimeoutMs(ms: number): void;
708
710
  getHeartbeatTimeoutMs(): number;
@@ -891,7 +893,7 @@ export declare class DefaultSocket implements Socket {
891
893
  makeCallPush(receiver_id: string, json_data: string, channel_id: string, caller_id: string): Promise<IncomingCallPush>;
892
894
  handleDropdownBoxSelected(message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>): Promise<DropdownBoxSelected>;
893
895
  handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string, extra_data: string): Promise<MessageButtonClicked>;
894
- joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
896
+ joinPTTChannel(clanId: string, channelId: string, dataType: number, jsonData: string, isTalk: boolean): Promise<JoinPTTChannel>;
895
897
  talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
896
898
  private pingPong;
897
899
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.99",
4
+ "version": "2.10.2",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -875,6 +875,8 @@ export interface JoinPTTChannel {
875
875
  receiver_id: string;
876
876
  /** clan id */
877
877
  clan_id: string;
878
+ /** is talk */
879
+ is_talk: boolean;
878
880
  }
879
881
 
880
882
  export interface TalkPTTChannel {
@@ -1080,7 +1082,8 @@ export interface Socket {
1080
1082
  clanId: string,
1081
1083
  channelId: string,
1082
1084
  dataType: number,
1083
- jsonData: string
1085
+ jsonData: string,
1086
+ isTalk: boolean,
1084
1087
  ): Promise<JoinPTTChannel>;
1085
1088
 
1086
1089
  talkPTTChannel(
@@ -2372,7 +2375,8 @@ export class DefaultSocket implements Socket {
2372
2375
  clanId: string,
2373
2376
  channelId: string,
2374
2377
  dataType: number,
2375
- jsonData: string
2378
+ jsonData: string,
2379
+ isTalk: boolean,
2376
2380
  ): Promise<JoinPTTChannel> {
2377
2381
  const response = await this.send({
2378
2382
  join_ptt_channel: {
@@ -2381,6 +2385,7 @@ export class DefaultSocket implements Socket {
2381
2385
  data_type: dataType,
2382
2386
  json_data: jsonData,
2383
2387
  receiver_id: "",
2388
+ is_talk: isTalk,
2384
2389
  },
2385
2390
  });
2386
2391
  return response.join_ptt_channel;