mirror of
https://github.com/langgenius/dify.git
synced 2026-02-25 23:01:49 -05:00
- Add types for sandbox file API (SandboxFileNode, SandboxFileDownloadTicket) - Add oRPC contracts for listFiles and downloadFile endpoints - Add TanStack Query hooks (useGetSandboxFiles, useDownloadSandboxFile) - Add useSandboxFilesTree hook with flat-to-tree conversion
31 lines
728 B
TypeScript
31 lines
728 B
TypeScript
import type {
|
|
SandboxFileDownloadRequest,
|
|
SandboxFileDownloadTicket,
|
|
SandboxFileListQuery,
|
|
SandboxFileNode,
|
|
} from '@/types/sandbox-file'
|
|
import { type } from '@orpc/contract'
|
|
import { base } from '../base'
|
|
|
|
export const listFilesContract = base
|
|
.route({
|
|
path: '/sandboxes/{sandboxId}/files',
|
|
method: 'GET',
|
|
})
|
|
.input(type<{
|
|
params: { sandboxId: string }
|
|
query?: SandboxFileListQuery
|
|
}>())
|
|
.output(type<SandboxFileNode[]>())
|
|
|
|
export const downloadFileContract = base
|
|
.route({
|
|
path: '/sandboxes/{sandboxId}/files/download',
|
|
method: 'POST',
|
|
})
|
|
.input(type<{
|
|
params: { sandboxId: string }
|
|
body: SandboxFileDownloadRequest
|
|
}>())
|
|
.output(type<SandboxFileDownloadTicket>())
|