gitlab

package
v3.0.0-...-241310d Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package github implements a simple client to consume gitlab API.

Index

Constants

View Source
const (
	ProjectBadgesApiPath = "/projects/:id/badges"
	ProjectBadgeApiPath  = "/projects/:id/badges/:badge_id"
)
View Source
const (
	ProjectBranchesApiPath       = "/projects/:id/repository/branches"
	ProjectBranchApiPath         = "/projects/:id/repository/branches/:branch"
	ProjectMergedBranchesApiPath = "/projects/:id/repository/merged_branches"
)
View Source
const (
	ProjectCommitBuildsApiPath   = "/projects/:id/repository/commits/:sha/builds"
	ProjectBuildArtifactsApiPath = "/projects/:id/builds/:build_id/artifacts"
)
View Source
const (
	ProjectCommitsApiPath             = "/projects/:id/repository/commits"
	ProjectMergeRequestCommitsApiPath = "/projects/:id/merge_requests/:merge_request_iid/commits"
	ProjectCommitApiPath              = "/projects/:id/repository/commits/:sha"
	ProjectCommitDiffApiPath          = "/projects/:id/repository/commits/:sha/diff"
	ProjectCommitRefsApiPath          = "/projects/:id/repository/commits/:sha/refs"
	ProjectCommitStatusesApiPath      = "/projects/:id/repository/commits/:sha/statuses"
	ProjectCommitMergeRequestsApiPath = "/projects/:id/repository/commits/:sha/merge_requests"
)
View Source
const (
	ProjectDeployKeysApiPath = "/projects/:id/keys"
	ProjectDeployKeyApiPath  = "/projects/:id/keys/:key_id"
)
View Source
const (
	ProjectEnvironmentsApiPath = "/projects/:id/environments"
	ProjectEnvironmentApiPath  = "/projects/:id/environments/:environment_id"
)
View Source
const (
	GroupsApiPath        = "/groups"
	GroupApiPath         = "/groups/:id"
	GroupProjectsApiPath = "/groups/:id/projects"
)
View Source
const (
	ProjectHooksApiPath = "/projects/:id/hooks"
	ProjectHookApiPath  = "/projects/:id/hooks/:hook_id"
)
View Source
const (
	ProjectJobsApiPath         = "/projects/:id/jobs"
	ProjectPipelineJobsApiPath = "/projects/:id/pipelines/:pipeline_id/jobs"
	ProjectJobApiPath          = "/projects/:id/jobs/:job_id"
	ProjectJobTraceApiPath     = "/projects/:id/jobs/:job_id/trace"
	CancelProjectJobApiPath    = "/projects/:id/jobs/:job_id/cancel"
	RetryProjectJobApiPath     = "/projects/:id/jobs/:job_id/retry"
	EraseProjectJobApiPath     = "/projects/:id/jobs/:job_id/erase"
)
View Source
const (
	MambersApiPath = "/:type/:id/members"          // List group or project team members
	MamberApiPath  = "/:type/:id/members/:user_id" // Get group or project team member
)
View Source
const (
	MergeRequestsApiPath                  = "/merge_requests"
	ProjectMergeRequestsApiPath           = "/projects/:id/merge_requests"
	GroupMergeRequestsApiPath             = "/groups/:id/merge_requests"
	ProjectMergeRequestApiPath            = "/projects/:id/merge_requests/:merge_request_iid"                                 // Get information about a single merge request
	ProjectMergeRequestChangesApiPath     = "/projects/:id/merge_requests/:merge_request_id/changes"                          // Shows information about the merge request including its files and changes
	ProjectMergeRequestMergeApiPath       = "/projects/:id/merge_requests/:merge_request_id/merge"                            // Merge changes submitted with MR
	ProjectMergeRequestCancelMergeApiPath = "/projects/:id/merge_requests/:merge_request_id/cancel_merge_when_build_succeeds" // Cancel Merge When Build Succeeds
	ProjectMergeRequestCommentsApiPath    = "/projects/:id/merge_requests/:merge_request_id/comments"                         // Lists all comments associated with a merge request
)
View Source
const (
	NamespacesApiPath = "/namespaces"
	NamespaceApiPath  = "/namespaces/:id"
)
View Source
const (
	ProjectIssueNotesApiPath        = "/projects/:id/issues/:issue_iid/notes"
	ProjectIssueNoteApiPath         = "/projects/:id/issues/:issue_iid/notes/:note_id"
	ProjectSnippetNotesApiPath      = "/projects/:id/snippets/:snippet_id/notes"
	ProjectSnippetNoteApiPath       = "/projects/:id/snippets/:snippet_id/notes/:note_id"
	ProjectMergeRequestNotesApiPath = "/projects/:id/merge_requests/:merge_request_iid/notes"
	ProjectMergeRequestNoteApiPath  = "/projects/:id/merge_requests/:merge_request_iid/notes/:note_id"
	GroupEpicNotesApiPath           = "/groups/:id/epics/:epic_id/notes"
	GroupEpicNoteApiPath            = "/groups/:id/epics/:epic_id/notes/:note_id"
)
View Source
const (
	ProjectPipelinesApiPath = "/projects/:id/pipelines"
	ProjectPipelineApiPath  = "/projects/:id/pipelines/:pipeline_id"
)
View Source
const (
	ProjectsApiPath      = "/projects"            // Get a list of projects owned by the authenticated user
	ProjectApiPath       = "/projects/:id"        // Get a specific project, identified by project ID or NAME
	StarProjectApiPath   = "/projects/:id/star"   // Stars a given project. Returns status code 304 if the project is already starred
	UnstarProjectApiPath = "/projects/:id/unstar" // Unstars a given project. Returns status code 304 if the project is not starred
	ProjectEventsApiPath = "/projects/:id/events" // Get project events
)
View Source
const (
	ProtectedBranchesApiPath = "/projects/:id/protected_branches"                    // Gets a list of protected branches from a project.
	ProtectBranchApiPath     = "/projects/:id/repository/branches/:branch/protect"   // Protects a single project repository branch.
	UnprotectBranchApiPath   = "/projects/:id/repository/branches/:branch/unprotect" // Unprotects a single project repository branch.
)
View Source
const (
	RepositoryTagsApiPath    = "/projects/:id/repository/tags"       // List project repository tags
	RepositoryTreeApiPath    = "/projects/:id/repository/tree"       // List repository tree
	RawRepositoryFileApiPath = "/projects/:id/repository/blobs/:sha" // Get raw file content for specific commit/branch
)
View Source
const (
	RunnersApiPath        = "/runners"                          // Get current users runner list.
	AllRunnersApiPath     = "/runners/all"                      // Get ALL runners list.
	RunnerApiPath         = "/runners/:id"                      // Get a single runner.
	ProjectRunnersApiPath = "/projects/:project_id/runners"     // Get ALL project runners.
	ProjectRunnerApiPath  = "/projects/:project_id/runners/:id" // Get a single project runner.
)
View Source
const (
	CurrentUserSshKeysApiPath = "/user/keys"
	UserSshKeysApiPath        = "/users/:id/keys"
	CurrentUserSshKeyApiPath  = "/user/keys/:key_id"
	UserSshKeyApiPath         = "/user/:id/keys/:key_id"
)
View Source
const (
	UsersApiPath       = "/users"
	UserApiPath        = "/users/:id"
	CurrentUserApiPath = "/user"
)
View Source
const (
	VariablesApiPath = "/:type/:id/variables"
	VariableApiPath  = "/:type/:id/variables/:key"
)
View Source
const (
	DashboardFeedPath = "/dashboard.atom"
)
View Source
const (
	ProjectIssuesApiPath = "/projects/:id/issues"
)

Variables

View Source
var CiEnvMapping map[string]*CiEnvKey

Functions

func AggregateJobs

func AggregateJobs(jobs []*Job) map[int]map[string]map[string][]*Job

Aggregate jobs by:

  • pipeline
  • stage
  • job name

The resulting aggregation can be used to built something similar as the GitLab's UI used to display pipeline details.

func PopulateCiInfo

func PopulateCiInfo(out interface{}) error

Types

type AcceptMergeRequestRequest

type AcceptMergeRequestRequest struct {
	MergeCommitMessage       string `json:"merge_commit_message,omitempty"`
	ShouldRemoveSourceBranch bool   `json:"should_remove_source_branch,omitempty"`
	MergedWhenBuildSucceeds  bool   `json:"merged_when_build_succeeds,omitempty"`
}

type AccessLevelInfo

type AccessLevelInfo struct {
	AccessLevel            int    `json:"access_level,omitempty"`
	AccessLevelDescription string `json:"access_level_description,omitempty"`
	GroupId                int    `json:"group_id,omitempty"`
	UserId                 int    `json:"user_id,omitempty"`
}

type ActivityFeed

type ActivityFeed struct {
	Title   string        `xml:"title" json:"title"`
	Id      string        `xml:"id" json:"id"`
	Link    []Link        `xml:"link" json:"link"`
	Updated time.Time     `xml:"updated,attr" json:"updated"`
	Entries []*FeedCommit `xml:"entry" json:"entries"`
}

type AddMergeRequestRequest

type AddMergeRequestRequest struct {
	SourceBranch    string   `json:"source_branch"`
	TargetBranch    string   `json:"target_branch"`
	AssigneeId      int      `json:"assignee_id,omitempty"`
	Title           string   `json:"title"`
	Description     string   `json:"description,omitempty"`
	TargetProjectId int      `json:"target_project_id,omitempty"`
	Lables          []string `json:"lables,omitempty"`
}

type ArtifactsFile

type ArtifactsFile struct {
	Filename string `json:"filename"`
	Size     int    `json:"size"`
}

type Badge

type Badge struct {
	Id               int    `json:"id" yaml:"id"`
	LinkUrl          string `json:"link_url" yaml:"link_url"`
	ImageUrl         string `json:"image_url" yaml:"image_url"`
	RenderedLinkUrl  string `json:"rendered_link_url" yaml:"rendered_link_url"`
	RenderedImageUrl string `json:"rendered_image_url" yaml:"rendered_image_url"`
	Kind             string `json:"kind" yaml:"kind"`
}

func (*Badge) RenderJson

func (b *Badge) RenderJson(w io.Writer) error

func (*Badge) RenderYaml

func (b *Badge) RenderYaml(w io.Writer) error

type BadgeCollection

type BadgeCollection struct {
	Items []*Badge
}

func (*BadgeCollection) RenderJson

func (c *BadgeCollection) RenderJson(w io.Writer) error

func (*BadgeCollection) RenderYaml

func (c *BadgeCollection) RenderYaml(w io.Writer) error

type Branch

type Branch struct {
	Name               string        `json:"name,omitempty" yaml:"name,omitempty"`
	Protected          bool          `json:"protected,omitempty" yaml:"protected,omitempty"`
	Merged             bool          `json:"merged,omitempty" yaml:"merged,omitempty"`
	DevelopersCanPush  bool          `json:"developers_can_push,omitempty" yaml:"developers_can_push,omitempty"`
	DevelopersCanMerge bool          `json:"developers_can_merge,omitempty" yaml:"developers_can_merge,omitempty"`
	Commit             *BranchCommit `json:"commit,omitempty" yaml:"commit,omitempty"`
}

func (*Branch) RenderJson

func (b *Branch) RenderJson(w io.Writer) error

func (*Branch) RenderYaml

func (b *Branch) RenderYaml(w io.Writer) error

type BranchCollection

type BranchCollection struct {
	Items []*Branch
}

func (*BranchCollection) RenderJson

func (c *BranchCollection) RenderJson(w io.Writer) error

func (*BranchCollection) RenderYaml

func (c *BranchCollection) RenderYaml(w io.Writer) error

type BranchCommit

