TRON

TRON · Ações GPT

GitHub User API

API for retrieving GitHub user & repo information.

  • GET /users/{username}Get user information

    Retrieves information for a specified GitHub user.

  • GET /repos/{owner}/{repo}Get repository information

    Retrieves information for a specified GitHub repository.

  • POST /login/oauth/access_tokenGet OAuth access token

    Retrieves the OAuth access token from GitHub.

  • GET /users/{username}/reposGet repository list for a user

    Retrieves a list of repositories for a specified GitHub user.

  • GET /orgs/{username}/reposGet repository list for an organization

    Retrieves a list of repositories for a specified GitHub organization.

  • GET /repos/{owner}/{repo}/contents/{path}Get File Metadata

    Retrieves metadata for a file in a GitHub repository.

  • GET /repos/{owner}/{repo}/git/refs/heads/{base_branch}Get latest commit SHA

    Prepares new branch creation.

  • POST /repos/{owner}/{repo}/git/refsCreate a new branch to your github repository

    Creates a new branch.

  • GET /repos/{owner}/{repo}/branches/{branch}Get new SHA on branch

    Get a new SHA on branch

  • POST /repos/{owner}/{repo}/git/treesCreate a new tree

    Create a new tree with the files you want to add

  • POST /repos/{owner}/{repo}/git/commitsCreate a new commit

    Create a new commit with the new tree

  • PATCH /repos/{owner}/{repo}/git/refs/heads/{branch}Patch a commit

    Patch a commit

