basePath: /ecosystem/api/v1
definitions:
  vercel.AccessTokenResponse:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
      redirectUrl:
        type: string
    type: object
  vercel.AddConnectionRequest:
    properties:
      branch_enabled:
        type: boolean
      configuration_id:
        type: string
      database:
        type: string
      framework_type:
        enum:
        - General
        - Prisma
        - TiDB Cloud Serverless Driver
        type: string
      vercel_project_id:
        type: string
      vercel_project_name:
        type: string
    required:
    - configuration_id
    - framework_type
    - vercel_project_id
    - vercel_project_name
    type: object
  vercel.AddDataAppConnectionRequest:
    properties:
      configuration_id:
        type: string
      vercel_project_id:
        type: string
      vercel_project_name:
        type: string
    required:
    - configuration_id
    - vercel_project_id
    - vercel_project_name
    type: object
  vercel.BaseResp:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
    type: object
  vercel.ConnectionTargetType:
    enum:
    - cluster
    - dataApp
    type: string
    x-enum-varnames:
    - TargetTypeCluster
    - TargetTypeDataApp
  vercel.CreateClusterRequest:
    properties:
      cluster_name:
        type: string
      configuration_id:
        type: string
      selected_vercel_projects:
        items:
          type: string
        type: array
    required:
    - cluster_name
    - configuration_id
    - selected_vercel_projects
    type: object
  vercel.EventType:
    enum:
    - project-removed
    - project.removed
    - integration-configuration-removed
    - integration-configuration.removed
    - deployment.created
    - deployment.ready
    - deployment.error
    - deployment.canceled
    type: string
    x-enum-varnames:
    - ProjectRemovedDeprecated
    - ProjectRemoved
    - IntegrationRemovedDeprecated
    - IntegrationRemoved
    - DeploymentCreated
    - DeploymentReady
    - DeploymentError
    - DeploymentCanceled
  vercel.ListConnectionResponse:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
      connections:
        items:
          $ref: '#/definitions/vercel.TiDBVercelConnectionVO'
        type: array
    type: object
  vercel.MessageResp:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
      message:
        type: string
    type: object
  vercel.ProjectVO:
    properties:
      id:
        type: string
      name:
        type: string
    type: object
  vercel.Resp:
    properties:
      err_code:
        type: integer
      err_msg:
        type: string
    type: object
  vercel.RetrieveProjectResponse:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
      projects:
        items:
          $ref: '#/definitions/vercel.ProjectVO'
        type: array
    type: object
  vercel.TiDBOrgVercelConnection:
    properties:
      base_resp:
        $ref: '#/definitions/vercel.Resp'
      connections_array:
        items:
          $ref: '#/definitions/vercel.TiDBTargetVercelConnectionVO'
        type: array
    type: object
  vercel.TiDBTargetVercelConnectionVO:
    properties:
      branch_enabled:
        type: boolean
      projects:
        items:
          $ref: '#/definitions/vercel.VercelProject'
        type: array
      target_id:
        type: string
      target_name:
        type: string
      target_type:
        $ref: '#/definitions/vercel.ConnectionTargetType'
      tidb_org_id:
        type: string
      tidb_org_name:
        type: string
      tidb_project_id:
        type: string
      tidb_project_name:
        type: string
    required:
    - tidb_org_id
    - tidb_project_id
    type: object
  vercel.TiDBVercelConnectionVO:
    properties:
      branch_enabled:
        type: boolean
      target_id:
        type: string
      target_name:
        type: string
      target_type:
        $ref: '#/definitions/vercel.ConnectionTargetType'
      tidb_org_id:
        type: string
      tidb_org_name:
        type: string
      tidb_project_id:
        type: string
      tidb_project_name:
        type: string
      vercel_project_id:
        type: string
      vercel_project_name:
        type: string
    required:
    - tidb_org_id
    - tidb_project_id
    - vercel_project_id
    - vercel_project_name
    type: object
  vercel.VercelEvent:
    properties:
      createdAt:
        type: integer
      id:
        type: string
      payload: {}
      type:
        $ref: '#/definitions/vercel.EventType'
    type: object
  vercel.VercelProject:
    properties:
      vercel_project_id:
        type: string
      vercel_project_name:
        type: string
    required:
    - vercel_project_id
    - vercel_project_name
    type: object
host: localhost:8080
info:
  contact: {}
  termsOfService: http://swagger.io/terms/
  title: Vercel Swagger API
  version: "1.0"
