swagger: '2.0' info: title: GitLab access_requests branches API version: v4 description: Operations related to access requests host: gitlab.com produces: - application/json tags: - name: branches description: Operations about branches paths: /api/v4/projects/{id}/repository/branches: get: description: Get a project repository branches produces: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: query name: page description: Current page number type: integer format: int32 default: 1 required: false example: 1 - in: query name: per_page description: Number of items per page type: integer format: int32 default: 20 required: false example: 20 - in: query name: search description: Return list of branches matching the search criteria type: string required: false - in: query name: regex description: Return list of branches matching the regex type: string required: false - in: query name: sort description: Return list of branches sorted by the given field type: string enum: - name_asc - updated_asc - updated_desc required: false - in: query name: page_token description: Name of branch to start the pagination from type: string required: false responses: '200': description: Get a project repository branches schema: type: array items: $ref: '#/definitions/API_Entities_Branch' '404': description: 404 Project Not Found tags: - branches operationId: getApiV4ProjectsIdRepositoryBranches post: description: Create branch produces: - application/json consumes: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - name: postApiV4ProjectsIdRepositoryBranches in: body required: true schema: $ref: '#/definitions/postApiV4ProjectsIdRepositoryBranches' responses: '201': description: Create branch schema: $ref: '#/definitions/API_Entities_Branch' '400': description: Failed to create branch tags: - branches operationId: postApiV4ProjectsIdRepositoryBranches /api/v4/projects/{id}/repository/branches/{branch}: head: description: Check if a branch exists produces: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: path name: branch description: The name of the branch type: string required: true responses: '204': description: No Content '404': description: Not Found tags: - branches operationId: headApiV4ProjectsIdRepositoryBranchesBranch get: description: Get a single repository branch produces: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: path name: branch type: integer format: int32 required: true responses: '200': description: Get a single repository branch schema: $ref: '#/definitions/API_Entities_Branch' '404': description: Branch Not Found tags: - branches operationId: getApiV4ProjectsIdRepositoryBranchesBranch delete: description: Delete a branch produces: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: path name: branch description: The name of the branch type: string required: true responses: '204': description: Delete a branch '404': description: Branch Not Found tags: - branches operationId: deleteApiV4ProjectsIdRepositoryBranchesBranch /api/v4/projects/{id}/repository/branches/{branch}/protect: put: description: Protect a single branch produces: - application/json consumes: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: path name: branch description: The name of the branch type: string required: true - name: putApiV4ProjectsIdRepositoryBranchesBranchProtect in: body required: true schema: $ref: '#/definitions/putApiV4ProjectsIdRepositoryBranchesBranchProtect' responses: '200': description: Protect a single branch schema: $ref: '#/definitions/API_Entities_Branch' '404': description: 404 Branch Not Found tags: - branches operationId: putApiV4ProjectsIdRepositoryBranchesBranchProtect /api/v4/projects/{id}/repository/branches/{branch}/unprotect: put: description: Unprotect a single branch produces: - application/json consumes: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true - in: path name: branch description: The name of the branch type: string required: true responses: '200': description: Unprotect a single branch schema: $ref: '#/definitions/API_Entities_Branch' '404': description: 404 Project Not Found tags: - branches operationId: putApiV4ProjectsIdRepositoryBranchesBranchUnprotect /api/v4/projects/{id}/repository/merged_branches: delete: description: Delete all merged branches produces: - application/json parameters: - in: path name: id description: The ID or URL-encoded path of the project type: string required: true responses: '202': description: 202 Accepted '404': description: 404 Project Not Found tags: - branches operationId: deleteApiV4ProjectsIdRepositoryMergedBranches definitions: API_Entities_Branch: type: object properties: name: type: string example: master commit: $ref: '#/definitions/API_Entities_Commit' merged: type: boolean example: true protected: type: boolean example: true developers_can_push: type: boolean example: true developers_can_merge: type: boolean example: true can_push: type: boolean example: true default: type: boolean example: true web_url: type: string example: https://gitlab.example.com/Commit921/the-dude/-/tree/master required: - name - commit - merged - protected - developers_can_push - developers_can_merge - can_push - default - web_url description: API_Entities_Branch model putApiV4ProjectsIdRepositoryBranchesBranchProtect: type: object properties: developers_can_push: type: boolean description: Flag if developers can push to that branch developers_can_merge: type: boolean description: Flag if developers can merge to that branch description: Protect a single branch postApiV4ProjectsIdRepositoryBranches: type: object properties: branch: type: string description: The name of the branch ref: type: string description: Create branch from commit sha or existing branch required: - branch - ref description: Create branch API_Entities_Commit: type: object properties: id: type: string example: 2695effb5807a22ff3d138d593fd856244e155e7 short_id: type: string example: 2695effb created_at: type: string format: date-time example: '2017-07-26T11:08:53.000+02:00' parent_ids: type: array items: type: string example: - 2a4b78934375d7f53875269ffd4f45fd83a84ebe title: type: string example: Initial commit message: type: string example: Initial commit author_name: type: string example: John Smith author_email: type: string example: john@example.com authored_date: type: string format: date-time example: '2012-05-28T04:42:42-07:00' committer_name: type: string example: Jack Smith committer_email: type: string example: jack@example.com committed_date: type: string format: date-time example: '2012-05-28T04:42:42-07:00' trailers: type: object example: Merged-By: Jane Doe janedoe@gitlab.com extended_trailers: type: object example: Signed-off-by: - John Doe - Jane Doe web_url: type: string example: https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746 required: - id - short_id - created_at - parent_ids - title - message - author_name - author_email - authored_date - committer_name - committer_email - committed_date - trailers - extended_trailers - web_url description: API_Entities_Commit model securityDefinitions: access_token_header: type: apiKey name: PRIVATE-TOKEN in: header access_token_query: type: apiKey name: private_token in: query