gerrit

package
v0.0.0-...-f58e54c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const TimeLayout = "2006-01-02 15:04:05.000000000"

TimeLayout is the expected format of timestamps from Gerrit.

Variables

This section is empty.

Functions

func ParseTimestamp

func ParseTimestamp(timeStamp string) time.Time

ParseTimestamp converts a timestamp from the Gerrit API to a time.Time in UTC.

Types

type AccountInfo

type AccountInfo struct {
	// AccountID is the numeric ID of the account.
	AccountID int `json:"_account_id,omitempty"`
	// Name is the full name of the user. Only set if detailed account information is requested
	// with DescribeDetailedAccounts (for change queries) or DescribeDetails (for account
	// queries).
	Name string
	// Email is the email address the user prefers to be contacted through. Only set if detailed
	// account information is requested with DescribeDetailedAccounts (for change queries) or
	// DescribeDetails (for account queries).
	Email string
	// SecondaryEmails is a list of the secondary email addresses of the user. Only set for
	// account queries when DescribeAllEmails is given, and if the calling user has the
	// ModifyAccount capability.
	SecondaryEmails []string `json:"secondary_emails,omitempty"`
	// Username is the username of the user. Only set if detailed account information is
	// requested with DescribeDetailedAccounts (for change queries) or DescribeDetails (for
	// account queries).
	Username string
	// Avatars is a list of usable avatar icons for the user.
	Avatars []struct {
		URL    string
		Height int
	} `json:",omitempty"`

	// MoreAccounts indicates whether an account query would deliver more results if not
	// limited. Only set on the last account that is returned.
	MoreAccounts bool `json:"_more_accounts,omitempty"`
}

AccountInfo contains information about a Gerrit account.

type ActionInfo

type ActionInfo struct {
	// Method is the HTTP method to use with the action. Most actions use POST, PUT or DELETE
	// to cause state changes.
	Method string
	// Label is a short title to display to a user describing the action. In the Gerrit web
	// interface the label is used as the text on the button presented in the UI.
	Label string
	// Title is longer text to display describing the action. In a web UI this should be the
	// title attribute of the element, displaying when the user hovers the mouse.
	Title string
	// Enabled indicates that the action is permitted at this time and the caller is likely
	// allowed to execute it. This may change if state is updated at the server or permissions
	// are modified.
	Enabled bool
}

ActionInfo describes a REST API call the client can make to manipulate a resource. These are frequently implemented by plugins and may be discovered at runtime.

type ApprovalInfo

type ApprovalInfo struct {
	AccountInfo

	// Value is the vote that the user has given for the label. If present and zero, the user
	// is permitted to vote on the label. If absent, the user is not permitted to vote on that
	// label.
	Value *int
	// PermittedVotingRange is the VotingRangeInfo the user is authorized to vote on that
	// label. If present, the user is permitted to vote on the label regarding the range
	// values. If absent, the user is not permitted to vote on that label.
	PermittedVotingRange VotingRangeInfo `json:"permitted_voting_range"`
	// Date is the time and date describing when the approval was made.
	Date string
	// Tag is the value of the tag field from ReviewInput set while posting the review.
	// Votes/comments that contain tag with 'autogenerated:' prefix can be filtered out in the
	// web UI. NOTE: To apply different tags on different votes/comments multiple invocations
	// of the REST call are required.
	Tag string
	// PostSubmit indicates that this vote was made after the change was submitted.
	PostSubmit bool `json:"post_submit,omitempty"`
}

ApprovalInfo describes an approval vote by a user on a changeset.

type ChangeInfo