paths:
  /orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/vercel/connections:
    delete:
      consumes:
      - application/json
      description: Delete connection between Vercel project and TiDB cluster
      parameters:
      - description: TiDB Org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB Project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: TiDB Cluster ID
        in: path
        name: cluster_id
        required: true
        type: string
      - in: query
        name: vercel_project_id
        required: true
        type: string
      - in: query
        name: vercel_project_name
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.MessageResp'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
    get:
      consumes:
      - application/json
      description: List connections between Vercel project and TiDB cluster By cluster
        id.
      parameters:
      - description: TiDB org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: TiDB cluster ID
        in: path
        name: cluster_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.ListConnectionResponse'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
    post:
      consumes:
      - application/json
      description: Add connection between Vercel project and TiDB cluster
      parameters:
      - description: TiDB Org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB Project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: TiDB Cluster ID
        in: path
        name: cluster_id
        required: true
        type: string
      - description: Vercel project information and integration configuration id
        in: body
        name: vercel_project
        required: true
        schema:
          $ref: '#/definitions/vercel.AddConnectionRequest'
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.MessageResp'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /orgs/{org_id}/projects/{project_id}/dataapps/{data_app_id}/vercel/connections:
    delete:
      consumes:
      - application/json
      description: Delete connection between Vercel project and TiDB data app
      parameters:
      - description: TiDB Org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB Project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: TiDB Data App ID
        in: path
        name: data_app_id
        required: true
        type: string
      - in: query
        name: vercel_project_id
        required: true
        type: string
      - in: query
        name: vercel_project_name
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.MessageResp'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
    post:
      consumes:
      - application/json
      description: Add connection between Vercel project and TiDB Data app
      parameters:
      - description: TiDB Org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB Project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: TiDB Data App ID
        in: path
        name: data_app_id
        required: true
        type: string
      - description: Vercel project information and integration configuration id
        in: body
        name: vercel_project
        required: true
        schema:
          $ref: '#/definitions/vercel.AddDataAppConnectionRequest'
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.MessageResp'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /orgs/{org_id}/projects/{project_id}/serverless/clusters:
    post:
      consumes:
      - application/json
      description: Create serverless cluster, return success when the cluster is ready.
      parameters:
      - description: TiDB Org ID
        in: path
        name: org_id
        required: true
        type: string
      - description: TiDB Project ID
        in: path
        name: project_id
        required: true
        type: string
      - description: Serverless cluster info
        in: body
        name: vercel_project
        required: true
        schema:
          $ref: '#/definitions/vercel.CreateClusterRequest'
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.MessageResp'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /orgs/{org_id}/vercel/connections:
    get:
      consumes:
      - application/json
      description: List connections between Vercel project and (cluster or data app)
        By TiDB Org.
      parameters:
      - description: TiDB org ID
        in: path
        name: org_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.TiDBOrgVercelConnection'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /vercel/access_token:
    post:
      consumes:
      - application/json
      description: Get Vercel access token. For the concern of security, we will store
        the long-lived access token in our database
      parameters:
      - description: The code received when adding integration.
        in: query
        name: code
        required: true
        type: string
      - description: The configuration ID of the integration(absent with External
          installation).
        in: query
        name: configurationId
        type: string
      - description: The ID of the created project(only exist when installing via
          Deploy Button).
        in: query
        name: currentProjectId
        type: string
      - description: An external ID or reference(only exist when installing via Deploy
          Button).
        in: query
        name: external-id
        type: string
      - description: The URL to redirect to after the integration has been installed(absent
          with External installation).
        in: query
        name: next
        type: string
      - description: The ID of the team (only if a team is selected).
        in: query
        name: teamId
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.AccessTokenResponse'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.AccessTokenResponse'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.AccessTokenResponse'
  /vercel/integration/configurations/{configuration_id}/connections:
    get:
      consumes:
      - application/json
      description: List connections between Vercel project and (cluster or data app)
        By integration configuration.
      parameters:
      - description: Vercel integration configuration id
        in: path
        name: configuration_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.ListConnectionResponse'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /vercel/integration/configurations/{configuration_id}/projects:
    get:
      consumes:
      - application/json
      description: List Vercel projects accessible to the integration configuration.
      parameters:
      - description: Vercel integration configuration information
        in: path
        name: configuration_id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            $ref: '#/definitions/vercel.RetrieveProjectResponse'
        "400":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
        "500":
          description: error
          schema:
            $ref: '#/definitions/vercel.BaseResp'
  /vercel/webhooks:
    post:
      consumes:
      - application/json
      description: Webhook for Vercel event https://vercel.com/docs/integrations/webhooks-overview#
      parameters:
      - description: Webhook request
        in: header
        name: x-vercel-signature
        required: true
        type: string
      - description: Vercel event callback
        in: body
        name: vercel_event
        required: true
        schema:
          $ref: '#/definitions/vercel.VercelEvent'
      produces:
      - application/json
      responses:
        "200":
          description: ok
          schema:
            type: string
        "400":
          description: error
          schema:
            type: string
        "403":
          description: error
          schema:
            type: string
        "500":
          description: error
          schema:
            type: string
schemes:
- http
swagger: "2.0"