type BranchCommit struct {
	Id               string  `json:"id,omitempty" yaml:"id,omitempty"`
	Tree             string  `json:"tree,omitempty" yaml:"tree,omitempty"`
	AuthoredDateRaw  string  `json:"authored_date,omitempty" yaml:"authored_date,omitempty"`
	CommittedDateRaw string  `json:"committed_date,omitempty" yaml:"committed_date,omitempty"`
	Message          string  `json:"message,omitempty" yaml:"message,omitempty"`
	Author           *Person `json:"author,omitempty" yaml:"author,omitempty"`
	Committer        *Person `json:"committer,omitempty" yaml:"committer,omitempty"`
}

type BranchesOptions

type BranchesOptions struct {
	PaginationOptions
	SortOptions

	// Return list of branches matching the search criteria
	Search string `url:"search,omitempty"`
}

type Build

type Build struct {
	Id            int           `json:"id"`
	ArtifactsFile ArtifactsFile `json:"artifacts_file"`
	Commit        Commit        `json:"commit,omitempty"`
	CreatedAt     string        `json:"created_at"`
	DownloadURL   string        `json:"download_url"`
	FinishedAt    string        `json:"finished_at"`
	Name          string        `json:"name"`
	Ref           string        `json:"ref"`
	Stage         string        `json:"stage"`
	StartedAt     string        `json:"started_at"`
	Status        string        `json:"status"`
	Tag           bool          `json:"tag"`
	User          User          `json:"user"`
	When          string        `json:"when,omitempty"`
	Manual        bool          `json:"manual,omitempty"`
}

type ChangeItem

type ChangeItem struct {
	OldPath     string `json:"old_path,omitempty"`
	NewPath     string `json:"new_path,omitempty"`
	AMode       string `json:"a_mode,omitempty"`
	BMode       string `json:"b_mode,omitempty"`
	Diff        string `json:"diff,omitempty"`
	NewFile     bool   `json:"new_file,omitempty"`
	RenamedFile bool   `json:"renamed_file,omitempty"`
	DeletedFile bool   `json:"deleted_file,omitempty"`
}

type ChangeItemCollection

type ChangeItemCollection struct {
	Items []*ChangeItem
}

func (*ChangeItemCollection) RenderJson

func (c *ChangeItemCollection) RenderJson(w io.Writer) error

func (*ChangeItemCollection) RenderYaml

func (c *ChangeItemCollection) RenderYaml(w io.Writer) error

type CiEnvKey

type CiEnvKey struct {
	FromGitlabVersion string
	FromRunnerVersion string
	Hide              bool
}

type CiInfo

type CiInfo struct {
	Chat struct {
		Input   string `env:"CHAT_INPUT"   json:"input"   yaml:"input"`
		Channel string `env:"CHAT_CHANNEL" json:"channel" yaml:"channel"`
	} `json:"chat" yaml:"chat"`
	Deploy struct {
		User string `env:"CI_DEPLOY_USER" json:"user" yaml:"user"`
	} `json:"deploy" yaml:"deploy"`
	Project struct {
		Id         string `env:"CI_PROJECT_ID"         json:"id"         yaml:"id"`
		Dir        string `env:"CI_PROJECT_DIR"        json:"dir"        yaml:"dir"`
		Name       string `env:"CI_PROJECT_NAME"       json:"name"       yaml:"name"`
		Namespace  string `env:"CI_PROJECT_NAMESPACE"  json:"namespace"  yaml:"namespace"`
		Path       string `env:"CI_PROJECT_PATH"       json:"path"       yaml:"path"`
		PathSlug   string `env:"CI_PROJECT_PATH_SLUG"  json:"path_slug"  yaml:"path_slug"`
		Url        string `env:"CI_PROJECT_URL"        json:"url"        yaml:"url"`
		Visibility string `env:"CI_PROJECT_VISIBILITY" json:"visibility" yaml:"visibility"`
	} `json:"project" yaml:"project"`
	Commit struct {
		Sha         string `env:"CI_COMMIT_SHA"         json:"sha"         yaml:"sha"`
		RefName     string `env:"CI_COMMIT_REF_NAME"    json:"ref_name"    yaml:"ref_name"`
		RefSlug     string `env:"CI_COMMIT_REF_SLUG"    json:"ref_slug"    yaml:"ref_slug"`
		Tag         string `env:"CI_COMMIT_TAG"         json:"tag"         yaml:"tag"`
		Message     string `env:"CI_COMMIT_MESSAGE"     json:"message"     yaml:"message"`
		Title       string `env:"CI_COMMIT_TITLE"       json:"title"       yaml:"title"`
		Description string `env:"CI_COMMIT_DESCRIPTION" json:"description" yaml:"description"`
	} `json:"commit" yaml:"commit"`
	Job struct {
		Id    string `env:"CI_JOB_ID"    json:"id"    yaml:"id"`
		Name  string `env:"CI_JOB_NAME"  json:"name"  yaml:"name"`
		Stage string `env:"CI_JOB_STAGE" json:"stage" yaml:"stage"`
		Url   string `env:"CI_JOB_URL"   json:"url"   yaml:"url"`
	} `json:"job" yaml:"job"`
	Pipeline struct {
		Id     string `env:"CI_PIPELINE_ID"     json:"id"     yaml:"id"`
		Iid    string `env:"CI_PIPELINE_IID"    json:"iid"    yaml:"iid"`
		Source string `env:"CI_PIPELINE_SOURCE" json:"source" yaml:"source"`
		Url    string `env:"CI_PIPELINE_URL"    json:"url"    yaml:"url"`
	} `json:"pipeline" yaml:"pipeline"`
	Runner struct {
		Id             string `env:"CI_RUNNER_ID"              json:"id"              yaml:"id"`
		Description    string `env:"CI_RUNNER_DESCRIPTION"     json:"description"     yaml:"description"`
		Tags           string `env:"CI_RUNNER_TAGS"            json:"tags"            yaml:"tags"`
		Version        string `env:"CI_RUNNER_VERSION"         json:"version"         yaml:"version"`
		Revision       string `env:"CI_RUNNER_REVISION"        json:"revision"        yaml:"revision"`
		ExecutableArch string `env:"CI_RUNNER_EXECUTABLE_ARCH" json:"executable_arch" yaml:"executable_arch"`
	} `json:"runner" yaml:"runner"`
	User struct {
		Id    string `env:"GITLAB_USER_ID"    json:"id"    yaml:"id"`
		Email string `env:"GITLAB_USER_EMAIL" json:"email" yaml:"email"`
		Login string `env:"GITLAB_USER_LOGIN" json:"login" yaml:"login"`
		Name  string `env:"GITLAB_USER_NAME"  json:"name"  yaml:"name"`
	} `json:"user" yaml:"user"`
	Server struct {
		Name     string `env:"CI_SERVER_NAME"     json:"name"     yaml:"name"`
		Revision string `env:"CI_SERVER_REVISION" json:"revision" yaml:"revision"`
		Version  string `env:"CI_SERVER_VERSION"  json:"version"  yaml:"version"`
	} `json:"server" yaml:"server"`
	Registry struct {
		Registry string `env:"CI_REGISTRY"       json:"registry" yaml:"registry"`
		Image    string `env:"CI_REGISTRY_IMAGE" json:"image"    yaml:"image"`
		User     string `env:"CI_REGISTRY_USER"  json:"user"     yaml:"user"`
	} `json:"registry" yaml:"registry"`
	Environment struct {
		Name string `env:"CI_ENVIRONMENT_NAME" json:"name" yaml:"name"`
		Slug string `env:"CI_ENVIRONMENT_SLUG" json:"slug" yaml:"slug"`
		Url  string `env:"CI_ENVIRONMENT_URL"  json:"url"  yaml:"url"`
	} `json:"environment" yaml:"environment"`
}

func GetCiInfo

func GetCiInfo() (*CiInfo, error)

func (*CiInfo) RenderJson

func (i *CiInfo) RenderJson(w io.Writer) error

func (*CiInfo) RenderYaml

func (i *CiInfo) RenderYaml(w io.Writer) error

type Commit

type Commit struct {
	MinimalCommit    `yaml:",inline"`
	AuthoredDateRaw  string   `json:"authored_date" yaml:"authored_date"`
	CommitterName    string   `json:"committer_name" yaml:"committer_name"`
	CommitterEmail   string   `json:"committer_email" yaml:"committer_email"`
	CommittedDateRaw string   `json:"committed_date" yaml:"committed_date"`
	ParentIds        []string `json:"parent_ids" yaml:"parent_ids"`
	Status           string   `json:"status,omitempty" yaml:"status,omitempty"`
	Stats            struct {
		Additions int `json:"additions" yaml:"additions"`
		Deletions int `json:"deletions" yaml:"deletions"`
		Total     int `json:"total" yaml:"total"`
	} `json:"stats,omitempty" yaml:"stats,omitempty"`
	LastPipeline struct {
		Id     int    `json:"id" yaml:"id"`
		Ref    string `json:"ref" yaml:"ref"`
		Sha    string `json:"sha" yaml:"sha"`
		Status string `json:"status" yaml:"status"`
	} `json:"last_pipeline,omitempty" yaml:"last_pipeline,omitempty"`
}

func (*Commit) RenderJson

func (c *Commit) RenderJson(w io.Writer) error

func (*Commit) RenderYaml

func (c *Commit) RenderYaml(w io.Writer) error

type CommitCollection

type CommitCollection struct {
	Items []*Commit
}

func (*CommitCollection) RenderJson

func (c *CommitCollection) RenderJson(w io.Writer) error

func (*CommitCollection) RenderYaml

func (c *CommitCollection) RenderYaml(w io.Writer) error

type CommitRef

type CommitRef struct {
	Name string `json:"name" yaml:"name"`
	Type string `json:"type" yaml:"type"`
}

type CommitRefCollection

type CommitRefCollection struct {
	Items []*CommitRef
}

func (*CommitRefCollection) RenderJson

func (c *CommitRefCollection) RenderJson(w io.Writer) error

func (*CommitRefCollection) RenderYaml

func (c *CommitRefCollection) RenderYaml(w io.Writer) error

type CommitStatus

type CommitStatus struct {
	Id           int    `json:"id" yaml:"id"`
	Ref          string `json:"ref" yaml:"ref"`
	Status       string `json:"status" yaml:"status"`
	CreatedAtRaw string `json:"created_at" yaml:"created_at"`
	StartedAtRaw string `json:"started_at" yaml:"started_at"`
	Name         string `json:"name" yaml:"name"`
	AllowFailure bool   `json:"allow_failure" yaml:"allow_failure"`
	Author       struct {
		Id        int    `json:"id"`
		Name      string `json:"name"`
		Username  string `json:"username"`
		State     string `json:"state"`
		WebUrl    string `json:"web_url"`
		AvatarUrl string `json:"avatar_url"`
	} `json:"author" yaml:"author"`
	Description   string `json:"description" yaml:"description"`
	Sha           string `json:"sha" yaml:"sha"`
	TargetURL     string `json:"target_url" yaml:"target_url"`
	FinishedAtRaw string `json:"finished_at" yaml:"finished_at"`
}

type CommitStatusCollection

type CommitStatusCollection struct {
	Items []*CommitStatus
}

func (*CommitStatusCollection) RenderJson

func (c *CommitStatusCollection) RenderJson(w io.Writer) error

func (*CommitStatusCollection) RenderYaml

func (c *CommitStatusCollection) RenderYaml(w io.Writer) error

type CommitsOptions

type CommitsOptions struct {
	PaginationOptions

	// The file path
	Path string `url:"path,omitempty"`

	// Only commits after or on this date will be returned in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ
	RefName string `url:"ref_name,omitempty"`

	// Only commits after or on this date will be returned in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ
	Since string `url:"since,omitempty"`

	// Only commits before or on this date will be returned in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ
	Until string `url:"until,omitempty"`

	// Retrieve every commit from the repository
	All bool `url:"all,omitempty"`

	// Stats about each commit will be added to the response
	WithStats bool `url:"with_stats,omitempty"`
}

