Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

4.0 KB
Raw Blame
// This file is auto-generated by @hey-api/openapi-ts

import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
  zAlreadySubmittedError,
  zExpiredError,
  zHumanInputFormExpiredError,
  zHumanInputFormSubmittedError,
  zInvalidFormDataError,
  zInvalidInputError,
  zWorkflowNotActiveError,
} from './zod.gen.ts'
import {
  zGetFormHumanInputByFormTokenPath,
  zGetFormHumanInputByFormTokenResponse,
  zGetFormHumanInputV2ByFormTokenPath,
  zGetFormHumanInputV2ByFormTokenResponse,
  zPostFormHumanInputByFormTokenBody,
  zPostFormHumanInputByFormTokenPath,
  zPostFormHumanInputByFormTokenResponse,
  zPostFormHumanInputV2ByFormTokenBody,
  zPostFormHumanInputV2ByFormTokenPath,
  zPostFormHumanInputV2ByFormTokenResponse,
} from './zod.gen.ts'

/**
 * Read a frozen v2 form using the current Account's Contact authorization.
 */
export const get = oc
  .route({
    description: "Read a frozen v2 form using the current Account's Contact authorization.",
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getFormHumanInputV2ByFormToken',
    path: '/form/human-input/v2/{form_token}',
    tags: ['console'],
  })
  .input(z.object({ params: zGetFormHumanInputV2ByFormTokenPath }))
  .output(zGetFormHumanInputV2ByFormTokenResponse)
  .errors({
    already_submitted: { status: 409, data: zAlreadySubmittedError },
    expired: { status: 410, data: zExpiredError },
  })

export const post = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postFormHumanInputV2ByFormToken',
    path: '/form/human-input/v2/{form_token}',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostFormHumanInputV2ByFormTokenBody,
      params: zPostFormHumanInputV2ByFormTokenPath,
    }),
  )
  .output(zPostFormHumanInputV2ByFormTokenResponse)
  .errors({
    already_submitted: { status: 409, data: zAlreadySubmittedError },
    expired: { status: 410, data: zExpiredError },
    invalid_input: { status: 400, data: zInvalidInputError },
    workflow_not_active: { status: 409, data: zWorkflowNotActiveError },
  })

export const byFormToken = {
  get,
  post,
}

export const v2 = {
  byFormToken,
}

/**
 * Get human input form definition by form token
 *
 * GET /console/api/form/human_input/<form_token>
 */
export const get2 = oc
  .route({
    description: 'GET /console/api/form/human_input/<form_token>',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getFormHumanInputByFormToken',
    path: '/form/human_input/{form_token}',
    summary: 'Get human input form definition by form token',
    tags: ['console'],
  })
  .input(z.object({ params: zGetFormHumanInputByFormTokenPath }))
  .output(zGetFormHumanInputByFormTokenResponse)
  .errors({ human_input_form_submitted: { status: 412, data: zHumanInputFormSubmittedError } })

/**
 * Submit human input form by form token
 *
 * POST /console/api/form/human_input/<form_token>
 *
 * Request body:
 * {
 * "inputs": {
 * "content": "User input content"
 * },
 * "action": "Approve"
 * }
 */
export const post2 = oc
  .route({
    description:
      'POST /console/api/form/human_input/<form_token>\n\nRequest body:\n{\n    "inputs": {\n        "content": "User input content"\n    },\n    "action": "Approve"\n}',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postFormHumanInputByFormToken',
    path: '/form/human_input/{form_token}',
    summary: 'Submit human input form by form token',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostFormHumanInputByFormTokenBody,
      params: zPostFormHumanInputByFormTokenPath,
    }),
  )
  .output(zPostFormHumanInputByFormTokenResponse)
  .errors({
    human_input_form_expired: { status: 412, data: zHumanInputFormExpiredError },
    human_input_form_submitted: { status: 412, data: zHumanInputFormSubmittedError },
    invalid_form_data: { status: 400, data: zInvalidFormDataError },
  })

export const byFormToken2 = {
  get: get2,
  post: post2,
}

export const humanInput = {
  v2,
  byFormToken: byFormToken2,
}

export const form = {
  humanInput,
}

export const contract = {
  form,
}