@byteplus/avatar-web-sdk
Advanced tools
+23
-4
@@ -8,3 +8,4 @@ import { AvatarSDKConfig, AvatarSessionConfig } from "../types"; | ||
| * @note Best practice: Create one instance per application process lifecycle and use it as a singleton. | ||
| * @warning The config is immutable after initialization. Any subsequent changes to the config object will not take effect. | ||
| * @warning Structural config (appKey, environment, etc.) is immutable after initialization. | ||
| * Tokens (stsToken, wssToken) can be updated via updateStsToken/updateWssToken methods. | ||
| */ | ||
@@ -14,4 +15,6 @@ export declare class AvatarSDK { | ||
| static readonly version: string; | ||
| /** Configuration for AvatarSDK (readonly) */ | ||
| readonly config: Readonly<AvatarSDKConfig>; | ||
| /** Configuration for AvatarSDK (structural parts are readonly) */ | ||
| private _config; | ||
| private _stsToken; | ||
| private _wssToken; | ||
| readonly logger: LogManager; | ||
@@ -21,6 +24,22 @@ /** | ||
| * @param config - Configuration for AvatarSDK | ||
| * @throws Error if appKey or secretKey is missing | ||
| * @throws Error if no valid authentication method is provided | ||
| */ | ||
| constructor(config: AvatarSDKConfig); | ||
| /** | ||
| * Get the current configuration (read-only view) | ||
| */ | ||
| get config(): Readonly<AvatarSDKConfig>; | ||
| /** | ||
| * Update STS Token | ||
| * @param stsToken - New STS Token, pass null to clear | ||
| * @note Updated token takes effect on next connection, does not affect current connection | ||
| */ | ||
| updateStsToken(stsToken: string | null): void; | ||
| /** | ||
| * Update WSS Token | ||
| * @param wssToken - New WSS Token, pass null to clear | ||
| * @note Updated token takes effect on next connection, does not affect current connection | ||
| */ | ||
| updateWssToken(wssToken: string | null): void; | ||
| /** | ||
| * Create AvatarSession instance with config | ||
@@ -27,0 +46,0 @@ * @param config - Session configuration |
+1
-1
| { | ||
| "name": "@byteplus/avatar-web-sdk", | ||
| "version": "1.0.1-beta.3", | ||
| "version": "1.0.1-beta.4", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./avatar-web-sdk.es.js", |
+7
-5
@@ -15,8 +15,10 @@ export * from "./errors"; | ||
| export interface AvatarSDKConfig { | ||
| /** App Key (Required) */ | ||
| appKey: string; | ||
| /** Secret Key (Required) */ | ||
| secretKey: string; | ||
| /** App Key (Optional, required for AK/SK authentication) */ | ||
| appKey?: string; | ||
| /** Secret Key (Optional, required for AK/SK authentication) */ | ||
| secretKey?: string; | ||
| /** STS Token (Optional) */ | ||
| stsToken?: string; | ||
| stsToken?: string | null; | ||
| /** WSS Token (Optional) */ | ||
| wssToken?: string | null; | ||
| /** Enable logging (Optional), default is true */ | ||
@@ -23,0 +25,0 @@ logEnabled?: boolean; |
Sorry, the diff of this file is too big to display
1613920
0.14%22442
0.24%