Help us shape the future of Go! Take the 2026 Go Developer Survey

gitlab

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package gitlab holds the wire types of GitLab's REST API v4.

Hand-written, for exactly the fields the server uses (CLAUDE.md rule 13, docs/architecture.md §4.10). A field is added when a tool reads it, and `scripts/gates api-fields` holds every field here against the OpenAPI snapshot. Fields GitLab adds without notice are reported by the client as drift rather than failing a call.

No field whose name ends in `_token` is ever declared: a project read once carried a runner registration token, and a field that is never decoded cannot leak. TestNoTokenFields holds it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel struct {
	ID                     int64  `json:"id"`
	AccessLevel            *int   `json:"access_level"`
	AccessLevelDescription string `json:"access_level_description"`
	UserID                 *int64 `json:"user_id"`
	GroupID                *int64 `json:"group_id"`
}

AccessLevel is one rule of a protected branch.

type Approvals

type Approvals struct {
	Approved          bool       `json:"approved"`
	ApprovalsRequired *int       `json:"approvals_required"`
	ApprovalsLeft     *int       `json:"approvals_left"`
	ApprovedBy        []Approver `json:"approved_by"`
	UserHasApproved   bool       `json:"user_has_approved"`
	UserCanApprove    bool       `json:"user_can_approve"`
}

Approvals is GET /projects/:id/merge_requests/:iid/approvals. The counts are Premium fields and absent on Community Edition.

type Approver

type Approver struct {
	User UserBasic `json:"user"`
}

Approver is one row of Approvals.ApprovedBy.

type ArtifactEntry

type ArtifactEntry struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Type string `json:"type"` // file or directory
	Size *int64 `json:"size"`
}

ArtifactEntry is one row of GET /projects/:id/jobs/:id/artifacts/tree.

type BlameCommit

type BlameCommit struct {
	ID           string    `json:"id"`
	AuthorName   string    `json:"author_name"`
	AuthoredDate time.Time `json:"authored_date"`
	Message      string    `json:"message"`
}

BlameCommit is the commit a blame range names.

type BlameRange

type BlameRange struct {
	Commit BlameCommit `json:"commit"`
	Lines  []string    `json:"lines"`
}

BlameRange is one row of GET …/repository/files/:path/blame: a run of lines and the commit that last changed them.

type Branch

type Branch struct {
	Name               string `json:"name"`
	Merged             bool   `json:"merged"`
	Protected          bool   `json:"protected"`
	Default            bool   `json:"default"`
	DevelopersCanPush  bool   `json:"developers_can_push"`
	DevelopersCanMerge bool   `json:"developers_can_merge"`
	CanPush            bool   `json:"can_push"`
	WebURL             string `json:"web_url"`
	Commit             Commit `json:"commit"`
}

Branch is one row of GET /projects/:id/repository/branches.

type Bridge

type Bridge struct {
	ID                 int64               `json:"id"`
	Name               string              `json:"name"`
	Stage              string              `json:"stage"`
	Status             string              `json:"status"`
	AllowFailure       bool                `json:"allow_failure"`
	FailureReason      string              `json:"failure_reason"`
	CreatedAt          time.Time           `json:"created_at"`
	StartedAt          *time.Time          `json:"started_at"`
	FinishedAt         *time.Time          `json:"finished_at"`
	Duration           *float64            `json:"duration"` // seconds
	WebURL             string              `json:"web_url"`
	DownstreamPipeline *DownstreamPipeline `json:"downstream_pipeline"`
}

Bridge is a trigger job: it starts a downstream pipeline and takes that pipeline's outcome. The job listing leaves it out.

type Commit

type Commit struct {
	ID             string       `json:"id"`
	ShortID        string       `json:"short_id"`
	Title          string       `json:"title"`
	Message        string       `json:"message"`
	AuthorName     string       `json:"author_name"`
	AuthorEmail    string       `json:"author_email"`
	AuthoredDate   time.Time    `json:"authored_date"`
	CommitterName  string       `json:"committer_name"`
	CommitterEmail string       `json:"committer_email"`
	CommittedDate  time.Time    `json:"committed_date"`
	CreatedAt      time.Time    `json:"created_at"`
	ParentIDs      []string     `json:"parent_ids"`
	WebURL         string       `json:"web_url"`
	Stats          *CommitStats `json:"stats"`
}

Commit is GET /projects/:id/repository/commits/:sha and the rows of the commit list. Stats come only on the single read.