type ChangeInfo struct {
	// ID gives the ID of the change in the format "<project>~<branch>~<Change-Id>", where
	// 'project', 'branch', and 'Change-Id' are URL encoded. For 'branch' the refs/heads/
	// prefix is omitted.
	ID string
	// Project is the name of the project.
	Project string
	// Branch is the name of the target branch. The refs/heads/ prefix is omitted.
	Branch string
	// Topic is the topic to which this change belongs.
	Topic string
	// Assignee is the assignee of the change.
	Assignee AccountInfo
	// Hashtags is a list of hashtags that are set on the change (only populated when NoteDb is
	// enabled).
	Hashtags []string
	// ChangeID is the Change-ID of the change.
	ChangeID string `json:"change_id"`
	// Subject is the subject of the change (header line of the commit message).
	Subject string
	// Status is the status of the change ("NEW"/"MERGED"/"ABANDONED").
	Status string
	// Created is the timestamp of when the change was created.
	Created string
	// Updated is the timestamp of when the change was last updated.
	Updated string
	// Submitted is the timestamp of when the change was submitted.
	Submitted string
	// Submitter is the user who submitted the change.
	Submitter AccountInfo
	// Starred indicates whether the calling user has starred this change with the default label.
	Starred bool `json:",omitempty"`
	// Stars is a list of star labels that are applied by the calling user to this change. The
	// labels are lexicographically sorted.
	Stars []string
	// Reviewed indicates whether the change was reviewed by the calling user. Only set if
	// DescribeReviewed is requested.
	Reviewed bool `json:",omitempty"`
	// SubmitType is the submit type of the change ("INHERIT"/"FAST_FORWARD_ONLY"/
	// "MERGE_IF_NECESSARY"/"ALWAYS_MERGE"/"CHERRY_PICK"/"REBASE_IF_NECESSARY"/"REBASE_ALWAYS").
	// Not set for merged changes.
	SubmitType string `json:"submit_type"`
	// Mergeable indicates whether the change is mergeable. Not set for merged changes, if the
	// change has not yet been tested, or if DescribeSkipMergeable is passed or when
	// change.api.excludeMergeableInChangeInfo is set in the Gerrit config.
	Mergeable bool
	// Submittable is whether the change has been approved by the project submit rules. Only
	// set if requested with DescribeSubmittable.
	Submittable bool
	// Insertions is the number of inserted lines.
	Insertions int
	// Deletions is the number of deleted lines.
	Deletions int
	// TotalCommentCount is the total number of inline comments across all patch sets. Not set
	// if the current change index doesn't have the data.
	TotalCommentCount int `json:"total_comment_count"`
	// UnresolvedCommentCount is the number of unresolved inline comment threads across all
	// patch sets. Not set if the current change index doesn't have the data.
	UnresolvedCommentCount int `json:"unresolved_comment_count"`
	// Number is the legacy numeric ID of the change.
	Number int `json:"_number,omitempty"`
	// Owner is the owner of the change.
	Owner AccountInfo
	// Actions is actions the caller might be able to perform on this revision. The information
	// is a map of view name to ActionInfo entries.
	Actions map[string]ActionInfo
	// Requirements is a list of the requirements to be met before this change can be submitted.
	Requirements []Requirement
	// Labels is the labels of the change as a map that maps the label names to LabelInfo
	// entries. Only set if DescribeLabels or DescribeDetailedLabels are requested.
	Labels map[string]LabelInfo
	// PermittedLabels is a map of the permitted labels that maps a label name to the list of
	// values that are allowed for that label. Only set if DescribeDetailedLabels is requested.
	PermittedLabels map[string][]string `json:"permitted_labels"`
	// RemovableReviewers is the reviewers that can be removed by the calling user as a list of
	// AccountInfo entities. Only set if DescribeDetailedLabels is requested.
	RemovableReviewers []AccountInfo `json:"removable_reviewers"`
	// Reviewers is a map that maps a reviewer state to a list of AccountInfo entities. Possible
	// reviewer states are "REVIEWER", "CC", and "REMOVED". Only set if DescribeDetailedLabels
	// is requested.
	Reviewers map[string][]AccountInfo
	// PendingReviewers is updates to Reviewers that have been made while the change was in the
	// WIP state. Only present on WIP changes and only if there are pending reviewer updates to
	// report. These are reviewers who have not yet been notified about being added to or
	// removed from the change.
	PendingReviewers map[string][]AccountInfo `json:"pending_reviewers"`
	// ReviewerUpdates is updates to Reviewers set for the change as ReviewerUpdateInfo
	// entities. Only set if DescribeReviewerUpdates is requested and if NoteDb is enabled.
	ReviewerUpdates []ReviewerUpdateInfo `json:"reviewer_updates"`
	// Messages is messages associated with the change as a list of ChangeMessageInfo
	// entities. Only set if DescribeMessages is requested.
	Messages []ChangeMessageInfo
	// CurrentRevision is the commit ID of the current patch set of this change. Only set if
	// DescribeCurrentRevision or DescribeAllRevisions are requested.
	CurrentRevision string `json:"current_revision"`
	// Revisions is all patch sets of this change as a map that maps the commit ID of the
	// patch set to a RevisionInfo entity. Only set if DescribeCurrentRevision is requested
	// (in which case it will only contain a key for the current revision) or if
	// DescribeAllRevisions is requested.
	Revisions map[string]RevisionInfo
	// TrackingIDs is a list of TrackingIDInfo entities describing references to external
	// tracking systems. Only set if DescribeTrackingIDs is requested.
	TrackingIDs []TrackingIDInfo `json:"tracking_ids"`
	// MoreChanges indicates whether the query would deliver more results if not limited.
	// Only set on the last change that is returned.
	MoreChanges bool `json:"_more_changes,omitempty"`
	// Problems is a list of ProblemInfo entities describing potential problems with this
	// change. Only set if DescribeCheck is requested.
	Problems []ProblemInfo
	// IsPrivate indicates whether the change is marked as private.
	IsPrivate bool `json:"is_private"`
	// WorkInProgress indicates whether the change is marked as Work In Progress.
	WorkInProgress bool `json:"work_in_progress"`
	// HasReviewStarted indicates whether the change has been marked Ready at some point in
	// time.
	HasReviewStarted bool `json:"has_review_started"`
	// RevertOf gives the numeric Change-Id of the change that this change reverts.
	RevertOf string `json:"revert_of,omitempty"`
}