type Environment

type Environment struct {
	Id                    int `json:"id,omitempty" yaml:"id,omitempty"`
	EnvironmentAddPayload `yaml:",inline"`
	Slug                  string              `json:"slug,omitempty" yaml:"slug,omitempty"`
	Project               *EnvironmentProject `json:"project,omitempty" yaml:"project,omitempty"`
}

func (*Environment) RenderJson

func (e *Environment) RenderJson(w io.Writer) error

func (*Environment) RenderYaml

func (e *Environment) RenderYaml(w io.Writer) error

type EnvironmentAddPayload

type EnvironmentAddPayload struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	ExternalUrl string `json:"external_url,omitempty" yaml:"external_url,omitempty"`
}

type EnvironmentCollection

type EnvironmentCollection struct {
	Items []*Environment
}

func (*EnvironmentCollection) RenderJson

func (c *EnvironmentCollection) RenderJson(w io.Writer) error

func (*EnvironmentCollection) RenderYaml

func (c *EnvironmentCollection) RenderYaml(w io.Writer) error

type EnvironmentProject

type EnvironmentProject struct {
	Id                int      `json:"id,omitempty" yaml:"id,omitempty"`
	Name              string   `json:"name,omitempty" yaml:"name,omitempty"`
	NameWithNamespace string   `json:"name_with_namespace,omitempty" yaml:"name_with_namespace,omitempty"`
	Path              string   `json:"path,omitempty" yaml:"path,omitempty"`
	PathWithNamespace string   `json:"path_with_namespace,omitempty" yaml:"path_with_namespace,omitempty"`
	Description       string   `json:"description" yaml:"description"`
	CreatedAtRaw      string   `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	DefaultBranch     string   `json:"default_branch" yaml:"default_branch"`
	TagList           []string `json:"tag_list" yaml:"tag_list"`
	SshUrlToRepo      string   `json:"ssh_url_to_repo" yaml:"ssh_url_to_repo"`
	HttpUrlToRepo     string   `json:"http_url_to_repo" yaml:"http_url_to_repo"`
	WebUrl            string   `json:"web_url" yaml:"web_url"`
	AvatarUrl         string   `json:"avatar_url" yaml:"avatar_url"`
	ForksCount        int      `json:"forks_count" yaml:"forks_count"`
	StarCount         int      `json:"star_count" yaml:"star_count"`
	LastActivityAtRaw string   `json:"last_activity_at,omitempty" yaml:"last_activity_at,omitempty"`
}

type FeedCommit

type FeedCommit struct {
	Id      string    `xml:"id" json:"id"`
	Title   string    `xml:"title" json:"title"`
	Link    []Link    `xml:"link" json:"link"`
	Updated time.Time `xml:"updated" json:"updated"`
	Author  Person    `xml:"author" json:"author"`
	Summary string    `xml:"summary" json:"summary"`
}

type Gitlab

type Gitlab struct {
	BaseUrl      string
	ApiPath      string
	RepoFeedPath string
	Token        string
	Client       *http.Client
}

func NewGitlab

func NewGitlab(baseUrl, apiPath, token string) *Gitlab

NewGitlab generates a new gitlab service

func (*Gitlab) Activity

func (g *Gitlab) Activity() (ActivityFeed, error)

func (*Gitlab) AddCurrentUserSshKey

func (g *Gitlab) AddCurrentUserSshKey(title, key string) (*ResponseMeta, error)

func (*Gitlab) AddGroup

func (g *Gitlab) AddGroup(group *GroupAddPayload) (*GroupWithDetails, *ResponseMeta, error)

func (*Gitlab) AddGroupEpicNote

func (g *Gitlab) AddGroupEpicNote(groupId string, epicId int, note *NoteAddPayload) (*Note, *ResponseMeta, error)

func (*Gitlab) AddGroupVariable

func (g *Gitlab) AddGroupVariable(groupId string, variable *Variable) (*Variable, *ResponseMeta, error)

func (*Gitlab) AddIssue

func (g *Gitlab) AddIssue(projectId string, req *IssueRequest) (issue *Issue, meta *ResponseMeta, err error)

func (*Gitlab) AddMergeRequest

func (g *Gitlab) AddMergeRequest(req *AddMergeRequestRequest) (*MergeRequest, error)

Creates a new merge request.

POST /projects/:id/merge_requests

Parameters:

id               The ID of a project

func (*Gitlab) AddProject

func (g *Gitlab) AddProject(project *ProjectAddPayload) (*Project, *ResponseMeta, error)

func (*Gitlab) AddProjectBadge

func (g *Gitlab) AddProjectBadge(projectId string, badge *Badge) (*Badge, *ResponseMeta, error)

func (*Gitlab) AddProjectBranch

func (g *Gitlab) AddProjectBranch(projectId string, branchName, ref string) (*Branch, *ResponseMeta, error)

func (*Gitlab) AddProjectDeployKey

func (g *Gitlab) AddProjectDeployKey(id, title, key string) (*ResponseMeta, error)

Add deploy key to project.

POST /projects/:id/keys

Parameters:

id    The ID of a project
title The key title
key   The key value

func (*Gitlab) AddProjectEnvironment

func (g *Gitlab) AddProjectEnvironment(projectId string, environment *EnvironmentAddPayload) (*Environment, *ResponseMeta, error)

func (*Gitlab) AddProjectHook

func (g *Gitlab) AddProjectHook(projectId string, hook *HookAddPayload) (*Hook, *ResponseMeta, error)

func (*Gitlab) AddProjectIssueNote

func (g *Gitlab) AddProjectIssueNote(projectId string, issueIid int, note *NoteAddPayload) (*Note, *ResponseMeta, error)

func (*Gitlab) AddProjectMergeRequestNote

func (g *Gitlab) AddProjectMergeRequestNote(projectId string, mergeRequestIid int, note *NoteAddPayload) (*Note, *ResponseMeta, error)

func (*Gitlab) AddProjectSnippetNote

func (g *Gitlab) AddProjectSnippetNote(projectId string, snippetId int, note *NoteAddPayload) (*Note, *ResponseMeta, error)

func (*Gitlab) AddProjectVariable

func (g *Gitlab) AddProjectVariable(projectId string, variable *Variable) (*Variable, *ResponseMeta, error)

func (*Gitlab) AddUserSshKey

func (g *Gitlab) AddUserSshKey(userId, title, key string) (*ResponseMeta, error)

func (*Gitlab) CancelProjectJob

func (g *Gitlab) CancelProjectJob(projectId string, jobId int) (*Job, *ResponseMeta, error)

func (*Gitlab) CurrentUser

func (g *Gitlab) CurrentUser() (*User, *ResponseMeta, error)

func (*Gitlab) CurrentUserSshKey

func (g *Gitlab) CurrentUserSshKey(id string) (*SshKey, *ResponseMeta, error)

func (*Gitlab) CurrentUserSshKeys

func (g *Gitlab) CurrentUserSshKeys(o *PaginationOptions) (*SshKeyCollection, *ResponseMeta, error)

func (*Gitlab) DeleteCurrentUserSshKey

func (g *Gitlab) DeleteCurrentUserSshKey(keyId int) (*ResponseMeta, error)

func (*Gitlab) DeleteRunner

func (g *Gitlab) DeleteRunner(id int) (*Runner, *ResponseMeta, error)

func (*Gitlab) DeleteUserSshKey

func (g *Gitlab) DeleteUserSshKey(userId, keyId int) (*ResponseMeta, error)

func (*Gitlab) DisableProjectRunner

func (g *Gitlab) DisableProjectRunner(projectId string, id int) (*Runner, *ResponseMeta, error)

func (*Gitlab) EditMergeRequest

func (g *Gitlab) EditMergeRequest(mr *MergeRequest) error

Updates an existing merge request.

PUT /projects/:id/merge_request/:merge_request_id

Parameters:

id               The ID of a project

func (*Gitlab) EnableProjectRunner

func (g *Gitlab) EnableProjectRunner(projectId string, id int) (*Runner, *ResponseMeta, error)

func (*Gitlab) EraseProjectJob

func (g *Gitlab) EraseProjectJob(projectId string, jobId int) (*Job, *ResponseMeta, error)

func (*Gitlab) Group

func (g *Gitlab) Group(id string, withCustomAttributes bool) (*GroupWithDetails, *ResponseMeta, error)

func (*Gitlab) GroupEpicNote

func (g *Gitlab) GroupEpicNote(groupId string, epicId, noteId int) (*Note, *ResponseMeta, error)

func (*Gitlab) GroupEpicNotes

func (g *Gitlab) GroupEpicNotes(groupId string, epicId int, o *NotesOptions) (*NoteCollection, *ResponseMeta, error)

func (*Gitlab) GroupMembers

func (g *Gitlab) GroupMembers(groupId string, o *MembersOptions) (*MemberCollection, *ResponseMeta, error)

func (*Gitlab) GroupMergeRequests

func (g *Gitlab) GroupMergeRequests(groupId int, o *MergeRequestsOptions) (*MergeRequestCollection, *ResponseMeta, error)

func (*Gitlab) GroupProjects

func (g *Gitlab) GroupProjects(id string) ([]*Project, *ResponseMeta, error)

func (*Gitlab) GroupVariable

func (g *Gitlab) GroupVariable(groupId, varKey string) (*Variable, *ResponseMeta, error)

func (*Gitlab) GroupVariables

func (g *Gitlab) GroupVariables(groupId string, o *PaginationOptions) (*VariableCollection, *ResponseMeta, error)

func (*Gitlab) Groups

func (*Gitlab) MergeRequests

func (*Gitlab) Namespace

func (g *Gitlab) Namespace(id string) (*Namespace, *ResponseMeta, error)

func (*Gitlab) Namespaces

func (*Gitlab) Project

func (g *Gitlab) Project(id string, withStatistics bool) (*Project, *ResponseMeta, error)

func (*Gitlab) ProjectBadge

func (g *Gitlab) ProjectBadge(projectId string, badgeId int) (*Badge, *ResponseMeta, error)

func (*Gitlab) ProjectBadges

func (g *Gitlab) ProjectBadges(projectId string, o *PaginationOptions) (*BadgeCollection, *ResponseMeta, error)

func (*Gitlab) ProjectBranch

func (g *Gitlab) ProjectBranch(projectId, branchName string) (*Branch, *ResponseMeta, error)

func (*Gitlab) ProjectBranches

func (g *Gitlab) ProjectBranches(projectId string, o *BranchesOptions) (*BranchCollection, *ResponseMeta, error)

func (*Gitlab) ProjectBuildArtifacts

func (g *Gitlab) ProjectBuildArtifacts(id, buildId string) (io.ReadCloser, error)

func (*Gitlab) ProjectCommit

func (g *Gitlab) ProjectCommit(projectId, commitSha string) (*Commit, *ResponseMeta, error)

func (*Gitlab) ProjectCommitBuilds

func (g *Gitlab) ProjectCommitBuilds(id, sha1 string) ([]*Build, *ResponseMeta, error)

func (*Gitlab) ProjectCommitDiff

func (g *Gitlab) ProjectCommitDiff(projectId, sha string, o *PaginationOptions) (*ChangeItemCollection, *ResponseMeta, error)

func (*Gitlab) ProjectCommitMergeRequests

func (g *Gitlab) ProjectCommitMergeRequests(projectId, sha string, o *PaginationOptions) (*MergeRequestCollection, *ResponseMeta, error)

func (*Gitlab) ProjectCommitRefs

func (g *Gitlab) ProjectCommitRefs(projectId, sha string, o *PaginationOptions) (*CommitRefCollection, *ResponseMeta, error)

func (*Gitlab) ProjectCommitStatuses

func (g *Gitlab) ProjectCommitStatuses(projectId, sha string, o *PaginationOptions) (*CommitStatusCollection, *ResponseMeta, error)

func (*Gitlab) ProjectCommits

func (g *Gitlab) ProjectCommits(projectId string, o *CommitsOptions) (*CommitCollection, *ResponseMeta, error)

func (*Gitlab) ProjectDeployKey

func (g *Gitlab) ProjectDeployKey(id, keyId string) (*SshKey, *ResponseMeta, error)

Get single project deploy key.

GET /projects/:id/keys/:key_id

Parameters:

id    The ID of a project
keyId The ID of a key

func (*Gitlab) ProjectDeployKeys

func (g *Gitlab) ProjectDeployKeys(id string) ([]*SshKey, *ResponseMeta, error)

Get list of project deploy keys.

GET /projects/:id/keys

Parameters:

id The ID of a project

func (*Gitlab) ProjectEnvironments

func (g *Gitlab) ProjectEnvironments(projectId string, o *PaginationOptions) (*EnvironmentCollection, *ResponseMeta, error)

func (*Gitlab) ProjectHook

func (g *Gitlab) ProjectHook(projectId, hookId string) (*Hook, *ResponseMeta, error)

func (*Gitlab) ProjectHooks

func (g *Gitlab) ProjectHooks(projectId string) (*HookCollection, *ResponseMeta, error)

func (*Gitlab) ProjectIssueNote

func (g *Gitlab) ProjectIssueNote(projectId string, issueIid, noteId int) (*Note, *ResponseMeta, error)

func (*Gitlab) ProjectIssueNotes

func (g *Gitlab) ProjectIssueNotes(projectId string, issueIid int, o *NotesOptions) (*NoteCollection, *ResponseMeta, error)

func (*Gitlab) ProjectJob

func (g *Gitlab) ProjectJob(projectId string, jobId int) (*Job, *ResponseMeta, error)

func (*Gitlab) ProjectJobTrace

func (g *Gitlab) ProjectJobTrace(projectId string, jobId int) (string, *ResponseMeta, error)

func (*Gitlab) ProjectJobs

func (g *Gitlab) ProjectJobs(projectId string, o *JobsOptions) (*JobCollection, *ResponseMeta, error)

func (*Gitlab) ProjectMembers

func (g *Gitlab) ProjectMembers(projectId string, o *MembersOptions) (*MemberCollection, *ResponseMeta, error)

func (*Gitlab) ProjectMergeRequest

func (g *Gitlab) ProjectMergeRequest(projectId string, mergeRequestIid int) (*MergeRequest, *ResponseMeta, error)

func (*Gitlab) ProjectMergeRequestAccept

func (g *Gitlab) ProjectMergeRequestAccept(id, merge_request_id string, req *AcceptMergeRequestRequest) (*MergeRequest, error)

Merge changes submitted with MR.

PUT /projects/:id/merge_request/:merge_request_id/merge

Parameters:

id               The ID of a project
merge_request_id The ID of a merge request

func (*Gitlab) ProjectMergeRequestCancelMerge

func (g *Gitlab) ProjectMergeRequestCancelMerge(id, merge_request_id string) (*MergeRequest, *ResponseMeta, error)

Cancel Merge When Build Succeeds.

PUT /projects/:id/merge_request/:merge_request_id/cancel_merge_when_build_succeeds

Parameters:

id               The ID of a project
merge_request_id The ID of a merge request

func (*Gitlab) ProjectMergeRequestChanges

func (g *Gitlab) ProjectMergeRequestChanges(id, merge_request_id string) (*MergeRequestChanges, *ResponseMeta, error)

Get information about the merge request including its files and changes.

GET /projects/:id/merge_request/:merge_request_id/changes

Parameters:

id               The ID of a project
merge_request_id The ID of a merge request

func (*Gitlab) ProjectMergeRequestCommits

func (g *Gitlab) ProjectMergeRequestCommits(projectId string, mergeRequestIid int, o *PaginationOptions) (*MinimalCommitCollection, *ResponseMeta, error)

func (*Gitlab) ProjectMergeRequestNote

func (g *Gitlab) ProjectMergeRequestNote(projectId string, mergeRequestIid, noteId int) (*Note, *ResponseMeta, error)

func (*Gitlab) ProjectMergeRequestNotes

func (g *Gitlab) ProjectMergeRequestNotes(projectId string, mergeRequestIid int, o *NotesOptions) (*NoteCollection, *ResponseMeta, error)

func (*Gitlab) ProjectMergeRequests

func (g *Gitlab) ProjectMergeRequests(projectId string, o *MergeRequestsOptions) (*MergeRequestCollection, *ResponseMeta, error)

func (*Gitlab) ProjectPipeline

func (g *Gitlab) ProjectPipeline(projectId, pipelineId string) (*PipelineWithDetails, *ResponseMeta, error)

func (*Gitlab) ProjectPipelineJobs

func (g *Gitlab) ProjectPipelineJobs(projectId string, pipelineId int, o *JobsOptions) (*JobCollection, *ResponseMeta, error)

func (*Gitlab) ProjectPipelines

func (g *Gitlab) ProjectPipelines(projectId string, o *PipelinesOptions) (*PipelineCollection, *ResponseMeta, error)

func (*Gitlab) ProjectRunners

func (g *Gitlab) ProjectRunners(projectId string, page, per_page int) ([]*Runner, *ResponseMeta, error)

func (*Gitlab) ProjectSnippetNote

func (g *Gitlab) ProjectSnippetNote(projectId string, snippetId, noteId int) (*Note, *ResponseMeta, error)

func (*Gitlab) ProjectSnippetNotes

func (g *Gitlab) ProjectSnippetNotes(projectId string, snippetId int, o *NotesOptions) (*NoteCollection, *ResponseMeta, error)

func (*Gitlab) ProjectVariable

func (g *Gitlab) ProjectVariable(projectId, varKey string) (*Variable, *ResponseMeta, error)

func (*Gitlab) ProjectVariables

func (g *Gitlab) ProjectVariables(projectId string, o *PaginationOptions) (*VariableCollection, *ResponseMeta, error)

func (*Gitlab) Projects

func (*Gitlab) ProtectBranch

func (g *Gitlab) ProtectBranch(projectId, branchName string) (*ResponseMeta, error)

func (*Gitlab) ProtectedBranches

func (g *Gitlab) ProtectedBranches(projectId string, o *PaginationOptions) ([]*ProtectedBranch, *ResponseMeta, error)

func (*Gitlab) RemoveGroup

func (g *Gitlab) RemoveGroup(id string) (string, *ResponseMeta, error)

func (*Gitlab) RemoveGroupEpicNote

func (g *Gitlab) RemoveGroupEpicNote(groupId string, epicId, noteId int) (*ResponseMeta, error)

func (*Gitlab) RemoveGroupVariable

func (g *Gitlab) RemoveGroupVariable(groupId, varKey string) (*ResponseMeta, error)

func (*Gitlab) RemoveProject

func (g *Gitlab) RemoveProject(id string) (string, *ResponseMeta, error)

func (*Gitlab) RemoveProjectBadge

func (g *Gitlab) RemoveProjectBadge(projectId, badgeId string) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectBranch

func (g *Gitlab) RemoveProjectBranch(projectId, branchName string) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectDeployKey

func (g *Gitlab) RemoveProjectDeployKey(id, keyId string) (*ResponseMeta, error)

Remove deploy key from project

DELETE /projects/:id/keys/:key_id

Parameters:

id    The ID of a project
keyId The ID of a key

func (*Gitlab) RemoveProjectEnvironment

func (g *Gitlab) RemoveProjectEnvironment(projectId string, id int) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectHook

func (g *Gitlab) RemoveProjectHook(projectId, hookId string) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectIssueNote

func (g *Gitlab) RemoveProjectIssueNote(projectId string, issueIid, noteId int) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectMergeRequestNote

func (g *Gitlab) RemoveProjectMergeRequestNote(projectId string, mergeRequestIid, noteId int) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectMergedBranches

func (g *Gitlab) RemoveProjectMergedBranches(projectId string) (string, *ResponseMeta, error)

func (*Gitlab) RemoveProjectSnippetNote

func (g *Gitlab) RemoveProjectSnippetNote(projectId string, snippetId, noteId int) (*ResponseMeta, error)

func (*Gitlab) RemoveProjectVariable

func (g *Gitlab) RemoveProjectVariable(projectId, varKey string) (*ResponseMeta, error)

func (*Gitlab) RemoveUser

func (g *Gitlab) RemoveUser(id string) (*ResponseMeta, error)

func (*Gitlab) RepoActivityFeed

func (g *Gitlab) RepoActivityFeed(feedPath string) ActivityFeed

func (*Gitlab) RepoRawFile

func (g *Gitlab) RepoRawFile(id, sha, filepath string) ([]byte, *ResponseMeta, error)

Get Raw file content

func (*Gitlab) RepoTags

func (g *Gitlab) RepoTags(id string) ([]*Tag, *ResponseMeta, error)

Get a list of repository tags from a project, sorted by name in reverse alphabetical order.

GET /projects/:id/repository/tags

Parameters:

id The ID of a project

Usage:

tags, err := gitlab.RepoTags("your_projet_id")
if err != nil {
	fmt.Println(err.Error())
}
for _, tag := range tags {
	fmt.Printf("%+v\n", tag)
}

func (*Gitlab) RepoTree

func (g *Gitlab) RepoTree(id, path, refName string) ([]*TreeNode, *ResponseMeta, error)

Get a list of repository files and directories in a project.

GET /projects/:id/repository/tree

Parameters:

    id (required) The ID of a project
    path (optional) The path inside repository. Used to get contend of subdirectories
		ref_name (optional) The name of a repository branch or tag or if not given the default branch

Usage:

pass nil when not using optional parameters

func (*Gitlab) ResourceUrl

func (g *Gitlab) ResourceUrl(path string, params map[string]string) *url.URL

ResourceUrl builds an url for given resource path.

It replaces path placeholders with values from `params`:

/whatever/:id => /whatever/1

func (*Gitlab) ResourceUrlQ

func (g *Gitlab) ResourceUrlQ(path string, params map[string]string, qs interface{}) *url.URL

ResourceUrlQ generates an url and appends a query string to it if available

func (*Gitlab) RetryProjectJob

func (g *Gitlab) RetryProjectJob(projectId string, jobId int) (*Job, *ResponseMeta, error)

func (*Gitlab) Runner

func (g *Gitlab) Runner(id int) (*RunnerWithDetails, *ResponseMeta, error)

func (*Gitlab) Runners

func (*Gitlab) StarProject

func (g *Gitlab) StarProject(id string) (*Project, *ResponseMeta, error)

func (*Gitlab) UnprotectBranch

func (g *Gitlab) UnprotectBranch(projectId, branchName string) (*ResponseMeta, error)

func (*Gitlab) UnstarProject

func (g *Gitlab) UnstarProject(id string) (*Project, *ResponseMeta, error)

func (*Gitlab) UpdateGroup

func (g *Gitlab) UpdateGroup(id string, group *GroupUpdatePayload) (*GroupWithDetails, error)

func (*Gitlab) UpdateProject

func (g *Gitlab) UpdateProject(id string, project *Project) (*Project, *ResponseMeta, error)

func (*Gitlab) UpdateRunner

func (g *Gitlab) UpdateRunner(id int, runner *Runner) (*Runner, *ResponseMeta, error)

func (*Gitlab) User

func (g *Gitlab) User(id string) (*User, *ResponseMeta, error)

func (*Gitlab) UserSshKeys

func (g *Gitlab) UserSshKeys(userId int, o *PaginationOptions) (*SshKeyCollection, *ResponseMeta, error)

func (*Gitlab) Users

type Group

type Group struct {
	Id                        int        `json:"id,omitempty" yaml:"id,omitempty"`
	Name                      string     `json:"name" yaml:"name"`
	Path                      string     `json:"path" yaml:"path"`
	Description               string     `json:"description" yaml:"description"`
	Visibility                Visibility `json:"visibility" yaml:"visibility"`
	LfsEnabled                bool       `json:"lfs_enabled" yaml:"lfs_enabled"`
	RequestAccessEnabled      bool       `json:"request_access_enabled" yaml:"request_access_enabled"`
	ParentId                  int        `json:"parent_id" yaml:"parent_id"`
	SharedRunnersMinutesLimit int        `json:"shared_runners_minutes_limit" yaml:"shared_runners_minutes_limit"`
	AvatarUrl                 string     `json:"avatar_url" yaml:"avatar_url"`
	WebURL                    string     `json:"web_url" yaml:"web_url"`
	FullName                  string     `json:"full_name" yaml:"full_name"`
	FullPath                  string     `json:"full_path" yaml:"full_path"`
}

func (*Group) RenderJson

func (g *Group) RenderJson(w io.Writer) error

func (*Group) RenderYaml

func (g *Group) RenderYaml(w io.Writer) error

type GroupAddPayload

type GroupAddPayload struct {
	Name                      string     `json:"name"`
	Path                      string     `json:"path"`
	Description               string     `json:"description,omitempty"`
	Visibility                Visibility `json:"visibility,omitempty"`
	LfsEnabled                bool       `json:"lfs_enabled,omitempty"`
	RequestAccessEnabled      bool       `json:"request_access_enabled,omitempty"`
	ParentId                  int        `json:"parent_id,omitempty"`
	SharedRunnersMinutesLimit int        `json:"shared_runners_minutes_limit,omitempty"`
}

type GroupCollection

type GroupCollection struct {
	Items []*Group
}

func (*GroupCollection) RenderJson

func (c *GroupCollection) RenderJson(w io.Writer) error

func (*GroupCollection) RenderYaml

func (c *GroupCollection) RenderYaml(w io.Writer) error

type GroupUpdatePayload

type GroupUpdatePayload struct {
	Id                        int        `json:"id,omitempty"`
	Name                      string     `json:"name"`
	Path                      string     `json:"path"`
	Description               string     `json:"description,omitempty"`
	MembershipLock            bool       `json:"membership_lock,omitempty"`
	ShareWithGroupLock        bool       `json:"share_with_group_lock,omitempty"`
	Visibility                Visibility `json:"visibility,omitempty"`
	LfsEnabled                bool       `json:"lfs_enabled,omitempty"`
	RequestAccessEnabled      bool       `json:"request_access_enabled,omitempty"`
	SharedRunnersMinutesLimit int        `json:"shared_runners_minutes_limit,omitempty"`
}

type GroupWithDetails

type GroupWithDetails struct {
	Group          `yaml:",inline"`
	Projects       []*Project `json:"projects" yaml:"projects"`
	SharedProjects []*Project `json:"shared_projects" yaml:"shared_projects"`
}

type GroupsOptions

type GroupsOptions struct {
	PaginationOptions
	SortOptions

	// Skip the group IDs passed
	SkipGroups []string `url:"skip_groups,omitempty,comma"`

	// Show all the groups you have access to
	// (defaults to false for authenticated users, true for admin)
	AllAvailable bool `url:"all_available,omitempty"`

	// Return the list of authorized groups matching the search criteria
	Search string `url:"search,omitempty"`

	// Include group statistics (admins only)
	Statistics bool `url:"statistics,omitempty"`

	// Include custom attributes in response (admins only)
	WithCustomAttributes bool `url:"with_custom_attributes,omitempty"`

	// Limit to groups owned by the current user
	Owned bool `url:"owned,omitempty"`
}

type Hook

type Hook struct {
	HookAddPayload
	Id        int    `json:"id,omitempty" yaml:"id,omitempty"`
	ProjectId int    `json:"project_id,omitempty" yaml:"project_id,omitempty"`
	CreatedAt string `json:"created_at,omitempty" yaml:"created_at,omitempty"`
}

func (*Hook) RenderJson

func (h *Hook) RenderJson(w io.Writer) error

func (*Hook) RenderYaml

func (h *Hook) RenderYaml(w io.Writer) error

type HookAddPayload

type HookAddPayload struct {
	Url                      string `json:"url" yaml:"url"`
	PushEvents               bool   `json:"push_events" yaml:"push_events"`
	IssuesEvents             bool   `json:"issues_events" yaml:"issues_events"`
	ConfidentialIssuesEvents bool   `json:"confidential_issues_events" yaml:"confidential_issues_events"`
	MergeRequestsEvents      bool   `json:"merge_requests_events" yaml:"merge_requests_events"`
	TagPushEvents            bool   `json:"tag_push_events" yaml:"tag_push_events"`
	NoteEvents               bool   `json:"note_events" yaml:"note_events"`
	JobEvents                bool   `json:"job_events" yaml:"job_events"`
	PipelineEvents           bool   `json:"pipeline_events" yaml:"pipeline_events"`
	WikiPageEvents           bool   `json:"wiki_page_events" yaml:"wiki_page_events"`
	EnableSslVerification    bool   `json:"enable_ssl_verification" yaml:"enable_ssl_verification"`
	Token                    string `json:"token" yaml:"token"`
}

type HookCollection

type HookCollection struct {
	Items []*Hook
}

func (*HookCollection) RenderJson

func (c *HookCollection) RenderJson(w io.Writer) error

func (*HookCollection) RenderYaml

func (c *HookCollection) RenderYaml(w io.Writer) error

type HookObjAttr

type HookObjAttr struct {
	Id              int       `json:"id,omitempty"`
	Ref             string    `json:"ref,omitempty"`
	Tag             bool      `json:"tag,omitempty"`
	Sha             string    `json:"sha,omitempty"`
	BeforeSha       string    `json:"before_sha,omitempty"`
	Title           string    `json:"title,omitempty"`
	AssigneeId      int       `json:"assignee_id,omitempty"`
	AuthorId        int       `json:"author_id,omitempty"`
	ProjectId       int       `json:"project_id,omitempty"`
	Status          string    `json:"status,omitempty"`
	Stages          []string  `json:"stages,omitempty"`
	CreatedAt       time.Time `json:"created_at,omitempty"`
	UpdatedAt       time.Time `json:"updated_at,omitempty"`
	FinishedAt      time.Time `json:"finished_at,omitempty"`
	Duration        int       `json:"duration,omitempty"`
	Position        int       `json:"position,omitempty"`
	BranchName      string    `json:"branch_name,omitempty"`
	Description     string    `json:"description,omitempty"`
	MilestoneId     int       `json:"milestone_id,omitempty"`
	State           string    `json:"state,omitempty"`
	IId             int       `json:"iid,omitempty"`
	TargetBranch    string    `json:"target_branch,omitempty"`
	SourceBranch    string    `json:"source_branch,omitempty"`
	SourceProjectId int       `json:"source_project_id,omitempty"`
	StCommits       string    `json:"st_commits,omitempty"`
	StDiffs         string    `json:"st_diffs,omitempty"`
	MergeStatus     string    `json:"merge_status,omitempty"`
	TargetProjectId int       `json:"target_project_id,omitempty"`
}

type HookPayload

type HookPayload struct {
	Before            string       `json:"before,omitempty"`
	After             string       `json:"after,omitempty"`
	Ref               string       `json:"ref,omitempty"`
	UserId            int          `json:"user_id,omitempty"`
	UserName          string       `json:"user_name,omitempty"`
	ProjectId         int          `json:"project_id,omitempty"`
	Project           *hProject    `json:"project,omitempty"`
	Repository        *hRepository `json:"repository,omitempty"`
	Commits           []hCommit    `json:"commits,omitempty"`
	Commit            *hCommit     `json:"commit,omitempty"`
	TotalCommitsCount int          `json:"total_commits_count,omitempty"`
	ObjectKind        string       `json:"object_kind,omitempty"`
	ObjectAttributes  *HookObjAttr `json:"object_attributes,omitempty"`
	Builds            []*Build     `json:"builds,omitempty"`
}

func ParseHook

func ParseHook(payload []byte) (*HookPayload, error)

ParseHook parses hook payload from GitLab

func (*HookPayload) Branch

func (h *HookPayload) Branch() string

Branch returns current branch for pipeline and push event hook payload This function returns empty string for any other events

func (*HookPayload) Head

func (h *HookPayload) Head() hCommit

Head returns the latest changeset for push event hook payload

type Issue

type Issue struct {
	Id          int        `json:"id"`
	IId         int        `json:"iid"`
	ProjectId   int        `json:"project_id,omitempty"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	Labels      []string   `json:"labels,omitempty"`
	Milestone   *Milestone `json:"milestone,omitempty"`
	Assignee    *User      `json:"assignee,omitempty"`
	Author      *User      `json:"author,omitempty"`
	State       string     `json:"state,omitempty"`
	CreatedAt   string     `json:"created_at,omitempty"`
	UpdatedAt   string     `json:"updated_at,omitempty"`
}

