mezon-js 2.10.94 → 2.10.96
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 +210 -0
- package/client.ts +60 -0
- package/dist/api.gen.d.ts +61 -0
- package/dist/client.d.ts +4 -1
- package/dist/mezon-js.cjs.js +112 -0
- package/dist/mezon-js.esm.mjs +112 -0
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -2966,6 +2966,112 @@ 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
|
+
|
3067
|
+
/** */
|
3068
|
+
export interface ApiCreateHashChannelAppsResponse {
|
3069
|
+
//
|
3070
|
+
hash?: string;
|
3071
|
+
//
|
3072
|
+
user_id?: string;
|
3073
|
+
}
|
3074
|
+
|
2969
3075
|
export class MezonApi {
|
2970
3076
|
constructor(
|
2971
3077
|
readonly serverKey: string,
|
@@ -11110,4 +11216,108 @@ export class MezonApi {
|
|
11110
11216
|
),
|
11111
11217
|
]);
|
11112
11218
|
}
|
11219
|
+
|
11220
|
+
/** Create mezon OAuth client */
|
11221
|
+
getMezonOauthClient(bearerToken: string,
|
11222
|
+
clientId?:string,
|
11223
|
+
options: any = {}
|
11224
|
+
): Promise<ApiMezonOauthClient> {
|
11225
|
+
|
11226
|
+
const urlPath = "/v2/mznoauthclient";
|
11227
|
+
const queryParams = new Map<string, any>();
|
11228
|
+
queryParams.set("client_id", clientId);
|
11229
|
+
|
11230
|
+
let bodyJson : string = "";
|
11231
|
+
|
11232
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11233
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
11234
|
+
if (bearerToken) {
|
11235
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11236
|
+
}
|
11237
|
+
|
11238
|
+
return Promise.race([
|
11239
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11240
|
+
if (response.status == 204) {
|
11241
|
+
return response;
|
11242
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11243
|
+
return response.json();
|
11244
|
+
} else {
|
11245
|
+
throw response;
|
11246
|
+
}
|
11247
|
+
}),
|
11248
|
+
new Promise((_, reject) =>
|
11249
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11250
|
+
),
|
11251
|
+
]);
|
11252
|
+
}
|
11253
|
+
|
11254
|
+
/** update mezon OAuth */
|
11255
|
+
updateMezonOauthClient(bearerToken: string,
|
11256
|
+
body:ApiMezonOauthClient,
|
11257
|
+
options: any = {}
|
11258
|
+
): Promise<ApiMezonOauthClient> {
|
11259
|
+
|
11260
|
+
if (body === null || body === undefined) {
|
11261
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
11262
|
+
}
|
11263
|
+
const urlPath = "/v2/mznoauthclient";
|
11264
|
+
const queryParams = new Map<string, any>();
|
11265
|
+
|
11266
|
+
let bodyJson : string = "";
|
11267
|
+
bodyJson = JSON.stringify(body || {});
|
11268
|
+
|
11269
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11270
|
+
const fetchOptions = buildFetchOptions("PATCH", options, bodyJson);
|
11271
|
+
if (bearerToken) {
|
11272
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11273
|
+
}
|
11274
|
+
|
11275
|
+
return Promise.race([
|
11276
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11277
|
+
if (response.status == 204) {
|
11278
|
+
return response;
|
11279
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11280
|
+
return response.json();
|
11281
|
+
} else {
|
11282
|
+
throw response;
|
11283
|
+
}
|
11284
|
+
}),
|
11285
|
+
new Promise((_, reject) =>
|
11286
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11287
|
+
),
|
11288
|
+
]);
|
11289
|
+
}
|
11290
|
+
/** */
|
11291
|
+
generateHashChannelApps(bearerToken: string,
|
11292
|
+
appId?:string,
|
11293
|
+
options: any = {}
|
11294
|
+
): Promise<ApiCreateHashChannelAppsResponse> {
|
11295
|
+
|
11296
|
+
const urlPath = "/v2/channel-apps/hash";
|
11297
|
+
const queryParams = new Map<string, any>();
|
11298
|
+
queryParams.set("app_id", appId);
|
11299
|
+
|
11300
|
+
let bodyJson : string = "";
|
11301
|
+
|
11302
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
11303
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
11304
|
+
if (bearerToken) {
|
11305
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
11306
|
+
}
|
11307
|
+
|
11308
|
+
return Promise.race([
|
11309
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
11310
|
+
if (response.status == 204) {
|
11311
|
+
return response;
|
11312
|
+
} else if (response.status >= 200 && response.status < 300) {
|
11313
|
+
return response.json();
|
11314
|
+
} else {
|
11315
|
+
throw response;
|
11316
|
+
}
|
11317
|
+
}),
|
11318
|
+
new Promise((_, reject) =>
|
11319
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
11320
|
+
),
|
11321
|
+
]);
|
11322
|
+
}
|
11113
11323
|
}
|
package/client.ts
CHANGED
@@ -163,6 +163,8 @@ import {
|
|
163
163
|
ApiGenerateMeetTokenResponse,
|
164
164
|
ApiHandleParticipantMeetStateRequest,
|
165
165
|
ApiMezonOauthClientList,
|
166
|
+
ApiMezonOauthClient,
|
167
|
+
ApiCreateHashChannelAppsResponse,
|
166
168
|
} from "./api.gen";
|
167
169
|
|
168
170
|
import { Session } from "./session";
|
@@ -4952,6 +4954,44 @@ export class Client {
|
|
4952
4954
|
});
|
4953
4955
|
}
|
4954
4956
|
|
4957
|
+
async getMezonOauthClient(
|
4958
|
+
session: Session,
|
4959
|
+
clientId?:string,
|
4960
|
+
): Promise<ApiMezonOauthClient> {
|
4961
|
+
if (
|
4962
|
+
this.autoRefreshSession &&
|
4963
|
+
session.refresh_token &&
|
4964
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4965
|
+
) {
|
4966
|
+
await this.sessionRefresh(session);
|
4967
|
+
}
|
4968
|
+
|
4969
|
+
return this.apiClient
|
4970
|
+
.getMezonOauthClient(session.token, clientId)
|
4971
|
+
.then((response: ApiMezonOauthClient) => {
|
4972
|
+
return Promise.resolve(response);
|
4973
|
+
});
|
4974
|
+
}
|
4975
|
+
|
4976
|
+
async updateMezonOauthClient(
|
4977
|
+
session: Session,
|
4978
|
+
body:ApiMezonOauthClient,
|
4979
|
+
): Promise<ApiMezonOauthClient> {
|
4980
|
+
if (
|
4981
|
+
this.autoRefreshSession &&
|
4982
|
+
session.refresh_token &&
|
4983
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4984
|
+
) {
|
4985
|
+
await this.sessionRefresh(session);
|
4986
|
+
}
|
4987
|
+
|
4988
|
+
return this.apiClient
|
4989
|
+
.updateMezonOauthClient(session.token, body)
|
4990
|
+
.then((response: ApiMezonOauthClient) => {
|
4991
|
+
return Promise.resolve(response);
|
4992
|
+
});
|
4993
|
+
}
|
4994
|
+
|
4955
4995
|
//**search thread */
|
4956
4996
|
async searchThread(
|
4957
4997
|
session: Session,
|
@@ -4973,4 +5013,24 @@ export class Client {
|
|
4973
5013
|
return Promise.resolve(response);
|
4974
5014
|
});
|
4975
5015
|
}
|
5016
|
+
|
5017
|
+
//**Generate Hash */
|
5018
|
+
async generateHashChannelApps(
|
5019
|
+
session: Session,
|
5020
|
+
appId?:string,
|
5021
|
+
): Promise<ApiCreateHashChannelAppsResponse> {
|
5022
|
+
if (
|
5023
|
+
this.autoRefreshSession &&
|
5024
|
+
session.refresh_token &&
|
5025
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
5026
|
+
) {
|
5027
|
+
await this.sessionRefresh(session);
|
5028
|
+
}
|
5029
|
+
|
5030
|
+
return this.apiClient
|
5031
|
+
.generateHashChannelApps(session.token, appId)
|
5032
|
+
.then((response: ApiCreateHashChannelAppsResponse) => {
|
5033
|
+
return Promise.resolve(response);
|
5034
|
+
});
|
5035
|
+
}
|
4976
5036
|
}
|
package/dist/api.gen.d.ts
CHANGED
@@ -1710,6 +1710,61 @@ 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
|
+
}
|
1763
|
+
/** */
|
1764
|
+
export interface ApiCreateHashChannelAppsResponse {
|
1765
|
+
hash?: string;
|
1766
|
+
user_id?: string;
|
1767
|
+
}
|
1713
1768
|
export declare class MezonApi {
|
1714
1769
|
readonly serverKey: string;
|
1715
1770
|
readonly basePath: string;
|
@@ -2120,4 +2175,10 @@ export declare class MezonApi {
|
|
2120
2175
|
generateMeetToken(bearerToken: string, body: ApiGenerateMeetTokenRequest, options?: any): Promise<ApiGenerateMeetTokenResponse>;
|
2121
2176
|
/** Handle participant meet state */
|
2122
2177
|
handleParticipantMeetState(bearerToken: string, body: ApiHandleParticipantMeetStateRequest, options?: any): Promise<any>;
|
2178
|
+
/** Create mezon OAuth client */
|
2179
|
+
getMezonOauthClient(bearerToken: string, clientId?: string, options?: any): Promise<ApiMezonOauthClient>;
|
2180
|
+
/** update mezon OAuth */
|
2181
|
+
updateMezonOauthClient(bearerToken: string, body: ApiMezonOauthClient, options?: any): Promise<ApiMezonOauthClient>;
|
2182
|
+
/** */
|
2183
|
+
generateHashChannelApps(bearerToken: string, appId?: string, options?: any): Promise<ApiCreateHashChannelAppsResponse>;
|
2123
2184
|
}
|
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, ApiCreateHashChannelAppsResponse } 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,8 @@ 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>;
|
651
|
+
generateHashChannelApps(session: Session, appId?: string): Promise<ApiCreateHashChannelAppsResponse>;
|
649
652
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -7091,6 +7091,87 @@ 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
|
+
}
|
7149
|
+
/** */
|
7150
|
+
generateHashChannelApps(bearerToken, appId, options = {}) {
|
7151
|
+
const urlPath = "/v2/channel-apps/hash";
|
7152
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7153
|
+
queryParams.set("app_id", appId);
|
7154
|
+
let bodyJson = "";
|
7155
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7156
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7157
|
+
if (bearerToken) {
|
7158
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7159
|
+
}
|
7160
|
+
return Promise.race([
|
7161
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7162
|
+
if (response.status == 204) {
|
7163
|
+
return response;
|
7164
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7165
|
+
return response.json();
|
7166
|
+
} else {
|
7167
|
+
throw response;
|
7168
|
+
}
|
7169
|
+
}),
|
7170
|
+
new Promise(
|
7171
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7172
|
+
)
|
7173
|
+
]);
|
7174
|
+
}
|
7094
7175
|
};
|
7095
7176
|
|
7096
7177
|
// session.ts
|
@@ -10846,6 +10927,26 @@ var Client = class {
|
|
10846
10927
|
});
|
10847
10928
|
});
|
10848
10929
|
}
|
10930
|
+
getMezonOauthClient(session, clientId) {
|
10931
|
+
return __async(this, null, function* () {
|
10932
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10933
|
+
yield this.sessionRefresh(session);
|
10934
|
+
}
|
10935
|
+
return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
|
10936
|
+
return Promise.resolve(response);
|
10937
|
+
});
|
10938
|
+
});
|
10939
|
+
}
|
10940
|
+
updateMezonOauthClient(session, body) {
|
10941
|
+
return __async(this, null, function* () {
|
10942
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10943
|
+
yield this.sessionRefresh(session);
|
10944
|
+
}
|
10945
|
+
return this.apiClient.updateMezonOauthClient(session.token, body).then((response) => {
|
10946
|
+
return Promise.resolve(response);
|
10947
|
+
});
|
10948
|
+
});
|
10949
|
+
}
|
10849
10950
|
//**search thread */
|
10850
10951
|
searchThread(session, clanId, channelId, label) {
|
10851
10952
|
return __async(this, null, function* () {
|
@@ -10857,4 +10958,15 @@ var Client = class {
|
|
10857
10958
|
});
|
10858
10959
|
});
|
10859
10960
|
}
|
10961
|
+
//**Generate Hash */
|
10962
|
+
generateHashChannelApps(session, appId) {
|
10963
|
+
return __async(this, null, function* () {
|
10964
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10965
|
+
yield this.sessionRefresh(session);
|
10966
|
+
}
|
10967
|
+
return this.apiClient.generateHashChannelApps(session.token, appId).then((response) => {
|
10968
|
+
return Promise.resolve(response);
|
10969
|
+
});
|
10970
|
+
});
|
10971
|
+
}
|
10860
10972
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -7057,6 +7057,87 @@ 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
|
+
}
|
7115
|
+
/** */
|
7116
|
+
generateHashChannelApps(bearerToken, appId, options = {}) {
|
7117
|
+
const urlPath = "/v2/channel-apps/hash";
|
7118
|
+
const queryParams = /* @__PURE__ */ new Map();
|
7119
|
+
queryParams.set("app_id", appId);
|
7120
|
+
let bodyJson = "";
|
7121
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
7122
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
7123
|
+
if (bearerToken) {
|
7124
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
7125
|
+
}
|
7126
|
+
return Promise.race([
|
7127
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
7128
|
+
if (response.status == 204) {
|
7129
|
+
return response;
|
7130
|
+
} else if (response.status >= 200 && response.status < 300) {
|
7131
|
+
return response.json();
|
7132
|
+
} else {
|
7133
|
+
throw response;
|
7134
|
+
}
|
7135
|
+
}),
|
7136
|
+
new Promise(
|
7137
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
7138
|
+
)
|
7139
|
+
]);
|
7140
|
+
}
|
7060
7141
|
};
|
7061
7142
|
|
7062
7143
|
// session.ts
|
@@ -10812,6 +10893,26 @@ var Client = class {
|
|
10812
10893
|
});
|
10813
10894
|
});
|
10814
10895
|
}
|
10896
|
+
getMezonOauthClient(session, clientId) {
|
10897
|
+
return __async(this, null, function* () {
|
10898
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10899
|
+
yield this.sessionRefresh(session);
|
10900
|
+
}
|
10901
|
+
return this.apiClient.getMezonOauthClient(session.token, clientId).then((response) => {
|
10902
|
+
return Promise.resolve(response);
|
10903
|
+
});
|
10904
|
+
});
|
10905
|
+
}
|
10906
|
+
updateMezonOauthClient(session, body) {
|
10907
|
+
return __async(this, null, function* () {
|
10908
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10909
|
+
yield this.sessionRefresh(session);
|
10910
|
+
}
|
10911
|
+
return this.apiClient.updateMezonOauthClient(session.token, body).then((response) => {
|
10912
|
+
return Promise.resolve(response);
|
10913
|
+
});
|
10914
|
+
});
|
10915
|
+
}
|
10815
10916
|
//**search thread */
|
10816
10917
|
searchThread(session, clanId, channelId, label) {
|
10817
10918
|
return __async(this, null, function* () {
|
@@ -10823,6 +10924,17 @@ var Client = class {
|
|
10823
10924
|
});
|
10824
10925
|
});
|
10825
10926
|
}
|
10927
|
+
//**Generate Hash */
|
10928
|
+
generateHashChannelApps(session, appId) {
|
10929
|
+
return __async(this, null, function* () {
|
10930
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
10931
|
+
yield this.sessionRefresh(session);
|
10932
|
+
}
|
10933
|
+
return this.apiClient.generateHashChannelApps(session.token, appId).then((response) => {
|
10934
|
+
return Promise.resolve(response);
|
10935
|
+
});
|
10936
|
+
});
|
10937
|
+
}
|
10826
10938
|
};
|
10827
10939
|
export {
|
10828
10940
|
ChannelStreamMode,
|