type CommitStats

type CommitStats struct {
	Additions int `json:"additions"`
	Deletions int `json:"deletions"`
	Total     int `json:"total"`
}

CommitStats counts a commit's changed lines.

type Compare

type Compare struct {
	Commits        []Commit `json:"commits"`
	Diffs          []Diff   `json:"diffs"`
	CompareTimeout bool     `json:"compare_timeout"`
	CompareSameRef bool     `json:"compare_same_ref"`
	WebURL         string   `json:"web_url"`
}

Compare is GET /projects/:id/repository/compare. GitLab returns every commit and every diff in one answer, unpaged.

type Deployment

type Deployment struct {
	ID          int64                 `json:"id"`
	IID         int64                 `json:"iid"`
	Status      string                `json:"status"`
	Ref         string                `json:"ref"`
	SHA         string                `json:"sha"`
	CreatedAt   time.Time             `json:"created_at"`
	UpdatedAt   *time.Time            `json:"updated_at"`
	User        *UserBasic            `json:"user"`
	Environment DeploymentEnvironment `json:"environment"`
	Deployable  *DeploymentJob        `json:"deployable"`
}

Deployment is one row of GET /projects/:id/deployments.

type DeploymentEnvironment

type DeploymentEnvironment struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

DeploymentEnvironment is the environment a deployment went to.

type DeploymentJob

type DeploymentJob struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

DeploymentJob is the job that ran a deployment.

type Diff

type Diff struct {
	OldPath       string `json:"old_path"`
	NewPath       string `json:"new_path"`
	AMode         string `json:"a_mode"`
	BMode         string `json:"b_mode"`
	Diff          string `json:"diff"`
	NewFile       bool   `json:"new_file"`
	RenamedFile   bool   `json:"renamed_file"`
	DeletedFile   bool   `json:"deleted_file"`
	TooLarge      bool   `json:"too_large"`
	Collapsed     bool   `json:"collapsed"`
	GeneratedFile *bool  `json:"generated_file"`
}

Diff is one file of a commit or merge request diff. TooLarge and Collapsed are kept, because a diff GitLab cut is not an empty one (§3.10).

type DiffRefs

type DiffRefs struct {
	BaseSHA  string `json:"base_sha"`
	HeadSHA  string `json:"head_sha"`
	StartSHA string `json:"start_sha"`
}

DiffRefs are the three SHAs a diff position is computed against.

type Discussion

type Discussion struct {
	ID             string `json:"id"`
	IndividualNote bool   `json:"individual_note"`
	Notes          []Note `json:"notes"`
}

Discussion is one thread of GET …/discussions.

type DownstreamPipeline

type DownstreamPipeline struct {
	ID        int64  `json:"id"`
	ProjectID int64  `json:"project_id"`
	Status    string `json:"status"`
	WebURL    string `json:"web_url"`
}

DownstreamPipeline is the pipeline a trigger job started, in its own project or another.

type DraftNote

type DraftNote struct {
	ID                int64     `json:"id"`
	AuthorID          int64     `json:"author_id"`
	Note              string    `json:"note"`
	DiscussionID      *string   `json:"discussion_id"`
	ResolveDiscussion bool      `json:"resolve_discussion"`
	CommitID          *string   `json:"commit_id"`
	Position          *Position `json:"position"`
	// LineCode is the line a draft on the diff is on, as GitLab computed
	// it from the position; null for a general draft.
	LineCode *string `json:"line_code"`
}

DraftNote is one row of GET …/merge_requests/:iid/draft_notes: a review comment the signed-in account has not published.

type Environment

type Environment struct {
	ID             int64                  `json:"id"`
	Name           string                 `json:"name"`
	Slug           string                 `json:"slug"`
	State          string                 `json:"state"`
	Tier           string                 `json:"tier"`
	ExternalURL    *string                `json:"external_url"`
	CreatedAt      time.Time              `json:"created_at"`
	UpdatedAt      time.Time              `json:"updated_at"`
	AutoStopAt     *time.Time             `json:"auto_stop_at"`
	LastDeployment *EnvironmentDeployment `json:"last_deployment"`
}

Environment is one row of GET /projects/:id/environments.

type EnvironmentDeployment

