gitlab

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BranchesEndpoint = "/api/v4/projects/{" + projectIdParam + "}/repository/branches"
View Source
const DeleteBranchEndpoint = "/api/v4/projects/{" + projectIdParam + "}/repository/branches/{" + branchIdParam + "}"
View Source
const MergeRequestsDetailsEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests/{" + mergeRequestIdParam + "}"
View Source
const MergeRequestsEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests"
View Source
const MergeRequestsEventsEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests/{" + mergeRequestIdParam + "}/notes"
View Source
const MergeRequestsMergeEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests/{" + mergeRequestIdParam + "}/merge"
View Source
const MergeRequestsPipelinesEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests/{" + mergeRequestIdParam + "}/pipelines"
View Source
const MergeRequestsRebaseEndpoint = "/api/v4/projects/{" + projectIdParam + "}/merge_requests/{" + mergeRequestIdParam + "}/rebase"

Variables

This section is empty.

Functions

func IsAutomaticMergeAllowed

func IsAutomaticMergeAllowed(pipelines []MergeRequestPipeline) bool

func IsPipelineRunning

func IsPipelineRunning(pipelines []MergeRequestPipeline) bool

Types

type ApiClient

type ApiClient struct {
	// contains filtered or unexported fields
}

func New

func New(gitlabUrl string, projectName string, userName string, apiToken string) *ApiClient

func (*ApiClient) CreateMergeRequest

func (client *ApiClient) CreateMergeRequest(sourceBranch string, targetBranch string, title string) (int, error)

func (*ApiClient) CreateMergeRequestNote

func (client *ApiClient) CreateMergeRequestNote(mergeRequestIid int, noteBody string) error

func (*ApiClient) DeleteBranch

func (client *ApiClient) DeleteBranch(branchName string) error

func (*ApiClient) GetMergeRequestDetails

func (client *ApiClient) GetMergeRequestDetails(mergeRequestIid int) (*MergeRequestDetails, error)

func (*ApiClient) GetMergeRequestPipelines

func (client *ApiClient) GetMergeRequestPipelines(mergeRequestIid int) ([]MergeRequestPipeline, error)

func (*ApiClient) ListBranches

func (client *ApiClient) ListBranches(namePatterns []string) ([]Branch, error)

func (*ApiClient) ListMergeRequestNotes

func (client *ApiClient) ListMergeRequestNotes(mergeRequestIid int) ([]MergeRequestNote, error)

func (*ApiClient) ListMergeRequests

func (client *ApiClient) ListMergeRequests() ([]MergeRequestDetails, error)

func (*ApiClient) MergeMergeRequest

func (client *ApiClient) MergeMergeRequest(mergeRequestIid int, currentSha string) (*MergeRequestDetails, error)

func (*ApiClient) RebaseMergeRequest

func (client *ApiClient) RebaseMergeRequest(mergeRequestIid int, shouldSkipCi bool) error

type Branch

type Branch struct {
	Name    string        `json:"name"`
	Default bool          `json:"default"`
	Commit  CommitDetails `json:"commit"`
}

type CommitDetails

type CommitDetails struct {
	AuthoredDate time.Time `json:"authored_date"`
	Message      string    `json:"message"`
}

type MergeRequestDetails

type MergeRequestDetails struct {
	Id                        int    `json:"id"`
	Iid                       int    `json:"iid"`
	Title                     string `json:"title"`
	State                     string `json:"state"`
	TargetBranch              string `json:"target_branch"`
	SourceBranch              string `json:"source_branch"`
	MergeWhenPipelineSucceeds bool   `json:"merge_when_pipeline_succeeds"`
	MergeStatus               string `json:"merge_status"`
	DetailedMergeStatus       string `json:"detailed_merge_status"`
	HasConflicts              bool   `json:"has_conflicts"`
	ShouldRemoveSourceBranch  bool   `json:"should_remove_source_branch"`
	CommitsBehind             int    `json:"diverged_commits_count"`
	Sha                       string `json:"sha"`
	RebaseInProgress          bool   `json:"rebase_in_progress"`
	RebaseError               string `json:"merge_error"`
}

type MergeRequestNote

type MergeRequestNote struct {
	MergeRequestIid int    `json:"noteable_iid"`
	Body            string `json:"body"`
}

type MergeRequestPipeline

type MergeRequestPipeline struct {
	Id        int       `json:"id"`
	Sha       string    `json:"sha"`
	Ref       string    `json:"ref"`
	Status    string    `json:"status"`
	UpdatedAt time.Time `json:"updated_at"`
	CreatedAt time.Time `json:"created_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL