mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 00:48:04 +08:00
feat(sandbox): add sandbox file API service layer
- 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
This commit is contained in:
30
web/contract/console/sandbox-file.ts
Normal file
30
web/contract/console/sandbox-file.ts
Normal file
@ -0,0 +1,30 @@
|
||||
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>())
|
||||
Reference in New Issue
Block a user