type EnvironmentDeployment struct {
	ID        int64     `json:"id"`
	IID       int64     `json:"iid"`
	Status    string    `json:"status"`
	Ref       string    `json:"ref"`
	SHA       string    `json:"sha"`
	CreatedAt time.Time `json:"created_at"`
}

EnvironmentDeployment is the last deployment an environment names.

type Event

type Event struct {
	ID             int64      `json:"id"`
	ActionName     string     `json:"action_name"`
	TargetType     *string    `json:"target_type"`
	TargetID       *int64     `json:"target_id"`
	TargetIID      *int64     `json:"target_iid"`
	TargetTitle    *string    `json:"target_title"`
	AuthorUsername string     `json:"author_username"`
	ProjectID      *int64     `json:"project_id"`
	CreatedAt      time.Time  `json:"created_at"`
	PushData       *EventPush `json:"push_data"`
}

Event is one row of GET /events and /projects/:id/events.

type EventPush

type EventPush struct {
	Action      string  `json:"action"`
	RefType     string  `json:"ref_type"`
	Ref         *string `json:"ref"`
	CommitCount int     `json:"commit_count"`
	CommitTitle *string `json:"commit_title"`
}

EventPush is what a push event carries.

type File

type File struct {
	FileName      string `json:"file_name"`
	FilePath      string `json:"file_path"`
	Size          int64  `json:"size"`
	Encoding      string `json:"encoding"`
	Content       string `json:"content"`
	ContentSHA256 string `json:"content_sha256"`
	Ref           string `json:"ref"`
	BlobID        string `json:"blob_id"`
	CommitID      string `json:"commit_id"`
	// LastCommitID is the witness an update or delete of this file
	// carries (§4.6).
	LastCommitID    string `json:"last_commit_id"`
	ExecuteFilemode bool   `json:"execute_filemode"`
}

File is GET /projects/:id/repository/files/:file_path. Content is base64 when Encoding says so.

type Issue