ChangeInfo refers to a change being reviewed, or that was already reviewed.

type ChangeMessageInfo

type ChangeMessageInfo struct {
	// ID is the ID of the message.
	ID string
	// Author is the author of the message as an AccountInfo entity. Unset if written by the
	// Gerrit system.
	Author AccountInfo
	// RealAuthor is the real author of the message as an AccountInfo entity. Set if the
	// message was posted on behalf of another user.
	RealAuthor *AccountInfo `json:"real_author"`
	// Date is the timestamp this message was posted.
	Date string
	// Message is the text left by the user.
	Message string
	// Tag is the value of the tag field from ReviewInput set while posting the review.
	// Votes/comments that contain tag with 'autogenerated:' prefix can be filtered out in the
	// web UI. NOTE: To apply different tags on different votes/comments multiple invocations
	// of the REST call are required.
	Tag string
	// RevisionNumber indicates which patchset (if any) generated this message.
	RevisionNumber int `json:"_revision_number"`
}

ChangeMessageInfo contains information about a message attached to a change.

type Client

type Client interface {
	QueryChangesEx(context.Context, []string, *QueryChangesOpts) ([]ChangeInfo, bool, error)
	GetChangeEx(context.Context, string, *QueryChangesOpts) (ChangeInfo, error)
	ListRevisionComments(context.Context, string, string) (map[string][]CommentInfo, error)
	GetPatchSetInfo(context.Context, string, string) (ChangeInfo, error)
	GetChangeReviewers(context.Context, string) ([]ReviewerInfo, error)
	QueryAccountsEx(context.Context, string, *QueryAccountsOpts) ([]AccountInfo, bool, error)
	URLForChange(*ChangeInfo) string
	Close() error
}

