Documentation
¶
Overview ¶
Package service is the orchestration between the tools and the REST client: resolving a project once per call, the reads that take more than one request, and turning wire types into the model a result carries, with every piece of other people's text prepared by render on the way (docs/architecture.md §4.1, §4.8).
Index ¶
- Constants
- Variables
- type BlameRequest
- type BranchDeletion
- type Comment
- type CommentDeletion
- type CommitAction
- type CommitCreate
- type CompareQuery
- type DiffLocation
- type DiscussionQuery
- type IssueCreate
- type IssueLinkRequest
- type IssueMoveRequest
- type IssueUpdate
- type ItemSearch
- type JobLogQuery
- type JobVariable
- type LabelRequest
- type LintQuery
- type MergeRequestCreate
- type MergeRequestMerge
- type MergeRequestUpdate
- type MilestoneRequest
- type MilestoneSearch
- type Options
- type PickRequest
- type PipelineRun
- type PipelineVariable
- type ProjectSearch
- type Registered
- type ReleaseCreate
- type Review
- type ReviewComment
- type SearchQuery
- type Service
- func (s *Service) AddComment(ctx context.Context, in Comment) (model.CommentWrite, error)
- func (s *Service) AddReviewComment(ctx context.Context, in ReviewComment) (model.CommentWrite, error)
- func (s *Service) ApproveMergeRequest(ctx context.Context, raw string, iid int64, sha string) (model.ApprovalWrite, error)
- func (s *Service) Blame(ctx context.Context, in BlameRequest) (model.Blame, error)
- func (s *Service) CancelPipeline(ctx context.Context, raw string, id int64) (model.PipelineWrite, error)
- func (s *Service) CompareRefs(ctx context.Context, q CompareQuery) (model.Compare, error)
- func (s *Service) CreateBranch(ctx context.Context, raw, branch, ref string) (model.BranchWrite, error)
- func (s *Service) CreateCommit(ctx context.Context, in CommitCreate) (model.CommitWrite, error)
- func (s *Service) CreateIssue(ctx context.Context, in IssueCreate) (model.IssueWrite, error)
- func (s *Service) CreateLabel(ctx context.Context, in LabelRequest) (model.LabelWrite, error)
- func (s *Service) CreateMergeRequest(ctx context.Context, in MergeRequestCreate) (model.MergeRequestWrite, error)
- func (s *Service) CreateMilestone(ctx context.Context, in MilestoneRequest) (model.MilestoneWrite, error)
- func (s *Service) CreateRelease(ctx context.Context, in ReleaseCreate) (model.ReleaseWrite, error)
- func (s *Service) CreateSnippet(ctx context.Context, in SnippetCreate) (model.SnippetWrite, error)
- func (s *Service) CreateTag(ctx context.Context, raw, name, ref, message string) (model.TagWrite, error)
- func (s *Service) DeleteBranch(ctx context.Context, in BranchDeletion) (model.BranchDelete, error)
- func (s *Service) DeleteComment(ctx context.Context, in CommentDeletion) (model.CommentDelete, error)
- func (s *Service) DeleteLabel(ctx context.Context, raw string, id int64, version string) (model.LabelWrite, error)
- func (s *Service) DeleteMilestone(ctx context.Context, raw string, id int64, updatedAt string) (model.MilestoneWrite, error)
- func (s *Service) DeleteReviewComment(ctx context.Context, raw string, iid, draftID int64) (model.DraftDelete, error)
- func (s *Service) DeleteTag(ctx context.Context, raw, name, sha string) (model.TagWrite, error)
- func (s *Service) DeleteWikiPage(ctx context.Context, raw, slug, witness string) (model.WikiDelete, error)
- func (s *Service) FindUsers(ctx context.Context, q gapi.UserQuery, opts gapi.ListOptions) (model.Users, error)
- func (s *Service) GetArtifact(ctx context.Context, raw string, job int64, path string, offset int) (model.Artifact, error)
- func (s *Service) GetCommit(ctx context.Context, raw, sha string, ...) (model.Commit, error)
- func (s *Service) GetFile(ctx context.Context, raw, path, ref string, offset int) (model.File, error)
- func (s *Service) GetIssue(ctx context.Context, raw string, iid int64, offset int) (model.Issue, error)
- func (s *Service) GetJobLog(ctx context.Context, q JobLogQuery) (model.JobLog, error)
- func (s *Service) GetMRDiff(ctx context.Context, raw string, iid int64, paths []string, ...) (model.MRDiff, error)
- func (s *Service) GetMergeRequest(ctx context.Context, raw string, iid int64, offset int) (model.MergeRequest, error)
- func (s *Service) GetPipeline(ctx context.Context, raw string, id int64) (model.PipelineDetail, error)
- func (s *Service) GetProject(ctx context.Context, raw string, offset int) (model.Project, error)
- func (s *Service) GetRelease(ctx context.Context, raw, tag string, offset int) (model.Release, error)
- func (s *Service) GetSnippet(ctx context.Context, raw string, id int64, file string, offset int) (model.Snippet, error)
- func (s *Service) GetWikiPage(ctx context.Context, raw, slug string, offset int) (model.WikiPage, error)
- func (s *Service) LinkIssues(ctx context.Context, in IssueLinkRequest) (model.IssueLinkWrite, error)
- func (s *Service) LintCI(ctx context.Context, q LintQuery) (model.Lint, error)
- func (s *Service) ListArtifacts(ctx context.Context, raw string, job int64, dir string, recursive bool, ...) (model.Artifacts, error)
- func (s *Service) ListBranches(ctx context.Context, raw, search string, opts gapi.ListOptions) (model.Branches, error)
- func (s *Service) ListCommits(ctx context.Context, raw string, q gapi.CommitQuery, opts gapi.ListOptions) (model.Commits, error)
- func (s *Service) ListDeployments(ctx context.Context, raw string, q gapi.DeploymentQuery, opts gapi.ListOptions) (model.Deployments, error)
- func (s *Service) ListDiscussions(ctx context.Context, q DiscussionQuery) (model.Discussions, error)
- func (s *Service) ListEnvironments(ctx context.Context, raw string, q gapi.EnvironmentQuery, ...) (model.Environments, error)
- func (s *Service) ListEvents(ctx context.Context, raw string, q gapi.EventQuery, opts gapi.ListOptions) (model.Events, error)
- func (s *Service) ListJobs(ctx context.Context, raw string, pipeline int64, q gapi.JobQuery, ...) (model.Jobs, error)
- func (s *Service) ListLabels(ctx context.Context, raw string, q gapi.LabelQuery, opts gapi.ListOptions) (model.Labels, error)
- func (s *Service) ListMRCommits(ctx context.Context, raw string, iid int64, opts gapi.ListOptions) (model.MRCommits, error)
- func (s *Service) ListMRFiles(ctx context.Context, raw string, iid int64, opts gapi.ListOptions) (model.MRFiles, error)
- func (s *Service) ListMembers(ctx context.Context, raw, query string, opts gapi.ListOptions) (model.Members, error)
- func (s *Service) ListMilestones(ctx context.Context, q MilestoneSearch) (model.Milestones, error)
- func (s *Service) ListPipelines(ctx context.Context, raw string, q gapi.PipelineQuery, opts gapi.ListOptions) (model.Pipelines, error)
- func (s *Service) ListReleases(ctx context.Context, raw string, q gapi.ReleaseQuery, opts gapi.ListOptions) (model.Releases, error)
- func (s *Service) ListReviewComments(ctx context.Context, raw string, iid int64, pageToken string) (model.DraftNotes, error)
- func (s *Service) ListSnippets(ctx context.Context, raw string, opts gapi.ListOptions) (model.Snippets, error)
- func (s *Service) ListTags(ctx context.Context, raw string, q gapi.TagQuery, opts gapi.ListOptions) (model.Tags, error)
- func (s *Service) ListTodos(ctx context.Context, q TodoSearch) (model.Todos, error)
- func (s *Service) ListTree(ctx context.Context, raw string, q gapi.TreeQuery, opts gapi.ListOptions) (model.Tree, error)
- func (s *Service) ListWikiPages(ctx context.Context, raw string) (model.WikiPages, error)
- func (s *Service) MarkTodosDone(ctx context.Context, ids []int64) (model.TodosDone, error)
- func (s *Service) Me(ctx context.Context) (model.Me, error)
- func (s *Service) MergeMergeRequest(ctx context.Context, in MergeRequestMerge) (model.MergeWrite, error)
- func (s *Service) MoveIssue(ctx context.Context, in IssueMoveRequest) (model.IssueMove, error)
- func (s *Service) Pick(ctx context.Context, in PickRequest) (model.PickWrite, error)
- func (s *Service) PlayJob(ctx context.Context, raw string, id int64, vars []JobVariable, ...) (model.JobWrite, error)
- func (s *Service) RebaseMergeRequest(ctx context.Context, raw string, iid int64, sha string, skipCI bool) (model.RebaseWrite, error)
- func (s *Service) ResolveDiscussion(ctx context.Context, raw, typ string, iid int64, discussionID string, ...) (model.DiscussionWrite, error)
- func (s *Service) ResolveURL(ctx context.Context, raw string) (model.Resolved, error)
- func (s *Service) RetryJob(ctx context.Context, raw string, id int64, inputs map[string]any) (model.JobWrite, error)
- func (s *Service) RetryPipeline(ctx context.Context, raw string, id int64) (model.PipelineWrite, error)
- func (s *Service) RunPipeline(ctx context.Context, in PipelineRun) (model.PipelineWrite, error)
- func (s *Service) SaveWikiPage(ctx context.Context, in WikiSave) (model.WikiWrite, error)
- func (s *Service) Search(ctx context.Context, q SearchQuery) (model.Search, error)
- func (s *Service) SearchIssues(ctx context.Context, q ItemSearch) (model.ItemList, error)
- func (s *Service) SearchMergeRequests(ctx context.Context, q ItemSearch) (model.ItemList, error)
- func (s *Service) SearchProjects(ctx context.Context, q ProjectSearch) (model.ProjectList, error)
- func (s *Service) SetRegistered(r []Registered)
- func (s *Service) SubmitReview(ctx context.Context, in Review) (model.ReviewSubmit, error)
- func (s *Service) UnapproveMergeRequest(ctx context.Context, raw string, iid int64) (model.ApprovalWrite, error)
- func (s *Service) UnlinkIssues(ctx context.Context, in IssueLinkRequest) (model.IssueLinkWrite, error)
- func (s *Service) UpdateIssue(ctx context.Context, in IssueUpdate) (model.IssueWrite, error)
- func (s *Service) UpdateLabel(ctx context.Context, in LabelRequest) (model.LabelWrite, error)
- func (s *Service) UpdateMergeRequest(ctx context.Context, in MergeRequestUpdate) (model.MergeRequestWrite, error)
- func (s *Service) UpdateMilestone(ctx context.Context, in MilestoneRequest) (model.MilestoneWrite, error)
- type SnippetCreate
- type SnippetFile
- type TodoSearch
- type WikiSave
Constants ¶
const MaxCommitActions = 100
MaxCommitActions caps one commit's file changes.
const MaxTodos = 100
MaxTodos caps mark_todos_done.
const SearchExcerptChars = 1000
SearchExcerptChars bounds one search row's excerpt: a blob's matching lines or a note's body.
Variables ¶
var IssueLinkTypes = []string{"relates_to", "blocks", "is_blocked_by"}
IssueLinkTypes are the link types GitLab takes; blocks and is_blocked_by need Premium.
var MilestoneStates = []string{"close", "activate"}
MilestoneStates are the state changes update_milestone takes.
var ReviewerStates = []string{"approved", "requested_changes", "reviewed"}
ReviewerStates are submit_review's reviewer states.
var SearchScopes = []string{"blobs", "commits", "issues", "merge_requests", "milestones", "notes", "projects", "users", "wiki_blobs"}
SearchScopes are the scopes search takes. Snippet titles are left to the snippets toolset.
var WikiFormats = []string{"asciidoc", "markdown", "org", "rdoc"}
WikiFormats are the markups a page can be written in.
Functions ¶
This section is empty.
Types ¶
type BlameRequest ¶
BlameRequest is get_blame's request.
type BranchDeletion ¶
type BranchDeletion struct {
Project string
Branch string
// SHA is the head the caller read: a branch pushed to since is not
// deleted unseen.
SHA string
// Unmerged allows a branch whose commits the default branch does not
// have.
Unmerged bool
}
BranchDeletion is delete_branch's request.
type Comment ¶
type Comment struct {
Project string
Type string // issue or merge_request
IID int64
Body string
DiscussionID string
Location *DiffLocation
// Thread starts a resolvable thread rather than a standalone comment.
Thread bool
}
Comment is add_comment's request.
type CommentDeletion ¶
type CommentDeletion struct {
Project string
Type string // issue or merge_request
IID int64
NoteID int64
UpdatedAt string
}
CommentDeletion is delete_comment's request.
type CommitAction ¶
type CommitAction struct {
Action string // create, update, delete or move
FilePath string
PreviousPath string
Content string
Encoding string // text or base64
LastCommitID string
}
CommitAction is one file change of create_commit.
type CommitCreate ¶
type CommitCreate struct {
Project string
Branch string
StartBranch string
Message string
Actions []CommitAction
}
CommitCreate is create_commit's request.
type CompareQuery ¶
type CompareQuery struct {
Project string
From, To string
Straight bool
CommitOffset int
FileOffset int
DiffOffset int
}
CompareQuery is compare_refs' query.
type DiffLocation ¶
type DiffLocation struct {
File string
Side string // new or old
Line int
EndLine int // 0 for one line
}
DiffLocation is a line of a merge request's diff, as the caller names it (§6.2).
type DiscussionQuery ¶
type DiscussionQuery struct {
Project string
IID int64
// Type is issue or merge_request: which IID names.
Type string
IncludeSystem bool
UnresolvedOnly bool
Max int
PageToken string
// NoteID and Offset read one comment on from an offset, when a
// previous page cut it.
NoteID int64
Offset int
}
DiscussionQuery is list_discussions' query.
type IssueCreate ¶
type IssueCreate struct {
Project string
Title string
Description string
Labels []string
Assignees []string
Milestone string
DueDate string
Confidential bool
}
IssueCreate is create_issue's request.
type IssueLinkRequest ¶
type IssueLinkRequest struct {
Project string
IID int64
TargetProject string
TargetIID int64
LinkType string
}
IssueLinkRequest is link_issues' and unlink_issues' request.
type IssueMoveRequest ¶
IssueMoveRequest is move_issue's request.
type IssueUpdate ¶
type IssueUpdate struct {
Project string
IID int64
UpdatedAt string
Title *string
Description *string
AddLabels []string
RemoveLabels []string
AddAssignees []string
RemoveAssignees []string
Milestone *string
ClearMilestone bool
State string // close or reopen
DueDate *string
ClearDueDate bool
Confidential *bool
}
IssueUpdate is update_issue's request. A nil pointer or empty list is a field left as it is.
type ItemSearch ¶
ItemSearch is search_issues' and search_merge_requests' query. At most one of Project and Group is set.
type JobLogQuery ¶
type JobLogQuery struct {
Project string
JobID int64
// ByteOffset is where the window starts; nil takes the tail.
ByteOffset *int
// ByteLimit is the window's size; 0 takes render.JobLogBytes.
ByteLimit int
FailedOnly bool
}
JobLogQuery is get_job_log's query. Offsets are bytes of the log as GitLab stores it.
type JobVariable ¶
JobVariable is one variable play_job sets.
type LabelRequest ¶
type LabelRequest struct {
Project string
LabelID int64
Version string
Name string
Color string
Description *string
Priority *int
}
LabelRequest is create_label's and update_label's request. A nil field is left as it is.
type LintQuery ¶
type LintQuery struct {
Project string
Ref string
Simulate bool
IncludeJobs bool
Offset int
// Content is configuration to lint instead of the committed one.
Content string
}
LintQuery is lint_ci's query.
type MergeRequestCreate ¶
type MergeRequestCreate struct {
Project string
SourceBranch string
TargetBranch string
Title string
Description string
Labels []string
Assignees []string
Reviewers []string
Milestone string
Draft bool
RemoveSourceBranch bool
Squash bool
}
MergeRequestCreate is create_merge_request's request.
type MergeRequestMerge ¶
type MergeRequestMerge struct {
Project string
IID int64
SHA string
Squash *bool
RemoveSourceBranch *bool
MergeCommitMessage string
SquashCommitMessage string
AutoMerge bool
}
MergeRequestMerge is merge_merge_request's request.
type MergeRequestUpdate ¶
type MergeRequestUpdate struct {
Project string
IID int64
UpdatedAt string
Title *string
Description *string
AddLabels []string
RemoveLabels []string
AddAssignees []string
RemoveAssignees []string
AddReviewers []string
RemoveReviewers []string
Milestone *string
ClearMilestone bool
State string
TargetBranch *string
Draft *bool
RemoveSourceBranch *bool
Squash *bool
}
MergeRequestUpdate is update_merge_request's request.
type MilestoneRequest ¶
type MilestoneRequest struct {
Project string
ID int64
UpdatedAt string
Title string
Description *string
DueDate *string
StartDate *string
StateEvent string
}
MilestoneRequest is create_milestone's and update_milestone's request. A nil field is left as it is; an empty date clears it.
type MilestoneSearch ¶
type MilestoneSearch struct {
Project string
Group string
State string
Search string
Title string
IncludeAncestors bool
List gapi.ListOptions
}
MilestoneSearch is list_milestones' query: a project or a group.
type Options ¶
type Options struct {
// Client is nil when nobody is signed in; every call then answers
// [auth].
Client *gapi.Client
Config config.Config
Granted []string
}
Options are what the service needs.
type PickRequest ¶
PickRequest is cherry_pick_commit's and revert_commit's request.
type PipelineRun ¶
type PipelineRun struct {
Project string
Ref string
Variables []PipelineVariable
Inputs map[string]any
}
PipelineRun is run_pipeline's request.
type PipelineVariable ¶
PipelineVariable is one variable run_pipeline sets.
type ProjectSearch ¶
type ProjectSearch struct {
Search string
Group string
IncludeSubgroups bool
// Scope is member (default), owned, starred or all.
Scope string
Visibility string
IncludeArchived bool
List gapi.ListOptions
}
ProjectSearch is search_projects' query.
type Registered ¶
Registered is one tool the server registered, for get_me and resolve_url to report the surface that exists rather than a second description of the rules that built it.
type ReleaseCreate ¶
type ReleaseCreate struct {
Project string
TagName string
Ref string
TagMessage string
Name string
Description string
Milestones []string
ReleasedAt *time.Time
Links []gapi.ReleaseLink
}
ReleaseCreate is create_release's request.
type ReviewComment ¶
type ReviewComment struct {
Project string
IID int64
Body string
DiscussionID string
ResolveThread bool
Location *DiffLocation
}
ReviewComment is add_review_comment's request.
type SearchQuery ¶
type SearchQuery struct {
Project string
Group string
Scope string
Search string
State string
Ref string
List gapi.ListOptions
}
SearchQuery is search's query.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds what every call shares.
func New ¶
New builds a Service. The instance comes from the client, or from the configuration when there is no client, so resolve_url can still say what a URL is before anyone signs in.
func (*Service) AddComment ¶
AddComment posts a comment now: on an issue or a merge request, as a reply in a thread, as a new resolvable thread, or as a new thread on a line of a merge request's diff.
func (*Service) AddReviewComment ¶
func (s *Service) AddReviewComment(ctx context.Context, in ReviewComment) (model.CommentWrite, error)
AddReviewComment creates a draft: a review comment only its author sees until submit_review publishes it.
func (*Service) ApproveMergeRequest ¶
func (s *Service) ApproveMergeRequest(ctx context.Context, raw string, iid int64, sha string) (model.ApprovalWrite, error)
ApproveMergeRequest approves a merge request at the head the caller read. An approval is someone's sign-off another person's merge rule counts, which is why it is Ship (§4.3, §17.2).
func (*Service) Blame ¶
Blame shows who last changed each line of a file, a run of lines per commit, under the file budget (§4.8).
func (*Service) CancelPipeline ¶
func (s *Service) CancelPipeline(ctx context.Context, raw string, id int64) (model.PipelineWrite, error)
CancelPipeline cancels a pipeline's running and pending jobs.
func (*Service) CompareRefs ¶
CompareRefs compares two refs: the commits in to and not in from, and the diffs, each under its bound (§7.5). GitLab answers unpaged, so the offsets continue within one answer.
func (*Service) CreateBranch ¶
func (s *Service) CreateBranch(ctx context.Context, raw, branch, ref string) (model.BranchWrite, error)
CreateBranch creates a branch at ref, the default branch when ref is empty. A name a protected rule covers is refused as create_commit refuses it: a new protected branch at a ref of the caller's choosing would put code there that no merge request showed (§4.4).
func (*Service) CreateCommit ¶
func (s *Service) CreateCommit(ctx context.Context, in CommitCreate) (model.CommitWrite, error)
CreateCommit commits file changes to a branch. It refuses the default branch and every protected branch, read at call time: code reaches a protected branch only through a merge request (§4.4).
func (*Service) CreateIssue ¶
func (s *Service) CreateIssue(ctx context.Context, in IssueCreate) (model.IssueWrite, error)
CreateIssue creates an issue.
func (*Service) CreateLabel ¶
func (s *Service) CreateLabel(ctx context.Context, in LabelRequest) (model.LabelWrite, error)
CreateLabel creates a project label.
func (*Service) CreateMergeRequest ¶
func (s *Service) CreateMergeRequest(ctx context.Context, in MergeRequestCreate) (model.MergeRequestWrite, error)
CreateMergeRequest opens a merge request.
func (*Service) CreateMilestone ¶
func (s *Service) CreateMilestone(ctx context.Context, in MilestoneRequest) (model.MilestoneWrite, error)
CreateMilestone creates a project milestone.
func (*Service) CreateRelease ¶
func (s *Service) CreateRelease(ctx context.Context, in ReleaseCreate) (model.ReleaseWrite, error)
CreateRelease creates a release, and its tag at ref when the tag does not exist yet.
func (*Service) CreateSnippet ¶
func (s *Service) CreateSnippet(ctx context.Context, in SnippetCreate) (model.SnippetWrite, error)
CreateSnippet creates a private snippet, in a project or the account's own. Visibility is not the caller's to choose: a public snippet from a model is how private content leaves (§4.7, §7.8).
func (*Service) CreateTag ¶
func (s *Service) CreateTag(ctx context.Context, raw, name, ref, message string) (model.TagWrite, error)
CreateTag creates a tag at a ref. A name a protected-tag rule covers is refused: a protected tag's pipelines see protected variables and may deploy, so it is made by a person (§17.13).
func (*Service) DeleteBranch ¶
func (s *Service) DeleteBranch(ctx context.Context, in BranchDeletion) (model.BranchDelete, error)
DeleteBranch deletes a branch. It refuses the default branch and every protected one, and one GitLab does not count merged unless the caller says so.
func (*Service) DeleteComment ¶
func (s *Service) DeleteComment(ctx context.Context, in CommentDeletion) (model.CommentDelete, error)
DeleteComment deletes one of the signed-in account's own comments. GitLab lets a maintainer delete anyone's; this server does not, since another person's words are theirs to withdraw.
func (*Service) DeleteLabel ¶
func (s *Service) DeleteLabel(ctx context.Context, raw string, id int64, version string) (model.LabelWrite, error)
DeleteLabel deletes a project label, which takes it off every issue and merge request.
func (*Service) DeleteMilestone ¶
func (s *Service) DeleteMilestone(ctx context.Context, raw string, id int64, updatedAt string) (model.MilestoneWrite, error)
DeleteMilestone deletes a project milestone the caller read, which takes it off every issue and merge request.
func (*Service) DeleteReviewComment ¶
func (s *Service) DeleteReviewComment(ctx context.Context, raw string, iid, draftID int64) (model.DraftDelete, error)
DeleteReviewComment deletes one of the signed-in account's drafts.
func (*Service) DeleteWikiPage ¶
func (s *Service) DeleteWikiPage(ctx context.Context, raw, slug, witness string) (model.WikiDelete, error)
DeleteWikiPage deletes a page the caller read.
func (*Service) FindUsers ¶
func (s *Service) FindUsers(ctx context.Context, q gapi.UserQuery, opts gapi.ListOptions) (model.Users, error)
FindUsers finds accounts by exact username or by a search of names and usernames (§6.3).
func (*Service) GetArtifact ¶
func (s *Service) GetArtifact(ctx context.Context, raw string, job int64, path string, offset int) (model.Artifact, error)
GetArtifact shows one text file of a job's artifacts, masked as a job log is (§4.1.4), under the file budget. A binary file is named with its size only.
func (*Service) GetCommit ¶
func (s *Service) GetCommit(ctx context.Context, raw, sha string, fileOffset, diffOffset, messageOffset int) (model.Commit, error)
GetCommit reads a commit and its diffs under the budget, starting at the fileOffset-th changed file. A diff that does not fit is named, and file_offset continues from it. The message is shown from messageOffset, and a cut one says where to continue.
func (*Service) GetFile ¶
func (s *Service) GetFile(ctx context.Context, raw, path, ref string, offset int) (model.File, error)
GetFile reads a file at a ref (§7.5). Text is shown inside a boundary under the budget; binary content is described, never shown.
func (*Service) GetIssue ¶
func (s *Service) GetIssue(ctx context.Context, raw string, iid int64, offset int) (model.Issue, error)
GetIssue reads an issue with a summary of its threads (§7.2). The two reads are independent and run at once.
func (*Service) GetJobLog ¶
GetJobLog shows a window of a job's log: the tail by default, from byte_offset when given, or the section the job failed in (§7.6). What it shows is cleaned as GitLab's page shows it, secret shapes masked (§4.1.4) and hidden characters made visible, inside a boundary. Only the window and what its edges need are read, so a log of any size can be shown (§7.6).
func (*Service) GetMRDiff ¶
func (s *Service) GetMRDiff(ctx context.Context, raw string, iid int64, paths []string, fileOffset, diffOffset int) (model.MRDiff, error)
GetMRDiff shows a merge request's diffs under the budget: the named files, or every file from fileOffset (§7.3). A named file the merge request does not change is refused naming it.
func (*Service) GetMergeRequest ¶
func (s *Service) GetMergeRequest(ctx context.Context, raw string, iid int64, offset int) (model.MergeRequest, error)
GetMergeRequest reads a merge request with its approval state and a summary of its threads (§7.2). The three reads are independent and run at once. The approval read is best effort: an instance that refuses it still has a merge request to show.
func (*Service) GetPipeline ¶
func (s *Service) GetPipeline(ctx context.Context, raw string, id int64) (model.PipelineDetail, error)
GetPipeline reads a pipeline with its failed jobs (§7.6). The two reads are independent and run at once.
func (*Service) GetProject ¶
GetProject reads one project.
func (*Service) GetRelease ¶
func (s *Service) GetRelease(ctx context.Context, raw, tag string, offset int) (model.Release, error)
GetRelease reads the release of a tag, its notes under the description budget.
func (*Service) GetSnippet ¶
func (s *Service) GetSnippet(ctx context.Context, raw string, id int64, file string, offset int) (model.Snippet, error)
GetSnippet reads a snippet and one of its files: the first unless file names another. A personal snippet has no project.
func (*Service) GetWikiPage ¶
func (s *Service) GetWikiPage(ctx context.Context, raw, slug string, offset int) (model.WikiPage, error)
GetWikiPage reads a page's content under the file budget, inside a boundary, with the hash a write needs.
func (*Service) LinkIssues ¶
func (s *Service) LinkIssues(ctx context.Context, in IssueLinkRequest) (model.IssueLinkWrite, error)
LinkIssues links two issues. A link that exists is reported unchanged.
func (*Service) LintCI ¶
LintCI checks a project's CI configuration at a ref (§7.6). The merged configuration is shown under the file budget.
func (*Service) ListArtifacts ¶
func (s *Service) ListArtifacts(ctx context.Context, raw string, job int64, dir string, recursive bool, opts gapi.ListOptions) (model.Artifacts, error)
ListArtifacts lists a job's artifact files.
func (*Service) ListBranches ¶
func (s *Service) ListBranches(ctx context.Context, raw, search string, opts gapi.ListOptions) (model.Branches, error)
ListBranches lists branches.
func (*Service) ListCommits ¶
func (s *Service) ListCommits(ctx context.Context, raw string, q gapi.CommitQuery, opts gapi.ListOptions) (model.Commits, error)
ListCommits lists commits reachable from a ref.
func (*Service) ListDeployments ¶
func (s *Service) ListDeployments(ctx context.Context, raw string, q gapi.DeploymentQuery, opts gapi.ListOptions) (model.Deployments, error)
ListDeployments lists a project's deployments.
func (*Service) ListDiscussions ¶
func (s *Service) ListDiscussions(ctx context.Context, q DiscussionQuery) (model.Discussions, error)
ListDiscussions lists threads newest first under the character budget (§4.8). Threads of the page that do not fit are named with their author and date, and the next page starts with them.
func (*Service) ListEnvironments ¶
func (s *Service) ListEnvironments(ctx context.Context, raw string, q gapi.EnvironmentQuery, opts gapi.ListOptions) (model.Environments, error)
ListEnvironments lists a project's environments.
func (*Service) ListEvents ¶
func (s *Service) ListEvents(ctx context.Context, raw string, q gapi.EventQuery, opts gapi.ListOptions) (model.Events, error)
ListEvents lists a project's activity, or the signed-in account's own when project is empty.
func (*Service) ListJobs ¶
func (s *Service) ListJobs(ctx context.Context, raw string, pipeline int64, q gapi.JobQuery, opts gapi.ListOptions) (model.Jobs, error)
ListJobs lists a pipeline's jobs.
func (*Service) ListLabels ¶
func (s *Service) ListLabels(ctx context.Context, raw string, q gapi.LabelQuery, opts gapi.ListOptions) (model.Labels, error)
ListLabels lists the labels a project's issues and merge requests can carry (§7.7).
func (*Service) ListMRCommits ¶
func (s *Service) ListMRCommits(ctx context.Context, raw string, iid int64, opts gapi.ListOptions) (model.MRCommits, error)
ListMRCommits lists a merge request's commits.
func (*Service) ListMRFiles ¶
func (s *Service) ListMRFiles(ctx context.Context, raw string, iid int64, opts gapi.ListOptions) (model.MRFiles, error)
ListMRFiles lists a merge request's changed files with their line counts and GitLab's markers, and no diff text (§7.3).
func (*Service) ListMembers ¶
func (s *Service) ListMembers(ctx context.Context, raw, query string, opts gapi.ListOptions) (model.Members, error)
ListMembers lists everyone with access to a project, through a group included.
func (*Service) ListMilestones ¶
func (s *Service) ListMilestones(ctx context.Context, q MilestoneSearch) (model.Milestones, error)
ListMilestones lists a project's or a group's milestones (§7.7).
func (*Service) ListPipelines ¶
func (s *Service) ListPipelines(ctx context.Context, raw string, q gapi.PipelineQuery, opts gapi.ListOptions) (model.Pipelines, error)
ListPipelines lists a project's pipelines (§7.6).
func (*Service) ListReleases ¶
func (s *Service) ListReleases(ctx context.Context, raw string, q gapi.ReleaseQuery, opts gapi.ListOptions) (model.Releases, error)
ListReleases lists a project's releases.
func (*Service) ListReviewComments ¶
func (s *Service) ListReviewComments(ctx context.Context, raw string, iid int64, pageToken string) (model.DraftNotes, error)
ListReviewComments lists the signed-in account's unpublished review comments on a merge request, under the discussion budget (§7.3). Drafts that do not fit are named, and the next page starts with them.
func (*Service) ListSnippets ¶
func (s *Service) ListSnippets(ctx context.Context, raw string, opts gapi.ListOptions) (model.Snippets, error)
ListSnippets lists a project's snippets, or the signed-in account's own when project is empty.
func (*Service) ListTags ¶
func (s *Service) ListTags(ctx context.Context, raw string, q gapi.TagQuery, opts gapi.ListOptions) (model.Tags, error)
ListTags lists a project's tags.
func (*Service) ListTree ¶
func (s *Service) ListTree(ctx context.Context, raw string, q gapi.TreeQuery, opts gapi.ListOptions) (model.Tree, error)
ListTree lists a directory.
func (*Service) ListWikiPages ¶
ListWikiPages lists a project wiki's pages. GitLab answers with every page at once.
func (*Service) MarkTodosDone ¶
MarkTodosDone marks the signed-in account's to-do items done by id. Under GITLAB_MCP_WRITE_NAMESPACES an item whose project is outside it is refused like any other write (§4.7); the items' projects are read once for that, and only then.
func (*Service) Me ¶
Me reads who is signed in and what this server and instance support (§7.9). The account is required; the instance metadata and the token details are reported as unknown when they cannot be read, because the rest of the answer is still worth having. The reads are independent and run at once, and metadata read here is kept for the next call.
func (*Service) MergeMergeRequest ¶
func (s *Service) MergeMergeRequest(ctx context.Context, in MergeRequestMerge) (model.MergeWrite, error)
MergeMergeRequest merges a merge request at the head the caller read, or sets it to merge when its pipeline succeeds.
func (*Service) MoveIssue ¶
MoveIssue moves an issue to another project. Both projects are held to the write allow-list, and a move that would show the issue to more people than can see it now is refused: an injected "move this" is how a private issue would reach a public project (§17.13).
func (*Service) Pick ¶
Pick cherry-picks or reverts a commit onto a branch as a new commit. The default branch and protected branches are refused as create_commit refuses them (§4.4). A dry run asks GitLab's own dry run, which says whether the change applies.
func (*Service) PlayJob ¶
func (s *Service) PlayJob(ctx context.Context, raw string, id int64, vars []JobVariable, inputs map[string]any) (model.JobWrite, error)
PlayJob starts a manual job, with variables for this run. Their values are sent and never shown.
func (*Service) RebaseMergeRequest ¶
func (s *Service) RebaseMergeRequest(ctx context.Context, raw string, iid int64, sha string, skipCI bool) (model.RebaseWrite, error)
RebaseMergeRequest rebases a merge request's source branch onto its target, from the head the caller reviewed. GitLab rebases in the background; the result says whether it is still running.
func (*Service) ResolveDiscussion ¶
func (s *Service) ResolveDiscussion(ctx context.Context, raw, typ string, iid int64, discussionID string, resolve bool) (model.DiscussionWrite, error)
ResolveDiscussion resolves or reopens a thread of a merge request, or of an issue when typ is issue.
func (*Service) ResolveURL ¶
ResolveURL turns a web URL on the configured instance into tool arguments (§6.1). It needs the network only when a file or tree URL's ref has slashes in it and could end anywhere: then one branch listing settles where the ref stops and the path starts.
func (*Service) RetryJob ¶
func (s *Service) RetryJob(ctx context.Context, raw string, id int64, inputs map[string]any) (model.JobWrite, error)
RetryJob runs a job again as a new job.
func (*Service) RetryPipeline ¶
func (s *Service) RetryPipeline(ctx context.Context, raw string, id int64) (model.PipelineWrite, error)
RetryPipeline retries a pipeline's failed and canceled jobs.
func (*Service) RunPipeline ¶
func (s *Service) RunPipeline(ctx context.Context, in PipelineRun) (model.PipelineWrite, error)
RunPipeline runs a pipeline for a ref. Variable values are sent and never shown: a result names their keys (§7.6).
func (*Service) SaveWikiPage ¶
SaveWikiPage creates a page, or changes one the caller read.
func (*Service) Search ¶
Search runs GitLab's search in one project, one group or the instance (§7.1). A scope the instance or group can only search with advanced search, which it lacks, is [unsupported] and says to search a project.
func (*Service) SearchIssues ¶
SearchIssues lists issues.
func (*Service) SearchMergeRequests ¶
SearchMergeRequests lists merge requests.
func (*Service) SearchProjects ¶
func (s *Service) SearchProjects(ctx context.Context, q ProjectSearch) (model.ProjectList, error)
SearchProjects lists projects.
func (*Service) SetRegistered ¶
func (s *Service) SetRegistered(r []Registered)
SetRegistered records the tools the server registered.
func (*Service) SubmitReview ¶
SubmitReview publishes every draft of the signed-in account on a merge request at once. An approving review is Ship: it is someone's sign-off another person's merge rule counts (§4.3).
func (*Service) UnapproveMergeRequest ¶
func (s *Service) UnapproveMergeRequest(ctx context.Context, raw string, iid int64) (model.ApprovalWrite, error)
UnapproveMergeRequest withdraws the signed-in account's approval.
func (*Service) UnlinkIssues ¶
func (s *Service) UnlinkIssues(ctx context.Context, in IssueLinkRequest) (model.IssueLinkWrite, error)
UnlinkIssues removes the link between two issues. With no link, the result is unchanged.
func (*Service) UpdateIssue ¶
func (s *Service) UpdateIssue(ctx context.Context, in IssueUpdate) (model.IssueWrite, error)
UpdateIssue changes the fields given, after checking the witness.
func (*Service) UpdateLabel ¶
func (s *Service) UpdateLabel(ctx context.Context, in LabelRequest) (model.LabelWrite, error)
UpdateLabel changes a project label. Only the fields given are sent.
func (*Service) UpdateMergeRequest ¶
func (s *Service) UpdateMergeRequest(ctx context.Context, in MergeRequestUpdate) (model.MergeRequestWrite, error)
UpdateMergeRequest changes the fields given, after checking the witness.
func (*Service) UpdateMilestone ¶
func (s *Service) UpdateMilestone(ctx context.Context, in MilestoneRequest) (model.MilestoneWrite, error)
UpdateMilestone changes a project milestone the caller read. Only the fields given are sent.
type SnippetCreate ¶
type SnippetCreate struct {
Project string // empty for a personal snippet
Title string
Description string
Files []SnippetFile
}
SnippetCreate is create_snippet's request.
type SnippetFile ¶
SnippetFile is one file of a new snippet.
type TodoSearch ¶
type TodoSearch struct {
Project string
State string
Action string
Type string
List gapi.ListOptions
}
TodoSearch is list_todos' query.