mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: narrow api key install session types
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import apiClient from './client'
|
||||
import { cachedRequest, buildCacheKey } from '@/utils/cache'
|
||||
import type { BillingSummary } from './auth'
|
||||
import type { ApiKeyInstallSession, InstallSessionTargetSystem, InstallTargetCli } from './me'
|
||||
|
||||
// LDAP 配置导出结构
|
||||
export interface LDAPConfigExport {
|
||||
@@ -678,6 +679,18 @@ export const adminApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
// 创建独立余额 Key 的 CLI 安装会话
|
||||
async createApiKeyInstallSession(
|
||||
keyId: string,
|
||||
data: { target_cli: InstallTargetCli; target_system: InstallSessionTargetSystem }
|
||||
): Promise<ApiKeyInstallSession> {
|
||||
const response = await apiClient.post<ApiKeyInstallSession>(
|
||||
`/api/admin/api-keys/${keyId}/install-sessions`,
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// 系统配置相关
|
||||
// 获取所有系统配置
|
||||
async getAllSystemConfigs(): Promise<Array<{ key: string; value: unknown; description?: string }>> {
|
||||
|
||||
@@ -173,6 +173,7 @@ export interface ApiKey {
|
||||
|
||||
export type InstallTargetCli = 'claude_code' | 'codex_cli' | 'gemini_cli'
|
||||
export type InstallTargetSystem = 'macos' | 'linux' | 'windows' | 'auto'
|
||||
export type InstallSessionTargetSystem = Exclude<InstallTargetSystem, 'auto'>
|
||||
|
||||
export interface ApiKeyInstallSession {
|
||||
install_code: string
|
||||
@@ -287,7 +288,7 @@ export const meApi = {
|
||||
|
||||
async createApiKeyInstallSession(
|
||||
keyId: string,
|
||||
data: { target_cli: InstallTargetCli; target_system: InstallTargetSystem }
|
||||
data: { target_cli: InstallTargetCli; target_system: InstallSessionTargetSystem }
|
||||
): Promise<ApiKeyInstallSession> {
|
||||
const response = await apiClient.post<ApiKeyInstallSession>(
|
||||
`/api/users/me/api-keys/${keyId}/install-sessions`,
|
||||
|
||||
Reference in New Issue
Block a user