Esquema API original
{
  "openapi": "3.0.0",
  "info": {
    "title": "GitHub User API",
    "version": "1.0.1",
    "description": "API for retrieving GitHub user & repo information."
  },
  "servers": [
    {
      "url": "https://api.github.com"
    }
  ],
  "paths": {
    "/users/{username}": {
      "get": {
        "summary": "Get user information",
        "description": "Retrieves information for a specified GitHub user.",
        "operationId": "getUserInfo",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "description": "GitHub username to retrieve information for.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PrivateUser"
                    },
                    {
                      "$ref": "#/components/schemas/PublicUser"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}": {
      "get": {
        "summary": "Get repository information",
        "description": "Retrieves information for a specified GitHub repository.",
        "operationId": "getRepoInfo",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "GitHub owner to retrieve information for.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "GitHub repo to retrieve information for.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Repository"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Repository not found"
          }
        }
      }
    },
    "/login/oauth/access_token": {
      "post": {
        "summary": "Get OAuth access token",
        "description": "Retrieves the OAuth access token from GitHub.",
        "operationId": "getOAuthToken",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with access token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/users/{username}/repos": {
      "get": {
        "summary": "Get repository list for a user",
        "description": "Retrieves a list of repositories for a specified GitHub user.",
        "operationId": "getRepoListUser",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "description": "GitHub user's name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Current page number.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          }
        }
      }
    },
    "/orgs/{username}/repos": {
      "get": {
        "summary": "Get repository list for an organization",
        "description": "Retrieves a list of repositories for a specified GitHub organization.",
        "operationId": "getRepoListOrg",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "description": "GitHub organization name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Number of records per page.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Current page number.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Organization not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/contents/{path}": {
      "get": {
        "operationId": "getFileMetadata",
        "summary": "Get File Metadata",
        "description": "Retrieves metadata for a file in a GitHub repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path to the file within the repository",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileMetadata"
                }
              }
            }
          },
          "404": {
            "description": "File not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/refs/heads/{base_branch}": {
      "get": {
        "summary": "Get latest commit SHA",
        "description": "Prepares new branch creation.",
        "operationId": "getLatestCommitSHA",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository on which to create a new commit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "base_branch",
            "in": "path",
            "required": true,
            "description": "Branch on which to base the a new branch.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SHA"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Branch not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/refs": {
      "post": {
        "summary": "Create a new branch to your github repository",
        "description": "Creates a new branch.",
        "operationId": "postBranch",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository on which to create a new commit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "new_branch_name",
            "in": "path",
            "required": true,
            "description": "Name of the new branch.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ref": {
                    "type": "string",
                    "description": "The reference for the new branch."
                  },
                  "sha": {
                    "type": "string",
                    "description": "The SHA1 value for the base commit."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SHA"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Branch not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/branches/{branch}": {
      "get": {
        "summary": "Get new SHA on branch",
        "description": "Get a new SHA on branch",
        "operationId": "getBranchSHA",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository on which to get SHA.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "description": "Branch on which to get SHA.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/repos/{owner}/{repo}/git/trees": {
      "post": {
        "summary": "Create a new tree",
        "description": "Create a new tree with the files you want to add",
        "operationId": "createTree",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository in which to create a new tree.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "base_tree": {
                    "type": "string",
                    "description": "SHA of the base tree."
                  },
                  "tree": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "File path in the tree."
                        },
                        "mode": {
                          "type": "string",
                          "description": "File mode."
                        },
                        "type": {
                          "type": "string",
                          "description": "Object type (e.g., blob)."
                        },
                        "content": {
                          "type": "string",
                          "description": "Content of the file."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Tree"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Branch not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/commits": {
      "post": {
        "summary": "Create a new commit",
        "description": "Create a new commit with the new tree",
        "operationId": "createCommit",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository in which to create a new tree.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "Message of the commit."
                  },
                  "parents": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "File path in the tree."
                    }
                  },
                  "tree": {
                    "type": "string",
                    "description": "SHA of a tree"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Commit"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Commit not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/refs/heads/{branch}": {
      "patch": {
        "summary": "Patch a commit",
        "description": "Patch a commit",
        "operationId": "updateCommit",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner of the Repository.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "Repository in which to patch.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "description": "Branch in which to patch.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sha": {
                    "type": "string",
                    "description": "Message of the commit."
                  },
                  "force": {
                    "type": "boolean",
                    "description": "If patch should be forced"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Commit"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Commit not found"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PrivateUser": {},
      "PublicUser": {},
      "FileMetadata": {},
      "SHA": {},
      "Tree": {},
      "Commit": {},
      "Repository": {}
    }
  }
}

Gitlab API

API for retrieving Gitlab user & repo information.

  • GET /users?username={username}Get user information

    Retrieves information for a specified Gitlab user.

  • GET /users/{username}/projectsGet user projects

    Retrieves projects assigned to this user.

  • POST /projects/{project}/repository/branchesCreate a new branch

    Create a new branch.

  • POST /projectsCreate a new project

    Create a new project.

Esquema API original
{
  "openapi": "3.0.0",
  "info": {
    "title": "Gitlab API",
    "version": "1.0.1",
    "description": "API for retrieving Gitlab user & repo information."
  },
  "servers": [
    {
      "url": "https://gitlab.com/api/v4"
    }
  ],
  "paths": {
    "/users?username={username}": {
      "get": {
        "summary": "Get user information",
        "description": "Retrieves information for a specified Gitlab user.",
        "operationId": "getUserInfo",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "description": "Gitlab username to retrieve information for.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/User"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          }
        }
      }
    },
    "/users/{username}/projects": {
      "get": {
        "summary": "Get user projects",
        "description": "Retrieves projects assigned to this user.",
        "operationId": "getProjects",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "description": "Gitlab username",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Project"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Project not found"
          }
        }
      }
    },
    "/projects/{project}/repository/branches": {
      "post": {
        "summary": "Create a new branch",
        "description": "Create a new branch.",
        "operationId": "createBranch",
        "parameters": [
          {
            "name": "project",
            "in": "path",
            "required": true,
            "description": "Project name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "description": "New branch name."
                  },
                  "ref": {
                    "type": "string",
                    "description": "Reference Branch."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Branch"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Create Branch was not succesfull"
          }
        }
      }
    },
    "/projects": {
      "post": {
        "summary": "Create a new project",
        "description": "Create a new project.",
        "operationId": "createProject",
        "parameters": [
          {
            "name": "project",
            "in": "path",
            "required": true,
            "description": "Project name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "New branch name."
                  },
                  "description": {
                    "type": "string",
                    "description": "Reference Branch."
                  },
                  "initialize_with_readme": {
                    "type": "boolean",
                    "description": "If you want a readme."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Project"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Create project not found"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "User": {},
      "Project": {},
      "Branch": {}
    }
  }
}