type Issue struct {
	ID             int64           `json:"id"`
	IID            int64           `json:"iid"`
	ProjectID      int64           `json:"project_id"`
	Title          string          `json:"title"`
	Description    string          `json:"description"`
	State          string          `json:"state"`
	Type           string          `json:"type"`
	Confidential   bool            `json:"confidential"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	ClosedAt       *time.Time      `json:"closed_at"`
	ClosedBy       *UserBasic      `json:"closed_by"`
	Labels         []string        `json:"labels"`
	Milestone      *Milestone      `json:"milestone"`
	Author         UserBasic       `json:"author"`
	Assignees      []UserBasic     `json:"assignees"`
	UserNotesCount int             `json:"user_notes_count"`
	Upvotes        int             `json:"upvotes"`
	Downvotes      int             `json:"downvotes"`
	DueDate        string          `json:"due_date"` // a date, "2026-10-01", not an instant
	WebURL         string          `json:"web_url"`
	References     References      `json:"references"`
	TaskCompletion *TaskCompletion `json:"task_completion_status"`
	// MovedToID is the issue it was moved to, once moved.
	MovedToID *int64 `json:"moved_to_id"`
}

Issue is GET /projects/:id/issues/:iid and the rows of the issue lists.

type IssueBasic

type IssueBasic struct {
	ID        int64  `json:"id"`
	IID       int64  `json:"iid"`
	ProjectID int64  `json:"project_id"`
	Title     string `json:"title"`
	State     string `json:"state"`
	WebURL    string `json:"web_url"`
}

IssueBasic is an issue as an issue link names it.

type IssueLink struct {
	ID          int64      `json:"id"`
	LinkType    string     `json:"link_type"`
	SourceIssue IssueBasic `json:"source_issue"`
	TargetIssue IssueBasic `json:"target_issue"`
}

IssueLink is POST /projects/:id/issues/:iid/links' answer.

type Job

type Job struct {
	ID             int64      `json:"id"`
	Name           string     `json:"name"`
	Stage          string     `json:"stage"`
	Status         string     `json:"status"`
	Ref            string     `json:"ref"`
	Tag            bool       `json:"tag"`
	AllowFailure   bool       `json:"allow_failure"`
	FailureReason  string     `json:"failure_reason"`
	CreatedAt      time.Time  `json:"created_at"`
	StartedAt      *time.Time `json:"started_at"`
	FinishedAt     *time.Time `json:"finished_at"`
	Duration       *float64   `json:"duration"`        // seconds
	QueuedDuration *float64   `json:"queued_duration"` // seconds
	WebURL         string     `json:"web_url"`
	Pipeline       JobPipe    `json:"pipeline"`
	// Artifacts holds the archived log as file_type "trace", once GitLab
	// has archived it; its size is the log's.
	Artifacts []JobArtifact `json:"artifacts"`
}

Job is one row of GET /projects/:id/pipelines/:pipeline_id/jobs.

type JobArtifact

type JobArtifact struct {
	FileType string `json:"file_type"`
	Size     int64  `json:"size"`
}

JobArtifact is one file a job keeps.

type JobPipe

type JobPipe struct {
	ID int64 `json:"id"`
}

JobPipe is the pipeline a job row names.

type Label

type Label struct {
	ID                     int64  `json:"id"`
	Name                   string `json:"name"`
	Color                  string `json:"color"`
	Description            string `json:"description"`
	OpenIssuesCount        *int   `json:"open_issues_count"`
	ClosedIssuesCount      *int   `json:"closed_issues_count"`
	OpenMergeRequestsCount *int   `json:"open_merge_requests_count"`
	Priority               *int   `json:"priority"`
	IsProjectLabel         bool   `json:"is_project_label"`
	Archived               bool   `json:"archived"`
}

Label is one row of GET /projects/:id/labels.

type LineRange

type LineRange struct {
	Start LineRangeEnd `json:"start"`
	End   LineRangeEnd `json:"end"`
}

LineRange is the first and last line a multi-line diff note covers.

type LineRangeEnd

type LineRangeEnd struct {
	LineCode string `json:"line_code"`
	Type     string `json:"type"`
	OldLine  *int   `json:"old_line"`
	NewLine  *int   `json:"new_line"`
}

LineRangeEnd is one end of a LineRange.

type Lint

type Lint struct {
	Valid      bool      `json:"valid"`
	Errors     []string  `json:"errors"`
	Warnings   []string  `json:"warnings"`
	MergedYAML string    `json:"merged_yaml"`
	Jobs       []LintJob `json:"jobs"`
}

Lint is GET /projects/:id/ci/lint.

type LintJob

type LintJob struct {
	Name         string `json:"name"`
	Stage        string `json:"stage"`
	When         string `json:"when"`
	AllowFailure bool   `json:"allow_failure"`
}

LintJob is one job of a linted configuration, with include_jobs.

type Member

type Member struct {
	ID          int64   `json:"id"`
	Username    string  `json:"username"`
	Name        string  `json:"name"`
	State       string  `json:"state"`
	AccessLevel int     `json:"access_level"`
	ExpiresAt   *string `json:"expires_at"` // a date, not an instant
}

Member is one row of GET /projects/:id/members/all. The email an administrator is shown is never declared.

type MergeRequest

type MergeRequest struct {
	ID              int64       `json:"id"`
	IID             int64       `json:"iid"`
	ProjectID       int64       `json:"project_id"`
	Title           string      `json:"title"`
	Description     string      `json:"description"`
	State           string      `json:"state"`
	Draft           bool        `json:"draft"`
	CreatedAt       time.Time   `json:"created_at"`
	UpdatedAt       time.Time   `json:"updated_at"`
	MergedAt        *time.Time  `json:"merged_at"`
	ClosedAt        *time.Time  `json:"closed_at"`
	MergeUser       *UserBasic  `json:"merge_user"`
	Author          UserBasic   `json:"author"`
	Assignees       []UserBasic `json:"assignees"`
	Reviewers       []UserBasic `json:"reviewers"`
	SourceBranch    string      `json:"source_branch"`
	TargetBranch    string      `json:"target_branch"`
	SourceProjectID int64       `json:"source_project_id"`
	TargetProjectID int64       `json:"target_project_id"`
	Labels          []string    `json:"labels"`
	Milestone       *Milestone  `json:"milestone"`
	// DetailedMergeStatus is kept as GitLab's string: the set grows
	// between releases, and an enum here would fail on the next one.
	DetailedMergeStatus         string  `json:"detailed_merge_status"`
	HasConflicts                bool    `json:"has_conflicts"`
	BlockingDiscussionsResolved bool    `json:"blocking_discussions_resolved"`
	SHA                         string  `json:"sha"`
	MergeCommitSHA              *string `json:"merge_commit_sha"`
	SquashCommitSHA             *string `json:"squash_commit_sha"`
	Squash                      bool    `json:"squash"`
	// ForceRemoveSourceBranch is the "delete the source branch when
	// merged" setting; GitLab sends null when it was never set.
	ForceRemoveSourceBranch bool           `json:"force_remove_source_branch"`
	UserNotesCount          int            `json:"user_notes_count"`
	ChangesCount            string         `json:"changes_count"` // "12" or "1000+"
	WebURL                  string         `json:"web_url"`
	References              References     `json:"references"`
	DiffRefs                *DiffRefs      `json:"diff_refs"`
	HeadPipeline            *PipelineBasic `json:"head_pipeline"`
	// MergeWhenPipelineSucceeds is set while an auto-merge waits for the
	// pipeline.
	MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
}

MergeRequest is GET /projects/:id/merge_requests/:iid and the rows of the merge request lists. DiffRefs and HeadPipeline come only on the single read.

type MergeRequestRebase

type MergeRequestRebase struct {
	SHA              string  `json:"sha"`
	MergeError       *string `json:"merge_error"`
	RebaseInProgress *bool   `json:"rebase_in_progress"`
}

MergeRequestRebase is what rebase_merge_request reads of a merge request afterwards. RebaseInProgress is sent only when asked for with include_rebase_in_progress; MergeError is why the last merge or rebase failed.

type Metadata

type Metadata struct {
	Version    string `json:"version"`
	Revision   string `json:"revision"`
	Enterprise bool   `json:"enterprise"`
}

Metadata is GET /metadata. It needs authentication.

type Milestone

type Milestone struct {
	ID    int64  `json:"id"`
	IID   int64  `json:"iid"`
	Title string `json:"title"`
	State string `json:"state"`
}

Milestone is the milestone embedded in an issue or merge request.

type Namespace

type Namespace struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Path     string `json:"path"`
	FullPath string `json:"full_path"`
	Kind     string `json:"kind"`
}

Namespace is the group or user a project lives under.

type Note

type Note struct {
	ID           int64      `json:"id"`
	Type         *string    `json:"type"` // "DiffNote", "DiscussionNote" or null
	Body         string     `json:"body"`
	Author       UserBasic  `json:"author"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
	System       bool       `json:"system"`
	Internal     bool       `json:"internal"`
	NoteableID   int64      `json:"noteable_id"`   //nolint:misspell // GitLab's wire name
	NoteableType string     `json:"noteable_type"` //nolint:misspell // GitLab's wire name
	NoteableIID  *int64     `json:"noteable_iid"`  //nolint:misspell // GitLab's wire name
	Resolvable   bool       `json:"resolvable"`
	Resolved     bool       `json:"resolved"`
	ResolvedBy   *UserBasic `json:"resolved_by"`
	ResolvedAt   *time.Time `json:"resolved_at"`
	Position     *Position  `json:"position"`
}