type IssueRequest

type IssueRequest struct {
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	AssigneeId  int    `json:"assignee_id,omitempty"`
	MilestoneId int    `json:"milestone_id,omitempty"`
	Labels      string `json:"labels,omitempty"`
}

type Job

type Job struct {
	Id                int     `json:"id,omitempty" yaml:"id,omitempty"`
	Name              string  `json:"name,omitempty" yaml:"name,omitempty"`
	Status            string  `json:"status,omitempty" yaml:"status,omitempty"`
	Stage             string  `json:"stage,omitempty" yaml:"stage,omitempty"`
	Ref               string  `json:"ref,omitempty" yaml:"ref,omitempty"`
	Tag               bool    `json:"tag,omitempty" yaml:"tag,omitempty"`
	Coverage          float64 `json:"coverage,omitempty" yaml:"coverage,omitempty"`
	CreatedAt         string  `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	StartedAt         string  `json:"started_at,omitempty" yaml:"started_at,omitempty"`
	FinishedAt        string  `json:"finished_at,omitempty" yaml:"finished_at,omitempty"`
	Duration          float64 `json:"duration,omitempty" yaml:"duration,omitempty"`
	ArtifactsExpireAt string  `json:"artifacts_expire_at,omitempty" yaml:"artifacts_expire_at,omitempty"`
	Pipeline          struct {
		Id     int    `json:"id,omitempty" yaml:"id,omitempty"`
		Status string `json:"status,omitempty" yaml:"status,omitempty"`
		Ref    string `json:"ref,omitempty" yaml:"ref,omitempty"`
		Sha    string `json:"sha,omitempty" yaml:"sha,omitempty"`
	} `json:"pipeline" yaml:"pipeline"`
	User struct {
		Id           int    `json:"id,omitempty" yaml:"id,omitempty"`
		Name         string `json:"name,omitempty" yaml:"name,omitempty"`
		Username     string `json:"username,omitempty" yaml:"username,omitempty"`
		State        string `json:"state,omitempty" yaml:"state,omitempty"`
		AvatarUrl    string `json:"avatar_url,omitempty" yaml:"avatar_url,omitempty"`
		WebUrl       string `json:"web_url,omitempty" yaml:"web_url,omitempty"`
		CreatedAt    string `json:"created_at,omitempty" yaml:"created_at,omitempty"`
		Bio          string `json:"bio,omitempty" yaml:"bio,omitempty"`
		Location     string `json:"location,omitempty" yaml:"location,omitempty"`
		Skype        string `json:"skype,omitempty" yaml:"skype,omitempty"`
		Linkedin     string `json:"linkedin,omitempty" yaml:"linkedin,omitempty"`
		Twitter      string `json:"twitter,omitempty" yaml:"twitter,omitempty"`
		WebsiteUrl   string `json:"website_url,omitempty" yaml:"website_url,omitempty"`
		Organization string `json:"organization,omitempty" yaml:"organization,omitempty"`
	} `json:"user" yaml:"user"`
	Commit struct {
		Id             string   `json:"id,omitempty" yaml:"id,omitempty"`
		ShortId        string   `json:"short_id,omitempty" yaml:"short_id,omitempty"`
		Title          string   `json:"title,omitempty" yaml:"title,omitempty"`
		Message        string   `json:"message,omitempty" yaml:"message,omitempty"`
		AuthorName     string   `json:"author_name,omitempty" yaml:"author_name,omitempty"`
		AuthorEmail    string   `json:"author_email,omitempty" yaml:"author_email,omitempty"`
		CommitterName  string   `json:"committer_name,omitempty" yaml:"committer_name,omitempty"`
		CommitterEmail string   `json:"committer_email,omitempty" yaml:"committer_email,omitempty"`
		CreatedAt      string   `json:"created_at,omitempty" yaml:"created_at,omitempty"`
		AuthoredDate   string   `json:"authored_date,omitempty" yaml:"authored_date,omitempty"`
		CommittedDate  string   `json:"committed_date,omitempty" yaml:"committed_date,omitempty"`
		ParentIds      []string `json:"parent_ids,omitempty" yaml:"parent_ids,omitempty"`
	} `json:"commit" yaml:"commit"`
	Runner struct {
		Id          int    `json:"id,omitempty" yaml:"id,omitempty"`
		Name        string `json:"name,omitempty" yaml:"name,omitempty"`
		Description string `json:"description,omitempty" yaml:"description,omitempty"`
		IpAddress   string `json:"ip_address,omitempty" yaml:"ip_address,omitempty"`
		Active      bool   `json:"active,omitempty" yaml:"active,omitempty"`
		IsShared    bool   `json:"is_shared,omitempty" yaml:"is_shared,omitempty"`
		Online      bool   `json:"online,omitempty" yaml:"online,omitempty"`
		Status      string `json:"status,omitempty" yaml:"status,omitempty"`
	} `json:"runner" yaml:"runner"`
}

func (*Job) RenderJson

func (j *Job) RenderJson(w io.Writer) error

func (*Job) RenderYaml

func (j *Job) RenderYaml(w io.Writer) error

type JobCollection

type JobCollection struct {
	Items []*Job
}

func (*JobCollection) RenderJson

func (c *JobCollection) RenderJson(w io.Writer) error

func (*JobCollection) RenderYaml

func (c *JobCollection) RenderYaml(w io.Writer) error

type JobsOptions

type JobsOptions struct {
	PaginationOptions
	SortOptions

	// The scope of jobs to show, one or array of:
	// created, pending, running, failed, success, canceled, skipped, manual;
	// showing all jobs if none provided
	Scope []string `url:"scope,omitempty"`
}
type Link struct {
	Rel  string `xml:"rel,attr,omitempty" json:"rel"`
	Href string `xml:"href,attr" json:"href"`
}

type Member

type Member struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	Username    string `json:"username"`
	State       string `json:"state"`
	AvatarUrl   string `json:"avatar_url"`
	WebUrl      string `json:"web_url"`
	AccessLevel int    `json:"access_level"`
	ExpiresAt   string `json:"expires_at"`
}

func (*Member) RenderJson

func (m *Member) RenderJson(w io.Writer) error

func (*Member) RenderYaml

func (m *Member) RenderYaml(w io.Writer) error

type MemberCollection

type MemberCollection struct {
	Items []*Member
}

func (*MemberCollection) RenderJson

func (c *MemberCollection) RenderJson(w io.Writer) error

func (*MemberCollection) RenderYaml

func (c *MemberCollection) RenderYaml(w io.Writer) error

type MembersOptions

type MembersOptions struct {
	PaginationOptions

	Query string `url:"query,omitempty"`
}

type MergeRequest

type MergeRequest struct {
	Id                        int               `json:"id,omitempty" yaml:"id,omitempty"`
	Iid                       int               `json:"iid,omitempty" yaml:"iid,omitempty"`
	ProjectId                 int               `json:"project_id,omitempty" yaml:"project_id,omitempty"`
	WebUrl                    string            `json:"web_url,omitempty" yaml:"web_url,omitempty"`
	Title                     string            `json:"title,omitempty" yaml:"title,omitempty"`
	Description               string            `json:"description,omitempty" yaml:"description,omitempty"`
	State                     string            `json:"state,omitempty" yaml:"state,omitempty"`
	CreatedAt                 string            `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	UpdatedAt                 string            `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
	SourceBranch              string            `json:"source_branch,omitempty" yaml:"source_branch,omitempty"`
	TargetBranch              string            `json:"target_branch,omitempty" yaml:"target_branch,omitempty"`
	Upvotes                   int               `json:"upvotes,omitempty" yaml:"upvotes,omitempty"`
	Downvotes                 int               `json:"downvotes,omitempty" yaml:"downvotes,omitempty"`
	SourceProjectID           int               `json:"source_project_id,omitempty" yaml:"source_project_id,omitempty"`
	TargetProjectID           int               `json:"target_project_id,omitempty" yaml:"target_project_id,omitempty"`
	Sha                       string            `json:"sha,omitempty" yaml:"sha,omitempty"`
	MergeCommitSha            string            `json:"merge_commit_sha,omitempty" yaml:"merge_commit_sha,omitempty"`
	WorkInProgress            bool              `json:"work_in_progress,omitempty" yaml:"work_in_progress,omitempty"`
	MergeStatus               string            `json:"merge_status,omitempty" yaml:"merge_status,omitempty"`
	Squash                    bool              `json:"squash,omitempty" yaml:"squash,omitempty"`
	MergeWhenPipelineSucceeds bool              `json:"merge_when_pipeline_succeeds,omitempty" yaml:"merge_when_pipeline_succeeds,omitempty"`
	ShouldRemoveSourceBranch  bool              `json:"should_remove_source_branch,omitempty" yaml:"should_remove_source_branch,omitempty"`
	ForceRemoveSourceBranch   bool              `json:"force_remove_source_branch,omitempty" yaml:"force_remove_source_branch,omitempty"`
	DiscussionLocked          bool              `json:"discussion_locked,omitempty" yaml:"discussion_locked,omitempty"`
	UserNotesCount            int               `json:"user_notes_count,omitempty" yaml:"user_notes_count,omitempty"`
	Pipeline                  *Pipeline         `json:"pipeline,omitempty" yaml:"pipeline,omitempty"`
	Author                    *MergeRequestUser `json:"author,omitempty" yaml:"author,omitempty"`
	Assignee                  *MergeRequestUser `json:"assignee,omitempty" yaml:"assignee,omitempty"`
	Labels                    []string          `json:"labels,omitempty" yaml:"labels,omitempty"`
	TimeStats                 *TimeStats        `json:"time_stats,omitempty" yaml:"time_stats,omitempty"`
	Milestone                 *Milestone        `json:"milestone,omitempty" yaml:"milestone,omitempty"`
}

func (*MergeRequest) RenderJson

func (mr *MergeRequest) RenderJson(w io.Writer) error

func (*MergeRequest) RenderYaml

func (mr *MergeRequest) RenderYaml(w io.Writer) error

type MergeRequestChanges

type MergeRequestChanges struct {
	*MergeRequest
	CreatedAt       string       `json:"created_at,omitempty"`
	UpdatedAt       string       `json:"updated_at,omitempty"`
	SourceProjectId int          `json:"source_project_id,omitempty"`
	TargetProjectId int          `json:"target_project_id,omitempty"`
	Labels          []string     `json:"labels,omitempty"`
	Milestone       Milestone    `json:"milestone,omitempty"`
	Changes         []ChangeItem `json:"changes,omitempty"`
}

type MergeRequestCollection

type MergeRequestCollection struct {
	Items []*MergeRequest
}

func (*MergeRequestCollection) RenderJson

func (c *MergeRequestCollection) RenderJson(w io.Writer) error

func (*MergeRequestCollection) RenderYaml

func (c *MergeRequestCollection) RenderYaml(w io.Writer) error

type MergeRequestScope

type MergeRequestScope string
const (
	MergeRequestScopeCreatedByMe        MergeRequestScope = "created_by_me"
	LegacyMergeRequestScopeCreatedByMe  MergeRequestScope = "created-by-me"
	MergeRequestScopeAssignedToMe       MergeRequestScope = "assigned_to_me"
	LegacyMergeRequestScopeAssignedToMe MergeRequestScope = "assigned-to-me"
	MergeRequestScopeAll                MergeRequestScope = "all"
)

For versions before 11.0, use the now deprecated created-by-me or assigned-to-me scopes

type MergeRequestUser

type MergeRequestUser struct {
	Id        int    `json:"id,omitempty" yaml:"id,omitempty"`
	Username  string `json:"username,omitempty" yaml:"username,omitempty"`
	Name      string `json:"name,omitempty" yaml:"name,omitempty"`
	State     string `json:"state,omitempty" yaml:"state,omitempty"`
	AvatarUrl string `json:"avatar_url,omitempty" yaml:"avatar_url,omitempty"`
	WebUrl    string `json:"web_url,omitempty" yaml:"web_url,omitempty"`
}

type MergeRequestsOptions

type MergeRequestsOptions struct {
	PaginationOptions
	SortOptions

	// Return the request having the given iid
	// only available for generic merge requests API endpoint
	Iids []int `url:"iids,omitempty,comma"`

	// Return all merge requests or just those that are
	// opened, closed, locked, or merged
	State string `url:"state,omitempty"`

	// Return merge requests for a specific milestone
	Milestone string `url:"milestone,omitempty"`

	// If simple, returns the iid, URL, title, description,
	// and basic state of merge request
	View string `url:"view,omitempty"`

	// Return merge requests matching a comma separated
	// list of labels
	Labels []string `url:"labels,omitempty,comma"`

	// Return merge requests created on or after the given time
	CreatedAfter *time.Time `url:"created_after,omitempty"`

	// Return merge requests created on or before the given time
	CreatedBefore *time.Time `url:"created_before,omitempty"`

	// Return merge requests updated on or after the given time
	UpdatedAfter *time.Time `url:"updated_after,omitempty"`

	// Return merge requests updated on or before the given time
	UpdatedBefore *time.Time `url:"updated_before,omitempty"`

	// Return merge requests with the given source branch
	SourceBranch string `url:"source_branch,omitempty"`

	// Return merge requests with the given target branch
	TargetBranch string `url:"target_branch,omitempty"`

	// Search merge requests against their title and description
	Search string `url:"search,omitempty"`

	// Returns merge requests created by the given user id
	AuthorId int `url:"author_id,omitempty"`

	// Returns merge requests assigned to the given user id
	AssigneeId int `url:"assignee_id,omitempty"`

	// Return merge requests reacted by the authenticated user by the given emoji
	MyReactionEmoji string `url:"my_reaction_emoji,omitempty"`

	// Return merge requests for the given scope: created_by_me, assigned_to_me or all,
	// For versions before 11.0, use the now deprecated created-by-me or assigned-to-me scopes instead.
	Scope MergeRequestScope `url:"scope,omitempty"`
}

type Milestone

type Milestone struct {
	Id          int    `json:"id,omitempty" yaml:"id,omitempty"`
	Iid         int    `json:"iid,omitempty" yaml:"iid,omitempty"`
	GroupId     int    `json:"group_id,omitempty" yaml:"group_id,omitempty"`
	ProjectId   int    `json:"project_id,omitempty" yaml:"project_id,omitempty"`
	Title       string `json:"title,omitempty" yaml:"title,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	State       string `json:"state,omitempty" yaml:"state,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
	CreatedAt   string `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	DueDate     string `json:"due_date,omitempty" yaml:"due_date,omitempty"`
	StartDate   string `json:"start_date,omitempty" yaml:"start_date,omitempty"`
	WebUrl      string `json:"web_url,omitempty" yaml:"web_url,omitempty"`
}

type MinimalCommit

type MinimalCommit struct {
	Id           string `json:"id" yaml:"id"`
	ShortId      string `json:"short_id" yaml:"short_id"`
	Title        string `json:"title" yaml:"title"`
	Message      string `json:"message" yaml:"message"`
	AuthorName   string `json:"author_name" yaml:"author_name"`
	AuthorEmail  string `json:"author_email" yaml:"author_email"`
	CreatedAtRaw string `json:"created_at" yaml:"created_at"`
}

func (*MinimalCommit) RenderJson

func (c *MinimalCommit) RenderJson(w io.Writer) error

func (*MinimalCommit) RenderYaml

func (c *MinimalCommit) RenderYaml(w io.Writer) error

type MinimalCommitCollection

type MinimalCommitCollection struct {
	Items []*MinimalCommit
}

func (*MinimalCommitCollection) RenderJson

func (c *MinimalCommitCollection) RenderJson(w io.Writer) error

func (*MinimalCommitCollection) RenderYaml

func (c *MinimalCommitCollection) RenderYaml(w io.Writer) error

type MinimalProject

type MinimalProject struct {
	Id                int    `json:"id" yaml:"id"`
	Name              string `json:"name" yaml:"name"`
	NameWithNamespace string `json:"name_with_namespace" yaml:"name_with_namespace"`
	Path              string `json:"path" yaml:"path"`
	PathWithNamespace string `json:"path_with_namespace" yaml:"path_with_namespace"`
}

type Namespace

type Namespace struct {
	Id                          int    `json:"id,omitempty" yaml:"id,omitempty"`
	Name                        string `json:"name,omitempty,omitempty" yaml:"name,omitempty,omitempty"`
	Path                        string `json:"path,omitempty,omitempty" yaml:"path,omitempty,omitempty"`
	Kind                        string `json:"kind,omitempty,omitempty" yaml:"kind,omitempty,omitempty"`
	FullPath                    string `json:"full_path,omitempty,omitempty" yaml:"full_path,omitempty,omitempty"`
	ParentId                    int    `json:"parent_id,omitempty" yaml:"parent_id,omitempty"`
	MembersCountWithDescendants int    `json:"members_count_with_descendants,omitempty" yaml:"members_count_with_descendants,omitempty"`
	Plan                        string `json:"plan,omitempty" yaml:"plan,omitempty"`
	Description                 string `json:"description,omitempty" yaml:"description,omitempty"`
	OwnerId                     int    `json:"owner_id,omitempty" yaml:"owner_id,omitempty"`
	CreatedAt                   string `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
	UpdatedAt                   string `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
}

func (*Namespace) RenderJson

func (ns *Namespace) RenderJson(w io.Writer) error

func (*Namespace) RenderYaml

func (ns *Namespace) RenderYaml(w io.Writer) error

type NamespaceCollection

type NamespaceCollection struct {
	Items []*Namespace
}

func (*NamespaceCollection) RenderJson

func (c *NamespaceCollection) RenderJson(w io.Writer) error

func (*NamespaceCollection) RenderYaml

func (c *NamespaceCollection) RenderYaml(w io.Writer) error

type NamespacesOptions

type NamespacesOptions struct {
	PaginationOptions
	SortOptions

	// Returns a list of namespaces the user is authorized to see
	// based on the search criteria
	Search string `url:"search,omitempty"`
}

type Note

type Note struct {
	Id           int    `json:"id"            yaml:"id"`
	Body         string `json:"body"          yaml:"body"`
	Attachment   string `json:"attachment"    yaml:"attachment"`
	Title        string `json:"title"         yaml:"title"`
	FileName     string `json:"file_name"     yaml:"file_name"`
	CreatedAtRaw string `json:"created_at"    yaml:"created_at"`
	UpdatedAtRaw string `json:"updated_at"    yaml:"updated_at"`
	ExpiresAtRaw string `json:"expires_at"    yaml:"expires_at"`
	System       bool   `json:"system"        yaml:"system"`
	Resolvable   bool   `json:"resolvable"    yaml:"resolvable"`
	NoteableId   int    `json:"noteable_id"   yaml:"noteable_id"`
	NoteableIid  int    `json:"noteable_iid"  yaml:"noteable_iid"`
	NoteableType string `json:"noteable_type" yaml:"noteable_type"`
	Author       struct {
		Id           int    `json:"id"         yaml:"id"`
		Username     string `json:"username"   yaml:"username"`
		Email        string `json:"email"      yaml:"email"`
		Name         string `json:"name"       yaml:"name"`
		State        string `json:"state"      yaml:"state"`
		CreatedAtRaw string `json:"created_at" yaml:"created_at"`
		AvatarUrm    string `json:"avatar_url" yaml:"avatar_url"`
		WebUrl       string `json:"web_url"    yaml:"web_url"`
	} `json:"author" yaml:"author"`
}

func (*Note) RenderJson

func (n *Note) RenderJson(w io.Writer) error

func (*Note) RenderYaml

func (n *Note) RenderYaml(w io.Writer) error

type NoteAddPayload

type NoteAddPayload struct {
	Body string `json:"body"`
}

type NoteCollection

type NoteCollection struct {
	Items []*Note
}

func (*NoteCollection) RenderJson

func (c *NoteCollection) RenderJson(w io.Writer) error

func (*NoteCollection) RenderYaml

func (c *NoteCollection) RenderYaml(w io.Writer) error

type NotesOptions

type NotesOptions struct {
	PaginationOptions
	SortOptions
}

type PaginationOptions

type PaginationOptions struct {
	Page    int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}

type Person

type Person struct {
	Name  string `xml:"name" json:"name"`
	Email string `xml:"email" json:"email"`
}

type Pipeline

type Pipeline struct {
	Id     int    `json:"id"`
	Status string `json:"status"`
	Ref    string `json:"ref"`
	Sha    string `json:"sha"`
}

type PipelineCollection

type PipelineCollection struct {
	Items []*Pipeline
}

func (*PipelineCollection) RenderJson

func (c *PipelineCollection) RenderJson(w io.Writer) error

func (*PipelineCollection) RenderYaml

func (c *PipelineCollection) RenderYaml(w io.Writer) error

type PipelineWithDetails

type PipelineWithDetails struct {
	Pipeline
	BeforeSha   string `json:"before_sha"`
	Tag         bool   `json:"tag"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	StartedAt   string `json:"started_at"`
	FinishedAt  string `json:"finished_at"`
	CommittedAt string `json:"committed_at"`
	Duration    int    `json:"duration"`
	Coverage    string `json:"coverage"`
	YamlErrors  string `json:"yaml_errors"`
	User        struct {
		Id        int    `json:"id"`
		Username  string `json:"username"`
		Name      string `json:"name"`
		State     string `json:"state"`
		AvatarUrl string `json:"avatar_url"`
		WebUrl    string `json:"web_url"`
	}
}

