mezon-js 2.10.93 → 2.10.95

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
@@ -2966,6 +2966,104 @@ export interface ApiHandleParticipantMeetStateRequest {
2966
2966
  state?: number;
2967
2967
  }
2968
2968
 
2969
+ /** */
2970
+ export interface ApiMezonOauthClient {
2971
+ //
2972
+ access_token_strategy?: string;
2973
+ //
2974
+ allowed_cors_origins?: Array<string>;
2975
+ //
2976
+ audience?: Array<string>;
2977
+ //
2978
+ authorization_code_grant_access_token_lifespan?: string;
2979
+ //
2980
+ authorization_code_grant_id_token_lifespan?: string;
2981
+ //
2982
+ authorization_code_grant_refresh_token_lifespan?: string;
2983
+ //
2984
+ backchannel_logout_session_required?: boolean;
2985
+ //
2986
+ backchannel_logout_uri?: string;
2987
+ //
2988
+ client_credentials_grant_access_token_lifespan?: string;
2989
+ //
2990
+ client_id?: string;
2991
+ //
2992
+ client_name?: string;
2993
+ //
2994
+ client_secret?: string;
2995
+ //
2996
+ client_secret_expires_at?: number;
2997
+ //
2998
+ client_uri?: string;
2999
+ //
3000
+ contacts?: Array<string>;
3001
+ //
3002
+ created_at?: string;
3003
+ //
3004
+ frontchannel_logout_session_required?: boolean;
3005
+ //
3006
+ frontchannel_logout_uri?: string;
3007
+ //
3008
+ grant_types?: Array<string>;
3009
+ //
3010
+ implicit_grant_access_token_lifespan?: string;
3011
+ //
3012
+ implicit_grant_id_token_lifespan?: string;
3013
+ //
3014
+ jwks?: Array<string>;
3015
+ //
3016
+ jwks_uri?: string;
3017
+ //
3018
+ jwt_bearer_grant_access_token_lifespan?: string;
3019
+ //
3020
+ logo_uri?: string;
3021
+ //
3022
+ owner?: string;
3023
+ //
3024
+ policy_uri?: string;
3025
+ //
3026
+ post_logout_redirect_uris?: Array<string>;
3027
+ //
3028
+ redirect_uris?: Array<string>;
3029
+ //
3030
+ refresh_token_grant_access_token_lifespan?: string;
3031
+ //
3032
+ refresh_token_grant_id_token_lifespan?: string;
3033
+ //
3034
+ refresh_token_grant_refresh_token_lifespan?: string;
3035
+ //
3036
+ registration_access_token?: string;
3037
+ //
3038
+ registration_client_uri?: string;
3039
+ //
3040
+ request_object_signing_alg?: string;
3041
+ //
3042
+ request_uris?: Array<string>;
3043
+ //
3044
+ response_types?: Array<string>;
3045
+ //
3046
+ scope?: string;
3047
+ //
3048
+ sector_identifier_uri?: string;
3049
+ //
3050
+ skip_consent?: boolean;
3051
+ //
3052
+ skip_logout_consent?: boolean;
3053
+ //
3054
+ subject_type?: string;
3055
+ //
3056
+ token_endpoint_auth_method?: string;
3057
+ //
3058
+ token_endpoint_auth_signing_alg?: string;
3059
+ //
3060
+ tos_uri?: string;
3061
+ //
3062
+ updated_at?: string;
3063
+ //
3064
+ userinfo_signed_response_alg?: string;
3065
+ }
3066
+
2969
3067
  export class MezonApi {
2970
3068
  constructor(
2971
3069
  readonly serverKey: string,
@@ -11110,4 +11208,75 @@ export class MezonApi {
11110
11208
  ),
11111
11209
  ]);
11112
11210
  }
