ChatCody - Repository Assistant

ChatCody - Repository Assistant · GPT-Aktionen

GitLab User, Projects, and Files API

  • GET /userGet the authenticated user's details
  • GET /users/{user_id}/projectsList user projects
  • POST /projectsCreate a new project (repository)
  • GET /projects/{project_id}/repository/treeList files in a repository
  • GET /projects/{project_id}/repository/files/{file_path}Get a file from a repository
  • POST /projects/{project_id}/repository/files/{file_path}Create a new file in a repository
  • PUT /projects/{project_id}/repository/files/{file_path}Update an existing file in a repository
  • DELETE /projects/{project_id}/repository/files/{file_path}Delete a file from a repository
  • GET /projects/{project_id}/issuesList issues for a project
  • POST /projects/{project_id}/issuesCreate a new issue in a project
  • GET /projects/{project_id}/issues/{issue_id}Get a single issue by ID
  • GET /projects/{project_id}/issues/{issue_id}/notesList all notes for a specific issue
  • POST /projects/{project_id}/issues/{issue_id}/notesAdd a new note to an issue
  • GET /projects/{project_id}/issues/{issue_id}/notes/{note_id}Get a single note from an issue
  • GET /projects/{project_id}/merge_requests/{merge_request_id}/notesList all notes for a specific merge request
  • POST /projects/{project_id}/merge_requests/{merge_request_id}/notesAdd a new note to a merge request
  • GET /projects/{project_id}/merge_requests/{merge_request_id}/notes/{note_id}Get a single note from a merge request
  • GET /projects/{project_id}/merge_requestsList merge requests for a project
  • POST /projects/{project_id}/merge_requestsCreate a new merge request
  • GET /projects/{project_id}/merge_requests/{merge_request_id}Get a single merge request by ID
  • PUT /projects/{project_id}/merge_requests/{merge_request_id}Update an existing merge request
  • GET /projects/{project_id}/merge_requests/{merge_request_id}/reviewsList reviews for a merge request
  • POST /projects/{project_id}/merge_requests/{merge_request_id}/reviewsCreate a new review for a merge request
  • GET /projects/{project_id}/repository/branchesList branches for a project
  • POST /projects/{project_id}/repository/branchesCreate a new branch in the project
  • GET /projects/{project_id}/repository/branches/{branch}Get a single branch