func (*PipelineWithDetails) RenderJson

func (p *PipelineWithDetails) RenderJson(w io.Writer) error

func (*PipelineWithDetails) RenderYaml

func (p *PipelineWithDetails) RenderYaml(w io.Writer) error

type PipelinesOptions

type PipelinesOptions struct {
	PaginationOptions
	SortOptions

	// The scope of pipelines, one of:
	// running, pending, finished, branches, tags
	Scope string `url:"scope,omitempty"`

	// The status of pipelines, one of:
	// running, pending, success, failed, canceled, skipped
	Status string `url:"status,omitempty"`

	// The ref of pipelines
	Ref string `url:"ref,omitempty"`

	// The sha or pipelines
	Sha string `url:"sha,omitempty"`

	// Returns pipelines with invalid configurations
	YamlErrors bool `url:"yaml_errors,omitempty"`

	// The name of the user who triggered pipelines
	Name string `url:"name,omitempty"`

	// The username of the user who triggered pipelines
	Username string `url:"username,omitempty"`
}

type Project

type Project struct {
	MinimalProject
	Description                               string                 `json:"description" yaml:"description"`
	DefaultBranch                             string                 `json:"default_branch" yaml:"default_branch"`
	Owner                                     *Member                `json:"owner" yaml:"owner"`
	Public                                    bool                   `json:"public" yaml:"public"`
	Visibility                                Visibility             `json:"visibility" yaml:"visibility"`
	IssuesEnabled                             bool                   `json:"issues_enabled" yaml:"issues_enabled"`
	OpenIssuesCount                           int                    `json:"open_issues_count" yaml:"open_issues_count"`
	MergeRequestsEnabled                      bool                   `json:"merge_requests_enabled" yaml:"merge_requests_enabled"`
	WallEnabled                               bool                   `json:"wall_enabled" yaml:"wall_enabled"`
	WikiEnabled                               bool                   `json:"wiki_enabled" yaml:"wiki_enabled"`
	CreatedAtRaw                              string                 `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Namespace                                 *Namespace             `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	NamespaceId                               int                    `json:"namespace_id" yaml:"namespace_id"`
	SshRepoUrl                                string                 `json:"ssh_url_to_repo" yaml:"ssh_url_to_repo"`
	HttpRepoUrl                               string                 `json:"http_url_to_repo" yaml:"http_url_to_repo"`
	WebUrl                                    string                 `json:"web_url" yaml:"web_url"`
	ReadmeUrl                                 string                 `json:"readme_url" yaml:"readme_url"`
	SharedRunnersEnabled                      bool                   `json:"shared_runners_enabled" yaml:"shared_runners_enabled"`
	Archived                                  bool                   `json:"archived" yaml:"archived"`
	OnlyAllowMergeIfPipelineSucceeds          bool                   `json:"only_allow_merge_if_pipeline_succeeds" yaml:"only_allow_merge_if_pipeline_succeeds"`
	OnlyAllowMergeIfAllDiscussionsAreResolved bool                   `json:"only_allow_merge_if_all_discussions_are_resolved" yaml:"only_allow_merge_if_all_discussions_are_resolved"`
	MergeMethod                               string                 `json:"merge_method" yaml:"merge_method"`
	TagList                                   []string               `json:"tag_list" yaml:"tag_list"`
	SharedWithGroups                          []*ProjectGroupSharing `json:"shared_with_groups" yaml:"shared_with_groups"`
	ForksCount                                int                    `json:"forks_count" yaml:"forks_count"`
	StarCount                                 int                    `json:"star_count" yaml:"star_count"`
	Statistics                                *ProjectStatistics     `json:"statistics" yaml:"statistics"`
}