11211
+
11212
+ /** Create mezon OAuth client */
11213
+ getMezonOauthClient(bearerToken: string,
11214
+ clientId?:string,
11215
+ options: any = {}
11216
+ ): Promise<ApiMezonOauthClient> {
11217
+
11218
+ const urlPath = "/v2/mznoauthclient";
11219
+ const queryParams = new Map<string, any>();
11220
+ queryParams.set("client_id", clientId);
11221
+
11222
+ let bodyJson : string = "";
11223
+
11224
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
11225
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
11226
+ if (bearerToken) {
11227
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
11228
+ }
11229
+
11230
+ return Promise.race([
11231
+ fetch(fullUrl, fetchOptions).then((response) => {
11232
+ if (response.status == 204) {
11233
+ return response;
11234
+ } else if (response.status >= 200 && response.status < 300) {
11235
+ return response.json();
11236
+ } else {
11237
+ throw response;
11238
+ }
11239
+ }),
11240
+ new Promise((_, reject) =>
11241
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
11242
+ ),
11243
+ ]);
11244
+ }
11245
+
11246
+ /** update mezon OAuth */
11247
+ updateMezonOauthClient(bearerToken: string,
11248
+ body:ApiMezonOauthClient,
11249
+ options: any = {}
11250
+ ): Promise<ApiMezonOauthClient> {
11251
+
11252
+ if (body === null || body === undefined) {
11253
+ throw new Error("'body' is a required parameter but is null or undefined.");
11254
+ }
11255
+ const urlPath = "/v2/mznoauthclient";
11256
+ const queryParams = new Map<string, any>();
11257
+
11258
+ let bodyJson : string = "";
11259
+ bodyJson = JSON.stringify(body || {});
11260
+
11261
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
11262
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
11263
+ if (bearerToken) {
11264
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
11265
+ }
11266
+
11267
+ return Promise.race([
11268
+ fetch(fullUrl, fetchOptions).then((response) => {
11269
+ if (response.status == 204) {
11270
+ return response;
11271
+ } else if (response.status >= 200 && response.status < 300) {
11272
+ return response.json();
11273
+ } else {
11274
+ throw response;
11275
+ }
11276
+ }),
11277
+ new Promise((_, reject) =>
11278
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
11279
+ ),
11280
+ ]);
11281
+ }
11113
11282
  }
package/client.ts CHANGED
@@ -163,6 +163,7 @@ import {
163
163
  ApiGenerateMeetTokenResponse,
164
164
  ApiHandleParticipantMeetStateRequest,
165
165
  ApiMezonOauthClientList,
166
+ ApiMezonOauthClient,
166
167
  } from "./api.gen";
167
168
 
168
169
  import { Session } from "./session";
@@ -4952,6 +4953,44 @@ export class Client {
4952
4953
  });
4953
4954
  }
4954
4955
 
4956
+ async getMezonOauthClient(
4957
+ session: Session,
4958
+ clientId?:string,
4959
+ ): Promise<ApiMezonOauthClient> {
4960
+ if (
4961
+ this.autoRefreshSession &&
4962
+ session.refresh_token &&
4963
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4964
+ ) {
4965
+ await this.sessionRefresh(session);
4966
+ }
4967
+
4968
+ return this.apiClient
4969
+ .getMezonOauthClient(session.token, clientId)
4970
+ .then((response: ApiMezonOauthClient) => {
4971
+ return Promise.resolve(response);
4972
+ });
4973
+ }
4974
+
4975
+ async updateMezonOauthClient(
4976
+ session: Session,
4977
+ body:ApiMezonOauthClient,
4978
+ ): Promise<ApiMezonOauthClient> {
4979
+ if (
4980
+ this.autoRefreshSession &&
4981
+ session.refresh_token &&
4982
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4983
+ ) {
4984
+ await this.sessionRefresh(session);
4985
+ }
4986
+
4987
+ return this.apiClient
4988
+ .updateMezonOauthClient(session.token, body)
4989
+ .then((response: ApiMezonOauthClient) => {
4990
+ return Promise.resolve(response);
4991
+ });
4992
+ }
4993
+
4955
4994
  //**search thread */