Ursprüngliches API-Schema
{
  "openapi": "3.1.0",
  "info": {
    "title": "GitLab User, Projects, and Files API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://gitlab.com/api/v4"
    }
  ],
  "paths": {
    "/user": {
      "get": {
        "summary": "Get the authenticated user's details",
        "operationId": "getCurrentUserGitLab",
        "responses": {
          "200": {
            "description": "Details of the authenticated user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "The ID of the authenticated user"
                    },
                    "username": {
                      "type": "string",
                      "description": "The username of the authenticated user"
                    },
                    "email": {
                      "type": "string",
                      "description": "The email of the authenticated user"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/users/{user_id}/projects": {
      "get": {
        "summary": "List user projects",
        "operationId": "listUserProjects",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "GitLab user ID"
          },
          {
            "in": "query",
            "name": "membership",
            "schema": {
              "type": "boolean"
            },
            "description": "Limit by projects that the current user is a member of"
          },
          {
            "in": "query",
            "name": "owned",
            "schema": {
              "type": "boolean"
            },
            "description": "Limit by projects that are owned by the current user"
          },
          {
            "in": "query",
            "name": "sort",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "description": "Return projects ordered by creation date in ascending or descending order"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of projects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Project"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/projects": {
      "post": {
        "summary": "Create a new project (repository)",
        "operationId": "createProject",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the new project"
                  },
                  "description": {
                    "type": "string",
                    "description": "A short project description"
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "private",
                      "internal",
                      "public"
                    ],
                    "default": "private",
                    "description": "Sets the project's visibility level"
                  },
                  "initialize_with_readme": {
                    "type": "boolean",
                    "default": false,
                    "description": "Whether to initialize the project with a README file"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Project created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          }
        }
      }
    },
    "/projects/{project_id}/repository/tree": {
      "get": {
        "summary": "List files in a repository",
        "operationId": "listRepositoryFiles",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "query",
            "name": "ref",
            "schema": {
              "type": "string"
            },
            "description": "The name of the branch, tag, or commit"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of files per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "file_name": {
                        "type": "string"
                      },
                      "file_path": {
                        "type": "string"
                      },
                      "size": {
                        "type": "integer"
                      },
                      "encoding": {
                        "type": "string"
                      },
                      "content_sha256": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/repository/files/{file_path}": {
      "get": {
        "summary": "Get a file from a repository",
        "operationId": "getRepositoryFile",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "file_path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Full path to the file"
          },
          {
            "in": "query",
            "name": "ref",
            "schema": {
              "type": "string"
            },
            "description": "The name of the branch, tag, or commit"
          }
        ],
        "responses": {
          "200": {
            "description": "File details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "file_name": {
                      "type": "string"
                    },
                    "file_path": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "encoding": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string"
                    },
                    "content_sha256": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new file in a repository",
        "operationId": "createRepositoryFile",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "file_path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Full path to the file"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "branch",
                  "content",
                  "commit_message"
                ],
                "properties": {
                  "branch": {
                    "type": "string",
                    "description": "The name of the branch where the commit will be made"
                  },
                  "content": {
                    "type": "string",
                    "description": "New file content, Base64 encoded"
                  },
                  "commit_message": {
                    "type": "string",
                    "description": "Commit message"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "File created"
          }
        }
      },
      "put": {
        "summary": "Update an existing file in a repository",
        "operationId": "updateRepositoryFile",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "file_path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Full path to the file"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "branch",
                  "content"
                ],
                "properties": {
                  "branch": {
                    "type": "string",
                    "description": "The name of the branch where the commit will be made"
                  },
                  "content": {
                    "type": "string",
                    "description": "New file content, Base64 encoded"
                  },
                  "commit_message": {
                    "type": "string",
                    "description": "Commit message"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File updated"
          }
        }
      },
      "delete": {
        "summary": "Delete a file from a repository",
        "operationId": "deleteRepositoryFile",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "file_path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Full path to the file to"
          }
        ],
        "responses": {
          "204": {
            "description": "File deleted"
          }
        }
      }
    },
    "/projects/{project_id}/issues": {
      "get": {
        "summary": "List issues for a project",
        "operationId": "listProjectIssues",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": [
                "opened",
                "closed",
                "all"
              ]
            },
            "description": "Return only issues with the specified state"
          },
          {
            "in": "query",
            "name": "labels",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated list of label names to filter by"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of issues per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of project issues",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Issue"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new issue in a project",
        "operationId": "createProjectIssue",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "title"
                ],
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "The title of the issue"
                  },
                  "description": {
                    "type": "string",
                    "description": "The description of the issue"
                  },
                  "labels": {
                    "type": "string",
                    "description": "Comma-separated list of labels for the issue"
                  },
                  "assignee_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "The ID or list of IDs of users to assign the issue to"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Issue created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Issue"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/issues/{issue_id}": {
      "get": {
        "summary": "Get a single issue by ID",
        "operationId": "getProjectIssue",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "issue_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the issue"
          }
        ],
        "responses": {
          "200": {
            "description": "Issue details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Issue"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/issues/{issue_id}/notes": {
      "get": {
        "summary": "List all notes for a specific issue",
        "operationId": "listIssueNotes",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "issue_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the issue"
          }
        ],
        "responses": {
          "200": {
            "description": "An array of notes for the issue"
          }
        }
      },
      "post": {
        "summary": "Add a new note to an issue",
        "operationId": "createIssueNote",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "issue_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the issue"
          },
          {
            "in": "query",
            "name": "body",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The content of the note"
          }
        ],
        "responses": {
          "201": {
            "description": "Note created"
          }
        }
      }
    },
    "/projects/{project_id}/issues/{issue_id}/notes/{note_id}": {
      "get": {
        "summary": "Get a single note from an issue",
        "operationId": "getIssueNote",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "issue_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the issue"
          },
          {
            "in": "path",
            "name": "note_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the note"
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed information about the note"
          }
        }
      }
    },
    "/projects/{project_id}/merge_requests/{merge_request_id}/notes": {
      "get": {
        "summary": "List all notes for a specific merge request",
        "operationId": "listMergeRequestNotes",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "mr_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the mr"
          }
        ],
        "responses": {
          "200": {
            "description": "An array of notes for the mr"
          }
        }
      },
      "post": {
        "summary": "Add a new note to a merge request",
        "operationId": "createMergeRequestNote",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "mr_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the mr"
          },
          {
            "in": "query",
            "name": "body",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The content of the note"
          }
        ],
        "responses": {
          "201": {
            "description": "Note created"
          }
        }
      }
    },
    "/projects/{project_id}/merge_requests/{merge_request_id}/notes/{note_id}": {
      "get": {
        "summary": "Get a single note from a merge request",
        "operationId": "getMergeRequestNote",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "mr_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the mr"
          },
          {
            "in": "path",
            "name": "note_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the note"
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed information about the note"
          }
        }
      }
    },
    "/projects/{project_id}/merge_requests": {
      "get": {
        "summary": "List merge requests for a project",
        "operationId": "listProjectMergeRequests",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": [
                "opened",
                "closed",
                "merged",
                "all"
              ]
            },
            "description": "Return only merge requests with the specified state"
          },
          {
            "in": "query",
            "name": "source_branch",
            "schema": {
              "type": "string"
            },
            "description": "Filter merge requests by source branch name"
          },
          {
            "in": "query",
            "name": "target_branch",
            "schema": {
              "type": "string"
            },
            "description": "Filter merge requests by target branch name"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of merge requests per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of project merge requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MergeRequest"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new merge request",
        "operationId": "createProjectMergeRequest",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source_branch",
                  "target_branch",
                  "title"
                ],
                "properties": {
                  "source_branch": {
                    "type": "string",
                    "description": "The source branch for the merge request"
                  },
                  "target_branch": {
                    "type": "string",
                    "description": "The target branch for the merge request"
                  },
                  "title": {
                    "type": "string",
                    "description": "The title of the merge request"
                  },
                  "description": {
                    "type": "string",
                    "description": "The description of the merge request"
                  },
                  "assignee_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Assignee user IDs for the merge request"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Merge request created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeRequest"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/merge_requests/{merge_request_id}": {
      "get": {
        "summary": "Get a single merge request by ID",
        "operationId": "getProjectMergeRequest",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "merge_request_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the merge request"
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed information about the merge request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeRequest"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update an existing merge request",
        "operationId": "updateProjectMergeRequest",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "merge_request_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the merge request"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "The title of the merge request"
                  },
                  "description": {
                    "type": "string",
                    "description": "The description of the merge request"
                  },
                  "state_event": {
                    "type": "string",
                    "enum": [
                      "close",
                      "reopen"
                    ],
                    "description": "Change the state of the merge request"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Merge request updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeRequest"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/merge_requests/{merge_request_id}/reviews": {
      "get": {
        "summary": "List reviews for a merge request",
        "operationId": "listMergeRequestReviews",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "merge_request_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the merge request"
          }
        ],
        "responses": {
          "200": {
            "description": "An array of reviews for the merge request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Review"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new review for a merge request",
        "operationId": "createMergeRequestReview",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "merge_request_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the merge request"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "body"
                ],
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The content of the review"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Review created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Review"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/repository/branches": {
      "get": {
        "summary": "List branches for a project",
        "operationId": "listProjectBranches",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          }
        ],
        "responses": {
          "200": {
            "description": "An array of branches for the project",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Branch"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new branch in the project",
        "operationId": "createProjectBranch",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "branch",
                  "ref"
                ],
                "properties": {
                  "branch": {
                    "type": "string",
                    "description": "The name of the branch to create"
                  },
                  "ref": {
                    "type": "string",
                    "description": "The branch name or commit SHA to start the new branch from"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Branch created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Branch"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{project_id}/repository/branches/{branch}": {
      "get": {
        "summary": "Get a single branch",
        "operationId": "getProjectBranch",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The ID of the project"
          },
          {
            "in": "path",
            "name": "branch",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The name of the branch"
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed information about the branch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Branch"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Branch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "merged": {
            "type": "boolean"
          },
          "protected": {
            "type": "boolean"
          },
          "default": {
            "type": "boolean"
          },
          "developers_can_push": {
            "type": "boolean"
          },
          "developers_can_merge": {
            "type": "boolean"
          },
          "can_push": {
            "type": "boolean"
          },
          "commit": {
            "$ref": "#/components/schemas/Commit"
          }
        }
      },
      "Commit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "short_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "parent_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "author_name": {
            "type": "string"
          },
          "author_email": {
            "type": "string"
          },
          "authored_date": {
            "type": "string"
          },
          "committer_name": {
            "type": "string"
          },
          "committer_email": {
            "type": "string"
          },
          "committed_date": {
            "type": "string"
          }
        }
      },
      "Review": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "body": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/User"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MergeRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "source_branch": {
            "type": "string"
          },
          "target_branch": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/User"
          },
          "assignees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/User"
            }
          }
        }
      },
      "Comment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "author": {
            "$ref": "#/components/schemas/User"
          }
        }
      },
      "Issue": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "The current state of the issue (e.g., opened, closed)"
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A list of labels applied to the issue"
          },
          "assignee": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/User"
            },
            "description": "Users assigned to the issue"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date and time when the issue was created"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date and time when the issue was last updated"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "username": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "avatar_url": {
            "type": "string"
          },
          "web_url": {
            "type": "string"
          }
        }
      },
      "Repository": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "owner": {
            "type": "object",
            "properties": {
              "login": {
                "type": "string"
              },
              "id": {
                "type": "integer"
              },
              "type": {
                "type": "string"
              },
              "site_admin": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "path_with_namespace": {
            "type": "string"
          },
          "visibility": {
            "type": "string"
          },
          "owner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "username": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}

GitHub User, Repositories, and Files API

  • GET /userGet the authenticated user's username
  • GET /users/{username}/reposList user repositories [ask user for type]
  • POST /users/{username}/reposCreate a new repository for a specific user
  • POST /user/reposCreate a new repository
  • GET /repos/{owner}/{repo}/contents/{path}Get contents of a file
  • PUT /repos/{owner}/{repo}/contents/{path}Create or update a file
  • DELETE /repos/{owner}/{repo}/contents/{path}Delete a file
  • GET /repos/{owner}/{repo}/contentsList files in the root of a repository
  • POST /repos/{owner}/{repo}/issuesCreate an issue
  • GET /repos/{owner}/{repo}/issuesList issues in a repository
  • GET /repos/{owner}/{repo}/issues/{issue_number}Get a single issue
  • POST /repos/{owner}/{repo}/issues/{issue_number}/commentsCreate a comment on an issue
  • GET /repos/{owner}/{repo}/issues/{issue_number}/commentsList comments on an issue
  • PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}Update a comment on an issue
  • DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}Delete a comment on an issue
  • POST /repos/{owner}/{repo}/git/refsCreate a branch
  • GET /repos/{owner}/{repo}/branchesList branches in a repository
  • GET /repos/{owner}/{repo}/branches/{branch}Get a single branch
  • PATCH /repos/{owner}/{repo}/branches/{branch}Update a branch
  • DELETE /repos/{owner}/{repo}/git/refs/heads/{branch}Delete a branch
  • POST /repos/{owner}/{repo}/pullsCreate a pull request
  • GET /repos/{owner}/{repo}/pullsList pull requests
  • GET /repos/{owner}/{repo}/pulls/{pull_number}Get a single pull request
  • PATCH /repos/{owner}/{repo}/pulls/{pull_number}Update a pull request [also used to close by updating status]
  • POST /repos/{owner}/{repo}/pulls/{pull_number}/reviewsCreate a pull request review
  • GET /repos/{owner}/{repo}/pulls/{pull_number}/reviewsList reviews on a pull request
  • GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}Get a specific review for a pull request
  • DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}Delete a review comment
  • GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/commentsList comments for a single review
  • POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/repliesCreate a reply to a comment
