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")

def branches(project_id : Int32, params : Hash? = 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"})

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")

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

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)

def protect_branch(project_id : Int32, branch : String, form : Hash? = 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" })

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")