4956
4995
  async searchThread(
4957
4996
  session: Session,
package/dist/api.gen.d.ts CHANGED
@@ -1710,6 +1710,56 @@ export interface ApiHandleParticipantMeetStateRequest {
1710
1710
  display_name?: string;
1711
1711
  state?: number;
1712
1712
  }
1713
+ /** */
1714
+ export interface ApiMezonOauthClient {
1715
+ access_token_strategy?: string;
1716
+ allowed_cors_origins?: Array<string>;
1717
+ audience?: Array<string>;
1718
+ authorization_code_grant_access_token_lifespan?: string;
1719
+ authorization_code_grant_id_token_lifespan?: string;
1720
+ authorization_code_grant_refresh_token_lifespan?: string;
1721
+ backchannel_logout_session_required?: boolean;
1722
+ backchannel_logout_uri?: string;
1723
+ client_credentials_grant_access_token_lifespan?: string;
1724
+ client_id?: string;
1725
+ client_name?: string;
1726
+ client_secret?: string;
1727
+ client_secret_expires_at?: number;
1728
+ client_uri?: string;
1729
+ contacts?: Array<string>;
1730
+ created_at?: string;
1731
+ frontchannel_logout_session_required?: boolean;
1732
+ frontchannel_logout_uri?: string;
1733
+ grant_types?: Array<string>;
1734
+ implicit_grant_access_token_lifespan?: string;
1735
+ implicit_grant_id_token_lifespan?: string;
1736
+ jwks?: Array<string>;
1737
+ jwks_uri?: string;
1738
+ jwt_bearer_grant_access_token_lifespan?: string;
1739
+ logo_uri?: string;
1740
+ owner?: string;
1741
+ policy_uri?: string;
1742
+ post_logout_redirect_uris?: Array<string>;
1743
+ redirect_uris?: Array<string>;
1744
+ refresh_token_grant_access_token_lifespan?: string;
1745
+ refresh_token_grant_id_token_lifespan?: string;
1746
+ refresh_token_grant_refresh_token_lifespan?: string;
1747
+ registration_access_token?: string;
1748
+ registration_client_uri?: string;
1749
+ request_object_signing_alg?: string;
1750
+ request_uris?: Array<string>;
1751
+ response_types?: Array<string>;
1752
+ scope?: string;
1753
+ sector_identifier_uri?: string;
1754
+ skip_consent?: boolean;
1755
+ skip_logout_consent?: boolean;
1756
+ subject_type?: string;
1757
+ token_endpoint_auth_method?: string;
1758
+ token_endpoint_auth_signing_alg?: string;
1759
+ tos_uri?: string;
1760
+ updated_at?: string;
1761
+ userinfo_signed_response_alg?: string;
1762
+ }
1713
1763
  export declare class MezonApi {
1714
1764
  readonly serverKey: string;
1715
1765
  readonly basePath: string;
@@ -2120,4 +2170,8 @@ export declare class MezonApi {
2120
2170
  generateMeetToken(bearerToken: string, body: ApiGenerateMeetTokenRequest, options?: any): Promise<ApiGenerateMeetTokenResponse>;
2121
2171
  /** Handle participant meet state */
2122
2172
  handleParticipantMeetState(bearerToken: string, body: ApiHandleParticipantMeetStateRequest, options?: any): Promise<any>;
2173
+ /** Create mezon OAuth client */
2174
+ getMezonOauthClient(bearerToken: string, clientId?: string, options?: any): Promise<ApiMezonOauthClient>;
2175
+ /** update mezon OAuth */
2176
+ updateMezonOauthClient(bearerToken: string, body: ApiMezonOauthClient, options?: any): Promise<ApiMezonOauthClient>;
2123
2177
  }
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, ApiAccountMezon, 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, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList } from "./api.gen";
16
+ import { ApiAccount, ApiAccountMezon, 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, ApiTransactionDetail, MezonapiCreateRoomChannelApps, ApiGenerateMeetTokenRequest, ApiGenerateMeetTokenResponse, ApiHandleParticipantMeetStateRequest, ApiMezonOauthClientList, ApiMezonOauthClient } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -645,5 +645,7 @@ export declare class Client {
645
645
  /** Handle participant meet state */
646
646
  handleParticipantMeetState(session: Session, body: ApiHandleParticipantMeetStateRequest): Promise<any>;
647
647
  listMezonOauthClient(session: Session): Promise<ApiMezonOauthClientList>;
648
+ getMezonOauthClient(session: Session, clientId?: string): Promise<ApiMezonOauthClient>;
649
+ updateMezonOauthClient(session: Session, body: ApiMezonOauthClient): Promise<ApiMezonOauthClient>;
648
650
  searchThread(session: Session, clanId?: string, channelId?: string, label?: string): Promise<ApiChannelDescList>;
649
651
  }
@@ -7091,6 +7091,61 @@ var MezonApi = class {
7091
7091
  )
7092
7092
  ]);
