module Gitlab::Client::Branch

Overview

Defines methods related to branch.

See http://docs.gitlab.com/ce/api/branches.html

Direct including types

Defined in:

gitlab/client/branch.cr

Instance Method Summary

Instance Method Detail

def branch(project_id : Int32, branch : String) : JSON::Any #

Get single branch in a project.

  • param [Int32] project_id The ID of a project.
  • param [String] branch The name of a branch.
  • return [JSON::Any] Information about the branch in a project.
client.branch(1, "master")

[View source]
def branches(project_id : Int32, params : Hash | Nil = nil) : JSON::Any #

Gets a list of branches in a project.

  • param [Int32] project_id The ID of a project.
  • param [Hash] params A customizable set of params.
  • option params [String] :page The page number.
  • option params [String] :per_page The number of results per page. default is 20
  • return [JSON::Any] List of branches under a project.
client.branches(1)
client.branches(1, {"per_page" => "10"})

[View source]
def create_branch(project_id : Int32, branch : String, ref : String) : JSON::Any #

Create branch in a project.

  • param [Int32] project_id The ID of a project.
  • param [String] branch The name of a branch.
  • param [String] ref The branch name or commit SHA to create branch from.
  • return [JSON::Any] Information about the created branch in a project.
client.create_branch(1, "develop", "master")
client.create_branch(1, "hotfix/xxx", "9dff773")

[View source]
def delete_branch(project_id : Int32, branch : String) : JSON::Any #

Delete a branch.

  • param [Int32] project_id The ID of a project
  • param [String] branch The name of a branch.
  • return [JSON::Any] Information about the deleted branch.
client.delete_branch(4, 2)

[View source]
def protect_branch(project_id : Int32, branch : String, form : Hash | Nil = nil) : JSON::Any #

Protect branch in a project.

  • param [Int32] project_id The ID of a project.
  • param [String] branch The name of a branch.
  • param [String] ref The branch name or commit SHA to create branch from.
  • return [JSON::Any] Information about protected branch in a project
client.branch(1, "master")
client.protect_branch(5, 'api', { "developers_can_push" => "true" })

[View source]
def unprotect_branch(project_id : Int32, branch : String) : JSON::Any #

Unprotect branch in a project.

  • param [Int32] project_id The ID of a project.
  • param [String] branch The name of a branch.
  • return [JSON::Any] Information about unprotected branch in a project
client.branch(1, "master")

[View source]