mirror of
https://github.com/langgenius/dify.git
synced 2026-06-01 04:00:59 -04:00
Co-authored-by: GareArc <garethcxy@dify.ai> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: L1nSn0w <l1nsn0w@qq.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: gigglewang <gigglewang@dify.ai> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
549 lines
11 KiB
TypeScript
549 lines
11 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import * as z from 'zod'
|
|
|
|
/**
|
|
* AccountPayload
|
|
*/
|
|
export const zAccountPayload = z.object({
|
|
email: z.string(),
|
|
id: z.string(),
|
|
name: z.string(),
|
|
})
|
|
|
|
/**
|
|
* AppDescribeQuery
|
|
*
|
|
* `?fields=` allow-list for GET /apps/<id>/describe.
|
|
*
|
|
* Empty / omitted → all blocks. Unknown member → ValidationError → 422.
|
|
*/
|
|
export const zAppDescribeQuery = z.object({
|
|
fields: z.array(z.string()).nullish(),
|
|
workspace_id: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* AppMode
|
|
*/
|
|
export const zAppMode = z.enum([
|
|
'advanced-chat',
|
|
'agent-chat',
|
|
'channel',
|
|
'chat',
|
|
'completion',
|
|
'rag-pipeline',
|
|
'workflow',
|
|
])
|
|
|
|
/**
|
|
* AppListQuery
|
|
*
|
|
* mode is a closed enum.
|
|
*/
|
|
export const zAppListQuery = z.object({
|
|
limit: z.int().gte(1).lte(200).optional().default(20),
|
|
mode: zAppMode.optional(),
|
|
name: z.string().max(200).nullish(),
|
|
page: z.int().gte(1).optional().default(1),
|
|
tag: z.string().max(100).nullish(),
|
|
workspace_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* AppRunRequest
|
|
*/
|
|
export const zAppRunRequest = z.object({
|
|
auto_generate_name: z.boolean().optional().default(true),
|
|
conversation_id: z.string().nullish(),
|
|
files: z.array(z.record(z.string(), z.unknown())).nullish(),
|
|
inputs: z.record(z.string(), z.unknown()),
|
|
query: z.string().nullish(),
|
|
workflow_id: z.string().nullish(),
|
|
workspace_id: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* DeviceCodeRequest
|
|
*/
|
|
export const zDeviceCodeRequest = z.object({
|
|
client_id: z.string(),
|
|
device_label: z.string(),
|
|
})
|
|
|
|
/**
|
|
* DeviceCodeResponse
|
|
*/
|
|
export const zDeviceCodeResponse = z.object({
|
|
device_code: z.string(),
|
|
expires_in: z.int(),
|
|
interval: z.int(),
|
|
user_code: z.string(),
|
|
verification_uri: z.string(),
|
|
})
|
|
|
|
/**
|
|
* DeviceLookupQuery
|
|
*/
|
|
export const zDeviceLookupQuery = z.object({
|
|
user_code: z.string(),
|
|
})
|
|
|
|
/**
|
|
* DeviceLookupResponse
|
|
*/
|
|
export const zDeviceLookupResponse = z.object({
|
|
client_id: z.string().nullish(),
|
|
expires_in_remaining: z.int().optional().default(0),
|
|
valid: z.boolean(),
|
|
})
|
|
|
|
/**
|
|
* DeviceMutateRequest
|
|
*/
|
|
export const zDeviceMutateRequest = z.object({
|
|
user_code: z.string(),
|
|
})
|
|
|
|
/**
|
|
* DeviceMutateResponse
|
|
*/
|
|
export const zDeviceMutateResponse = z.object({
|
|
status: z.string(),
|
|
})
|
|
|
|
/**
|
|
* DevicePollRequest
|
|
*/
|
|
export const zDevicePollRequest = z.object({
|
|
client_id: z.string(),
|
|
device_code: z.string(),
|
|
})
|
|
|
|
/**
|
|
* FileResponse
|
|
*/
|
|
export const zFileResponse = z.object({
|
|
conversation_id: z.string().nullish(),
|
|
created_at: z.int().nullish(),
|
|
created_by: z.string().nullish(),
|
|
extension: z.string().nullish(),
|
|
file_key: z.string().nullish(),
|
|
id: z.string(),
|
|
mime_type: z.string().nullish(),
|
|
name: z.string(),
|
|
original_url: z.string().nullish(),
|
|
preview_url: z.string().nullish(),
|
|
size: z.int(),
|
|
source_url: z.string().nullish(),
|
|
tenant_id: z.string().nullish(),
|
|
user_id: z.string().nullish(),
|
|
})
|
|
|
|
export const zJsonValue = z.unknown()
|
|
|
|
/**
|
|
* HumanInputFormSubmitPayload
|
|
*/
|
|
export const zHumanInputFormSubmitPayload = z.object({
|
|
action: z.string(),
|
|
inputs: z.record(z.string(), zJsonValue),
|
|
})
|
|
|
|
/**
|
|
* PermittedExternalAppsListQuery
|
|
*
|
|
* Strict (extra='forbid').
|
|
*/
|
|
export const zPermittedExternalAppsListQuery = z.object({
|
|
limit: z.int().gte(1).lte(200).optional().default(20),
|
|
mode: zAppMode.optional(),
|
|
name: z.string().max(200).nullish(),
|
|
page: z.int().gte(1).optional().default(1),
|
|
})
|
|
|
|
/**
|
|
* RevokeResponse
|
|
*/
|
|
export const zRevokeResponse = z.object({
|
|
status: z.string(),
|
|
})
|
|
|
|
/**
|
|
* ServerVersionResponse
|
|
*
|
|
* Meta endpoint payload for `GET /openapi/v1/_version` — no auth required.
|
|
*/
|
|
export const zServerVersionResponse = z.object({
|
|
edition: z.enum(['CLOUD', 'SELF_HOSTED']),
|
|
version: z.string(),
|
|
})
|
|
|
|
/**
|
|
* SessionRow
|
|
*/
|
|
export const zSessionRow = z.object({
|
|
client_id: z.string(),
|
|
created_at: z.string().nullish(),
|
|
device_label: z.string(),
|
|
expires_at: z.string().nullish(),
|
|
id: z.string(),
|
|
last_used_at: z.string().nullish(),
|
|
prefix: z.string(),
|
|
})
|
|
|
|
/**
|
|
* SessionListResponse
|
|
*/
|
|
export const zSessionListResponse = z.object({
|
|
data: z.array(zSessionRow),
|
|
has_more: z.boolean(),
|
|
limit: z.int(),
|
|
page: z.int(),
|
|
total: z.int(),
|
|
})
|
|
|
|
/**
|
|
* TagItem
|
|
*/
|
|
export const zTagItem = z.object({
|
|
name: z.string(),
|
|
})
|
|
|
|
/**
|
|
* AppDescribeInfo
|
|
*/
|
|
export const zAppDescribeInfo = z.object({
|
|
author: z.string().nullish(),
|
|
description: z.string().nullish(),
|
|
id: z.string(),
|
|
is_agent: z.boolean().optional().default(false),
|
|
mode: z.string(),
|
|
name: z.string(),
|
|
service_api_enabled: z.boolean(),
|
|
tags: z.array(zTagItem).optional().default([]),
|
|
updated_at: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* AppDescribeResponse
|
|
*/
|
|
export const zAppDescribeResponse = z.object({
|
|
info: zAppDescribeInfo.optional(),
|
|
input_schema: z.record(z.string(), z.unknown()).nullish(),
|
|
parameters: z.record(z.string(), z.unknown()).nullish(),
|
|
})
|
|
|
|
/**
|
|
* AppInfoResponse
|
|
*/
|
|
export const zAppInfoResponse = z.object({
|
|
author: z.string().nullish(),
|
|
description: z.string().nullish(),
|
|
id: z.string(),
|
|
mode: z.string(),
|
|
name: z.string(),
|
|
tags: z.array(zTagItem).optional().default([]),
|
|
})
|
|
|
|
/**
|
|
* AppListRow
|
|
*/
|
|
export const zAppListRow = z.object({
|
|
created_by_name: z.string().nullish(),
|
|
description: z.string().nullish(),
|
|
id: z.string(),
|
|
mode: zAppMode,
|
|
name: z.string(),
|
|
tags: z.array(zTagItem).optional().default([]),
|
|
updated_at: z.string().nullish(),
|
|
workspace_id: z.string().nullish(),
|
|
workspace_name: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* AppListResponse
|
|
*/
|
|
export const zAppListResponse = z.object({
|
|
data: z.array(zAppListRow),
|
|
has_more: z.boolean(),
|
|
limit: z.int(),
|
|
page: z.int(),
|
|
total: z.int(),
|
|
})
|
|
|
|
/**
|
|
* PermittedExternalAppsListResponse
|
|
*/
|
|
export const zPermittedExternalAppsListResponse = z.object({
|
|
data: z.array(zAppListRow),
|
|
has_more: z.boolean(),
|
|
limit: z.int(),
|
|
page: z.int(),
|
|
total: z.int(),
|
|
})
|
|
|
|
/**
|
|
* UsageInfo
|
|
*/
|
|
export const zUsageInfo = z.object({
|
|
completion_tokens: z.int().optional().default(0),
|
|
prompt_tokens: z.int().optional().default(0),
|
|
total_tokens: z.int().optional().default(0),
|
|
})
|
|
|
|
/**
|
|
* MessageMetadata
|
|
*/
|
|
export const zMessageMetadata = z.object({
|
|
retriever_resources: z.array(z.record(z.string(), z.unknown())).optional().default([]),
|
|
usage: zUsageInfo.optional(),
|
|
})
|
|
|
|
/**
|
|
* WorkflowRunData
|
|
*/
|
|
export const zWorkflowRunData = z.object({
|
|
created_at: z.int().nullish(),
|
|
elapsed_time: z.number().nullish(),
|
|
error: z.string().nullish(),
|
|
finished_at: z.int().nullish(),
|
|
id: z.string(),
|
|
outputs: z.record(z.string(), z.unknown()).optional(),
|
|
status: z.string(),
|
|
total_steps: z.int().nullish(),
|
|
total_tokens: z.int().nullish(),
|
|
workflow_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* WorkspaceDetailResponse
|
|
*/
|
|
export const zWorkspaceDetailResponse = z.object({
|
|
created_at: z.string().nullish(),
|
|
current: z.boolean(),
|
|
id: z.string(),
|
|
name: z.string(),
|
|
role: z.string(),
|
|
status: z.string(),
|
|
})
|
|
|
|
/**
|
|
* WorkspacePayload
|
|
*/
|
|
export const zWorkspacePayload = z.object({
|
|
id: z.string(),
|
|
name: z.string(),
|
|
role: z.string(),
|
|
})
|
|
|
|
/**
|
|
* AccountResponse
|
|
*/
|
|
export const zAccountResponse = z.object({
|
|
account: zAccountPayload.optional(),
|
|
default_workspace_id: z.string().nullish(),
|
|
subject_email: z.string().nullish(),
|
|
subject_issuer: z.string().nullish(),
|
|
subject_type: z.string(),
|
|
workspaces: z.array(zWorkspacePayload).optional().default([]),
|
|
})
|
|
|
|
/**
|
|
* WorkspaceSummaryResponse
|
|
*/
|
|
export const zWorkspaceSummaryResponse = z.object({
|
|
current: z.boolean(),
|
|
id: z.string(),
|
|
name: z.string(),
|
|
role: z.string(),
|
|
status: z.string(),
|
|
})
|
|
|
|
/**
|
|
* WorkspaceListResponse
|
|
*/
|
|
export const zWorkspaceListResponse = z.object({
|
|
workspaces: z.array(zWorkspaceSummaryResponse),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetHealthResponse = z.record(z.string(), z.unknown())
|
|
|
|
/**
|
|
* Server version
|
|
*/
|
|
export const zGetVersionResponse = zServerVersionResponse
|
|
|
|
/**
|
|
* Account info
|
|
*/
|
|
export const zGetAccountResponse = zAccountResponse
|
|
|
|
/**
|
|
* Session list
|
|
*/
|
|
export const zGetAccountSessionsResponse = zSessionListResponse
|
|
|
|
/**
|
|
* Session revoked
|
|
*/
|
|
export const zDeleteAccountSessionsSelfResponse = zRevokeResponse
|
|
|
|
export const zDeleteAccountSessionsBySessionIdPath = z.object({
|
|
session_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Session revoked
|
|
*/
|
|
export const zDeleteAccountSessionsBySessionIdResponse = zRevokeResponse
|
|
|
|
export const zGetAppsQuery = z.object({
|
|
limit: z.int().gte(1).lte(200).optional().default(20),
|
|
mode: z.string().optional(),
|
|
name: z.string().max(200).optional(),
|
|
page: z.int().gte(1).optional().default(1),
|
|
tag: z.string().max(100).optional(),
|
|
workspace_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* App list
|
|
*/
|
|
export const zGetAppsResponse = zAppListResponse
|
|
|
|
export const zGetAppsByAppIdDescribePath = z.object({
|
|
app_id: z.string(),
|
|
})
|
|
|
|
export const zGetAppsByAppIdDescribeQuery = z.object({
|
|
fields: z.array(z.string()).optional(),
|
|
workspace_id: z.string().optional(),
|
|
})
|
|
|
|
/**
|
|
* App description
|
|
*/
|
|
export const zGetAppsByAppIdDescribeResponse = zAppDescribeResponse
|
|
|
|
export const zPostAppsByAppIdFilesUploadPath = z.object({
|
|
app_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* File uploaded successfully
|
|
*/
|
|
export const zPostAppsByAppIdFilesUploadResponse = zFileResponse
|
|
|
|
export const zGetAppsByAppIdFormHumanInputByFormTokenPath = z.object({
|
|
app_id: z.string(),
|
|
form_token: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Form definition
|
|
*/
|
|
export const zGetAppsByAppIdFormHumanInputByFormTokenResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPostAppsByAppIdFormHumanInputByFormTokenBody = zHumanInputFormSubmitPayload
|
|
|
|
export const zPostAppsByAppIdFormHumanInputByFormTokenPath = z.object({
|
|
app_id: z.string(),
|
|
form_token: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Form submitted
|
|
*/
|
|
export const zPostAppsByAppIdFormHumanInputByFormTokenResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPostAppsByAppIdRunBody = zAppRunRequest
|
|
|
|
export const zPostAppsByAppIdRunPath = z.object({
|
|
app_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Run result (SSE stream)
|
|
*/
|
|
export const zPostAppsByAppIdRunResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zGetAppsByAppIdTasksByTaskIdEventsPath = z.object({
|
|
app_id: z.string(),
|
|
task_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* SSE event stream
|
|
*/
|
|
export const zGetAppsByAppIdTasksByTaskIdEventsResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPostAppsByAppIdTasksByTaskIdStopPath = z.object({
|
|
app_id: z.string(),
|
|
task_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Task stopped
|
|
*/
|
|
export const zPostAppsByAppIdTasksByTaskIdStopResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPostOauthDeviceApproveBody = zDeviceMutateRequest
|
|
|
|
/**
|
|
* Approved
|
|
*/
|
|
export const zPostOauthDeviceApproveResponse = zDeviceMutateResponse
|
|
|
|
export const zPostOauthDeviceCodeBody = zDeviceCodeRequest
|
|
|
|
/**
|
|
* Device code created
|
|
*/
|
|
export const zPostOauthDeviceCodeResponse = zDeviceCodeResponse
|
|
|
|
export const zPostOauthDeviceDenyBody = zDeviceMutateRequest
|
|
|
|
/**
|
|
* Denied
|
|
*/
|
|
export const zPostOauthDeviceDenyResponse = zDeviceMutateResponse
|
|
|
|
export const zGetOauthDeviceLookupQuery = z.object({
|
|
user_code: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Device lookup result
|
|
*/
|
|
export const zGetOauthDeviceLookupResponse = zDeviceLookupResponse
|
|
|
|
export const zPostOauthDeviceTokenBody = zDevicePollRequest
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zPostOauthDeviceTokenResponse = z.record(z.string(), z.unknown())
|
|
|
|
/**
|
|
* Permitted external apps list
|
|
*/
|
|
export const zGetPermittedExternalAppsResponse = zPermittedExternalAppsListResponse
|
|
|
|
/**
|
|
* Workspace list
|
|
*/
|
|
export const zGetWorkspacesResponse = zWorkspaceListResponse
|
|
|
|
export const zGetWorkspacesByWorkspaceIdPath = z.object({
|
|
workspace_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Workspace detail
|
|
*/
|
|
export const zGetWorkspacesByWorkspaceIdResponse = zWorkspaceDetailResponse
|