Ursprüngliches API-Schema
{
  "openapi": "3.1.0",
  "info": {
    "title": "GitHub User, Repositories, and Files API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.github.com"
    }
  ],
  "paths": {
    "/user": {
      "get": {
        "summary": "Get the authenticated user's username",
        "operationId": "getCurrentUser",
        "responses": {
          "200": {
            "description": "Username of the authenticated user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "login": {
                      "type": "string",
                      "description": "The username of the authenticated user"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/users/{username}/repos": {
      "get": {
        "summary": "List user repositories [ask user for type]",
        "operationId": "listUserRepos",
        "parameters": [
          {
            "in": "path",
            "name": "username",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "GitHub username"
          },
          {
            "in": "query",
            "name": "type",
            "required": true,
            "schema": {
              "type": "string",
              "default": "owner"
            },
            "description": "Type of repositories (all, owner, member)"
          },
          {
            "in": "query",
            "name": "sort",
            "schema": {
              "type": "string"
            },
            "description": "The field to sort by (created, updated, pushed, full_name)"
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string"
            },
            "description": "Sort direction (asc or desc)"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of repositories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Repository"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a new repository for a specific user",
        "operationId": "createUserRepository",
        "parameters": [
          {
            "in": "path",
            "name": "username",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The username for whom the repository is being created"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "user-repository"
                  },
                  "description": {
                    "type": "string",
                    "example": "User's personal repository"
                  },
                  "private": {
                    "type": "boolean",
                    "example": true
                  },
                  "auto_init": {
                    "type": "boolean",
                    "example": false
                  },
                  "gitignore_template": {
                    "type": "string",
                    "example": "Python"
                  },
                  "license_template": {
                    "type": "string",
                    "example": "gpl-3.0"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Repository created successfully"
          }
        }
      }
    },
    "/user/repos": {
      "post": {
        "summary": "Create a new repository",
        "operationId": "createRepository",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the repository"
                  },
                  "description": {
                    "type": "string",
                    "description": "A short description of the repository"
                  },
                  "private": {
                    "type": "boolean",
                    "description": "Whether the repository is private"
                  },
                  "auto_init": {
                    "type": "boolean",
                    "description": "Pass true to create an initial commit with empty README"
                  },
                  "gitignore_template": {
                    "type": "string",
                    "description": "Desired GITIGNORE template to apply"
                  },
                  "license_template": {
                    "type": "string",
                    "description": "Desired license template to apply"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Repository created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "format": "int64"
                    },
                    "name": {
                      "type": "string"
                    },
                    "full_name": {
                      "type": "string"
                    },
                    "private": {
                      "type": "boolean"
                    },
                    "owner": {
                      "$ref": "#/components/schemas/User"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/contents/{path}": {
      "get": {
        "summary": "Get contents of a file",
        "operationId": "getFile",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "File path"
          },
          {
            "in": "query",
            "name": "ref",
            "schema": {
              "type": "string"
            },
            "description": "The name of the commit/branch/tag. Default: the repository’s default branch (usually master)"
          }
        ],
        "responses": {
          "200": {
            "description": "File content and metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileContent"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Create or update a file",
        "operationId": "createOrUpdateFile",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "File path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "The commit message."
                  },
                  "content": {
                    "type": "string",
                    "description": "The new file content, using Base64 encoding."
                  },
                  "sha": {
                    "type": "string",
                    "description": "Required if updating a file. The blob SHA of the file being replaced."
                  },
                  "branch": {
                    "type": "string",
                    "description": "The branch name. Defaults to the repository’s default branch."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File successfully created or updated"
          },
          "201": {
            "description": "File successfully created"
          },
          "404": {
            "description": "Resource not found"
          },
          "409": {
            "description": "Conflict"
          },
          "422": {
            "description": "Validation failed, or the endpoint has been spammed"
          }
        }
      },
      "delete": {
        "summary": "Delete a file",
        "operationId": "deleteFile",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "File path"
          }
        ],
        "responses": {
          "204": {
            "description": "File successfully deleted"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/contents": {
      "get": {
        "summary": "List files in the root of a repository",
        "operationId": "listRepoFiles",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "query",
            "name": "ref",
            "schema": {
              "type": "string",
              "default": "master"
            },
            "description": "The name of the commit/branch/tag. Default: master"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of files in the repository root",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/File"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues": {
      "post": {
        "summary": "Create an issue",
        "operationId": "createIssue",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Title of the issue"
                  },
                  "body": {
                    "type": "string",
                    "description": "Detailed description of the issue"
                  },
                  "labels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Labels to associate with this issue"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Issue created successfully"
          }
        }
      },
      "get": {
        "summary": "List issues in a repository",
        "operationId": "listIssues",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed",
                "all"
              ],
              "default": "open"
            },
            "description": "State of the issues to list"
          },
          {
            "in": "query",
            "name": "labels",
            "schema": {
              "type": "string"
            },
            "description": "A comma-separated list of labels to filter by"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of issues"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues/{issue_number}": {
      "get": {
        "summary": "Get a single issue",
        "operationId": "getIssue",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "issue_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Issue number"
          }
        ],
        "responses": {
          "200": {
            "description": "Issue retrieved successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues/{issue_number}/comments": {
      "post": {
        "summary": "Create a comment on an issue",
        "operationId": "createIssueComment",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "issue_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Issue number"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The text of the comment"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Comment on the issue created successfully"
          }
        }
      },
      "get": {
        "summary": "List comments on an issue",
        "operationId": "listIssueComments",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "issue_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Issue number"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of comments for the specified issue"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues/comments/{comment_id}": {
      "patch": {
        "summary": "Update a comment on an issue",
        "operationId": "updateIssueComment",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "comment_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Comment ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The updated text of the comment"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Comment on the issue updated successfully"
          }
        }
      },
      "delete": {
        "summary": "Delete a comment on an issue",
        "operationId": "deleteIssueComment",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "comment_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Comment ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Comment on the issue deleted successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/refs": {
      "post": {
        "summary": "Create a branch",
        "operationId": "createBranch",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ref": {
                    "type": "string",
                    "description": "The name of the new branch (e.g., refs/heads/new-branch)"
                  },
                  "sha": {
                    "type": "string",
                    "description": "The SHA1 value to branch from"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Branch created successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/branches": {
      "get": {
        "summary": "List branches in a repository",
        "operationId": "listBranches",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of branches"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/branches/{branch}": {
      "get": {
        "summary": "Get a single branch",
        "operationId": "getBranch",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "branch",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Branch name"
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the branch"
          }
        }
      },
      "patch": {
        "summary": "Update a branch",
        "operationId": "updateBranch",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "branch",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Branch name"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "new_name": {
                    "type": "string",
                    "description": "New name of the branch"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Branch updated successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/refs/heads/{branch}": {
      "delete": {
        "summary": "Delete a branch",
        "operationId": "deleteBranch",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "branch",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Branch name"
          }
        ],
        "responses": {
          "204": {
            "description": "Branch deleted successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls": {
      "post": {
        "summary": "Create a pull request",
        "operationId": "createPullRequest",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Title of the pull request"
                  },
                  "head": {
                    "type": "string",
                    "description": "The name of the branch where changes are implemented"
                  },
                  "base": {
                    "type": "string",
                    "description": "The name of the branch you want the changes pulled into"
                  },
                  "body": {
                    "type": "string",
                    "description": "Detailed description of the pull request"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pull request created successfully"
          }
        }
      },
      "get": {
        "summary": "List pull requests",
        "operationId": "listPullRequests",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed",
                "all"
              ],
              "default": "open"
            },
            "description": "State of the pull requests to list"
          },
          {
            "in": "query",
            "name": "sort",
            "schema": {
              "type": "string",
              "enum": [
                "created",
                "updated",
                "popularity",
                "long-running"
              ],
              "default": "created"
            },
            "description": "The criteria to sort pull requests"
          },
          {
            "in": "query",
            "name": "direction",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "description": "The direction to sort pull requests"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 3
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of pull requests"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{pull_number}": {
      "get": {
        "summary": "Get a single pull request",
        "operationId": "getPullRequest",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the pull request"
          }
        }
      },
      "patch": {
        "summary": "Update a pull request [also used to close by updating status]",
        "operationId": "updatePullRequest",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Title of the pull request"
                  },
                  "body": {
                    "type": "string",
                    "description": "Detailed description of the pull request"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "open",
                      "closed"
                    ],
                    "description": "State of the pull request"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pull request updated successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{pull_number}/reviews": {
      "post": {
        "summary": "Create a pull request review",
        "operationId": "createPullRequestReview",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The body text of the pull request review"
                  },
                  "event": {
                    "type": "string",
                    "enum": [
                      "APPROVE",
                      "REQUEST_CHANGES",
                      "COMMENT"
                    ],
                    "description": "The review action to perform"
                  },
                  "comments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "The relative path to the file that necessitates a comment"
                        },
                        "position": {
                          "type": "integer",
                          "description": "The position in the diff where the comment should be placed"
                        },
                        "body": {
                          "type": "string",
                          "description": "Text of the comment"
                        }
                      },
                      "required": [
                        "path"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pull request review created successfully"
          }
        }
      },
      "get": {
        "summary": "List reviews on a pull request",
        "operationId": "listPullRequestReviews",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of pull request reviews"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}": {
      "get": {
        "summary": "Get a specific review for a pull request",
        "operationId": "getPullRequestReview",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          },
          {
            "in": "path",
            "name": "review_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Review ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the pull request review"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/comments/{comment_id}": {
      "delete": {
        "summary": "Delete a review comment",
        "operationId": "deleteReviewComment",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "comment_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Review comment ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Review comment deleted successfully"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments": {
      "get": {
        "summary": "List comments for a single review",
        "operationId": "listReviewComments",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          },
          {
            "in": "path",
            "name": "review_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Review ID"
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer",
              "default": 10
            },
            "description": "Number of items per page"
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            },
            "description": "Page number of the results to fetch"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of comments for the specified review"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies": {
      "post": {
        "summary": "Create a reply to a comment",
        "operationId": "createCommentReply",
        "parameters": [
          {
            "in": "path",
            "name": "owner",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository owner's username"
          },
          {
            "in": "path",
            "name": "repo",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository name"
          },
          {
            "in": "path",
            "name": "pull_number",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Pull request number"
          },
          {
            "in": "path",
            "name": "comment_id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "ID of the comment being replied to"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The text of the reply"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Reply to the comment created successfully"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "File": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the file"
          },
          "path": {
            "type": "string",
            "description": "Path of the file relative to repository root"
          },
          "size": {
            "type": "integer",
            "description": "Size of the file in bytes"
          },
          "type": {
            "type": "string",
            "description": "Type of the file (e.g., file, dir)"
          }
        }
      },
      "Repository": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "private": {
            "type": "boolean"
          },
          "owner": {
            "$ref": "#/components/schemas/User"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "login": {
            "type": "string"
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "type": {
            "type": "string"
          },
          "site_admin": {
            "type": "boolean"
          }
        }
      },
      "FileContent": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Content of the file"
          },
          "encoding": {
            "type": "string",
            "description": "Encoding type used for content"
          },
          "url": {
            "type": "string",
            "description": "URL to access the file"
          },
          "sha": {
            "type": "string",
            "description": "SHA of the file"
          }
        }
      },
      "FileInput": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Commit message"
          },
          "content": {
            "type": "string",
            "description": "Base64 encoded content of the file"
          },
          "branch": {
            "type": "string",
            "description": "Branch name"
          },
          "committer": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "author": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}