gitlab

package
v0.11.5-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gitlab provides a SDK and helpers for the gitlab provider.

Index

Constants

View Source
const (
	// ErrNotFound indicates the resource does not exists.
	ErrNotFound errors.Kind = "resource not found (HTTP Status: 404)"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// BaseURL is the base URL used to construct the final URL of endpoints.
	// If not set, it uses CI_API_V4_URL environment variable.
	BaseURL string

	// HTTPClient sets the HTTP client used and then allows for advanced
	// connection reuse schemes. If not set, a new http.Client is used.
	HTTPClient *http.Client

	// Token is the Gitlab token (usually provided by the GITLAB_TOKEN environment variable.
	Token string

	ProjectID int
	Group     string
	Project   string
}

Client is a Gitlab API HTTP client wrapper.

func (*Client) MRForCommit

func (c *Client) MRForCommit(ctx context.Context, sha string) (mr MR, found bool, err error)

MRForCommit returns the with first Merge Requests associated with the provided commit SHA.

type MR

type MR struct {
	ID             int      `json:"id"`
	IID            int      `json:"iid"`
	ProjectID      int      `json:"project_id"`
	Title          string   `json:"title"`
	Description    string   `json:"description,omitempty"`
	State          string   `json:"state"`
	CreatedAt      string   `json:"created_at,omitempty"`
	UpdatedAt      string   `json:"updated_at,omitempty"`
	TargetBranch   string   `json:"target_branch"`
	SourceBranch   string   `json:"source_branch"`
	Upvotes        int      `json:"upvotes"`
	Downvotes      int      `json:"downvotes"`
	Author         User     `json:"author"`
	Labels         []string `json:"labels"`
	Draft          bool     `json:"draft"`
	WorkInProgress bool     `json:"work_in_progress"`
	SHA            string   `json:"sha"`
	MergeStatus    string   `json:"merge_status"`
	WebURL         string   `json:"web_url"`
}

MR is a Gitlab Merge Request.

type MRs

type MRs []MR

MRs is a list of Gitlab Merge Requests.

type User

type User struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	Name      string `json:"name"`
	WebURL    string `json:"web_url"`
	AvatarURL string `json:"avatar_url"`
	State     string `json:"state"`
}

User is a Gitlab user.

Jump to

Keyboard shortcuts

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