func (*Project) RenderJson

func (p *Project) RenderJson(w io.Writer) error

func (*Project) RenderYaml

func (p *Project) RenderYaml(w io.Writer) error

type ProjectAddPayload

type ProjectAddPayload struct {
	Name string `json:"name"` // The name of the new project. Equals path if not provided
	Path string `json:"path"` // Repository name for new project. Generated based on name if not provided (generated lowercased with dashes)
}

type ProjectCollection

type ProjectCollection struct {
	Items []*Project
}

func (*ProjectCollection) RenderJson

func (c *ProjectCollection) RenderJson(w io.Writer) error

func (*ProjectCollection) RenderYaml

func (c *ProjectCollection) RenderYaml(w io.Writer) error

type ProjectGroupSharing

type ProjectGroupSharing struct {
	GroupId          int    `json:"group_id" yaml:"group_id"`
	GroupName        string `json:"group_name" yaml:"group_name"`
	GroupAccessLevel int    `json:"group_access_level" yaml:"group_access_level"`
}

type ProjectStatistics

type ProjectStatistics struct {
	CommitCount      int `json:"commit_count" yaml:"commit_count"`
	StorageSize      int `json:"storage_size" yaml:"storage_size"`
	RepositorySize   int `json:"repository_size" yaml:"repository_size"`
	LfsObjectsSize   int `json:"lfs_objects_size" yaml:"lfs_objects_size"`
	JobArtifactsSize int `json:"job_artifacts_size" yaml:"job_artifacts_size"`
}