Client abstracts interaction with the Gerrit client, largely just so that it can be possible to mock. Ew.

func OpenClient

func OpenClient(ctx context.Context, log *zap.Logger, serverURL string) (Client, error)

OpenClient opens a Gerrit API client.

type CommentInfo

type CommentInfo struct {
	// PatchSet is the patch set number for the comment; only set in contexts where comments
	// may be returned for multiple patch sets.
	PatchSet int `json:"patch_set"`
	// ID is the URL encoded UUID of the comment.
	ID string
	// Path is the path of the file for which the inline comment was done. Not set if returned
	// in a map where the key is the file path.
	Path string
	// Side is the side on which the comment was added. Allowed values are REVISION and PARENT.
	// If not set, the default is REVISION.
	Side string
	// Parent is the 1-based parent number. Used only for merge commits when side == PARENT.
	// When not set the comment is for the auto-merge tree.
	Parent int
	// Line is the number of the line for which the comment was done. If range is set, this
	// equals the end line of the range. If neither line nor range is set, it’s a file comment.
	Line int
	// Range is the range of the comment as a CommentRange entity.
	Range *CommentRange
	// InReplyTo is the URL encoded UUID of the comment to which this comment is a reply.
	InReplyTo string `json:"in_reply_to"`
	// Message is the comment message.
	Message string
	// Updated is the timestamp of when this comment was written.
	Updated string
	// Author is the author of the message as an AccountInfo entity. Unset for draft comments,
	// assumed to be the calling user.
	Author AccountInfo
	// Tag is the value of the tag field from ReviewInput set while posting the review. NOTE:
	// To apply different tags on different votes/comments multiple invocations of the REST
	// call are required.
	Tag string
	// Unresolved is whether or not the comment must be addressed by the user. The state of
	// resolution of a comment thread is stored in the last comment in that thread
	// chronologically.
	Unresolved bool
}

CommentInfo contains information about an inline comment.

type CommentRange

type CommentRange struct {
	// StartLine is the start line number of the range. (1-based)
	StartLine int `json:"start_line"`
	// StartLine is the character position in the start line. (0-based)
	StartCharacter int `json:"start_character"`
	// EndLine is the end line number of the range. (1-based)
	EndLine int `json:"end_line"`
	// EndCharacter is the character position in the end line. (0-based)
	EndCharacter int `json:"end_character"`
}

CommentRange describes the range of an inline comment.

The comment range is a range from the start position, specified by start_line and start_character, to the end position, specified by end_line and end_character. The start position is inclusive and the end position is exclusive.

So, a range over part of a line will have start_line equal to end_line; however a range with end_line set to 5 and end_character equal to 0 will not include any characters on line 5.

type CommitInfo

type CommitInfo struct {
	// Commit is the commit ID. Not set if included in a RevisionInfo entity that is contained
	// in a map which has the commit ID as key.
	Commit string
	// Parents is the parent commits of this commit as a list of CommitInfo entities. In each
	// parent only the commit and subject fields are populated.
	Parents []CommitInfo
	// Author is the author of the commit as a GitPersonInfo entity.
	Author GitPersonInfo
	// Committer is the committer of the commit as a GitPersonInfo entity.
	Committer GitPersonInfo
	// Subject is the subject of the commit (header line of the commit message).
	Subject string
	// Message is the commit message.
	Message string
	// WebLinks is links to the commit in external sites as a list of WebLinkInfo entities.
	WebLinks []WebLinkInfo `json:"web_links"`
}

CommitInfo contains information about a commit.

type FetchInfo

type FetchInfo struct {
	// URL is the URL of the project.
	URL string
	// Ref is the ref of the patch set.
	Ref string
	// Commands gives the download commands for this patch set as a map that maps the command
	// names to the commands. Only set if DescribeDownloadCommands is requested.
	Commands map[string]string
}

