Lightdash Git Files API

The Git Files API from Lightdash — 3 operation(s) for git files.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

lightdash-git-files-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Lightdash AiAgents Git Files API
  version: 0.3156.1
  description: 'Open API documentation for all public Lightdash API endpoints. # Authentication Before you get started, you might need to create a Personal Access Token to authenticate via the API. You can create a token by following this guide: https://docs.lightdash.com/references/personal_tokens

    '
  license:
    name: MIT
  contact:
    name: Lightdash Support
    email: support@lightdash.com
    url: https://docs.lightdash.com/help-and-contact/contact/contact_info/
servers:
- url: /
tags:
- name: Git Files
paths:
  /api/v1/projects/{projectUuid}/git/branches:
    get:
      operationId: listGitBranches
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitBranchesResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: List branches for the connected repository
      summary: List branches
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
    post:
      operationId: createGitBranch
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitBranchCreatedResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create a new branch from a source branch
      summary: Create branch
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGitBranchRequest'
  /api/v1/projects/{projectUuid}/git/branches/{branch}/files:
    get:
      operationId: getGitFileOrDirectory
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitFileOrDirectoryResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Get file content or directory listing. Returns directory entries if path is a directory, file content if path is a file.
      summary: Get file or directory
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: branch
        required: true
        schema:
          type: string
      - in: query
        name: path
        required: false
        schema:
          type: string
    put:
      operationId: saveGitFile
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitFileSavedResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create or update a file. Provide sha to update existing file, omit for new file.
      summary: Save file
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: branch
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                message:
                  type: string
                sha:
                  type: string
                content:
                  type: string
                path:
                  type: string
              required:
              - content
              - path
              type: object
    delete:
      operationId: deleteGitFile
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitFileDeletedResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Delete a file from the repository
      summary: Delete file
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: branch
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                message:
                  type: string
                sha:
                  type: string
                path:
                  type: string
              required:
              - sha
              - path
              type: object
  /api/v1/projects/{projectUuid}/git/branches/{branch}/pull-request:
    post:
      operationId: createGitPullRequest
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGitPullRequestCreatedResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create a pull request from a branch to the default branch
      summary: Create pull request
      tags:
      - Git Files
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: branch
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGitPullRequestRequest'
components:
  schemas:
    ApiGitBranchCreatedResponse:
      properties:
        results:
          $ref: '#/components/schemas/GitBranch'
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
    CreateGitPullRequestRequest:
      properties:
        description:
          type: string
        title:
          type: string
      required:
      - description
      - title
      type: object
    GitFileEntry:
      properties:
        sha:
          type: string
        size:
          type: number
          format: double
        type:
          type: string
          enum:
          - file
          - dir
        path:
          type: string
        name:
          type: string
      required:
      - sha
      - size
      - type
      - path
      - name
      type: object
    AnyType:
      description: 'This AnyType is an alias for any

        The goal is to make it easier to identify any type in the codebase

        without having to eslint-disable all the time

        These are only used on legacy `any` types, don''t use it for new types.

        This is added on a separate file to avoid circular dependencies.'
    ApiErrorPayload:
      properties:
        error:
          properties:
            data:
              $ref: '#/components/schemas/AnyType'
              description: Optional data containing details of the error
            message:
              type: string
              description: A friendly message summarising the error
            name:
              type: string
              description: Unique name for the type of error
            statusCode:
              type: number
              format: integer
              description: HTTP status code
          required:
          - name
          - statusCode
          type: object
        status:
          type: string
          enum:
          - error
          nullable: false
      required:
      - error
      - status
      type: object
      description: 'The Error object is returned from the api any time there is an error.

        The message contains'
    GitBranch:
      properties:
        isProtected:
          type: boolean
          description: TRUE if direct writes are blocked (GitHub protection OR project's configured branch)
        name:
          type: string
      required:
      - isProtected
      - name
      type: object
    PullRequestCreated:
      properties:
        prUrl:
          type: string
        prTitle:
          type: string
      required:
      - prUrl
      - prTitle
      type: object
    ApiGitBranchesResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/GitBranch'
          type: array
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
    GitFileOrDirectory:
      anyOf:
      - properties:
          entries:
            items:
              $ref: '#/components/schemas/GitFileEntry'
            type: array
          type:
            type: string
            enum:
            - directory
            nullable: false
        required:
        - entries
        - type
        type: object
      - properties:
          path:
            type: string
          sha:
            type: string
          content:
            type: string
          type:
            type: string
            enum:
            - file
            nullable: false
        required:
        - path
        - sha
        - content
        - type
        type: object
    ApiGitFileDeletedResponse:
      properties:
        results:
          properties:
            deleted:
              type: boolean
              enum:
              - true
              nullable: false
          required:
          - deleted
          type: object
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
    ApiGitFileOrDirectoryResponse:
      properties:
        results:
          $ref: '#/components/schemas/GitFileOrDirectory'
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
    CreateGitBranchRequest:
      properties:
        sourceBranch:
          type: string
        name:
          type: string
      required:
      - sourceBranch
      - name
      type: object
    ApiGitPullRequestCreatedResponse:
      properties:
        results:
          $ref: '#/components/schemas/PullRequestCreated'
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
    ApiGitFileSavedResponse:
      properties:
        results:
          properties:
            path:
              type: string
            sha:
              type: string
          required:
          - path
          - sha
          type: object
        status:
          type: string
          enum:
          - ok
          nullable: false
      required:
      - results
      - status
      type: object
  securitySchemes:
    session_cookie:
      type: apiKey
      in: cookie
      name: connect.sid
    api_key:
      type: apiKey
      in: header
      name: Authorization
      description: Value should be 'ApiKey <your key>'