7093
7093
  }
7094
+ /** Create mezon OAuth client */
7095
+ getMezonOauthClient(bearerToken, clientId, options = {}) {
7096
+ const urlPath = "/v2/mznoauthclient";
7097
+ const queryParams = /* @__PURE__ */ new Map();
7098
+ queryParams.set("client_id", clientId);
7099
+ let bodyJson = "";
7100
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7101
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
7102
+ if (bearerToken) {
7103
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7104
+ }
7105
+ return Promise.race([
7106
+ fetch(fullUrl, fetchOptions).then((response) => {
7107
+ if (response.status == 204) {
7108
+ return response;
7109
+ } else if (response.status >= 200 && response.status < 300) {
7110
+ return response.json();
7111
+ } else {
7112
+ throw response;
7113
+ }
7114
+ }),
7115
+ new Promise(
7116
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7117
+ )
7118
+ ]);
7119
+ }
7120
+ /** update mezon OAuth */
7121
+ updateMezonOauthClient(bearerToken, body, options = {}) {
7122
+ if (body === null || body === void 0) {
7123
+ throw new Error("'body' is a required parameter but is null or undefined.");
7124
+ }
7125
+ const urlPath = "/v2/mznoauthclient";
7126
+ const queryParams = /* @__PURE__ */ new Map();
7127
+ let bodyJson = "";
7128
+ bodyJson = JSON.stringify(body || {});
7129
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7130
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
7131
+ if (bearerToken) {
7132
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7133
+ }
7134
+ return Promise.race([
7135
+ fetch(fullUrl, fetchOptions).then((response) => {
7136
+ if (response.status == 204) {
7137
+ return response;
7138
+ } else if (response.status >= 200 && response.status < 300) {
7139
+ return response.json();
7140
+ } else {
7141
+ throw response;
7142
+ }
7143
+ }),
7144
+ new Promise(
7145
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7146
+ )
7147
+ ]);
7148
+ }
7094
7149
  };
7095
7150
 
7096
7151
  // session.ts
@@ -10846,6 +10901,26 @@ var Client = class {
10846
10901
  });
10847
10902
  });
10848
10903
  }
10904
+ getMezonOauthClient(session, clientId) {
10905
+ return __async(this, null, function* () {
10906
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10907
+ yield this.sessionRefresh(session);
10908
+ }
10909
+ return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
10910
+ return Promise.resolve(response);
10911
+ });
10912
+ });
10913
+ }
10914
+ updateMezonOauthClient(session, body) {
10915
+ return __async(this, null, function* () {
10916
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10917
+ yield this.sessionRefresh(session);
10918
+ }
10919
+ return this.apiClient.updateMezonOauthClient(session.token, body).then((response) => {
10920
+ return Promise.resolve(response);
10921
+ });
10922
+ });
10923
+ }
10849
10924
  //**search thread */