FetchInfo contains information about how to fetch a patch set via a certain protocol.

type FileInfo

type FileInfo struct {
	// Status is the status of the file (“A”=Added, “D”=Deleted, “R”=Renamed, “C”=Copied,
	// “W”=Rewritten). Not set if the file was Modified (“M”).
	Status string
	// Binary indicates Whether the file is binary.
	Binary bool
	// OldPath is the old file path. Only set if the file was renamed or copied.
	OldPath string `json:"old_path"`
	// LinesInserted is the number of inserted lines. Not set for binary files or if no lines
	// were inserted. An empty last line is not included in the count and hence this number can
	// differ by one from details provided in DiffInfo.
	LinesInserted int `json:"lines_inserted"`
	// LinesDeleted is the number of deleted lines. Not set for binary files or if no lines
	// were deleted. An empty last line is not included in the count and hence this number can
	// differ by one from details provided in DiffInfo.
	LinesDeleted int `json:"lines_deleted"`
	// SizeDelta is the number of bytes by which the file size increased/decreased.
	SizeDelta int `json:"size_delta"`
	// Size is the file size in bytes.
	Size int
}

The FileInfo entity contains information about a file in a patch set.

type GitPersonInfo

type GitPersonInfo struct {
	// Name is the name of the author/committer.
	Name string
	// Email is the email address of the author/committer.
	Email string
	// Date is the timestamp of when this identity was constructed.
	Date string
	// TZ is the timezone offset from UTC of when this identity was constructed.
	TZ string
}

GitPersonInfo contains information about the author/committer of a commit.

type GpgKeyInfo

type GpgKeyInfo struct {
	// ID is the 8-char hex GPG key ID. Not set in map context.
	ID string
	// Fingerprint is the 40-char (plus spaces) hex GPG key fingerprint. Not set for deleted
	// keys.
	Fingerprint string
	// UserIDs is a list of OpenPGP User IDs associated with the public key. Not set for
	// deleted keys.
	UserIDs []string `json:"user_ids"`
	// Key is ASCII armored public key material. Not set for deleted keys.
	Key string
	// Status is the result of server-side checks on the key; one of "BAD", "OK", or "TRUSTED".
	// BAD keys have serious problems and should not be used. If a key is OK, inspecting only
	// that key found no problems, but the system does not fully trust the key’s origin. A
	// TRUSTED key is valid, and the system knows enough about the key and its origin to trust
	// it. Not set for deleted keys.
	Status string
	// Problems is a list of human-readable problem strings found in the course of checking
	// whether the key is valid and trusted. Not set for deleted keys.
	Problems []string
}

GpgKeyInfo contains information about a GPG public key.

type LabelInfo

type LabelInfo struct {
	// Optional is whether the label is optional. Optional means the label may be set, but
	// it's neither necessary for submission nor does it block submission if set.
	Optional bool

	// Approved is one user who approved this label on the change (voted the maximum value).
	Approved *AccountInfo
	// Rejected is one user who rejected this label on the change (voted the minimum value).
	Rejected *AccountInfo
	// Recommended is one user who recommended this label on the change (voted positively, but
	// not the maximum value).
	Recommended *AccountInfo
	// Disliked is one user who disliked this label on the change (voted negatively, but not
	// the minimum value).
	Disliked *AccountInfo
	// Blocking is whether the labels blocks submit operation.
	Blocking bool
	// Value is the voting value of the user who recommended/disliked this label on the change
	// if it is not "+1"/"-1".
	Value int
	// DefaultValue is the default voting value for the label. This value may be outside the
	// range specified in PermittedLabels.
	DefaultValue int `json:"default_value"`

	// All is a list of all approvals for this label as a list of ApprovalInfo entities. Items
	// in this list may not represent actual votes cast by users; if a user votes on any label,
	// a corresponding ApprovalInfo will appear in this list for all labels.
	All []ApprovalInfo
	// Values is a map of all values that are allowed for this label. The map maps the values
	// ("-2","-1","0","+1","+2") to the value descriptions.
	Values map[string]string
}

