feat(users): add install session client

This commit is contained in:
RWDai
2026-05-08 23:16:16 +08:00
parent da46eb4791
commit 46f44f4ea7

View File

@@ -171,6 +171,21 @@ export interface ApiKey {
force_capabilities?: Record<string, boolean> | null // 强制能力配置 force_capabilities?: Record<string, boolean> | null // 强制能力配置
} }
export type InstallTargetCli = 'claude_code' | 'codex_cli' | 'gemini_cli'
export type InstallTargetSystem = 'macos' | 'linux' | 'windows' | 'auto'
export interface ApiKeyInstallSession {
install_code: string
expires_at_unix_secs: number
expires_in_seconds: number
target_cli: InstallTargetCli
target_cli_label: string
target_system: InstallTargetSystem
target_system_label: string
unix_command: string
powershell_command: string
}
// 不再需要 ProviderBinding 接口 // 不再需要 ProviderBinding 接口
export interface ChangePasswordRequest { export interface ChangePasswordRequest {
@@ -270,6 +285,17 @@ export const meApi = {
return response.data return response.data
}, },
async createApiKeyInstallSession(
keyId: string,
data: { target_cli: InstallTargetCli; target_system: InstallTargetSystem }
): Promise<ApiKeyInstallSession> {
const response = await apiClient.post<ApiKeyInstallSession>(
`/api/users/me/api-keys/${keyId}/install-sessions`,
data
)
return response.data
},
// 使用统计 // 使用统计
async getUsage(params?: { async getUsage(params?: {
start_date?: string start_date?: string