Implement webhook
This commit is contained in:
@@ -114,6 +114,45 @@ export const authApi = {
|
||||
me: () => request<AdminUser>("/api/auth/me"),
|
||||
};
|
||||
|
||||
// ---------- 站点级设置 ----------
|
||||
export type AnalysisWebhookSetting = {
|
||||
enabled: boolean;
|
||||
url: string;
|
||||
secretConfigured: boolean;
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type AnalysisWebhookTestResult = {
|
||||
ok: boolean;
|
||||
statusCode: number | null;
|
||||
latencyMs: number | null;
|
||||
message: string;
|
||||
payload: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export const siteSettingsApi = {
|
||||
getAnalysisWebhook: () =>
|
||||
request<AnalysisWebhookSetting>("/api/settings/analysis-webhook"),
|
||||
updateAnalysisWebhook: (body: {
|
||||
enabled: boolean;
|
||||
url: string;
|
||||
secret?: string;
|
||||
clearSecret?: boolean;
|
||||
}) =>
|
||||
request<AnalysisWebhookSetting>("/api/settings/analysis-webhook", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(body),
|
||||
}),
|
||||
testAnalysisWebhook: (body: { url: string; secret?: string }) =>
|
||||
request<AnalysisWebhookTestResult>(
|
||||
"/api/settings/analysis-webhook/test",
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
// ---------- 接口定义驱动的模型注册表 ----------
|
||||
export type InterfaceField = {
|
||||
key: string;
|
||||
|
||||
Reference in New Issue
Block a user