LabelInfo contains information about a label on a change, always corresponding to the current patch set.

type PatchSetNumber

type PatchSetNumber int

PatchSetNumber exists to allow parsing one stupid field in RevisionInfo which can end up being either a number or the string "edit".

const PatchSetIsEdit PatchSetNumber = -1

PatchSetIsEdit means that the value of the patchset number field was "edit" instead of an integer.

func (*PatchSetNumber) UnmarshalJSON

func (p *PatchSetNumber) UnmarshalJSON(b []byte) error

UnmarshalJSON defines how this type is unmarshaled from JSON.

type ProblemInfo

type ProblemInfo struct {
	// Message is a plaintext message describing the problem with the change.
	Message string
	// Status is the status of fixing the problem ("FIXED", "FIX_FAILED"). Only set if a fix
	// was attempted.
	Status string
	// Outcome is an additional plaintext message describing the outcome of the fix, if Status
	// is set.
	Outcome string
}

ProblemInfo contains a description of a potential consistency problem with a change. These are not related to the code review process, but rather indicate some inconsistency in Gerrit’s database or repository metadata related to the enclosing change.

type PushCertificateInfo

type PushCertificateInfo struct {
	// Certificate is the signed certificate payload and GPG signature block.
	Certificate string
	// Key is information about the key that signed the push, along with any problems found
	// while checking the signature or the key itself, as a GpgKeyInfo entity.
	Key GpgKeyInfo
}

PushCertificateInfo contains information about a push certificate provided when the user pushed for review with git push --signed HEAD:refs/for/<branch>. Only used when signed push is enabled on the server.

type QueryAccountsOpts

type QueryAccountsOpts struct {
	Limit             int
	StartAt           int
	DescribeDetails   bool
	DescribeAllEmails bool
}

QueryAccountsOpts is a structure representing options that affect the behavior of the QueryAccountsEx method on the Gerrit API client.

type QueryChangesOpts