10850
10925
  searchThread(session, clanId, channelId, label) {
10851
10926
  return __async(this, null, function* () {
@@ -7057,6 +7057,61 @@ var MezonApi = class {
7057
7057
  )
7058
7058
  ]);
7059
7059
  }
7060
+ /** Create mezon OAuth client */
7061
+ getMezonOauthClient(bearerToken, clientId, options = {}) {
7062
+ const urlPath = "/v2/mznoauthclient";
7063
+ const queryParams = /* @__PURE__ */ new Map();
7064
+ queryParams.set("client_id", clientId);
7065
+ let bodyJson = "";
7066
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7067
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
7068
+ if (bearerToken) {
7069
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7070
+ }
7071
+ return Promise.race([
7072
+ fetch(fullUrl, fetchOptions).then((response) => {
7073
+ if (response.status == 204) {
7074
+ return response;
7075
+ } else if (response.status >= 200 && response.status < 300) {
7076
+ return response.json();
7077
+ } else {
7078
+ throw response;
7079
+ }
7080
+ }),
7081
+ new Promise(
7082
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7083
+ )
7084
+ ]);
7085
+ }
7086
+ /** update mezon OAuth */
7087
+ updateMezonOauthClient(bearerToken, body, options = {}) {
7088
+ if (body === null || body === void 0) {
7089
+ throw new Error("'body' is a required parameter but is null or undefined.");
7090
+ }
7091
+ const urlPath = "/v2/mznoauthclient";
7092
+ const queryParams = /* @__PURE__ */ new Map();
7093
+ let bodyJson = "";
7094
+ bodyJson = JSON.stringify(body || {});
7095
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7096
+ const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
7097
+ if (bearerToken) {
7098
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7099
+ }
7100
+ return Promise.race([
7101
+ fetch(fullUrl, fetchOptions).then((response) => {
7102
+ if (response.status == 204) {
7103
+ return response;
7104
+ } else if (response.status >= 200 && response.status < 300) {
7105
+ return response.json();
7106
+ } else {
7107
+ throw response;
7108
+ }
7109
+ }),
7110
+ new Promise(
7111
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
7112
+ )
7113
+ ]);
7114
+ }
7060
7115
  };
7061
7116
 
7062
7117
  // session.ts
@@ -10812,6 +10867,26 @@ var Client = class {
10812
10867
  });
10813
10868
  });
10814
10869
  }
10870
+ getMezonOauthClient(session, clientId) {
10871
+ return __async(this, null, function* () {
10872
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10873
+ yield this.sessionRefresh(session);
10874
+ }
10875
+ return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
10876
+ return Promise.resolve(response);
10877
+ });
10878
+ });
10879
+ }
10880
+ updateMezonOauthClient(session, body) {
10881
+ return __async(this, null, function* () {
10882
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
10883
+ yield this.sessionRefresh(session);
10884
+ }
10885
+ return this.apiClient.updateMezonOauthClient(session.token, body).then((response) => {
10886
+ return Promise.resolve(response);
10887
+ });
10888
+ });
10889
+ }
10815
10890
  //**search thread */
10816
10891
  searchThread(session, clanId, channelId, label) {
10817
10892
  return __async(this, null, function* () {
package/dist/socket.d.ts CHANGED
@@ -338,6 +338,7 @@ export interface ChannelCreatedEvent {
338
338
  channel_type: number;
339
339
  status: number;
340
340
  app_url: string;
341
+ clan_name: string;
341
342
  }
342
343
  export interface ChannelDeletedEvent {
343
344
  clan_id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.10.93",
4
+ "version": "2.10.95",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -505,6 +505,8 @@ export interface ChannelCreatedEvent {
505
505
  status: number;
506
506
  // app url
507
507
  app_url: string;
508
+ // clan_name
509
+ clan_name: string;
508
510
  }
509
511
 
510
512
  export interface ChannelDeletedEvent {