type ProjectsOptions

type ProjectsOptions struct {
	PaginationOptions
	SortOptions

	// Limit by archived status
	Archived bool `url:"archived,omitempty"`

	// Limit by visibility public, internal, or private
	Visibility Visibility `url:"visibility,omitempty"`

	// Return projects ordered by id, name, path, created_at, updated_at,
	// or last_activity_at fields. Default is created_at
	OrderBy ProjectsOrder `url:"order_by,omitempty"`

	// Return list of projects matching the search criteria
	Search string `url:"search,omitempty"`

	// Return only the ID, URL, name, and path of each project
	Simple bool `url:"simple,omitempty"`

	// Limit by projects owned by the current user
	Owned bool `url:"owned,omitempty"`

	// Limit by projects that the current user is a member of
	Membership bool `url:"membership,omitempty"`

	// Limit by projects starred by the current user
	Starred bool `url:"starred,omitempty"`

	// Include project statistics
	Statistics bool `url:"statistics,omitempty"`

	// Include custom attributes in response (admins only)
	WithCustomAttributes bool `url:"with_custom_attributes,omitempty"`

	// Limit by enabled issues feature
	WithIssuesEnabled bool `url:"with_issues_enabled,omitempty"`

	// Limit by enabled merge requests feature
	WithMergeRequestsEnabled bool `url:"with_merge_requests_enabled,omitempty"`
}