type QueryChangesOpts struct {
	// Limit specifies a limit on the number of results returned from a QueryChangesEx call.
	Limit int
	// StartAt specifies a number of changes to skip when querying multiple. This and Limit can
	// be combined to implement paging.
	StartAt int
	// DescribeLabels requests inclusion of a summary of each label required for submit, and
	// approvers that have granted (or rejected) that label.
	DescribeLabels bool
	// DescribeDetailedLabels requests inclusion of detailed label information, including
	// numeric values of all existing approvals, recognized label values, values permitted to
	// be set by the current user, all reviewers by state, and reviewers that may be removed by
	// the current user.
	DescribeDetailedLabels bool
	// DescribeCurrentRevision requests inclusion of details about the current revision (patch
	// set) of the change, including the commit SHA-1 and URLs to fetch from.
	DescribeCurrentRevision bool
	// DescribeAllRevisions requests inclusion of details about all revisions, not just
	// current.
	DescribeAllRevisions bool
	// DescribeDownloadCommands requests inclusion of the commands field in the FetchInfo for
	// revisions. Only valid when the DescribeCurrentRevision or DescribeAllRevisions options
	// are selected.
	DescribeDownloadCommands bool
	// DescribeCurrentCommit requests inclusion of all header fields from the commit object,
	// including message. Only valid when the DescribeCurrentRevision or DescribeAllRevisions
	// options are selected.
	DescribeCurrentCommit bool
	// DescribeAllCommits requests inclusion of all header fields from the output revisions.
	// If only DescribeCurrentRevision was requested then only the current revision’s commit
	// data will be output.
	DescribeAllCommits bool
	// DescribeCurrentFiles requests inclusion of list files modified by the commit and magic
	// files, including basic line counts inserted/deleted per file. Only valid when the
	// DescribeCurrentRevision or DescribeAllRevisions options are selected.
	DescribeCurrentFiles bool
	// DescribeAllFiles requests inclusion of all files modified by the commit and magic files,
	// including basic line counts inserted/deleted per file. If only DescribeCurrentRevision
	// was requested then only that commit’s modified files will be output.
	DescribeAllFiles bool
	// DescribeDetailedAccounts requests inclusion of the AccountID, Email and Username fields
	// in AccountInfo entities.
	DescribeDetailedAccounts bool
	// DescribeReviewerUpdates requests inclusion of updates to reviewers set as
	// ReviewerUpdateInfo entities.
	DescribeReviewerUpdates bool
	// DescribeMessages requests inclusion of messages associated with the change.
	DescribeMessages bool
	// DescribeCurrentActions requests inclusion of include information on available actions
	// for the change and its current revision. Ignored if the caller is not authenticated.
	DescribeCurrentActions bool
	// DescribeChangeActions requests inclusion of information on available change actions for
	// the change. Ignored if the caller is not authenticated.
	DescribeChangeActions bool
	// DescribeReviewed requests inclusion of the reviewed field if all of the following are
	// true: (1) the change is open, (2) the caller is authenticated, and (3) the caller has
	// commented on the change more recently than the last update from the change owner, i.e.
	// this change would show up in the results of reviewedby:self.
	DescribeReviewed bool
	// DescribeSkipMergeable requests skipping of the Mergeable field in ChangeInfo. For fast-
	// moving projects, this field must be recomputed often, which is slow for projects with
	// big trees.
	//
	// When change.api.excludeMergeableInChangeInfo is set in the gerrit.config, the mergeable
	// field will always be omitted and DescribeSkipMergeable has no effect.
	//
	// A change’s mergeability can be requested separately by calling the get-mergeable
	// endpoint.
	DescribeSkipMergeable bool
	// DescribeSubmittable requests inclusion of the Submittable field in ChangeInfo entities,
	// which can be used to tell if the change is reviewed and ready for submit.
	DescribeSubmittable bool
	// DescribeWebLinks requests inclusion of the WebLinks field in CommitInfo entities,
	// therefore only valid in combination with DescribeCurrentCommit or DescribeAllCommits.
	DescribeWebLinks bool
	// DescribeCheck requests inclusion of potential problems with the change.
	DescribeCheck bool
	// DescribeCommitFooters requests inclusion of the full commit message with Gerrit-specific
	// commit footers in the RevisionInfo.
	DescribeCommitFooters bool
	// DescribePushCertificates requests inclusion of push certificate information in the
	// RevisionInfo. Ignored if signed push is not enabled on the server.
	DescribePushCertificates bool
	// DescribeTrackingIDs requests inclusion of references to external tracking systems as
	// TrackingIDInfo entities.
	DescribeTrackingIDs bool
	// DescribeNoLimit requests all results to be returned.
	DescribeNoLimit bool
}

QueryChangesOpts controls behavior of queries to change-related API endpoints.

type Requirement

type Requirement struct {
	// Status is the status of the requirement. Can be either "OK", "NOT_READY" or "RULE_ERROR".
	Status string
	// FallbackText is a human readable reason.
	FallbackText string `json:"fallback_text"`
	// Type is an alphanumerical (plus hyphens or underscores) string to identify what the
	// requirement is and why it was triggered. Can be seen as a class: requirements sharing
	// the same type were created for a similar reason, and the data structure will follow one
	// set of rules.
	Type string
	// Data holds custom key-value strings, used in templates to render richer status messages.
	// (Not sure what structure that data takes.)
	Data interface{}
}

Requirement contains information about a requirement relative to a change.

type ReviewerInfo