Note is one comment in a discussion.

type Pipeline

type Pipeline struct {
	ID        int64     `json:"id"`
	IID       int64     `json:"iid"`
	ProjectID int64     `json:"project_id"`
	SHA       string    `json:"sha"`
	Ref       string    `json:"ref"`
	Status    string    `json:"status"`
	Source    string    `json:"source"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	WebURL    string    `json:"web_url"`
}

Pipeline is one row of GET /projects/:id/pipelines.

type PipelineBasic

type PipelineBasic struct {
	ID     int64  `json:"id"`
	IID    int64  `json:"iid"`
	SHA    string `json:"sha"`
	Ref    string `json:"ref"`
	Status string `json:"status"`
	WebURL string `json:"web_url"`
}

PipelineBasic is the pipeline embedded in a merge request.

type PipelineDetail

type PipelineDetail struct {
	ID             int64                 `json:"id"`
	IID            int64                 `json:"iid"`
	ProjectID      int64                 `json:"project_id"`
	SHA            string                `json:"sha"`
	Ref            string                `json:"ref"`
	Status         string                `json:"status"`
	Source         string                `json:"source"`
	CreatedAt      time.Time             `json:"created_at"`
	UpdatedAt      time.Time             `json:"updated_at"`
	WebURL         string                `json:"web_url"`
	BeforeSHA      string                `json:"before_sha"`
	Tag            bool                  `json:"tag"`
	YAMLErrors     *string               `json:"yaml_errors"`
	User           *UserBasic            `json:"user"`
	StartedAt      *time.Time            `json:"started_at"`
	FinishedAt     *time.Time            `json:"finished_at"`
	Duration       *int64                `json:"duration"`        // seconds
	QueuedDuration *int64                `json:"queued_duration"` // seconds
	DetailedStatus *PipelineDetailStatus `json:"detailed_status"`
}

PipelineDetail is GET /projects/:id/pipelines/:pipeline_id: a list row's fields and the ones only the single read carries.

type PipelineDetailStatus

type PipelineDetailStatus struct {
	Text  string `json:"text"`
	Label string `json:"label"`
	Group string `json:"group"`
}

PipelineDetailStatus is the status GitLab shows a person: "passed with warnings" where Status says "success".

type Position

type Position struct {
	BaseSHA      string `json:"base_sha"`
	StartSHA     string `json:"start_sha"`
	HeadSHA      string `json:"head_sha"`
	PositionType string `json:"position_type"`
	OldPath      string `json:"old_path"`
	NewPath      string `json:"new_path"`
	OldLine      *int   `json:"old_line"`
	NewLine      *int   `json:"new_line"`
	// LineRange is a multi-line comment's first and last line.
	LineRange *LineRange `json:"line_range"`
}

Position is where a diff note sits.

type Project

type Project struct {
	ID                int64  `json:"id"`
	Name              string `json:"name"`
	NameWithNamespace string `json:"name_with_namespace"`
	Path              string `json:"path"`
	PathWithNamespace string `json:"path_with_namespace"`
	Description       string `json:"description"`
	DefaultBranch     string `json:"default_branch"`
	Visibility        string `json:"visibility"`
	// IssuesAccessLevel narrows who sees the issues: private is members
	// only, whatever the project's visibility.
	IssuesAccessLevel string     `json:"issues_access_level"`
	WebURL            string     `json:"web_url"`
	Archived          bool       `json:"archived"`
	EmptyRepo         bool       `json:"empty_repo"`
	Topics            []string   `json:"topics"`
	StarCount         int        `json:"star_count"`
	ForksCount        int        `json:"forks_count"`
	OpenIssuesCount   *int       `json:"open_issues_count"`
	CreatedAt         time.Time  `json:"created_at"`
	LastActivityAt    *time.Time `json:"last_activity_at"`
	Namespace         Namespace  `json:"namespace"`
}

Project is GET /projects/:id and the rows of GET /projects.

Secret fields (runners_token and the rest) are never declared, so they are never decoded (§3.19).

type ProjectMilestone

type ProjectMilestone struct {
	ID        int64     `json:"id"`
	IID       int64     `json:"iid"`
	Title     string    `json:"title"`
	State     string    `json:"state"`
	DueDate   string    `json:"due_date"`   // a date, not an instant
	StartDate string    `json:"start_date"` // a date, not an instant
	Expired   *bool     `json:"expired"`
	UpdatedAt time.Time `json:"updated_at"`
	WebURL    string    `json:"web_url"`
	// Description and CreatedAt are read only by the milestone writes.
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
}

ProjectMilestone is one row of GET /projects/:id/milestones and GET /groups/:id/milestones.

type ProtectedBranch

type ProtectedBranch struct {
	ID                        int64         `json:"id"`
	Name                      string        `json:"name"`
	PushAccessLevels          []AccessLevel `json:"push_access_levels"`
	MergeAccessLevels         []AccessLevel `json:"merge_access_levels"`
	AllowForcePush            bool          `json:"allow_force_push"`
	CodeOwnerApprovalRequired *bool         `json:"code_owner_approval_required"`
}

ProtectedBranch is one row of GET /projects/:id/protected_branches. The name may be a wildcard such as "release/*".

type ProtectedTag

type ProtectedTag struct {
	Name string `json:"name"`
}

ProtectedTag is one row of GET /projects/:id/protected_tags. Name may be a wildcard.

type RebaseState

type RebaseState struct {
	RebaseInProgress bool `json:"rebase_in_progress"`
}

RebaseState is PUT …/merge_requests/:iid/rebase's answer.

type References

type References struct {
	Short    string `json:"short"`
	Relative string `json:"relative"`
	Full     string `json:"full"`
}

References are the ways GitLab spells an issue or merge request: "#12", "group/project#12".

type RelatedIssue

type RelatedIssue struct {
	IID         int64  `json:"iid"`
	ProjectID   int64  `json:"project_id"`
	Title       string `json:"title"`
	State       string `json:"state"`
	WebURL      string `json:"web_url"`
	IssueLinkID int64  `json:"issue_link_id"`
	LinkType    string `json:"link_type"`
}

RelatedIssue is one row of GET /projects/:id/issues/:iid/links: the linked issue, and the link.

type Release

type Release struct {
	TagName         string             `json:"tag_name"`
	Name            string             `json:"name"`
	Description     *string            `json:"description"`
	CreatedAt       time.Time          `json:"created_at"`
	ReleasedAt      *time.Time         `json:"released_at"`
	UpcomingRelease bool               `json:"upcoming_release"`
	Author          *UserBasic         `json:"author"`
	Commit          *ReleaseCommit     `json:"commit"`
	Milestones      []ReleaseMilestone `json:"milestones"`
	Assets          *ReleaseAssets     `json:"assets"`
}

Release is GET /projects/:id/releases/:tag_name and a row of the listing.

type ReleaseAssets

type ReleaseAssets struct {
	Count int           `json:"count"`
	Links []ReleaseLink `json:"links"`
}

ReleaseAssets counts a release's assets: its links and source archives.

type ReleaseCommit

type ReleaseCommit struct {
	ID      string `json:"id"`
	ShortID string `json:"short_id"`
	Title   string `json:"title"`
}

ReleaseCommit is the commit a release's tag points at.

type ReleaseLink struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	LinkType string `json:"link_type"`
}

ReleaseLink is an asset link of a release.

type ReleaseMilestone

type ReleaseMilestone struct {
	ID    int64  `json:"id"`
	Title string `json:"title"`
}

ReleaseMilestone is a milestone a release names.

type ScopeList

type ScopeList []string

ScopeList is a token's scopes, which Doorkeeper writes as an array and OAuth as one space-separated string. It reads either; any other shape reads as no scopes rather than failing the answer.

func (*ScopeList) UnmarshalJSON

func (l *ScopeList) UnmarshalJSON(data []byte) error

UnmarshalJSON reads an array of scopes or a space-separated string.

type SearchCommit

type SearchCommit struct {
	ID            string    `json:"id"`
	Title         string    `json:"title"`
	AuthorName    string    `json:"author_name"`
	CommittedDate time.Time `json:"committed_date"`
	WebURL        string    `json:"web_url"`
	ProjectID     int64     `json:"project_id"`
}

SearchCommit is one row of a commits search: a commit, and the project it is in.

type SearchHit

type SearchHit struct {
	// Issues, merge requests, milestones, projects, users, notes.
	ID        int64      `json:"id"`
	IID       int64      `json:"iid"`
	ProjectID int64      `json:"project_id"`
	Title     string     `json:"title"`
	State     string     `json:"state"`
	WebURL    string     `json:"web_url"`
	UpdatedAt *time.Time `json:"updated_at"`
	Author    *UserBasic `json:"author"`
	// Projects.
	PathWithNamespace string `json:"path_with_namespace"`
	// Projects and users.
	Name string `json:"name"`
	// Users.
	Username string `json:"username"`
	// Blobs and wiki blobs.
	Path      string `json:"path"`
	Ref       string `json:"ref"`
	Startline int    `json:"startline"`
	Data      string `json:"data"`
	// Notes.
	Body         string `json:"body"`
	NoteableType string `json:"noteable_type"` //nolint:misspell // GitLab's wire name
	NoteableIID  *int64 `json:"noteable_iid"`  //nolint:misspell // GitLab's wire name
}

SearchHit is one row of GET /search and its group and project forms, for every scope but commits. Its shape depends on the scope; this is the union of the fields read, and each scope fills its own.

type Snippet

type Snippet struct {
	ID          int64         `json:"id"`
	Title       string        `json:"title"`
	Description *string       `json:"description"`
	Visibility  string        `json:"visibility"`
	Author      UserBasic     `json:"author"`
	FileName    string        `json:"file_name"`
	Files       []SnippetFile `json:"files"`
	ProjectID   *int64        `json:"project_id"`
	CreatedAt   time.Time     `json:"created_at"`
	UpdatedAt   time.Time     `json:"updated_at"`
	WebURL      string        `json:"web_url"`
}

Snippet is GET /snippets/:id and /projects/:id/snippets/:snippet_id. ProjectID is null for a personal snippet. raw_url is not decoded: no URL a response names is ever called (§11).

type SnippetFile

type SnippetFile struct {
	Path string `json:"path"`
}

SnippetFile is one file of a snippet's repository.

type Tag

type Tag struct {
	Name      string      `json:"name"`
	Message   string      `json:"message"` // an annotated tag's message, "" for a lightweight tag
	Target    string      `json:"target"`
	Protected bool        `json:"protected"`
	CreatedAt *time.Time  `json:"created_at"`
	Commit    Commit      `json:"commit"`
	Release   *TagRelease `json:"release"`
}

Tag is one row of GET /projects/:id/repository/tags.

type TagRelease

type TagRelease struct {
	TagName string `json:"tag_name"`
}

TagRelease is the release a tag carries, if any.

type TaskCompletion

type TaskCompletion struct {
	Count          int `json:"count"`
	CompletedCount int `json:"completed_count"`
}

TaskCompletion counts the checkboxes in a description.

type Todo

type Todo struct {
	ID         int64        `json:"id"`
	Project    *TodoProject `json:"project"`
	Author     UserBasic    `json:"author"`
	ActionName string       `json:"action_name"`
	TargetType string       `json:"target_type"`
	Target     TodoTarget   `json:"target"`
	TargetURL  string       `json:"target_url"`
	Body       string       `json:"body"`
	State      string       `json:"state"`
	CreatedAt  time.Time    `json:"created_at"`
}

Todo is one row of GET /todos.

type TodoProject

type TodoProject struct {
	ID                int64  `json:"id"`
	PathWithNamespace string `json:"path_with_namespace"`
}

TodoProject is the project a to-do item belongs to.

type TodoTarget

type TodoTarget struct {
	IID   int64  `json:"iid"`
	Title string `json:"title"`
	State string `json:"state"`
}

TodoTarget is the issue, merge request or other item a to-do item points at. Its shape depends on TargetType; only what they share is read. The id is not: a commit's is its SHA, an issue's a number.

type TokenInfo

type TokenInfo struct {
	ResourceOwnerID int64 `json:"resource_owner_id"`
	// Scope is what the token was granted. Older Doorkeeper answers name
	// the key "scopes"; either is read.
	Scope ScopeList `json:"scope"`
	// ExpiresIn is the seconds left, nil for a token that does not
	// expire.
	ExpiresIn   *int64               `json:"expires_in"`
	Application TokenInfoApplication `json:"application"`
	// CreatedAt is Unix seconds, as Doorkeeper writes it.
	CreatedAt int64 `json:"created_at"`
}

TokenInfo is GET /oauth/token/info, Doorkeeper's introspection of the bearer token. It lives under the web base, not the API root.

func (*TokenInfo) UnmarshalJSON

func (t *TokenInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON reads the answer, taking the scopes from "scopes" when "scope" carries none.

type TokenInfoApplication

type TokenInfoApplication struct {
	UID string `json:"uid"`
}

TokenInfoApplication names the OAuth application the token came from.

type TreeEntry

type TreeEntry struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"` // "blob", "tree" or "commit" (a submodule)
	Path string `json:"path"`
	Mode string `json:"mode"`
}

