import type { CreateSnippetPayload, IncrementSnippetUseCountResponse, PublishSnippetWorkflowResponse, Snippet, SnippetDraftConfig, SnippetDraftNodeRunPayload, SnippetDraftRunPayload, SnippetDraftSyncPayload, SnippetDraftSyncResponse, SnippetImportPayload, SnippetIterationNodeRunPayload, SnippetListResponse, SnippetLoopNodeRunPayload, SnippetWorkflow, UpdateSnippetPayload, WorkflowNodeExecution, WorkflowNodeExecutionListResponse, WorkflowRunDetail, WorkflowRunPagination, } from '@/types/snippet' import { type } from '@orpc/contract' import { base } from '../base' export const listCustomizedSnippetsContract = base .route({ path: '/workspaces/current/customized-snippets', method: 'GET', }) .input(type<{ query: { page: number limit: number keyword?: string creator_id?: string is_published?: boolean } }>()) .output(type()) export const createCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets', method: 'POST', }) .input(type<{ body: CreateSnippetPayload }>()) .output(type()) export const getCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const updateCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}', method: 'PATCH', }) .input(type<{ params: { snippetId: string } body: UpdateSnippetPayload }>()) .output(type()) export const deleteCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}', method: 'DELETE', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const exportCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}/export', method: 'GET', }) .input(type<{ params: { snippetId: string } query: { include_secret?: 'true' | 'false' } }>()) .output(type()) export const importCustomizedSnippetContract = base .route({ path: '/workspaces/current/customized-snippets/imports', method: 'POST', }) .input(type<{ body: SnippetImportPayload }>()) .output(type()) export const confirmSnippetImportContract = base .route({ path: '/workspaces/current/customized-snippets/imports/{importId}/confirm', method: 'POST', }) .input(type<{ params: { importId: string } }>()) .output(type()) export const checkSnippetDependenciesContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}/check-dependencies', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const incrementSnippetUseCountContract = base .route({ path: '/workspaces/current/customized-snippets/{snippetId}/use-count/increment', method: 'POST', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const getSnippetDraftWorkflowContract = base .route({ path: '/snippets/{snippetId}/workflows/draft', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const syncSnippetDraftWorkflowContract = base .route({ path: '/snippets/{snippetId}/workflows/draft', method: 'POST', }) .input(type<{ params: { snippetId: string } body: SnippetDraftSyncPayload }>()) .output(type()) export const getSnippetDraftConfigContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/config', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const getSnippetPublishedWorkflowContract = base .route({ path: '/snippets/{snippetId}/workflows/publish', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const publishSnippetWorkflowContract = base .route({ path: '/snippets/{snippetId}/workflows/publish', method: 'POST', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const getSnippetDefaultBlockConfigsContract = base .route({ path: '/snippets/{snippetId}/workflows/default-workflow-block-configs', method: 'GET', }) .input(type<{ params: { snippetId: string } }>()) .output(type()) export const listSnippetWorkflowRunsContract = base .route({ path: '/snippets/{snippetId}/workflow-runs', method: 'GET', }) .input(type<{ params: { snippetId: string } query: { last_id?: string limit?: number } }>()) .output(type()) export const getSnippetWorkflowRunDetailContract = base .route({ path: '/snippets/{snippetId}/workflow-runs/{runId}', method: 'GET', }) .input(type<{ params: { snippetId: string runId: string } }>()) .output(type()) export const listSnippetWorkflowRunNodeExecutionsContract = base .route({ path: '/snippets/{snippetId}/workflow-runs/{runId}/node-executions', method: 'GET', }) .input(type<{ params: { snippetId: string runId: string } }>()) .output(type()) export const runSnippetDraftNodeContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/nodes/{nodeId}/run', method: 'POST', }) .input(type<{ params: { snippetId: string nodeId: string } body: SnippetDraftNodeRunPayload }>()) .output(type()) export const getSnippetDraftNodeLastRunContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/nodes/{nodeId}/last-run', method: 'GET', }) .input(type<{ params: { snippetId: string nodeId: string } }>()) .output(type()) export const runSnippetDraftIterationNodeContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/iteration/nodes/{nodeId}/run', method: 'POST', }) .input(type<{ params: { snippetId: string nodeId: string } body: SnippetIterationNodeRunPayload }>()) .output(type()) export const runSnippetDraftLoopNodeContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/loop/nodes/{nodeId}/run', method: 'POST', }) .input(type<{ params: { snippetId: string nodeId: string } body: SnippetLoopNodeRunPayload }>()) .output(type()) export const runSnippetDraftWorkflowContract = base .route({ path: '/snippets/{snippetId}/workflows/draft/run', method: 'POST', }) .input(type<{ params: { snippetId: string } body: SnippetDraftRunPayload }>()) .output(type()) export const stopSnippetWorkflowTaskContract = base .route({ path: '/snippets/{snippetId}/workflow-runs/tasks/{taskId}/stop', method: 'POST', }) .input(type<{ params: { snippetId: string taskId: string } }>()) .output(type())