feat(frontend): add API integration playground
This commit is contained in:
@@ -25,6 +25,7 @@ export interface APIPrincipalConfig {
|
||||
signed_token_header_name: string
|
||||
require_direct_header: boolean
|
||||
has_hmac_secret: boolean
|
||||
hmac_secret?: string
|
||||
}
|
||||
|
||||
export interface UpdateAPIPrincipalConfigPayload {
|
||||
@@ -35,6 +36,19 @@ export interface UpdateAPIPrincipalConfigPayload {
|
||||
hmac_secret?: string
|
||||
}
|
||||
|
||||
export interface CreateAPIPrincipalTestTokenPayload {
|
||||
external_user_id: string
|
||||
expires_in_seconds?: number
|
||||
}
|
||||
|
||||
export interface APIPrincipalTestToken {
|
||||
token: string
|
||||
header_name: string
|
||||
expires_in_seconds: number
|
||||
expires_at_unix: number
|
||||
external_user_id: string
|
||||
}
|
||||
|
||||
// 搜索租户参数
|
||||
export interface SearchTenantsParams {
|
||||
keyword?: string
|
||||
@@ -117,6 +131,21 @@ export async function updateAPIPrincipalConfig(
|
||||
}
|
||||
}
|
||||
|
||||
export async function createAPIPrincipalTestToken(
|
||||
tenantId: number,
|
||||
payload: CreateAPIPrincipalTestTokenPayload,
|
||||
): Promise<{ success: boolean; data?: APIPrincipalTestToken; message?: string }> {
|
||||
try {
|
||||
const response = await post(`/api/v1/tenants/${tenantId}/api-principal-test-token`, payload)
|
||||
return response as unknown as { success: boolean; data?: APIPrincipalTestToken; message?: string }
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
message: error.message || t('error.tenant.createApiPrincipalTestTokenFailed'),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新租户信息(目前暴露名称、描述两个字段的编辑入口)。
|
||||
* 后端 `PUT /tenants/:id` 用指针字段区分"未传"和"显式空串",未传的列不会
|
||||
|
||||
Reference in New Issue
Block a user