type ProjectsOrder

type ProjectsOrder string
const (
	ProjectsOrderId   ProjectsOrder = "id"
	ProjectsOrderName ProjectsOrder = "name"
	ProjectsOrderPath ProjectsOrder = "path"
)

type ProtectedBranch

type ProtectedBranch struct {
	Name              string             `json:"name,omitempty"`
	PushAccessLevels  []*AccessLevelInfo `json:"push_access_levels,omitempty"`
	MergeAccessLevels []*AccessLevelInfo `json:"merge_access_levels,omitempty"`
}

type Renderable

type Renderable interface {
	RenderJson(w io.Writer) error
	RenderYaml(w io.Writer) error
}

type ResponseMeta

type ResponseMeta struct {
	Method     string
	Url        string
	StatusCode int
	RequestId  string
	Page       int
	PerPage    int
	PrevPage   int
	NextPage   int
	TotalPages int
	Total      int
	Runtime    float64
}

type ResponseWithMessage

type ResponseWithMessage struct {
	Message string `json:"message"`
}

type Runner

type Runner struct {
	Id          int    `json:"id,omitempty" yaml:"id,omitempty"`
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Active      bool   `json:"active,omitempty" yaml:"active,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	IpAddress   string `json:"ip_address,omitempty" yaml:"ip_address,omitempty"`
	IsShared    bool   `json:"is_shared,omitempty" yaml:"is_shared,omitempty"`
	Online      bool   `json:"online,omitempty" yaml:"online,omitempty"`
	Status      string `json:"status,omitempty" yaml:"status,omitempty"`
}

type RunnerCollection

type RunnerCollection struct {
	Items []*Runner
}

func (*RunnerCollection) RenderJson

func (c *RunnerCollection) RenderJson(w io.Writer) error

func (*RunnerCollection) RenderYaml

func (c *RunnerCollection) RenderYaml(w io.Writer) error

type RunnerScope

type RunnerScope string
const (
	RunnerScopeSpecific RunnerScope = "specific"
	RunnerScopeShared   RunnerScope = "shared"
	RunnerScopeActive   RunnerScope = "active"
	RunnerScopePaused   RunnerScope = "paused"
	RunnerScopeOnline   RunnerScope = "online"
)

type RunnerWithDetails

type RunnerWithDetails struct {
	Runner         `yaml:",inline"`
	Architecture   string     `json:"architecture,omitempty" yaml:"architecture,omitempty"`
	Platform       string     `json:"platform,omitempty" yaml:"platform,omitempty"`
	Token          string     `json:"token,omitempty" yaml:"token,omitempty"`
	Revision       string     `json:"revision,omitempty" yaml:"revision,omitempty"`
	ContactedAt    string     `json:"contacted_at,omitempty" yaml:"contacted_at,omitempty"`
	Version        string     `json:"version,omitempty" yaml:"version,omitempty"`
	Projects       []*Project `json:"projects,omitempty" yaml:"projects,omitempty"`
	TagList        []string   `json:"tag_list,omitempty" yaml:"tag_list,omitempty"`
	AccessLevel    string     `json:"access_level,omitempty" yaml:"access_level,omitempty"`
	MaximumTimeout int        `json:"maximum_timeout,omitempty" yaml:"maximum_timeout,omitempty"`
}

func (*RunnerWithDetails) RenderJson

func (r *RunnerWithDetails) RenderJson(w io.Writer) error

func (*RunnerWithDetails) RenderYaml

func (r *RunnerWithDetails) RenderYaml(w io.Writer) error

type RunnersOptions

type RunnersOptions struct {
	PaginationOptions
	SortOptions

	// Get a list of all runners in the GitLab instance (specific and shared).
	// Access is restricted to users with admin privileges
	All bool `url:"-"`

	// The scope of runners to show, one of: specific, shared, active, paused, online;
	// showing all runners if none provided
	Scope RunnerScope `url:"scope,omitempty"`
}

type SortDirection

type SortDirection string
const (
	SortDirectionAsc  SortDirection = "asc"
	SortDirectionDesc SortDirection = "desc"
)

type SortOptions

type SortOptions struct {
	OrderBy string        `url:"order_by,omitempty"`
	Sort    SortDirection `url:"sort,omitempty"`
}

type SshKey

type SshKey struct {
	Id           int    `json:"id,omitempty" yaml:"id,omitempty"`
	Title        string `json:"title,omitempty" yaml:"title,omitempty"`
	Key          string `json:"key,omitempty" yaml:"key,omitempty"`
	CreatedAtRaw string `json:"created_at,omitempty" yaml:"created_at,omitempty"`
}

func (*SshKey) RenderJson

func (s *SshKey) RenderJson(w io.Writer) error

func (*SshKey) RenderYaml

func (s *SshKey) RenderYaml(w io.Writer) error

type SshKeyCollection

type SshKeyCollection struct {
	Items []*SshKey
}

func (*SshKeyCollection) RenderJson

func (c *SshKeyCollection) RenderJson(w io.Writer) error

func (*SshKeyCollection) RenderYaml

func (c *SshKeyCollection) RenderYaml(w io.Writer) error

type Tag

type Tag struct {
	Name      string        `json:"name,omitempty"`
	Protected bool          `json:"protected,omitempty"`
	Commit    *BranchCommit `json:"commit,omitempty"`
}

type TimeStats

type TimeStats struct {
	TimeEstimate        int    `json:"time_estimate,omitempty" yaml:"time_estimate,omitempty"`
	TotalTimeSpent      int    `json:"total_time_spent,omitempty" yaml:"total_time_spent,omitempty"`
	HumanTimeEstimate   string `json:"human_time_estimate,omitempty" yaml:"human_time_estimate,omitempty"`
	HumanTotalTimeSpent string `json:"human_total_time_spent,omitempty" yaml:"human_total_time_spent,omitempty"`
}

type TreeNode

type TreeNode struct {
	Name string
	Type string
	Mode string
	Id   string
}

type User

type User struct {
	Id               int             `json:"id,omitempty" yaml:"id,omitempty"`
	Username         string          `json:"username,omitempty" yaml:"username,omitempty"`
	Email            string          `json:"email,omitempty" yaml:"email,omitempty"`
	Name             string          `json:"name,omitempty" yaml:"name,omitempty"`
	State            string          `json:"state,omitempty" yaml:"state,omitempty"`
	AvatarUrl        string          `json:"avatar_url,omitempty" yaml:"avatar_url,omitempty"`
	WebUrl           string          `json:"web_url" yaml:"web_url"`
	CreatedAt        string          `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	IsAdmin          bool            `json:"is_admin,omitempty" yaml:"is_admin,omitempty"`
	Bio              string          `json:"bio,omitempty" yaml:"bio,omitempty"`
	Location         string          `json:"location,omitempty" yaml:"location,omitempty"`
	Skype            string          `json:"skype,omitempty" yaml:"skype,omitempty"`
	LinkedIn         string          `json:"linkedin,omitempty" yaml:"linkedin,omitempty"`
	Twitter          string          `json:"twitter,omitempty" yaml:"twitter,omitempty"`
	WebsiteUrl       string          `json:"website_url" yaml:"website_url"`
	Organization     string          `json:"organization" yaml:"organization"`
	LastSignInAt     string          `json:"last_sign_in_at,omitempty" yaml:"last_sign_in_at,omitempty"`
	ConfirmedAt      string          `json:"confirmed_at,omitempty" yaml:"confirmed_at,omitempty"`
	ThemeId          int             `json:"theme_id,omitempty" yaml:"theme_id,omitempty"`
	LastActivityOn   string          `json:"last_activity_on,omitempty" yaml:"last_activity_on,omitempty"`
	ColorSchemeId    int             `json:"color_scheme_id,omitempty" yaml:"color_scheme_id,omitempty"`
	ProjectsLimit    int             `json:"projects_limit,omitempty" yaml:"projects_limit,omitempty"`
	CurrentSignInAt  string          `json:"current_sign_in_at,omitempty" yaml:"current_sign_in_at,omitempty"`
	Identities       []*UserIdentity `json:"identities,omitempty" yaml:"identities,omitempty"`
	CanCreateGroup   bool            `json:"can_create_group,omitempty" yaml:"can_create_group,omitempty"`
	CanCreateProject bool            `json:"can_create_project,omitempty" yaml:"can_create_project,omitempty"`
	TwoFactorEnabled bool            `json:"two_factor_enabled,omitempty" yaml:"two_factor_enabled,omitempty"`
	External         bool            `json:"external,omitempty" yaml:"external,omitempty"`
}

func (*User) RenderJson

func (u *User) RenderJson(w io.Writer) error

func (*User) RenderYaml

func (u *User) RenderYaml(w io.Writer) error

type UserCollection

type UserCollection struct {
	Items []*User
}

func (*UserCollection) RenderJson

func (c *UserCollection) RenderJson(w io.Writer) error

func (*UserCollection) RenderYaml

func (c *UserCollection) RenderYaml(w io.Writer) error

type UserIdentity

type UserIdentity struct {
	Provider  string `json:"provider,omitempty" yaml:"provider,omitempty"`
	ExternUid string `json:"extern_uid,omitempty" yaml:"extern_uid,omitempty"`
}

type UsersOptions

type UsersOptions struct {
	PaginationOptions

	// Search users by email or username
	Search string `url:"search,omitempty"`

	// Search users by username
	Username string `url:"username,omitempty"`

	// Limit to active users
	Active bool `url:"active,omitempty"`

	// Limit to blocked users
	Blocked bool `url:"blocked,omitempty"`
}

type Variable

type Variable struct {
	Key              string `json:"key"`
	Value            string `json:"value"`
	Protected        bool   `json:"protected"`
	EnvironmentScope string `json:"environment_scope,omitempty"`
}

func (*Variable) RenderJson

func (v *Variable) RenderJson(w io.Writer) error

func (*Variable) RenderYaml

func (v *Variable) RenderYaml(w io.Writer) error

type VariableCollection

type VariableCollection struct {
	Items []*Variable
}

func (*VariableCollection) RenderJson

func (c *VariableCollection) RenderJson(w io.Writer) error

func (*VariableCollection) RenderYaml

func (c *VariableCollection) RenderYaml(w io.Writer) error

type Visibility

type Visibility string
const (
	// VisibilityPrivate indicates project access must be granted explicitly for each user.
	VisibilityPrivate Visibility = "private"

	// VisibilityInternal indicates the project can be cloned by any logged in user.
	VisibilityInternal Visibility = "internal"

	// VisibilityPublic indicates the project can be cloned without any authentication.
	VisibilityPublic Visibility = "public"
)

Jump to

Keyboard shortcuts

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