TreeEntry is one row of GET /projects/:id/repository/tree.

type User

type User struct {
	ID        int64      `json:"id"`
	Username  string     `json:"username"`
	Name      string     `json:"name"`
	State     string     `json:"state"`
	WebURL    string     `json:"web_url"`
	Bot       bool       `json:"bot"`
	IsAdmin   bool       `json:"is_admin"`
	CreatedAt *time.Time `json:"created_at"`
}

User is GET /user, the signed-in account.

type UserBasic

type UserBasic struct {
	ID       int64  `json:"id"`
	Username string `json:"username"`
	Name     string `json:"name"`
	State    string `json:"state"`
	WebURL   string `json:"web_url"`
}

UserBasic is the user embedded in issues, merge requests and notes.

type WikiPage

type WikiPage struct {
	Format   string `json:"format"`
	Slug     string `json:"slug"`
	Title    string `json:"title"`
	Content  string `json:"content"`
	Encoding string `json:"encoding"`
}

WikiPage is GET /projects/:id/wikis/:slug. GitLab exposes no version and no updated_at, so the server's witness is a hash of Content (§4.6).

type WikiPageBasic

type WikiPageBasic struct {
	Format string `json:"format"`
	Slug   string `json:"slug"`
	Title  string `json:"title"`
}

WikiPageBasic is one row of GET /projects/:id/wikis.

Jump to

Keyboard shortcuts

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