type ReviewerInfo struct {
	AccountInfo
	// Approvals is the approvals of the reviewer as a map that maps the label names to the
	// approval values (“-2”, “-1”, “0”, “+1”, “+2”).
	Approvals map[string]string
}

ReviewerInfo entity contains information about a reviewer and its votes on a change.

type ReviewerUpdateInfo

type ReviewerUpdateInfo struct {
	// Updated is the Timestamp of the update.
	Updated string
	// UpdatedBy is the account which modified state of the reviewer in question as AccountInfo
	// entity.
	UpdatedBy AccountInfo `json:"updated_by"`
	// Reviewer is the reviewer account added or removed from the change as an AccountInfo
	// entity.
	Reviewer *AccountInfo
	// State is the reviewer state, one of "REVIEWER", "CC" or "REMOVED".
	State string
}

ReviewerUpdateInfo contains information about updates to change’s reviewers set.

type RevisionInfo

type RevisionInfo struct {
	// Kind is the change kind. Valid values are "REWORK", "TRIVIAL_REBASE",
	// "MERGE_FIRST_PARENT_UPDATE", "NO_CODE_CHANGE", and "NO_CHANGE".
	Kind string
	// Number is the patch set number, or "edit" if the patch set is an edit.
	Number PatchSetNumber `json:"_number"`
	// Created is the timestamp of when the patch set was created.
	Created string
	// Uploader is the uploader of the patch set as an AccountInfo entity.
	Uploader AccountInfo
	// Ref is the Git reference for the patch set.
	Ref string
	// Fetch is information about how to fetch this patch set. The fetch information is
	// provided as a map that maps the protocol name (“git”, “http”, “ssh”) to FetchInfo
	// entities. This information is only included if a plugin implementing the download
	// commands interface is installed.
	Fetch map[string]FetchInfo
	// Commit is the commit of the patch set as CommitInfo entity.
	Commit CommitInfo
	// Files is the files of the patch set as a map that maps the file names to FileInfo
	// entities. Only set if DescribeCurrentFiles or DescribeAllFiles options are requested.
	Files map[string]FileInfo
	// Actions is actions the caller might be able to perform on this revision. The information
	// is a map of view name to ActionInfo entities.
	Actions map[string]ActionInfo
	// Reviewed indicates whether the caller is authenticated and has commented on the
	// current revision. Only set if DescribeReviewed option is requested.
	Reviewed bool
	// MessageWithFooter contains the full commit message with Gerrit-specific commit footers,
	// as if this revision were submitted using the Cherry Pick submit type. Only set when
	// the DescribeCommitFooters option is requested and when this is the current patch set.
	MessageWithFooter string `json:"message_with_footer"`
	// PushCertificate contains the push certificate provided by the user when uploading this
	// patch set as a PushCertificateInfo entity. This field is set if and only if the
	// DescribePushCertificates option is requested; if no push certificate was provided, it
	// is set to an empty object.
	PushCertificate *PushCertificateInfo `json:"push_certificate"`
	// Description is the description of this patchset, as displayed in the patchset selector
	// menu. May be empty if no description is set.
	Description string
}

RevisionInfo contains information about a patch set. Not all fields are returned by default. Additional fields can be obtained by settings fields on QueryChangesOpts.

type TrackingIDInfo

type TrackingIDInfo struct {
	// System is the name of the external tracking system.
	System string
	// ID is the tracking id.
	ID string
}

TrackingIDInfo describes a reference to an external tracking system.

type VotingRangeInfo

type VotingRangeInfo struct {
	// Min is the minimum voting value.
	Min int
	// Max is the maximum voting value.
	Max int
}

VotingRangeInfo describes the continuous voting range from min to max values.

type WebLinkInfo

type WebLinkInfo struct {
	// Name is the link name.
	Name string
	// URL is the link URL.
	URL string
	// ImageURL is the URL to the icon of the link.
	ImageURL string `json:"image_url"`
}

WebLinkInfo describes a link to an external site.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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