gerrit

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 17 Imported by: 90

README

go-gerrit

GoDoc

go-gerrit is a Go client library for the Gerrit Code Review system.

go-gerrit - Go client/library for Gerrit Code Review

Features

Installation

go-gerrit follows the Go Release Policy. This means we support the current + 2 previous Go versions.

It is go gettable ...

$ go get github.com/andygrunwald/go-gerrit

API / Usage

Have a look at the GoDoc documentation for a detailed API description.

The Gerrit Code Review - REST API was the foundation document.

Authentication

Gerrit supports multiple ways for authentication.

HTTP Basic

Some Gerrit instances (like TYPO3) has auth.gitBasicAuth activated. With this, you can authenticate with HTTP Basic like this:

instance := "https://review.typo3.org/"
client, _ := gerrit.NewClient(instance, nil)
client.Authentication.SetBasicAuth("andy.grunwald", "my secrect password")

self, _, _ := client.Accounts.GetAccount("self")

fmt.Printf("Username: %s", self.Name)

// Username: Andy Grunwald

If you get a 401 Unauthorized, check your Account Settings and have a look at the HTTP Password configuration.

HTTP Digest

Some Gerrit instances (like Wikimedia) has Digest access authentication activated.

instance := "https://gerrit.wikimedia.org/r/"
client, _ := gerrit.NewClient(instance, nil)
client.Authentication.SetDigestAuth("andy.grunwald", "my secrect http password")

self, resp, err := client.Accounts.GetAccount("self")

fmt.Printf("Username: %s", self.Name)

// Username: Andy Grunwald

If the chosen Gerrit instance does not support digest auth, an error like WWW-Authenticate header type is not Digest is thrown.

If you get a 401 Unauthorized, check your Account Settings and have a look at the HTTP Password configuration.

Some Gerrit instances hosted like the one hosted googlesource.com (e.g. Go, Android or Gerrit) support HTTP Cookie authentication.

You need the cookie name and the cookie value. You can get them by click on "Settings > HTTP Password > Obtain Password" in your Gerrit instance.

There you can receive your values. The cookie name will be (mostly) o (if hosted on googlesource.com). Your cookie secret will be something like git-your@email.com=SomeHash....

instance := "https://gerrit-review.googlesource.com/"
client, _ := gerrit.NewClient(instance, nil)
client.Authentication.SetCookieAuth("o", "my-cookie-secret")

self, _, _ := client.Accounts.GetAccount("self")

fmt.Printf("Username: %s", self.Name)

// Username: Andy G.

Examples

More examples are available

Get version of Gerrit instance

Receive the version of the Gerrit instance used by the Gerrit team for development:

package main

import (
	"fmt"

	"github.com/andygrunwald/go-gerrit"
)

func main() {
	instance := "https://gerrit-review.googlesource.com/"
	client, err := gerrit.NewClient(instance, nil)
	if err != nil {
		panic(err)
	}

	v, _, err := client.Config.GetVersion()
	if err != nil {
		panic(err)
	}

	fmt.Printf("Version: %s", v)

	// Version: 3.4.1-2066-g8db5605430
}
Get all public projects

List all projects from Chromium:

package main

import (
	"fmt"

	"github.com/andygrunwald/go-gerrit"
)

func main() {
	instance := "https://chromium-review.googlesource.com/"
	client, err := gerrit.NewClient(instance, nil)
	if err != nil {
		panic(err)
	}

	opt := &gerrit.ProjectOptions{
		Description: true,
	}
	projects, _, err := client.Projects.ListProjects(opt)
	if err != nil {
		panic(err)
	}

	for name, p := range *projects {
		fmt.Printf("%s - State: %s\n", name, p.State)
	}

	// chromiumos/third_party/bluez - State: ACTIVE
	// external/github.com/Polymer/ShadowDOM - State: ACTIVE
	// external/github.com/domokit/mojo_sdk - State: ACTIVE
	// ...
}
Query changes

Get some changes of the kernel/common project from the AndroidGerrit Review System.

package main

import (
	"fmt"

	"github.com/andygrunwald/go-gerrit"
)

func main() {
	instance := "https://android-review.googlesource.com/"
	client, err := gerrit.NewClient(instance, nil)
	if err != nil {
		panic(err)
	}

	opt := &gerrit.QueryChangeOptions{}
	opt.Query = []string{"project:kernel/common"}
	opt.AdditionalFields = []string{"LABELS"}
	changes, _, err := client.Changes.QueryChanges(opt)
	if err != nil {
		panic(err)
	}

	for _, change := range *changes {
		fmt.Printf("Project: %s -> %s -> %s%d\n", change.Project, change.Subject, instance, change.Number)
	}

	// Project: kernel/common -> ANDROID: GKI: Update symbols to symbol list -> https://android-review.googlesource.com/1830553
	// Project: kernel/common -> ANDROID: db845c_gki.fragment: Remove CONFIG_USB_NET_AX8817X from fragment -> https://android-review.googlesource.com/1830439
	// Project: kernel/common -> ANDROID: Update the ABI representation -> https://android-review.googlesource.com/1830469
	// ...
}

Development

Running tests and linters

Tests only:

$ make test

Checks, tests and linters

$ make vet staticcheck test
Local Gerrit setup

For local development, we suggest the usage of the official Gerrit Code Review docker image:

$ docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit:3.4.1

Wait a few minutes until the Gerrit Code Review NNN ready message appears, where NNN is your current Gerrit version, then open your browser to http://localhost:8080 and you will be in Gerrit Code Review.

Authentication

For local development setups, go to http://localhost:8080/settings/#HTTPCredentials and click GENERATE NEW PASSWORD. Now you can use (only for development purposes):

client.Authentication.SetBasicAuth("admin", "secret")

Replace secret with your new value.

Frequently Asked Questions (FAQ)

How is the source code organized?

The source code organization is inspired by go-github by Google.

Every REST API Endpoint (e.g. /access/, /changes/) is coupled in a service (e.g. AccessService in access.go, ChangesService in changes.go). Every service is part of gerrit.Client as a member variable.

gerrit.Client can provide essential helper functions to avoid unnecessary code duplications, such as building a new request or parse responses.

Based on this structure, implementing a new API functionality is straight forward. Here is an example of *ChangeService.DeleteTopic* / DELETE /changes/{change-id}/topic:

func (s *ChangesService) DeleteTopic(changeID string) (*Response, error) {
    u := fmt.Sprintf("changes/%s/topic", changeID)
    return s.client.DeleteRequest(u, nil)
}
What about the version compatibility with Gerrit?

The library was implemented based on the REST API of Gerrit version 2.11.3-1230-gb8336f1 and tested against this version.

This library might be working with older versions as well. If you notice an incompatibility open a new issue. We also appreciate your Pull Requests to improve this library. We welcome contributions!

What about adding code to support the REST API of an (optional) plugin?

It will depend on the plugin, and you are welcome to open a new issue first to propose the idea and use-case. As an example, the addition of support for events-log plugin was supported because the plugin itself is fairly popular. The structures that the REST API uses could also be used by gerrit stream-events.

License

This project is released under the terms of the MIT license.

Documentation

Overview

Package gerrit provides a client for using the Gerrit API.

Construct a new Gerrit client, then use the various services on the client to access different parts of the Gerrit API. For example:

instance := "https://go-review.googlesource.com/"
client, _ := gerrit.NewClient(instance, nil)

// Get all public projects
projects, _, err := client.Projects.ListProjects(nil)

Set optional parameters for an API method by passing an Options object.

// Get all projects with descriptions
opt := &gerrit.ProjectOptions{
	Description: true,
}
projects, _, err := client.Projects.ListProjects(opt)

The services of a client divide the API into logical chunks and correspond to the structure of the Gerrit API documentation at https://gerrit-review.googlesource.com/Documentation/rest-api.html#_endpoints.

Authentication

The go-gerrit library supports various methods to support the authentication. This methods are combined in the AuthenticationService that is available at client.Authentication.

One way is an authentication via HTTP cookie. Some Gerrit instances hosted like the one hosted googlesource.com (e.g. https://go-review.googlesource.com/, https://android-review.googlesource.com/ or https://gerrit-review.googlesource.com/) support HTTP Cookie authentication.

You need the cookie name and the cookie value. You can get them by click on "Settings > HTTP Password > Obtain Password" in your Gerrit instance. There you can receive your values. The cookie name will be (mostly) "o" (if hosted on googlesource.com). Your cookie secret will be something like "git-your@email.com=SomeHash...".

instance := "https://gerrit-review.googlesource.com/"
client, _ := gerrit.NewClient(instance, nil)
client.Authentication.SetCookieAuth("o", "my-cookie-secret")

self, _, _ := client.Accounts.GetAccount("self")

fmt.Printf("Username: %s", self.Name)

// Username: Andy G.

Some other Gerrit instances (like https://review.typo3.org/) has auth.gitBasicAuth activated. With this you can authenticate with HTTP Basic like this:

instance := "https://review.typo3.org/"
client, _ := gerrit.NewClient(instance, nil)
client.Authentication.SetBasicAuth("andy.grunwald", "my secrect password")

self, _, _ := client.Accounts.GetAccount("self")

fmt.Printf("Username: %s", self.Name)

// Username: Andy Grunwald

Additionally when creating a new client, pass an http.Client that supports further actions for you. For more information regarding authentication have a look at the Gerrit documentation: https://gerrit-review.googlesource.com/Documentation/rest-api.html#authentication

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// ErrWWWAuthenticateHeaderMissing is returned by digestAuthHeader when the WWW-Authenticate header is missing
	ErrWWWAuthenticateHeaderMissing = errors.New("WWW-Authenticate header is missing")

	// ErrWWWAuthenticateHeaderInvalid is returned by digestAuthHeader when the WWW-Authenticate invalid
	ErrWWWAuthenticateHeaderInvalid = errors.New("WWW-Authenticate header is invalid")

	// ErrWWWAuthenticateHeaderNotDigest is returned by digestAuthHeader when the WWW-Authenticate header is not 'Digest'
	ErrWWWAuthenticateHeaderNotDigest = errors.New("WWW-Authenticate header type is not Digest")
)
View Source
var (
	// ErrNoInstanceGiven is returned by NewClient in the event the
	// gerritURL argument was blank.
	ErrNoInstanceGiven = errors.New("no Gerrit instance given")

	// ErrUserProvidedWithoutPassword is returned by NewClient
	// if a user name is provided without a password.
	ErrUserProvidedWithoutPassword = errors.New("a username was provided without a password")

	// ErrAuthenticationFailed is returned by NewClient in the event the provided
	// credentials didn't allow us to query account information using digest, basic or cookie
	// auth.
	ErrAuthenticationFailed = errors.New("failed to authenticate using the provided credentials")

	// ReParseURL is used to parse the url provided to NewClient(). This
	// regular expression contains five groups which capture the scheme,
	// username, password, hostname and port. If we parse the url with this
	// regular expression
	ReParseURL = regexp.MustCompile(`^(http|https)://(.+):(.+)@(.+):(\d+)(.*)$`)
)

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have no response body.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api.html#response-codes

func RemoveMagicPrefixLine

func RemoveMagicPrefixLine(body []byte) []byte

RemoveMagicPrefixLine removes the "magic prefix line" of Gerris JSON response if present. The JSON response body starts with a magic prefix line that must be stripped before feeding the rest of the response body to a JSON parser. The reason for this is to prevent against Cross Site Script Inclusion (XSSI) attacks. By default all standard Gerrit APIs include this prefix line though some plugins may not.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api.html#output

Types

type AbandonInput

type AbandonInput struct {
	Message       string       `json:"message,omitempty"`
	Notify        string       `json:"notify,omitempty"`
	NotifyDetails []NotifyInfo `json:"notify_details,omitempty"`
}

AbandonInput entity contains information for abandoning a change.

type AccessCheckInfo

type AccessCheckInfo struct {
	// The HTTP status code for the access. 200 means success and 403 means denied.
	Status int `json:"status"`

	// A clarifying message if status is not 200.
	Message string `json:"message"`
}

AccessCheckInfo entity is the result of an access check.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#access-check-info

type AccessSectionInfo

type AccessSectionInfo struct {
	Permissions map[string]PermissionInfo `json:"permissions"`
}

AccessSectionInfo describes the access rights that are assigned on a ref.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#access-section-info

type AccessService

type AccessService struct {
	// contains filtered or unexported fields
}

AccessService contains Access Right related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html

func (*AccessService) ListAccessRights

ListAccessRights lists the access rights for projects. As result a map is returned that maps the project name to ProjectAccessInfo entities. The entries in the map are sorted by project name.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#list-access

type AccountCapabilityInfo

type AccountCapabilityInfo struct {
	AccessDatabase     bool           `json:"accessDatabase,omitempty"`
	AdministrateServer bool           `json:"administrateServer,omitempty"`
	CreateAccount      bool           `json:"createAccount,omitempty"`
	CreateGroup        bool           `json:"createGroup,omitempty"`
	CreateProject      bool           `json:"createProject,omitempty"`
	EmailReviewers     bool           `json:"emailReviewers,omitempty"`
	FlushCaches        bool           `json:"flushCaches,omitempty"`
	KillTask           bool           `json:"killTask,omitempty"`
	MaintainServer     bool           `json:"maintainServer,omitempty"`
	Priority           string         `json:"priority,omitempty"`
	QueryLimit         QueryLimitInfo `json:"queryLimit"`
	RunAs              bool           `json:"runAs,omitempty"`
	RunGC              bool           `json:"runGC,omitempty"`
	StreamEvents       bool           `json:"streamEvents,omitempty"`
	ViewAllAccounts    bool           `json:"viewAllAccounts,omitempty"`
	ViewCaches         bool           `json:"viewCaches,omitempty"`
	ViewConnections    bool           `json:"viewConnections,omitempty"`
	ViewPlugins        bool           `json:"viewPlugins,omitempty"`
	ViewQueue          bool           `json:"viewQueue,omitempty"`
}

AccountCapabilityInfo entity contains information about the global capabilities of a user.

type AccountDetailInfo

type AccountDetailInfo struct {
	AccountInfo
	RegisteredOn Timestamp `json:"registered_on"`
}

AccountDetailInfo entity contains detailed information about an account.

type AccountExternalIdInfo

type AccountExternalIdInfo struct {
	Identity     string `json:"identity"`
	EmailAddress string `json:"email_address,omitempty"`
	Trusted      bool   `json:"trusted"`
	CanDelete    bool   `json:"can_delete,omitempty"`
}

AccountExternalIdInfo entity contains information for an external id of an account.

type AccountInfo

type AccountInfo struct {
	AccountID   int    `json:"_account_id,omitempty"`
	Name        string `json:"name,omitempty"`
	DisplayName string `json:"display_name,omitempty"`
	Email       string `json:"email,omitempty"`
	Username    string `json:"username,omitempty"`

	// Avatars lists avatars of various sizes for the account.
	// This field is only populated if the avatars plugin is enabled.
	Avatars []struct {
		URL    string `json:"url,omitempty"`
		Height int    `json:"height,omitempty"`
	} `json:"avatars,omitempty"`
	MoreAccounts    bool     `json:"_more_accounts,omitempty"`
	SecondaryEmails []string `json:"secondary_emails,omitempty"`
	Status          string   `json:"status,omitempty"`
	Inactive        bool     `json:"inactive,omitempty"`
	Tags            []string `json:"tags,omitempty"`
}

AccountInfo entity contains information about an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info

type AccountInput

type AccountInput struct {
	Username     string   `json:"username,omitempty"`
	Name         string   `json:"name,omitempty"`
	Email        string   `json:"email,omitempty"`
	SSHKey       string   `json:"ssh_key,omitempty"`
	HTTPPassword string   `json:"http_password,omitempty"`
	Groups       []string `json:"groups,omitempty"`
}

AccountInput entity contains information for the creation of a new account.

type AccountNameInput

type AccountNameInput struct {
	Name string `json:"name,omitempty"`
}

AccountNameInput entity contains information for setting a name for an account.

type AccountOptions

type AccountOptions struct {
	// Additional fields can be obtained by adding o parameters.
	// Currently supported are "DETAILS" and "ALL_EMAILS".
	//
	// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account
	AdditionalFields []string `url:"o,omitempty"`
}

AccountOptions specifies parameters for Query Accounts.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account

type AccountsService

type AccountsService struct {
	// contains filtered or unexported fields
}

AccountsService contains Account related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html

func (*AccountsService) AddGPGKeys

func (s *AccountsService) AddGPGKeys(ctx context.Context, accountID string, input *GpgKeysInput) (*map[string]GpgKeyInfo, *Response, error)

AddGPGKeys Add or delete one or more GPG keys for a user. The changes must be provided in the request body as a GpgKeysInput entity. Each new GPG key is provided in ASCII armored format, and must contain a self-signed certification matching a registered email or other identity of the user.

As a response, the modified GPG keys are returned as a map of GpgKeyInfo entities, keyed by ID. Deleted keys are represented by an empty object.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#add-delete-gpg-keys

func (*AccountsService) CheckAccountCapability

func (s *AccountsService) CheckAccountCapability(ctx context.Context, accountID, capabilityID string) (string, *Response, error)

CheckAccountCapability checks if a user has a certain global capability.

If the user has the global capability the string ok is returned. If the user doesn’t have the global capability the response is “404 Not Found”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#check-account-capability

func (*AccountsService) CreateAccount

func (s *AccountsService) CreateAccount(ctx context.Context, username string, input *AccountInput) (*AccountInfo, *Response, error)

CreateAccount creates a new account. In the request body additional data for the account can be provided as AccountInput.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#create-account

func (*AccountsService) CreateAccountEmail

func (s *AccountsService) CreateAccountEmail(ctx context.Context, accountID, emailID string, input *EmailInput) (*EmailInfo, *Response, error)

CreateAccountEmail registers a new email address for the user. A verification email is sent with a link that needs to be visited to confirm the email address, unless DEVELOPMENT_BECOME_ANY_ACCOUNT is used as authentication type. For the development mode email addresses are directly added without confirmation. A Gerrit administrator may add an email address without confirmation by setting no_confirmation in the EmailInput. In the request body additional data for the email address can be provided as EmailInput.

As response the new email address is returned as EmailInfo entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#create-account-email

func (*AccountsService) DeleteAccountEmail

func (s *AccountsService) DeleteAccountEmail(ctx context.Context, accountID, emailID string) (*Response, error)

DeleteAccountEmail deletes an email address of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-account-email

func (*AccountsService) DeleteAccountName

func (s *AccountsService) DeleteAccountName(ctx context.Context, accountID string) (*Response, error)

DeleteAccountName deletes the name of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-account-name

func (*AccountsService) DeleteActive

func (s *AccountsService) DeleteActive(ctx context.Context, accountID string) (*Response, error)

DeleteActive sets the account state to inactive. If the account was already inactive the response is “404 Not Found”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-active

func (*AccountsService) DeleteGPGKey

func (s *AccountsService) DeleteGPGKey(ctx context.Context, accountID, gpgKeyID string) (*Response, error)

DeleteGPGKey deletes a GPG key of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-gpg-key

func (*AccountsService) DeleteHTTPPassword

func (s *AccountsService) DeleteHTTPPassword(ctx context.Context, accountID string) (*Response, error)

DeleteHTTPPassword deletes the HTTP password of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-http-password

func (*AccountsService) DeleteSSHKey

func (s *AccountsService) DeleteSSHKey(ctx context.Context, accountID, sshKeyID string) (*Response, error)

DeleteSSHKey deletes an SSH key of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-ssh-key

func (*AccountsService) GetAccount

func (s *AccountsService) GetAccount(ctx context.Context, account string) (*AccountInfo, *Response, error)

GetAccount returns an account as an AccountInfo entity. If account is "self" the current authenticated account will be returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-account

func (*AccountsService) GetAccountDetails

func (s *AccountsService) GetAccountDetails(ctx context.Context, accountID string) (*AccountDetailInfo, *Response, error)

GetAccountDetails retrieves the details of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-detail

func (*AccountsService) GetAccountEmail

func (s *AccountsService) GetAccountEmail(ctx context.Context, accountID, emailID string) (*EmailInfo, *Response, error)

GetAccountEmail retrieves an email address of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-account-email

func (*AccountsService) GetAccountExternalIDs

func (s *AccountsService) GetAccountExternalIDs(ctx context.Context, accountID string) (*[]AccountExternalIdInfo, *Response, error)

GetAccountExternalIDs retrieves the external ids of a user account.

Only external ids belonging to the caller may be requested. Users that have Modify Account can request external ids that belong to other accounts.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-account-external-ids

func (*AccountsService) GetAccountName

func (s *AccountsService) GetAccountName(ctx context.Context, accountID string) (string, *Response, error)

GetAccountName retrieves the full name of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-account-name

func (*AccountsService) GetActive

func (s *AccountsService) GetActive(ctx context.Context, accountID string) (string, *Response, error)

GetActive checks if an account is active.

If the account is active the string ok is returned. If the account is inactive the response is “204 No Content”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-active

func (*AccountsService) GetAvatarChangeURL

func (s *AccountsService) GetAvatarChangeURL(ctx context.Context, accountID string) (string, *Response, error)

GetAvatarChangeURL retrieves the URL where the user can change the avatar image.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-avatar-change-url

func (*AccountsService) GetDiffPreferences

func (s *AccountsService) GetDiffPreferences(ctx context.Context, accountID string) (*DiffPreferencesInfo, *Response, error)

GetDiffPreferences retrieves the diff preferences of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-diff-preferences

func (*AccountsService) GetGPGKey

func (s *AccountsService) GetGPGKey(ctx context.Context, accountID, gpgKeyID string) (*GpgKeyInfo, *Response, error)

GetGPGKey retrieves a GPG key of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-gpg-key

func (*AccountsService) GetHTTPPassword

func (s *AccountsService) GetHTTPPassword(ctx context.Context, accountID string) (string, *Response, error)

GetHTTPPassword retrieves the HTTP password of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-http-password

func (*AccountsService) GetSSHKey

func (s *AccountsService) GetSSHKey(ctx context.Context, accountID, sshKeyID string) (*SSHKeyInfo, *Response, error)

GetSSHKey retrieves an SSH key of a user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-ssh-key

func (*AccountsService) GetStarredChanges

func (s *AccountsService) GetStarredChanges(ctx context.Context, accountID string) (*[]ChangeInfo, *Response, error)

GetStarredChanges gets the changes starred by the identified user account. This URL endpoint is functionally identical to the changes query GET /changes/?q=is:starred.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-starred-changes

func (*AccountsService) GetUserPreferences

func (s *AccountsService) GetUserPreferences(ctx context.Context, accountID string) (*PreferencesInfo, *Response, error)

GetUserPreferences retrieves the user’s preferences.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-user-preferences

func (*AccountsService) GetUsername

func (s *AccountsService) GetUsername(ctx context.Context, accountID string) (string, *Response, error)

GetUsername retrieves the username of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#get-username

func (*AccountsService) ListAccountCapabilities

func (s *AccountsService) ListAccountCapabilities(ctx context.Context, accountID string, opt *CapabilityOptions) (*AccountCapabilityInfo, *Response, error)

ListAccountCapabilities returns the global capabilities that are enabled for the specified user. If the global capabilities for the calling user should be listed, self can be used as account-id. This can be used by UI tools to discover if administrative features are available to the caller, so they can hide (or show) relevant UI actions.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-account-capabilities

func (*AccountsService) ListAccountEmails

func (s *AccountsService) ListAccountEmails(ctx context.Context, accountID string) (*[]EmailInfo, *Response, error)

ListAccountEmails returns the email addresses that are configured for the specified user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-account-emails

func (*AccountsService) ListGPGKeys

func (s *AccountsService) ListGPGKeys(ctx context.Context, accountID string) (*map[string]GpgKeyInfo, *Response, error)

ListGPGKeys returns the GPG keys of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-gpg-keys

func (*AccountsService) ListGroups

func (s *AccountsService) ListGroups(ctx context.Context, accountID string) (*[]GroupInfo, *Response, error)

ListGroups lists all groups that contain the specified user as a member.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-groups

func (*AccountsService) ListSSHKeys

func (s *AccountsService) ListSSHKeys(ctx context.Context, accountID string) (*[]SSHKeyInfo, *Response, error)

ListSSHKeys returns the SSH keys of an account.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-ssh-keys

func (*AccountsService) QueryAccounts

func (s *AccountsService) QueryAccounts(ctx context.Context, opt *QueryAccountOptions) (*[]AccountInfo, *Response, error)

QueryAccounts lists accounts visible to the caller. The query string must be provided by the q parameter. The n parameter can be used to limit the returned results.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-accounts

func (*AccountsService) SetAccountName

func (s *AccountsService) SetAccountName(ctx context.Context, accountID string, input *AccountNameInput) (*string, *Response, error)

SetAccountName sets the full name of an account. The new account name must be provided in the request body inside an AccountNameInput entity.

As response the new account name is returned. If the name was deleted the response is “204 No Content”. Some realms may not allow to modify the account name. In this case the request is rejected with “405 Method Not Allowed”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-account-name

func (*AccountsService) SetActive

func (s *AccountsService) SetActive(ctx context.Context, accountID string) (*Response, error)

SetActive sets the account state to active.

If the account was already active the response is “200 OK”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-active

func (*AccountsService) SetDiffPreferences

func (s *AccountsService) SetDiffPreferences(ctx context.Context, accountID string, input *DiffPreferencesInput) (*DiffPreferencesInfo, *Response, error)

SetDiffPreferences sets the diff preferences of a user. The new diff preferences must be provided in the request body as a DiffPreferencesInput entity.

As result the new diff preferences of the user are returned as a DiffPreferencesInfo entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-diff-preferences

func (*AccountsService) SetHTTPPassword

func (s *AccountsService) SetHTTPPassword(ctx context.Context, accountID string, input *HTTPPasswordInput) (*string, *Response, error)

SetHTTPPassword sets/Generates the HTTP password of an account. The options for setting/generating the HTTP password must be provided in the request body inside a HTTPPasswordInput entity.

As response the new HTTP password is returned. If the HTTP password was deleted the response is “204 No Content”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-http-password

func (*AccountsService) SetPreferredEmail

func (s *AccountsService) SetPreferredEmail(ctx context.Context, accountID, emailID string) (*Response, error)

SetPreferredEmail sets an email address as preferred email address for an account.

If the email address was already the preferred email address of the account the response is “200 OK”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-preferred-email

func (*AccountsService) SetUserPreferences

func (s *AccountsService) SetUserPreferences(ctx context.Context, accountID string, input *PreferencesInput) (*PreferencesInfo, *Response, error)

SetUserPreferences sets the user’s preferences. The new preferences must be provided in the request body as a PreferencesInput entity.

As result the new preferences of the user are returned as a PreferencesInfo entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-user-preferences

func (*AccountsService) SetUsername

func (s *AccountsService) SetUsername(ctx context.Context, accountID string, input *UsernameInput) (*string, *Response, error)

SetUsername sets a new username. The new username must be provided in the request body inside a UsernameInput entity. Once set, the username cannot be changed or deleted. If attempted this fails with “405 Method Not Allowed”.

As response the new username is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#set-username

func (*AccountsService) StarChange

func (s *AccountsService) StarChange(ctx context.Context, accountID, changeID string) (*Response, error)

StarChange star a change. Starred changes are returned for the search query is:starred or starredby:USER and automatically notify the user whenever updates are made to the change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#star-change

func (*AccountsService) SuggestAccount

func (s *AccountsService) SuggestAccount(ctx context.Context, opt *QueryAccountOptions) (*[]AccountInfo, *Response, error)

SuggestAccount suggests users for a given query q and result limit n. If result limit is not passed, then the default 10 is used. Returns a list of matching AccountInfo entities.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account

func (*AccountsService) UnstarChange

func (s *AccountsService) UnstarChange(ctx context.Context, accountID, changeID string) (*Response, error)

UnstarChange nstar a change. Removes the starred flag, stopping notifications.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#unstar-change

type ActionInfo

type ActionInfo struct {
	Method  string `json:"method,omitempty"`
	Label   string `json:"label,omitempty"`
	Title   string `json:"title,omitempty"`
	Enabled bool   `json:"enabled,omitempty"`
}

ActionInfo entity 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 AddReviewerResult

type AddReviewerResult struct {
	Input     string         `json:"input,omitempty"`
	Reviewers []ReviewerInfo `json:"reviewers,omitempty"`
	CCS       []ReviewerInfo `json:"ccs,omitempty"`
	Error     string         `json:"error,omitempty"`
	Confirm   bool           `json:"confirm,omitempty"`
}

AddReviewerResult entity describes the result of adding a reviewer to a change.

type ApprovalInfo

type ApprovalInfo struct {
	AccountInfo
	Value int    `json:"value,omitempty"`
	Date  string `json:"date,omitempty"`
}

ApprovalInfo entity contains information about an approval from a user for a label on a change.

type AttentionSetInfo

type AttentionSetInfo struct {
	// AccountInfo entity.
	Account AccountInfo `json:"account"`
	// The timestamp of the last update.
	LastUpdate Timestamp `json:"last_update"`
	// The reason of for adding or removing the user.
	Reason string `json:"reason"`
}

AttentionSetInfo entity contains details of users that are in the attention set.

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-info

type AttentionSetInput

type AttentionSetInput struct {
	User          string                       `json:"user,omitempty"`
	Reason        string                       `json:"reason"`
	Notify        string                       `json:"notify,omitempty"`
	NotifyDetails map[RecipientType]NotifyInfo `json:"notify_details,omitempty"`
}

AttentionSetInput entity contains details for adding users to the attention set and removing them from it.

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input

type AuthInfo

type AuthInfo struct {
	Type                     string   `json:"type"`
	UseContributorAgreements bool     `json:"use_contributor_agreements,omitempty"`
	EditableAccountFields    []string `json:"editable_account_fields"`
	LoginURL                 string   `json:"login_url,omitempty"`
	LoginText                string   `json:"login_text,omitempty"`
	SwitchAccountURL         string   `json:"switch_account_url,omitempty"`
	RegisterURL              string   `json:"register_url,omitempty"`
	RegisterText             string   `json:"register_text,omitempty"`
	EditFullNameURL          string   `json:"edit_full_name_url,omitempty"`
	HTTPPasswordURL          string   `json:"http_password_url,omitempty"`
	IsGitBasicAuth           bool     `json:"is_git_basic_auth,omitempty"`
}

AuthInfo entity contains information about the authentication configuration of the Gerrit server.

type AuthenticationService

type AuthenticationService struct {
	// contains filtered or unexported fields
}

AuthenticationService contains Authentication related functions.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api.html#authentication

func (*AuthenticationService) HasAuth

func (s *AuthenticationService) HasAuth() bool

HasAuth checks if an auth type is used

func (*AuthenticationService) HasBasicAuth

func (s *AuthenticationService) HasBasicAuth() bool

HasBasicAuth checks if the auth type is HTTP Basic auth

func (*AuthenticationService) HasCookieAuth

func (s *AuthenticationService) HasCookieAuth() bool

HasCookieAuth checks if the auth type is HTTP Cookie based

func (*AuthenticationService) HasDigestAuth

func (s *AuthenticationService) HasDigestAuth() bool

HasDigestAuth checks if the auth type is HTTP Digest based

func (*AuthenticationService) ResetAuth

func (s *AuthenticationService) ResetAuth()

ResetAuth resets all former authentification settings

func (*AuthenticationService) SetBasicAuth

func (s *AuthenticationService) SetBasicAuth(username, password string)

SetBasicAuth sets basic parameters for HTTP Basic auth

func (*AuthenticationService) SetCookieAuth

func (s *AuthenticationService) SetCookieAuth(name, value string)

SetCookieAuth sets basic parameters for HTTP Cookie

func (*AuthenticationService) SetDigestAuth

func (s *AuthenticationService) SetDigestAuth(username, password string)

SetDigestAuth sets digest parameters for HTTP Digest auth.

type BanInput

type BanInput struct {
	Commits []string `json:"commits"`
	Reason  string   `json:"reason,omitempty"`
}

BanInput entity contains information for banning commits in a project.

type BanResultInfo

type BanResultInfo struct {
	NewlyBanned   []string `json:"newly_banned,omitempty"`
	AlreadyBanned []string `json:"already_banned,omitempty"`
	Ignored       []string `json:"ignored,omitempty"`
}

BanResultInfo entity describes the result of banning commits.

type BranchInfo

type BranchInfo struct {
	Ref       string        `json:"ref"`
	Revision  string        `json:"revision"`
	CanDelete bool          `json:"can_delete"`
	WebLinks  []WebLinkInfo `json:"web_links,omitempty"`
}

BranchInfo entity contains information about a branch.

type BranchInput

type BranchInput struct {
	Ref      string `json:"ref,omitempty"`
	Revision string `json:"revision,omitempty"`
}

BranchInput entity contains information for the creation of a new branch.

type BranchOptions

type BranchOptions struct {
	// Limit the number of branches to be included in the results.
	Limit int `url:"n,omitempty"`

	// Skip the given number of branches from the beginning of the list.
	Skip string `url:"s,omitempty"`

	// Substring limits the results to those projects that match the specified substring.
	Substring string `url:"m,omitempty"`

	// Limit the results to those branches that match the specified regex.
	// Boundary matchers '^' and '$' are implicit.
	// For example: the regex 't*' will match any branches that start with 'test' and regex '*t' will match any branches that end with 'test'.
	Regex string `url:"r,omitempty"`
}

BranchOptions specifies the parameters to the branch API endpoints.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#branch-options

type CacheInfo

type CacheInfo struct {
	Name       string       `json:"name,omitempty"`
	Type       string       `json:"type"`
	Entries    EntriesInfo  `json:"entries"`
	AverageGet string       `json:"average_get,omitempty"`
	HitRatio   HitRatioInfo `json:"hit_ratio"`
}

CacheInfo entity contains information about a cache.

type CacheOperationInput

type CacheOperationInput struct {
	Operation string   `json:"operation"`
	Caches    []string `json:"caches,omitempty"`
}

CacheOperationInput entity contains information about an operation that should be executed on caches.

type CapabilityOptions

type CapabilityOptions struct {
	// To filter the set of global capabilities the q parameter can be used.
	// Filtering may decrease the response time by avoiding looking at every possible alternative for the caller.
	Filter []string `url:"q,omitempty"`
}

CapabilityOptions specifies the parameters to filter for capabilities.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#list-account-capabilities

type ChangeConfigInfo

type ChangeConfigInfo struct {
	AllowDrafts      bool   `json:"allow_drafts,omitempty"`
	LargeChange      int    `json:"large_change"`
	ReplyLabel       string `json:"reply_label"`
	ReplyTooltip     string `json:"reply_tooltip"`
	UpdateDelay      int    `json:"update_delay"`
	SubmitWholeTopic bool   `json:"submit_whole_topic"`
}

ChangeConfigInfo entity contains information about Gerrit configuration from the change section.

type ChangeEditDetailOptions

type ChangeEditDetailOptions struct {
	// When request parameter list is provided the response also includes the file list.
	List bool `url:"list,omitempty"`
	// When base request parameter is provided the file list is computed against this base revision.
	Base bool `url:"base,omitempty"`
	// When request parameter download-commands is provided fetch info map is also included.
	DownloadCommands bool `url:"download-commands,omitempty"`
}

ChangeEditDetailOptions specifies the parameters to the ChangesService.GetChangeEditDetails.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-detail

type ChangeEditInput

type ChangeEditInput struct {
	RestorePath string `json:"restore_path,omitempty"`
	OldPath     string `json:"old_path,omitempty"`
	NewPath     string `json:"new_path,omitempty"`
}

ChangeEditInput entity contains information for restoring a path within change edit.

type ChangeEditMessageInput

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

ChangeEditMessageInput entity contains information for changing the commit message within a change edit.

type ChangeInfo

type ChangeInfo struct {
	ID                     string                        `json:"id"`
	URL                    string                        `json:"url,omitempty"`
	Project                string                        `json:"project"`
	Branch                 string                        `json:"branch"`
	Topic                  string                        `json:"topic,omitempty"`
	AttentionSet           map[string]AttentionSetInfo   `json:"attention_set,omitempty"`
	Assignee               AccountInfo                   `json:"assignee,omitempty"`
	Hashtags               []string                      `json:"hashtags,omitempty"`
	ChangeID               string                        `json:"change_id"`
	Subject                string                        `json:"subject"`
	Status                 string                        `json:"status"`
	Created                Timestamp                     `json:"created"`
	Updated                Timestamp                     `json:"updated"`
	Submitted              *Timestamp                    `json:"submitted,omitempty"`
	Submitter              AccountInfo                   `json:"submitter,omitempty"`
	Starred                bool                          `json:"starred,omitempty"`
	Reviewed               bool                          `json:"reviewed,omitempty"`
	SubmitType             string                        `json:"submit_type,omitempty"`
	Mergeable              bool                          `json:"mergeable,omitempty"`
	Submittable            bool                          `json:"submittable,omitempty"`
	Insertions             int                           `json:"insertions"`
	Deletions              int                           `json:"deletions"`
	TotalCommentCount      int                           `json:"total_comment_count,omitempty"`
	UnresolvedCommentCount int                           `json:"unresolved_comment_count,omitempty"`
	Number                 int                           `json:"_number"`
	Owner                  AccountInfo                   `json:"owner"`
	Actions                map[string]ActionInfo         `json:"actions,omitempty"`
	Labels                 map[string]LabelInfo          `json:"labels,omitempty"`
	PermittedLabels        map[string][]string           `json:"permitted_labels,omitempty"`
	RemovableReviewers     []AccountInfo                 `json:"removable_reviewers,omitempty"`
	Reviewers              map[string][]AccountInfo      `json:"reviewers,omitempty"`
	PendingReviewers       map[string][]AccountInfo      `json:"pending_reviewers,omitempty"`
	ReviewerUpdates        []ReviewerUpdateInfo          `json:"reviewer_updates,omitempty"`
	Messages               []ChangeMessageInfo           `json:"messages,omitempty"`
	CurrentRevision        string                        `json:"current_revision,omitempty"`
	Revisions              map[string]RevisionInfo       `json:"revisions,omitempty"`
	MoreChanges            bool                          `json:"_more_changes,omitempty"`
	Problems               []ProblemInfo                 `json:"problems,omitempty"`
	IsPrivate              bool                          `json:"is_private,omitempty"`
	WorkInProgress         bool                          `json:"work_in_progress,omitempty"`
	HasReviewStarted       bool                          `json:"has_review_started,omitempty"`
	RevertOf               int                           `json:"revert_of,omitempty"`
	SubmissionID           string                        `json:"submission_id,omitempty"`
	CherryPickOfChange     int                           `json:"cherry_pick_of_change,omitempty"`
	CherryPickOfPatchSet   int                           `json:"cherry_pick_of_patch_set,omitempty"`
	ContainsGitConflicts   bool                          `json:"contains_git_conflicts,omitempty"`
	BaseChange             string                        `json:"base_change,omitempty"`
	SubmitRequirements     []SubmitRequirementResultInfo `json:"submit_requirements,omitempty"`
}

ChangeInfo entity contains information about a change.

type ChangeInput

type ChangeInput struct {
	Project           string                 `json:"project"`
	Branch            string                 `json:"branch"`
	Subject           string                 `json:"subject"`
	Topic             string                 `json:"topic,omitempty"`
	Status            string                 `json:"status,omitempty"`
	IsPrivate         bool                   `json:"is_private,omitempty"`
	WorkInProgress    bool                   `json:"work_in_progress,omitempty"`
	BaseChange        string                 `json:"base_change,omitempty"`
	BaseCommit        string                 `json:"base_commit,omitempty"`
	NewBranch         bool                   `json:"new_branch,omitempty"`
	ValidationOptions map[string]interface{} `json:"validation_options,omitempty"`
	Merge             *MergeInput            `json:"merge,omitempty"`
	Author            *AccountInput          `json:"author,omitempty"`
	Notify            string                 `json:"notify,omitempty"`
	NotifyDetails     string                 `json:"notify_details,omitempty"`
}

ChangeInput entity contains information about creating a new change.

Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-input

type ChangeMessageInfo

type ChangeMessageInfo struct {
	ID             string      `json:"id"`
	Author         AccountInfo `json:"author,omitempty"`
	Date           Timestamp   `json:"date"`
	Message        string      `json:"message"`
	Tag            string      `json:"tag,omitempty"`
	RevisionNumber int         `json:"_revision_number,omitempty"`
}

ChangeMessageInfo entity contains information about a message attached to a change.

type ChangeOptions

type ChangeOptions struct {
	// Additional fields can be obtained by adding o parameters, each option requires more database lookups and slows down the query response time to the client so they are generally disabled by default.
	//
	// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
	AdditionalFields []string `url:"o,omitempty"`
}

ChangeOptions specifies the parameters for Query changes.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

type ChangesService

type ChangesService struct {
	// contains filtered or unexported fields
}

ChangesService contains Change related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html

func (*ChangesService) AbandonChange

func (s *ChangesService) AbandonChange(ctx context.Context, changeID string, input *AbandonInput) (*ChangeInfo, *Response, error)

AbandonChange abandons a change.

The request body does not need to include a AbandonInput entity if no review comment is added.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#abandon-change

func (*ChangesService) AddReviewer

func (s *ChangesService) AddReviewer(ctx context.Context, changeID string, input *ReviewerInput) (*AddReviewerResult, *Response, error)

AddReviewer adds one user or all members of one group as reviewer to the change. The reviewer to be added to the change must be provided in the request body as a ReviewerInput entity.

As response an AddReviewerResult entity is returned that describes the newly added reviewers. If a group is specified, adding the group members as reviewers is an atomic operation. This means if an error is returned, none of the members are added as reviewer. If a group with many members is added as reviewer a confirmation may be required.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#add-reviewer

func (*ChangesService) ChangeCommitMessageInChangeEdit

func (s *ChangesService) ChangeCommitMessageInChangeEdit(ctx context.Context, changeID string, input *ChangeEditMessageInput) (*Response, error)

ChangeCommitMessageInChangeEdit modify commit message. The request body needs to include a ChangeEditMessageInput entity.

If a change edit doesn’t exist for this change yet, it is created. As response “204 No Content” is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-change-edit-message

func (*ChangesService) ChangeFileContentInChangeEdit

func (s *ChangesService) ChangeFileContentInChangeEdit(ctx context.Context, changeID, filePath, content string) (*Response, error)

ChangeFileContentInChangeEdit put content of a file to a change edit.

When change edit doesn’t exist for this change yet it is created. When file content isn’t provided, it is wiped out for that file. As response “204 No Content” is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-file

func (*ChangesService) ChangesSubmittedTogether

func (s *ChangesService) ChangesSubmittedTogether(ctx context.Context, changeID string) (*[]ChangeInfo, *Response, error)

ChangesSubmittedTogether returns a list of all changes which are submitted when {submit} is called for this change, including the current change itself. An empty list is returned if this change will be submitted by itself (no other changes).

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submitted_together

func (*ChangesService) CheckChange

func (s *ChangesService) CheckChange(ctx context.Context, changeID string) (*ChangeInfo, *Response, error)

CheckChange performs consistency checks on the change, and returns a ChangeInfo entity with the problems field set to a list of ProblemInfo entities. Depending on the type of problem, some fields not marked optional may be missing from the result. At least id, project, branch, and _number will be present.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#check-change

func (*ChangesService) CherryPickRevision

func (s *ChangesService) CherryPickRevision(ctx context.Context, changeID, revisionID string, input *CherryPickInput) (*ChangeInfo, *Response, error)

CherryPickRevision cherry picks a revision to a destination branch. The commit message and destination branch must be provided in the request body inside a CherryPickInput entity.

As response a ChangeInfo entity is returned that describes the resulting cherry picked change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#cherry-pick

func (*ChangesService) CreateChange

func (s *ChangesService) CreateChange(ctx context.Context, input *ChangeInput) (*ChangeInfo, *Response, error)

CreateChange creates a new change.

The change input ChangeInput entity must be provided in the request body.

Only the following attributes are honored: project, branch, subject, status and topic. The first three attributes are mandatory.

Valid values for status are: DRAFT and NEW.

As response a ChangeInfo entity is returned that describes the resulting change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#create-change

func (*ChangesService) CreateDraft

func (s *ChangesService) CreateDraft(ctx context.Context, changeID, revisionID string, input *CommentInput) (*CommentInfo, *Response, error)

CreateDraft creates a draft comment on a revision. The new draft comment must be provided in the request body inside a CommentInput entity.

As response a CommentInfo entity is returned that describes the draft comment.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#create-draft

func (*ChangesService) DeleteChange

func (s *ChangesService) DeleteChange(ctx context.Context, changeID string) (*Response, error)

DeleteChange deletes a new or abandoned change

New or abandoned changes can be deleted by their owner if the user is granted the Delete Own Changes permission, otherwise only by administrators.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-change

func (*ChangesService) DeleteChangeEdit

func (s *ChangesService) DeleteChangeEdit(ctx context.Context, changeID string) (*Response, error)

DeleteChangeEdit deletes change edit.

As response “204 No Content” is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit

func (*ChangesService) DeleteDraft

func (s *ChangesService) DeleteDraft(ctx context.Context, changeID, revisionID, draftID string) (*Response, error)

DeleteDraft deletes a draft comment from a revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-draft

func (*ChangesService) DeleteDraftRevision

func (s *ChangesService) DeleteDraftRevision(ctx context.Context, changeID, revisionID string) (*Response, error)

DeleteDraftRevision deletes a draft revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-draft-revision

func (*ChangesService) DeleteFileInChangeEdit

func (s *ChangesService) DeleteFileInChangeEdit(ctx context.Context, changeID, filePath string) (*Response, error)

DeleteFileInChangeEdit deletes a file from a change edit. This deletes the file from the repository completely. This is not the same as reverting or restoring a file to its previous contents.

When change edit doesn’t exist for this change yet it is created.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-edit-file

func (*ChangesService) DeleteReviewed

func (s *ChangesService) DeleteReviewed(ctx context.Context, changeID, revisionID, fileID string) (*Response, error)

DeleteReviewed deletes the reviewed flag of the calling user from a file of a revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-reviewed

func (*ChangesService) DeleteReviewer

func (s *ChangesService) DeleteReviewer(ctx context.Context, changeID, accountID string) (*Response, error)

DeleteReviewer deletes a reviewer from a change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-reviewer

func (*ChangesService) DeleteTopic

func (s *ChangesService) DeleteTopic(ctx context.Context, changeID string) (*Response, error)

DeleteTopic deletes the topic of a change. The request body does not need to include a TopicInput entity if no review comment is added.

Please note that some proxies prohibit request bodies for DELETE requests. In this case, if you want to specify a commit message, use PUT to delete the topic.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-topic

func (*ChangesService) DeleteVote

func (s *ChangesService) DeleteVote(ctx context.Context, changeID string, accountID string, label string, input *DeleteVoteInput) (*Response, error)

DeleteVote deletes a single vote from a change. Note, that even when the last vote of a reviewer is removed the reviewer itself is still listed on the change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-vote

func (*ChangesService) FixChange

func (s *ChangesService) FixChange(ctx context.Context, changeID string, input *FixInput) (*ChangeInfo, *Response, error)

FixChange performs consistency checks on the change as with GET /check, and additionally fixes any problems that can be fixed automatically. The returned field values reflect any fixes.

Some fixes have options controlling their behavior, which can be set in the FixInput entity body. Only the change owner, a project owner, or an administrator may fix changes.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-change

func (*ChangesService) GetChange

func (s *ChangesService) GetChange(ctx context.Context, changeID string, opt *ChangeOptions) (*ChangeInfo, *Response, error)

GetChange retrieves a change. Additional fields can be obtained by adding o parameters, each option requires more database lookups and slows down the query response time to the client so they are generally disabled by default.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change

func (*ChangesService) GetChangeDetail

func (s *ChangesService) GetChangeDetail(ctx context.Context, changeID string, opt *ChangeOptions) (*ChangeInfo, *Response, error)

GetChangeDetail retrieves a change with labels, detailed labels, detailed accounts, and messages. Additional fields can be obtained by adding o parameters, each option requires more database lookups and slows down the query response time to the client so they are generally disabled by default.

This response will contain all votes for each label and include one combined vote. The combined label vote is calculated in the following order (from highest to lowest): REJECTED > APPROVED > DISLIKED > RECOMMENDED.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change-detail

func (*ChangesService) GetChangeEditDetails

func (s *ChangesService) GetChangeEditDetails(ctx context.Context, changeID string, opt *ChangeEditDetailOptions) (*EditInfo, *Response, error)

GetChangeEditDetails retrieves a change edit details. As response an EditInfo entity is returned that describes the change edit, or “204 No Content” when change edit doesn’t exist for this change. Change edits are stored on special branches and there can be max one edit per user per change. Edits aren’t tracked in the database.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-detail

func (*ChangesService) GetComment

func (s *ChangesService) GetComment(ctx context.Context, changeID, revisionID, commentID string) (*CommentInfo, *Response, error)

GetComment retrieves a published comment of a revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-comment

func (*ChangesService) GetCommit

func (s *ChangesService) GetCommit(ctx context.Context, changeID, revisionID string, opt *CommitOptions) (*CommitInfo, *Response, error)

GetCommit retrieves a parsed commit of a revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-commit

func (*ChangesService) GetContent

func (s *ChangesService) GetContent(ctx context.Context, changeID, revisionID, fileID string) (*string, *Response, error)

GetContent gets the content of a file from a certain revision. The content is returned as base64 encoded string. The HTTP response Content-Type is always text/plain, reflecting the base64 wrapping. A Gerrit-specific X-FYI-Content-Type header is returned describing the server detected content type of the file.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-content

func (*ChangesService) GetContentType

func (s *ChangesService) GetContentType(ctx context.Context, changeID, revisionID, fileID string) (*Response, error)

GetContentType gets the content type of a file from a certain revision. This is nearly the same as GetContent. But if only the content type is required, callers should use HEAD to avoid downloading the encoded file contents.

For further documentation see GetContent.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-content

func (*ChangesService) GetDiff

func (s *ChangesService) GetDiff(ctx context.Context, changeID, revisionID, fileID string, opt *DiffOptions) (*DiffInfo, *Response, error)

GetDiff gets the diff of a file from a certain revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-diff

func (*ChangesService) GetDraft

func (s *ChangesService) GetDraft(ctx context.Context, changeID, revisionID, draftID string) (*CommentInfo, *Response, error)

GetDraft retrieves a draft comment of a revision that belongs to the calling user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-draft

func (*ChangesService) GetHashtags

func (c *ChangesService) GetHashtags(ctx context.Context, changeID string) ([]string, *Response, error)

GetHashtags gets the hashtags associated with a change.

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-hashtags

func (*ChangesService) GetIncludedIn

func (s *ChangesService) GetIncludedIn(ctx context.Context, changeID string) (*IncludedInInfo, *Response, error)

GetIncludedIn retrieves the branches and tags in which a change is included.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-included-in

func (*ChangesService) GetMergeable

func (s *ChangesService) GetMergeable(ctx context.Context, changeID, revisionID string, opt *MergableOptions) (*MergeableInfo, *Response, error)

GetMergeable gets the method the server will use to submit (merge) the change and an indicator if the change is currently mergeable.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-mergeable

func (*ChangesService) GetPatch

func (s *ChangesService) GetPatch(ctx context.Context, changeID, revisionID string, opt *PatchOptions) (*string, *Response, error)

GetPatch gets the formatted patch for one revision.

The formatted patch is returned as text encoded inside base64. Adding query parameter zip (for example /changes/.../patch?zip) returns the patch as a single file inside of a ZIP archive. Clients can expand the ZIP to obtain the plain text patch, avoiding the need for a base64 decoding step. This option implies download.

Query parameter download (e.g. /changes/.../patch?download) will suggest the browser save the patch as commitsha1.diff.base64, for later processing by command line tools.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-patch

func (*ChangesService) GetRelatedChanges

func (s *ChangesService) GetRelatedChanges(ctx context.Context, changeID, revisionID string) (*RelatedChangesInfo, *Response, error)

GetRelatedChanges retrieves related changes of a revision. Related changes are changes that either depend on, or are dependencies of the revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes

func (*ChangesService) GetReview

func (s *ChangesService) GetReview(ctx context.Context, changeID, revisionID string) (*ChangeInfo, *Response, error)

GetReview retrieves a review of a revision.

As response a ChangeInfo entity with detailed labels and detailed accounts is returned that describes the review of the revision. The revision for which the review is retrieved is contained in the revisions field. In addition the current_revision field is set if the revision for which the review is retrieved is the current revision of the change. Please note that the returned labels are always for the current patch set.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-review

func (*ChangesService) GetReviewer

func (s *ChangesService) GetReviewer(ctx context.Context, changeID, accountID string) (*ReviewerInfo, *Response, error)

GetReviewer retrieves a reviewer of a change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-reviewer

func (*ChangesService) GetRevisionActions

func (s *ChangesService) GetRevisionActions(ctx context.Context, changeID, revisionID string) (*map[string]ActionInfo, *Response, error)

GetRevisionActions retrieves revision actions of the revision of a change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-revision-actions

func (*ChangesService) GetSubmitType

func (s *ChangesService) GetSubmitType(ctx context.Context, changeID, revisionID string) (string, *Response, error)

GetSubmitType gets the method the server will use to submit (merge) the change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-submit-type

func (*ChangesService) GetTopic

func (s *ChangesService) GetTopic(ctx context.Context, changeID string) (string, *Response, error)

GetTopic retrieves the topic of a change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-topic

func (*ChangesService) IndexChange

func (s *ChangesService) IndexChange(ctx context.Context, changeID string) (*Response, error)

IndexChange adds or updates the change in the secondary index.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#index-change

func (*ChangesService) ListChangeComments

func (s *ChangesService) ListChangeComments(ctx context.Context, changeID string) (*map[string][]CommentInfo, *Response, error)

ListChangeComments lists the published comments of all revisions of the change. The entries in the map are sorted by file path, and the comments for each path are sorted by patch set number. Each comment has the patch_set and author fields set.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-change-comments

func (*ChangesService) ListChangeDrafts

func (s *ChangesService) ListChangeDrafts(ctx context.Context, changeID string) (*map[string][]CommentInfo, *Response, error)

ListChangeDrafts lLists the draft comments of all revisions of the change that belong to the calling user. The entries in the map are sorted by file path, and the comments for each path are sorted by patch set number. Each comment has the patch_set field set, and no author.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-change-drafts

func (*ChangesService) ListFiles

func (s *ChangesService) ListFiles(ctx context.Context, changeID, revisionID string, opt *FilesOptions) (map[string]FileInfo, *Response, error)

ListFiles lists the files that were modified, added or deleted in a revision. As result a map is returned that maps the file path to a list of FileInfo entries. The entries in the map are sorted by file path.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files

func (*ChangesService) ListFilesReviewed

func (s *ChangesService) ListFilesReviewed(ctx context.Context, changeID, revisionID string, opt *FilesOptions) ([]string, *Response, error)

ListFilesReviewed lists the files that were modified, added or deleted in a revision. Unlike ListFiles, the response of ListFilesReviewed is a list of the paths the caller has marked as reviewed. Clients that also need the FileInfo should make two requests.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files

func (*ChangesService) ListReviewers

func (s *ChangesService) ListReviewers(ctx context.Context, changeID string) (*[]ReviewerInfo, *Response, error)

ListReviewers lists the reviewers of a change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-reviewers

func (*ChangesService) ListRevisionComments

func (s *ChangesService) ListRevisionComments(ctx context.Context, changeID, revisionID string) (*map[string][]CommentInfo, *Response, error)

ListRevisionComments lists the published comments of a revision. As result a map is returned that maps the file path to a list of CommentInfo entries. The entries in the map are sorted by file path and only include file (or inline) comments. Use the Get Change Detail endpoint to retrieve the general change message (or comment).

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-comments

func (*ChangesService) ListRevisionDrafts

func (s *ChangesService) ListRevisionDrafts(ctx context.Context, changeID, revisionID string) (*map[string][]CommentInfo, *Response, error)

ListRevisionDrafts lists the draft comments of a revision that belong to the calling user. Returns a map of file paths to lists of CommentInfo entries. The entries in the map are sorted by file path.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-drafts

func (*ChangesService) ListVotes

func (s *ChangesService) ListVotes(ctx context.Context, changeID string, accountID string) (map[string]int, *Response, error)

ListVotes lists the votes for a specific reviewer of the change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-votes

func (*ChangesService) MoveChange

func (s *ChangesService) MoveChange(ctx context.Context, changeID string, input *MoveInput) (*ChangeInfo, *Response, error)

MoveChange moves a change.

The destination branch must be provided in the request body inside a MoveInput entity. Only veto votes that are blocking the change from submission are moved to the destination branch by default.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#move-change

func (*ChangesService) PublishChangeEdit

func (s *ChangesService) PublishChangeEdit(ctx context.Context, changeID, notify string) (*Response, error)

PublishChangeEdit promotes change edit to a regular patch set.

As response “204 No Content” is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit

Example
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "ok")
}))
defer ts.Close()

ctx := context.Background()
client, err := gerrit.NewClient(ctx, ts.URL, nil)
if err != nil {
	panic(err)
}

_, err = client.Changes.PublishChangeEdit(ctx, "123", "NONE")
if err != nil {
	panic(err)
}
Output:

func (*ChangesService) PublishDraftChange

func (s *ChangesService) PublishDraftChange(ctx context.Context, changeID, notify string) (*Response, error)

PublishDraftChange publishes a draft change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-draft-change

func (*ChangesService) PublishDraftRevision

func (s *ChangesService) PublishDraftRevision(ctx context.Context, changeID, revisionID string) (*Response, error)

PublishDraftRevision publishes a draft revision.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-draft-revision

func (*ChangesService) QueryChanges

func (s *ChangesService) QueryChanges(ctx context.Context, opt *QueryChangeOptions) (*[]ChangeInfo, *Response, error)

QueryChanges lists changes visible to the caller. The query string must be provided by the q parameter. The n parameter can be used to limit the returned results.

The change output is sorted by the last update time, most recently updated to oldest updated.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

Example
ctx := context.Background()
instance := "https://android-review.googlesource.com/"
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
	panic(err)
}

opt := &gerrit.QueryChangeOptions{}
opt.Query = []string{
	"change:249244",
}
opt.Limit = 2
opt.AdditionalFields = []string{"LABELS"}
changes, _, err := client.Changes.QueryChanges(ctx, opt)
if err != nil {
	panic(err)
}

for _, change := range *changes {
	fmt.Printf("Project: %s -> %s -> %s%d\n", change.Project, change.Subject, instance, change.Number)
}
Output:

Project: platform/art -> ART: Change return types of field access entrypoints -> https://android-review.googlesource.com/249244
Example (WithSubmittable)
instance := "https://android-review.googlesource.com/"
ctx := context.Background()
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
	panic(err)
}

opt := &gerrit.QueryChangeOptions{}
opt.Query = []string{
	"change:249244",
}
opt.AdditionalFields = []string{"SUBMITTABLE"}

changes, _, err := client.Changes.QueryChanges(ctx, opt)
if err != nil {
	panic(err)
}

for _, change := range *changes {
	fmt.Printf("Project: %s -> %s -> %s%d, Ready to submit: %t\n", change.Project, change.Subject, instance, change.Number, change.Submittable)
}
Output:

Project: platform/art -> ART: Change return types of field access entrypoints -> https://android-review.googlesource.com/249244, Ready to submit: false
Example (WithSymbols)

Prior to fixing #18 this test would fail.

instance := "https://android-review.googlesource.com/"
ctx := context.Background()
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
	panic(err)
}

opt := &gerrit.QueryChangeOptions{}
opt.Query = []string{
	"change:249244+status:merged",
}
opt.Limit = 2
opt.AdditionalFields = []string{"LABELS"}
changes, _, err := client.Changes.QueryChanges(ctx, opt)
if err != nil {
	panic(err)
}

for _, change := range *changes {
	fmt.Printf("Project: %s -> %s -> %s%d\n", change.Project, change.Subject, instance, change.Number)
}
Output:

Project: platform/art -> ART: Change return types of field access entrypoints -> https://android-review.googlesource.com/249244

func (*ChangesService) RebaseChange

func (s *ChangesService) RebaseChange(ctx context.Context, changeID string, input *RebaseInput) (*ChangeInfo, *Response, error)

RebaseChange rebases a change.

Optionally, the parent revision can be changed to another patch set through the RebaseInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#rebase-change

func (*ChangesService) RebaseChangeEdit

func (s *ChangesService) RebaseChangeEdit(ctx context.Context, changeID string) (*Response, error)

RebaseChangeEdit rebases change edit on top of latest patch set.

When change was rebased on top of latest patch set, response “204 No Content” is returned. When change edit is already based on top of the latest patch set, the response “409 Conflict” is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#rebase-edit

func (*ChangesService) RemoveAttention

func (s *ChangesService) RemoveAttention(ctx context.Context, changeID, accountID string, input *AttentionSetInput) (*Response, error)

RemoveAttention deletes a single user from the attention set of a change. AttentionSetInput.Input must be provided

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#remove-from-attention-set

func (*ChangesService) RestoreChange

func (s *ChangesService) RestoreChange(ctx context.Context, changeID string, input *RestoreInput) (*ChangeInfo, *Response, error)

RestoreChange restores a change.

The request body does not need to include a RestoreInput entity if no review comment is added.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#restore-change

func (*ChangesService) RetrieveCommitMessageFromChangeEdit

func (s *ChangesService) RetrieveCommitMessageFromChangeEdit(ctx context.Context, changeID string) (string, *Response, error)

RetrieveCommitMessageFromChangeEdit retrieves commit message from change edit. The commit message is returned as base64 encoded string.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-message

func (*ChangesService) RetrieveFileContentFromChangeEdit

func (s *ChangesService) RetrieveFileContentFromChangeEdit(ctx context.Context, changeID, filePath string) (*string, *Response, error)

RetrieveFileContentFromChangeEdit retrieves content of a file from a change edit.

The content of the file is returned as text encoded inside base64. The Content-Type header will always be text/plain reflecting the outer base64 encoding. A Gerrit-specific X-FYI-Content-Type header can be examined to find the server detected content type of the file.

When the specified file was deleted in the change edit “204 No Content” is returned. If only the content type is required, callers should use HEAD to avoid downloading the encoded file contents.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file

func (*ChangesService) RetrieveFileContentTypeFromChangeEdit

func (s *ChangesService) RetrieveFileContentTypeFromChangeEdit(ctx context.Context, changeID, filePath string) (*Response, error)

RetrieveFileContentTypeFromChangeEdit retrieves content type of a file from a change edit. This is nearly the same as RetrieveFileContentFromChangeEdit. But if only the content type is required, callers should use HEAD to avoid downloading the encoded file contents.

For further documentation please have a look at RetrieveFileContentFromChangeEdit.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file

func (*ChangesService) RetrieveMetaDataOfAFileFromChangeEdit

func (s *ChangesService) RetrieveMetaDataOfAFileFromChangeEdit(ctx context.Context, changeID, filePath string) (*EditFileInfo, *Response, error)

RetrieveMetaDataOfAFileFromChangeEdit retrieves meta data of a file from a change edit. Currently only web links are returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-meta-data

func (*ChangesService) RevertChange

func (s *ChangesService) RevertChange(ctx context.Context, changeID string, input *RevertInput) (*ChangeInfo, *Response, error)

RevertChange reverts a change.

The request body does not need to include a RevertInput entity if no review comment is added.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-change

func (*ChangesService) SetCommitMessage

func (s *ChangesService) SetCommitMessage(ctx context.Context, changeID string, input *CommitMessageInput) (*Response, error)

SetCommitMessage creates a new patch set with a new commit message. The new commit message must be provided in the request body inside a CommitMessageInput entity. If a Change-Id footer is specified, it must match the current Change-Id footer. If the Change-Id footer is absent, the current Change-Id is added to the message.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-message

func (*ChangesService) SetHashtags

func (c *ChangesService) SetHashtags(ctx context.Context, changeID string, input *HashtagsInput) ([]string, *Response, error)

SetHashtags adds and/or removes hashtags from a change.

As response the change’s hashtags are returned as a list of strings.

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-hashtags

func (*ChangesService) SetReadyForReview

func (s *ChangesService) SetReadyForReview(ctx context.Context, changeID string, input *ReadyForReviewInput) (*Response, error)

SetReadyForReview marks the change as ready for review (set WIP property to false) Changes may only be marked ready by the owner, project owners or site administrators. Activates notifications of reviewer. The request body does not need to include a WorkInProgressInput entity if no review comment is added. Marking a change ready for review also adds all of the reviewers of the change to the attention set.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-ready-for-review

func (*ChangesService) SetReview

func (s *ChangesService) SetReview(ctx context.Context, changeID, revisionID string, input *ReviewInput) (*ReviewResult, *Response, error)

SetReview sets a review on a revision. The review must be provided in the request body as a ReviewInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

func (*ChangesService) SetReviewed

func (s *ChangesService) SetReviewed(ctx context.Context, changeID, revisionID, fileID string) (*Response, error)

SetReviewed marks a file of a revision as reviewed by the calling user.

If the file was already marked as reviewed by the calling user the response is “200 OK”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-reviewed

func (*ChangesService) SetTopic

func (s *ChangesService) SetTopic(ctx context.Context, changeID string, input *TopicInput) (*string, *Response, error)

SetTopic sets the topic of a change. The new topic must be provided in the request body inside a TopicInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-topic

func (*ChangesService) SubmitChange

func (s *ChangesService) SubmitChange(ctx context.Context, changeID string, input *SubmitInput) (*ChangeInfo, *Response, error)

SubmitChange submits a change.

The request body only needs to include a SubmitInput entity if submitting on behalf of another user.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change

func (*ChangesService) SuggestReviewers

func (s *ChangesService) SuggestReviewers(ctx context.Context, changeID string, opt *QueryOptions) (*[]SuggestedReviewerInfo, *Response, error)

SuggestReviewers suggest the reviewers for a given query q and result limit n. If result limit is not passed, then the default 10 is used.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#suggest-reviewers

func (*ChangesService) TestSubmitRule

func (s *ChangesService) TestSubmitRule(ctx context.Context, changeID, revisionID string, input *RuleInput) (*[]SubmitRecord, *Response, error)

TestSubmitRule tests the submit_rule Prolog rule in the project, or the one given.

Request body may be either the Prolog code as text/plain or a RuleInput object. The query parameter filters may be set to SKIP to bypass parent project filters while testing a project-specific rule.

The response is a list of SubmitRecord entries describing the permutations that satisfy the tested submit rule.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#test-submit-rule

func (*ChangesService) TestSubmitType

func (s *ChangesService) TestSubmitType(ctx context.Context, changeID, revisionID string, input *RuleInput) (*string, *Response, error)

TestSubmitType tests the submit_type Prolog rule in the project, or the one given.

Request body may be either the Prolog code as text/plain or a RuleInput object. The query parameter filters may be set to SKIP to bypass parent project filters while testing a project-specific rule.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#test-submit-type

func (*ChangesService) UpdateDraft

func (s *ChangesService) UpdateDraft(ctx context.Context, changeID, revisionID, draftID string, input *CommentInput) (*CommentInfo, *Response, error)

UpdateDraft updates a draft comment on a revision. The new draft comment must be provided in the request body inside a CommentInput entity.

As response a CommentInfo entity is returned that describes the draft comment.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#update-draft

type CheckAccessOptions

type CheckAccessOptions struct {
	// The account for which to check access. Mandatory.
	Account string `url:"account,omitempty"`

	// The ref permission for which to check access. If not specified, read access to at least branch is checked.
	Permission string `url:"perm,omitempty"`

	// The branch for which to check access. This must be given if perm is specified.
	Ref string `url:"ref,omitempty"`
}

CheckAccessOptions is options for check access

type CherryPickInput

type CherryPickInput struct {
	Message           string                       `json:"message,omitempty"`
	Destination       string                       `json:"destination"`
	Base              string                       `json:"base,omitempty"`
	Parent            int                          `json:"parent,omitempty"`
	Notify            string                       `json:"notify,omitempty"`
	NotifyDetails     map[RecipientType]NotifyInfo `json:"notify_details,omitempty"`
	KeepReviewers     bool                         `json:"keep_reviewers,omitempty"`
	AllowConflicts    bool                         `json:"allow_conflicts,omitempty"`
	Topic             string                       `json:"topic,omitempty"`
	AllowEmpty        bool                         `json:"allow_empty,omitempty"`
	CommitterEmail    string                       `json:"committer_email,omitempty"`
	ValidationOptions map[string]string            `json:"validation_options,omitempty"`
}

CherryPickInput entity contains information for cherry-picking a change to a new branch.

type ChildProjectOptions

type ChildProjectOptions struct {
	// Recursive resolve the child projects of a project recursively.
	// Child projects that are not visible to the calling user are ignored and are not resolved further.
	Recursive int `url:"recursive,omitempty"`
}

ChildProjectOptions specifies the parameters to the Child Project API endpoints.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-child-projects

type Client

type Client struct {

	// Gerrit service for authentication.
	Authentication *AuthenticationService

	// Services used for talking to different parts of the standard Gerrit API.
	Access   *AccessService
	Accounts *AccountsService
	Changes  *ChangesService
	Config   *ConfigService
	Groups   *GroupsService
	Plugins  *PluginsService
	Projects *ProjectsService

	// Additional services used for talking to non-standard Gerrit APIs.
	EventsLog *EventsLogService
	// contains filtered or unexported fields
}

A Client manages communication with the Gerrit API.

func NewClient

func NewClient(ctx context.Context, gerritURL string, httpClient *http.Client) (*Client, error)

NewClient returns a new Gerrit API client. gerritURL specifies the HTTP endpoint of the Gerrit instance. For example, "http://localhost:8080/". If gerritURL does not have a trailing slash, one is added automatically. If a nil httpClient is provided, http.DefaultClient will be used.

The url may contain credentials, http://admin:secret@localhost:8081/ for example. These credentials may either be a user name and password or name and value as in the case of cookie based authentication. If the url contains credentials then this function will attempt to validate the credentials before returning the client. ErrAuthenticationFailed will be returned if the credentials cannot be validated. The process of validating the credentials is relatively simple and only requires that the provided user have permission to GET /a/accounts/self.

func (*Client) BaseURL

func (c *Client) BaseURL() url.URL

BaseURL returns the client's Gerrit instance HTTP endpoint.

func (*Client) Call

func (c *Client) Call(ctx context.Context, method, u string, body interface{}, v interface{}) (*Response, error)

Call is a combine function for Client.NewRequest and Client.Do.

Most API methods are quite the same. Get the URL, apply options, make a request, and get the response. Without adding special headers or something. To avoid a big amount of code duplication you can Client.Call.

method is the HTTP method you want to call. u is the URL you want to call. body is the HTTP body. v is the HTTP response.

For more information read https://github.com/google/go-github/issues/234

func (*Client) DeleteRequest

func (c *Client) DeleteRequest(ctx context.Context, urlStr string, body interface{}) (*Response, error)

DeleteRequest sends an DELETE API Request to urlStr with optional body. It is a shorthand combination for Client.NewRequest with Client.Do.

Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewRawPutRequest

func (c *Client) NewRawPutRequest(ctx context.Context, urlStr string, body string) (*http.Request, error)

NewRawPutRequest creates a raw PUT request and makes no attempt to encode or marshal the body. Just passes it straight through.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type CommentInfo

type CommentInfo struct {
	PatchSet        int           `json:"patch_set,omitempty"`
	ID              string        `json:"id"`
	Path            string        `json:"path,omitempty"`
	Side            string        `json:"side,omitempty"`
	Line            int           `json:"line,omitempty"`
	Range           *CommentRange `json:"range,omitempty"`
	InReplyTo       string        `json:"in_reply_to,omitempty"`
	Message         string        `json:"message,omitempty"`
	Updated         *Timestamp    `json:"updated"`
	Author          AccountInfo   `json:"author,omitempty"`
	Unresolved      *bool         `json:"unresolved,omitempty"`
	ChangeMessageID string        `json:"change_message_id,omitempty"`
	CommitID        string        `json:"commit_id,omitempty"`
}

CommentInfo entity contains information about an inline comment.

type CommentInput

type CommentInput struct {
	ID         string        `json:"id,omitempty"`
	Path       string        `json:"path,omitempty"`
	Side       string        `json:"side,omitempty"`
	Line       int           `json:"line,omitempty"`
	Range      *CommentRange `json:"range,omitempty"`
	InReplyTo  string        `json:"in_reply_to,omitempty"`
	Updated    *Timestamp    `json:"updated,omitempty"`
	Message    string        `json:"message,omitempty"`
	Unresolved *bool         `json:"unresolved,omitempty"`
}

CommentInput entity contains information for creating an inline comment.

type CommentRange

type CommentRange struct {
	StartLine      int `json:"start_line"`
	StartCharacter int `json:"start_character"`
	EndLine        int `json:"end_line"`
	EndCharacter   int `json:"end_character"`
}

CommentRange entity describes the range of an inline comment.

type CommitInfo

type CommitInfo struct {
	Commit    string        `json:"commit,omitempty"`
	Parents   []CommitInfo  `json:"parents"`
	Author    GitPersonInfo `json:"author"`
	Committer GitPersonInfo `json:"committer"`
	Subject   string        `json:"subject"`
	Message   string        `json:"message"`
	WebLinks  []WebLinkInfo `json:"web_links,omitempty"`
}

CommitInfo entity contains information about a commit.

type CommitMessageInput

type CommitMessageInput struct {
	Message       string       `json:"message,omitempty"`
	Notify        string       `json:"notify,omitempty"`
	NotifyDetails []NotifyInfo `json:"notify_details"`
}

CommitMessageInput entity contains information for changing the commit message of a change.

type CommitOptions

type CommitOptions struct {
	// Adding query parameter links (for example /changes/.../commit?links) returns a CommitInfo with the additional field web_links.
	Weblinks bool `url:"links,omitempty"`
}

CommitOptions specifies the parameters for GetCommit call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-commit

type ConfigCapabilityInfo

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

ConfigCapabilityInfo entity contains information about a capability.type

type ConfigInfo

type ConfigInfo struct {
	Description                      string                         `json:"description,omitempty"`
	UseContributorAgreements         InheritedBooleanInfo           `json:"use_contributor_agreements,omitempty"`
	UseContentMerge                  InheritedBooleanInfo           `json:"use_content_merge,omitempty"`
	UseSignedOffBy                   InheritedBooleanInfo           `json:"use_signed_off_by,omitempty"`
	CreateNewChangeForAllNotInTarget InheritedBooleanInfo           `json:"create_new_change_for_all_not_in_target,omitempty"`
	RequireChangeID                  InheritedBooleanInfo           `json:"require_change_id,omitempty"`
	EnableSignedPush                 InheritedBooleanInfo           `json:"enable_signed_push,omitempty"`
	MaxObjectSizeLimit               MaxObjectSizeLimitInfo         `json:"max_object_size_limit"`
	SubmitType                       string                         `json:"submit_type"`
	State                            string                         `json:"state,omitempty"`
	Commentlinks                     map[string]string              `json:"commentlinks"`
	Theme                            ThemeInfo                      `json:"theme,omitempty"`
	PluginConfig                     map[string]ConfigParameterInfo `json:"plugin_config,omitempty"`
	Actions                          map[string]ActionInfo          `json:"actions,omitempty"`
}

ConfigInfo entity contains information about the effective project configuration.

type ConfigInput

type ConfigInput struct {
	Description                      string                       `json:"description,omitempty"`
	UseContributorAgreements         string                       `json:"use_contributor_agreements,omitempty"`
	UseContentMerge                  string                       `json:"use_content_merge,omitempty"`
	UseSignedOffBy                   string                       `json:"use_signed_off_by,omitempty"`
	CreateNewChangeForAllNotInTarget string                       `json:"create_new_change_for_all_not_in_target,omitempty"`
	RequireChangeID                  string                       `json:"require_change_id,omitempty"`
	MaxObjectSizeLimit               MaxObjectSizeLimitInfo       `json:"max_object_size_limit,omitempty"`
	SubmitType                       string                       `json:"submit_type,omitempty"`
	State                            string                       `json:"state,omitempty"`
	PluginConfigValues               map[string]map[string]string `json:"plugin_config_values,omitempty"`
}

ConfigInput entity describes a new project configuration.

type ConfigParameterInfo

type ConfigParameterInfo struct {
	DisplayName string   `json:"display_name,omitempty"`
	Description string   `json:"description,omitempty"`
	Warning     string   `json:"warning,omitempty"`
	Type        string   `json:"type"`
	Value       string   `json:"value,omitempty"`
	Values      []string `json:"values,omitempty"`
}

ConfigParameterInfo entity describes a project configuration parameter.

type ConfigService

type ConfigService struct {
	// contains filtered or unexported fields
}

ConfigService contains Config related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html

func (*ConfigService) CacheOperations

func (s *ConfigService) CacheOperations(ctx context.Context, input *CacheOperationInput) (*Response, error)

CacheOperations executes a cache operation that is specified in the request body in a CacheOperationInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#cache-operations

func (*ConfigService) ConfirmEmail

func (s *ConfigService) ConfirmEmail(ctx context.Context, input *EmailConfirmationInput) (*Response, error)

ConfirmEmail confirms that the user owns an email address. The email token must be provided in the request body inside an EmailConfirmationInput entity.

The response is “204 No Content”. If the token is invalid or if it’s the token of another user the request fails and the response is “422 Unprocessable Entity”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#confirm-email

func (*ConfigService) DeleteTask

func (s *ConfigService) DeleteTask(ctx context.Context, taskID string) (*Response, error)

DeleteTask kills a task from the background work queue that the Gerrit daemon is currently performing, or will perform in the near future. The caller must be a member of a group that is granted one of the following capabilities:

* Kill Task * Maintain Server * Administrate Server

End-users may see a task only if they can also see the project the task is associated with. Tasks operating on other projects, or that do not have a specific project, are hidden. Members of a group granted one of the following capabilities may view all tasks:

* View Queue * Maintain Server * Administrate Server

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#delete-task

func (*ConfigService) FlushCache

func (s *ConfigService) FlushCache(ctx context.Context, cacheName string, input *CacheOperationInput) (*Response, error)

FlushCache flushes a cache. The caller must be a member of a group that is granted one of the following capabilities:

* Flush Caches (any cache except "web_sessions") * Maintain Server (any cache including "web_sessions") * Administrate Server (any cache including "web_sessions")

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#flush-cache

func (*ConfigService) GetCache

func (s *ConfigService) GetCache(ctx context.Context, cacheName string) (*CacheInfo, *Response, error)

GetCache retrieves information about a cache. The caller must be a member of a group that is granted one of the following capabilities: * View Caches * Maintain Server * Administrate Server

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-cache

func (*ConfigService) GetServerInfo

func (s *ConfigService) GetServerInfo(ctx context.Context) (*ServerInfo, *Response, error)

GetServerInfo returns the information about the Gerrit server configuration.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-info

func (*ConfigService) GetSummary

func (s *ConfigService) GetSummary(ctx context.Context, opt *SummaryOptions) (*SummaryInfo, *Response, error)

GetSummary retrieves a summary of the current server state. The caller must be a member of a group that is granted the Administrate Server capability.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-summary

func (*ConfigService) GetTask

func (s *ConfigService) GetTask(ctx context.Context, taskID string) (*TaskInfo, *Response, error)

GetTask retrieves a task from the background work queue that the Gerrit daemon is currently performing, or will perform in the near future. End-users may see a task only if they can also see the project the task is associated with. Tasks operating on other projects, or that do not have a specific project, are hidden.

The caller must be a member of a group that is granted one of the following capabilities: * View Queue * Maintain Server * Administrate Server

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-task

func (*ConfigService) GetTopMenus

func (s *ConfigService) GetTopMenus(ctx context.Context) (*[]TopMenuEntryInfo, *Response, error)

GetTopMenus returns the list of additional top menu entries.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-top-menus

func (*ConfigService) GetVersion

func (s *ConfigService) GetVersion(ctx context.Context) (string, *Response, error)

GetVersion returns the version of the Gerrit server.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-version

Example
instance := "https://gerrit-review.googlesource.com/"
ctx := context.Background()
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
	panic(err)
}

v, _, err := client.Config.GetVersion(ctx)
if err != nil {
	panic(err)
}
// We can`t output the direct version here, because
// the test would fail if gerrit-review.googlesource.com
// will upgrade their instance.
// To access the version just print variable v
if len(v) > 0 {
	fmt.Println("Got version from Gerrit")
}
Output:

Got version from Gerrit

func (*ConfigService) ListCaches

func (s *ConfigService) ListCaches(ctx context.Context, opt *ListCachesOptions) (*map[string]CacheInfo, *Response, error)

ListCaches lists the caches of the server. Caches defined by plugins are included. The caller must be a member of a group that is granted one of the following capabilities: * View Caches * Maintain Server * Administrate Server The entries in the map are sorted by cache name.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#list-caches

func (*ConfigService) ListCapabilities

func (s *ConfigService) ListCapabilities(ctx context.Context) (*map[string]ConfigCapabilityInfo, *Response, error)

ListCapabilities lists the capabilities that are available in the system. There are two kinds of capabilities: core and plugin-owned capabilities. The entries in the map are sorted by capability ID.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#list-capabilities

func (*ConfigService) ListTasks

func (s *ConfigService) ListTasks(ctx context.Context) (*[]TaskInfo, *Response, error)

ListTasks lists the tasks from the background work queues that the Gerrit daemon is currently performing, or will perform in the near future. Gerrit contains an internal scheduler, similar to cron, that it uses to queue and dispatch both short and long term tasks. Tasks that are completed or canceled exit the queue very quickly once they enter this state, but it can be possible to observe tasks in these states. End-users may see a task only if they can also see the project the task is associated with. Tasks operating on other projects, or that do not have a specific project, are hidden.

The caller must be a member of a group that is granted one of the following capabilities: * View Queue * Maintain Server * Administrate Server

The entries in the list are sorted by task state, remaining delay and command.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#list-tasks

type DashboardInfo

type DashboardInfo struct {
	ID              string                 `json:"id"`
	Project         string                 `json:"project"`
	DefiningProject string                 `json:"defining_project"`
	Ref             string                 `json:"ref"`
	Path            string                 `json:"path"`
	Description     string                 `json:"description,omitempty"`
	Foreach         string                 `json:"foreach,omitempty"`
	URL             string                 `json:"url"`
	Default         bool                   `json:"default"`
	Title           string                 `json:"title,omitempty"`
	Sections        []DashboardSectionInfo `json:"sections"`
}

DashboardInfo entity contains information about a project dashboard.

type DashboardInput

type DashboardInput struct {
	ID            string `json:"id,omitempty"`
	CommitMessage string `json:"commit_message,omitempty"`
}

DashboardInput entity contains information to create/update a project dashboard.

type DashboardSectionInfo

type DashboardSectionInfo struct {
	Name  string `json:"name"`
	Query string `json:"query"`
}

DashboardSectionInfo entity contains information about a section in a dashboard.

type DeleteBranchesInput

type DeleteBranchesInput struct {
	Branches []string `json:"DeleteBranchesInput"`
}

DeleteBranchesInput entity contains information about branches that should be deleted.

type DeleteOptionsInfo

type DeleteOptionsInfo struct {
	Force    bool `json:"force"`
	Preserve bool `json:"preserve"`
}

DeleteOptionsInfo entity contains information for the deletion of a project.

type DeleteTagsInput

type DeleteTagsInput struct {
	Tags []string `json:"tags"`
}

DeleteTagsInput entity for delete tags.

type DeleteVoteInput

type DeleteVoteInput struct {
	Label         string                `json:"label,omitempty"`
	Notify        string                `json:"notify,omitempty"`
	NotifyDetails map[string]NotifyInfo `json:"notify_details"`
}

DeleteVoteInput entity contains options for the deletion of a vote.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-vote-input

type DiffContent

type DiffContent struct {
	A      []string          `json:"a,omitempty"`
	B      []string          `json:"b,omitempty"`
	AB     []string          `json:"ab,omitempty"`
	EditA  DiffIntralineInfo `json:"edit_a,omitempty"`
	EditB  DiffIntralineInfo `json:"edit_b,omitempty"`
	Skip   int               `json:"skip,omitempty"`
	Common bool              `json:"common,omitempty"`
}

DiffContent entity contains information about the content differences in a file.

type DiffFileMetaInfo

type DiffFileMetaInfo struct {
	Name        string        `json:"name"`
	ContentType string        `json:"content_type"`
	Lines       int           `json:"lines"`
	WebLinks    []WebLinkInfo `json:"web_links,omitempty"`
}

DiffFileMetaInfo entity contains meta information about a file diff

type DiffInfo

type DiffInfo struct {
	MetaA           DiffFileMetaInfo  `json:"meta_a,omitempty"`
	MetaB           DiffFileMetaInfo  `json:"meta_b,omitempty"`
	ChangeType      string            `json:"change_type"`
	IntralineStatus string            `json:"intraline_status,omitempty"`
	DiffHeader      []string          `json:"diff_header"`
	Content         []DiffContent     `json:"content"`
	WebLinks        []DiffWebLinkInfo `json:"web_links,omitempty"`
	Binary          bool              `json:"binary,omitempty"`
}

DiffInfo entity contains information about the diff of a file in a revision.

type DiffIntralineInfo

type DiffIntralineInfo [][2]int

DiffIntralineInfo entity contains information about intraline edits in a file.

The information consists of a list of <skip length, mark length> pairs, where the skip length is the number of characters between the end of the previous edit and the start of this edit, and the mark length is the number of edited characters following the skip. The start of the edits is from the beginning of the related diff content lines.

Note that the implied newline character at the end of each line is included in the length calculation, and thus it is possible for the edits to span newlines.

type DiffOptions

type DiffOptions struct {
	// If the intraline parameter is specified, intraline differences are included in the diff.
	Intraline bool `url:"intraline,omitempty"`

	// The base parameter can be specified to control the base patch set from which the diff
	// should be generated.
	Base string `url:"base,omitempty"`

	// The integer-valued request parameter parent can be specified to control the parent commit number
	// against which the diff should be generated. This is useful for supporting review of merge commits.
	// The value is the 1-based index of the parent’s position in the commit object.
	Parent int `url:"parent,omitempty"`

	// If the weblinks-only parameter is specified, only the diff web links are returned.
	WeblinksOnly bool `url:"weblinks-only,omitempty"`

	// The ignore-whitespace parameter can be specified to control how whitespace differences are reported in the result. Valid values are NONE, TRAILING, CHANGED or ALL.
	IgnoreWhitespace string `url:"ignore-whitespace,omitempty"`

	// The context parameter can be specified to control the number of lines of surrounding context in the diff.
	// Valid values are ALL or number of lines.
	Context string `url:"context,omitempty"`
}

DiffOptions specifies the parameters for GetDiff call.

type DiffPreferencesInfo

type DiffPreferencesInfo struct {
	Context                 int    `json:"context"`
	Theme                   string `json:"theme"`
	ExpandAllComments       bool   `json:"expand_all_comments,omitempty"`
	IgnoreWhitespace        string `json:"ignore_whitespace"`
	IntralineDifference     bool   `json:"intraline_difference,omitempty"`
	LineLength              int    `json:"line_length"`
	ManualReview            bool   `json:"manual_review,omitempty"`
	RetainHeader            bool   `json:"retain_header,omitempty"`
	ShowLineEndings         bool   `json:"show_line_endings,omitempty"`
	ShowTabs                bool   `json:"show_tabs,omitempty"`
	ShowWhitespaceErrors    bool   `json:"show_whitespace_errors,omitempty"`
	SkipDeleted             bool   `json:"skip_deleted,omitempty"`
	SkipUncommented         bool   `json:"skip_uncommented,omitempty"`
	SyntaxHighlighting      bool   `json:"syntax_highlighting,omitempty"`
	HideTopMenu             bool   `json:"hide_top_menu,omitempty"`
	AutoHideDiffTableHeader bool   `json:"auto_hide_diff_table_header,omitempty"`
	HideLineNumbers         bool   `json:"hide_line_numbers,omitempty"`
	TabSize                 int    `json:"tab_size"`
	HideEmptyPane           bool   `json:"hide_empty_pane,omitempty"`
}

DiffPreferencesInfo entity contains information about the diff preferences of a user.

type DiffPreferencesInput

type DiffPreferencesInput struct {
	Context                 int    `json:"context,omitempty"`
	ExpandAllComments       bool   `json:"expand_all_comments,omitempty"`
	IgnoreWhitespace        string `json:"ignore_whitespace,omitempty"`
	IntralineDifference     bool   `json:"intraline_difference,omitempty"`
	LineLength              int    `json:"line_length,omitempty"`
	ManualReview            bool   `json:"manual_review,omitempty"`
	RetainHeader            bool   `json:"retain_header,omitempty"`
	ShowLineEndings         bool   `json:"show_line_endings,omitempty"`
	ShowTabs                bool   `json:"show_tabs,omitempty"`
	ShowWhitespaceErrors    bool   `json:"show_whitespace_errors,omitempty"`
	SkipDeleted             bool   `json:"skip_deleted,omitempty"`
	SkipUncommented         bool   `json:"skip_uncommented,omitempty"`
	SyntaxHighlighting      bool   `json:"syntax_highlighting,omitempty"`
	HideTopMenu             bool   `json:"hide_top_menu,omitempty"`
	AutoHideDiffTableHeader bool   `json:"auto_hide_diff_table_header,omitempty"`
	HideLineNumbers         bool   `json:"hide_line_numbers,omitempty"`
	TabSize                 int    `json:"tab_size,omitempty"`
}

DiffPreferencesInput entity contains information for setting the diff preferences of a user. Fields which are not set will not be updated.

type DiffWebLinkInfo

type DiffWebLinkInfo struct {
	Name                     string `json:"name"`
	URL                      string `json:"url"`
	ImageURL                 string `json:"image_url"`
	ShowOnSideBySideDiffView bool   `json:"show_on_side_by_side_diff_view"`
	ShowOnUnifiedDiffView    bool   `json:"show_on_unified_diff_view"`
}

DiffWebLinkInfo entity describes a link on a diff screen to an external site.

type DownloadInfo

type DownloadInfo struct {
	Schemes  map[string]DownloadSchemeInfo `json:"schemes"`
	Archives []string                      `json:"archives"`
}

DownloadInfo entity contains information about supported download options.

type DownloadSchemeInfo

type DownloadSchemeInfo struct {
	URL             string            `json:"url"`
	IsAuthRequired  bool              `json:"is_auth_required,omitempty"`
	IsAuthSupported bool              `json:"is_auth_supported,omitempty"`
	Commands        map[string]string `json:"commands"`
	CloneCommands   map[string]string `json:"clone_commands"`
}

DownloadSchemeInfo entity contains information about a supported download scheme and its commands.

type EditFileInfo

type EditFileInfo struct {
	WebLinks []WebLinkInfo `json:"web_links,omitempty"`
}

EditFileInfo entity contains additional information of a file within a change edit.

type EditInfo

type EditInfo struct {
	Commit       CommitInfo           `json:"commit"`
	BaseRevision string               `json:"baseRevision"`
	Fetch        map[string]FetchInfo `json:"fetch"`
	Files        map[string]FileInfo  `json:"files,omitempty"`
}

EditInfo entity contains information about a change edit.

type EmailConfirmationInput

type EmailConfirmationInput struct {
	Token string `json:"token"`
}

EmailConfirmationInput entity contains information for confirming an email address.

type EmailInfo

type EmailInfo struct {
	Email               string `json:"email"`
	Preferred           bool   `json:"preferred,omitempty"`
	PendingConfirmation bool   `json:"pending_confirmation,omitempty"`
}

EmailInfo entity contains information about an email address of a user.

type EmailInput

type EmailInput struct {
	Email          string `json:"email"`
	Preferred      bool   `json:"preferred,omitempty"`
	NoConfirmation bool   `json:"no_confirmation,omitempty"`
}

EmailInput entity contains information for registering a new email address.

type EntriesInfo

type EntriesInfo struct {
	Mem   int    `json:"mem,omitempty"`
	Disk  int    `json:"disk,omitempty"`
	Space string `json:"space,omitempty"`
}

EntriesInfo entity contains information about the entries in a cache.

type EventInfo

type EventInfo struct {
	Type           string        `json:"type"`
	Change         ChangeInfo    `json:"change,omitempty"`
	ChangeKey      ChangeInfo    `json:"changeKey,omitempty"`
	PatchSet       PatchSet      `json:"patchSet,omitempty"`
	EventCreatedOn int           `json:"eventCreatedOn,omitempty"`
	Reason         string        `json:"reason,omitempty"`
	Abandoner      AccountInfo   `json:"abandoner,omitempty"`
	Restorer       AccountInfo   `json:"restorer,omitempty"`
	Submitter      AccountInfo   `json:"submitter,omitempty"`
	Author         AccountInfo   `json:"author,omitempty"`
	Uploader       AccountInfo   `json:"uploader,omitempty"`
	Approvals      []AccountInfo `json:"approvals,omitempty"`
	Comment        string        `json:"comment,omitempty"`
	Editor         AccountInfo   `json:"editor,omitempty"`
	Added          []string      `json:"added,omitempty"`
	Removed        []string      `json:"removed,omitempty"`
	Hashtags       []string      `json:"hashtags,omitempty"`
	RefUpdate      RefUpdate     `json:"refUpdate,omitempty"`
	Project        ProjectInfo   `json:"project,omitempty"`
	Reviewer       AccountInfo   `json:"reviewer,omitempty"`
	OldTopic       string        `json:"oldTopic,omitempty"`
	Changer        AccountInfo   `json:"changer,omitempty"`
}

EventInfo contains information about an event emitted by Gerrit. This structure can be used either when parsing streamed events or when reading the output of the events-log plugin.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/cmd-stream-events.html#events

type EventsLogOptions

type EventsLogOptions struct {
	From time.Time
	To   time.Time

	// IgnoreUnmarshalErrors will cause GetEvents to ignore any errors
	// that come up when calling json.Unmarshal. This can be useful in
	// cases where the events-log plugin was not kept up to date with
	// the Gerrit version for some reason. In these cases the events-log
	// plugin will return data structs that don't match the EventInfo
	// struct which in turn causes issues for json.Unmarshal.
	IgnoreUnmarshalErrors bool
}

EventsLogOptions contains options for querying events from the events-logs plugin.

type EventsLogService

type EventsLogService struct {
	// contains filtered or unexported fields
}

EventsLogService contains functions for querying the API provided by the optional events-log plugin.

func (*EventsLogService) GetEvents

func (events *EventsLogService) GetEvents(ctx context.Context, options *EventsLogOptions) ([]EventInfo, *Response, [][]byte, error)

GetEvents returns a list of events for the given input options. Use of this function requires an authenticated user and for the events-log plugin to be installed. This function returns the unmarshalled EventInfo structs, response, failed lines and errors. Marshaling errors will cause this function to return before processing is complete unless you set EventsLogOptions.IgnoreUnmarshalErrors to true. This can be useful in cases where the events-log plugin got out of sync with the Gerrit version which in turn produced events which can't be transformed unmarshalled into EventInfo.

Gerrit API docs: https://<yourserver>/plugins/events-log/Documentation/rest-api-events.html

type FetchInfo

type FetchInfo struct {
	URL      string            `json:"url"`
	Ref      string            `json:"ref"`
	Commands map[string]string `json:"commands,omitempty"`
}

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

type FileInfo

type FileInfo struct {
	Status        string `json:"status,omitempty"`
	Binary        bool   `json:"binary,omitempty"`
	OldPath       string `json:"old_path,omitempty"`
	LinesInserted int    `json:"lines_inserted,omitempty"`
	LinesDeleted  int    `json:"lines_deleted,omitempty"`
	SizeDelta     int    `json:"size_delta"`
	Size          int    `json:"size"`
}

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

type FilesOptions

type FilesOptions struct {
	// The request parameter q changes the response to return a list of all files (modified or unmodified)
	// that contain that substring in the path name. This is useful to implement suggestion services
	// finding a file by partial name.
	Q string `url:"q,omitempty"`

	// The base parameter can be specified to control the base patch set from which the list of files
	// should be generated.
	//
	// Note: This option is undocumented.
	Base string `url:"base,omitempty"`

	// The integer-valued request parameter parent changes the response to return a list of the files
	// which are different in this commit compared to the given parent commit. This is useful for
	// supporting review of merge commits. The value is the 1-based index of the parent’s position
	// in the commit object.
	Parent int `url:"parent,omitempty"`
}

FilesOptions specifies the parameters for ListFiles and ListFilesReviewed calls.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-files

type FixInput

type FixInput struct {
	DeletePatchSetIfCommitMissing bool   `json:"delete_patch_set_if_commit_missing"`
	ExpectMergedAs                string `json:"expect_merged_as"`
}

FixInput entity contains options for fixing commits using the fix change endpoint.

type FixReplacementInfo

type FixReplacementInfo struct {
	// The path of the file which should be modified. Any file in the repository may be modified.
	Path string `json:"path"`

	// A CommentRange indicating which content of the file should be replaced.
	// Lines in the file are assumed to be separated by the line feed character,
	// the carriage return character, the carriage return followed by the line
	// feed character, or one of the other Unicode linebreak sequences supported
	// by Java.
	Range CommentRange `json:"range"`

	// The content which should be used instead of the current one.
	Replacement string `json:"replacement,omitempty"`
}

FixReplacementInfo entity describes how the content of a file should be replaced by another content. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-replacement-info

type FixSuggestionInfo

type FixSuggestionInfo struct {
	// The UUID of the suggested fix. It will be generated automatically and
	// hence will be ignored if it’s set for input objects.
	FixID string `json:"fix_id"`
	// A description of the suggested fix.
	Description string `json:"description"`
	// A list of FixReplacementInfo entities indicating how the content of one or
	// several files should be modified. Within a file, they should refer to
	// non-overlapping regions.
	Replacements FixReplacementInfo `json:"replacements"`
}

FixSuggestionInfo entity represents a suggested fix. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-suggestion-info

type GCInput

type GCInput struct {
	ShowProgress bool `json:"show_progress"`
	Aggressive   bool `json:"aggressive"`
}

GCInput entity contains information to run the Git garbage collection.

type GitPersonInfo

type GitPersonInfo struct {
	Name  string    `json:"name"`
	Email string    `json:"email"`
	Date  Timestamp `json:"date"`
	TZ    int       `json:"tz"`
}

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

type GitwebInfo

type GitwebInfo struct {
	URL  string         `json:"url"`
	Type GitwebTypeInfo `json:"type"`
}

GitwebInfo entity contains information about the gitweb configuration.

type GitwebTypeInfo

type GitwebTypeInfo struct {
	Name          string `json:"name"`
	Revision      string `json:"revision,omitempty"`
	Project       string `json:"project,omitempty"`
	Branch        string `json:"branch,omitempty"`
	RootTree      string `json:"root_tree,omitempty"`
	File          string `json:"file,omitempty"`
	FileHistory   string `json:"file_history,omitempty"`
	PathSeparator string `json:"path_separator"`
	LinkDrafts    bool   `json:"link_drafts,omitempty"`
	URLEncode     bool   `json:"url_encode,omitempty"`
}

GitwebTypeInfo entity contains information about the gitweb configuration.

type GpgKeyInfo

type GpgKeyInfo struct {
	ID          string   `json:"id,omitempty"`
	Fingerprint string   `json:"fingerprint,omitempty"`
	UserIDs     []string `json:"user_ids,omitempty"`
	Key         string   `json:"key,omitempty"`
}

GpgKeyInfo entity contains information about a GPG public key.

type GpgKeysInput

type GpgKeysInput struct {
	Add    []string `json:"add"`
	Delete []string `json:"delete"`
}

GpgKeysInput entity contains information for adding/deleting GPG keys.

type GroupAuditEventInfo

type GroupAuditEventInfo struct {
	// TODO Member AccountInfo OR GroupInfo `json:"member"`
	Type string      `json:"type"`
	User AccountInfo `json:"user"`
	Date Timestamp   `json:"date"`
}

GroupAuditEventInfo entity contains information about an audit event of a group.

type GroupBaseInfo

type GroupBaseInfo struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

GroupBaseInfo entity contains base information about the group.

type GroupInfo

type GroupInfo struct {
	ID          string           `json:"id"`
	Name        string           `json:"name,omitempty"`
	URL         string           `json:"url,omitempty"`
	Options     GroupOptionsInfo `json:"options"`
	Description string           `json:"description,omitempty"`
	GroupID     int              `json:"group_id,omitempty"`
	Owner       string           `json:"owner,omitempty"`
	OwnerID     string           `json:"owner_id,omitempty"`
	CreatedOn   *Timestamp       `json:"created_on,omitempty"`
	MoreGroups  bool             `json:"_more_groups,omitempty"`
	Members     []AccountInfo    `json:"members,omitempty"`
	Includes    []GroupInfo      `json:"includes,omitempty"`
}

GroupInfo entity contains information about a group. This can be a Gerrit internal group, or an external group that is known to Gerrit.

type GroupInput

type GroupInput struct {
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	VisibleToAll bool   `json:"visible_to_all,omitempty"`
	OwnerID      string `json:"owner_id,omitempty"`
}

GroupInput entity contains information for the creation of a new internal group.

type GroupOptionsInfo

type GroupOptionsInfo struct {
	VisibleToAll bool `json:"visible_to_all,omitempty"`
}

GroupOptionsInfo entity contains options of the group.

type GroupOptionsInput

type GroupOptionsInput struct {
	VisibleToAll bool `json:"visible_to_all,omitempty"`
}

GroupOptionsInput entity contains new options for a group.

type GroupsInput

type GroupsInput struct {
	OneGroup string   `json:"_one_group,omitempty"`
	Groups   []string `json:"groups,omitempty"`
}

GroupsInput entity contains information about groups that should be included into a group or that should be deleted from a group.

type GroupsService

type GroupsService struct {
	// contains filtered or unexported fields
}

GroupsService contains Group related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html

func (*GroupsService) AddGroupMember

func (s *GroupsService) AddGroupMember(ctx context.Context, groupID, accountID string) (*AccountInfo, *Response, error)

AddGroupMember adds a user as member to a Gerrit internal group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#add-group-member

func (*GroupsService) AddGroupMembers

func (s *GroupsService) AddGroupMembers(ctx context.Context, groupID string, input *MembersInput) (*[]AccountInfo, *Response, error)

AddGroupMembers adds one or several users to a Gerrit internal group. The users to be added to the group must be provided in the request body as a MembersInput entity.

As response a list of detailed AccountInfo entities is returned that describes the group members that were specified in the MembersInput. An AccountInfo entity is returned for each user specified in the input, independently of whether the user was newly added to the group or whether the user was already a member of the group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#_add_group_members

func (*GroupsService) CreateGroup

func (s *GroupsService) CreateGroup(ctx context.Context, groupID string, input *GroupInput) (*GroupInfo, *Response, error)

CreateGroup creates a new Gerrit internal group. In the request body additional data for the group can be provided as GroupInput.

As response the GroupInfo entity is returned that describes the created group. If the group creation fails because the name is already in use the response is “409 Conflict”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#create-group

func (*GroupsService) DeleteGroupDescription

func (s *GroupsService) DeleteGroupDescription(ctx context.Context, groupID string) (*Response, error)

DeleteGroupDescription deletes the description of a Gerrit internal group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#delete-group-description

func (*GroupsService) DeleteGroupMember

func (s *GroupsService) DeleteGroupMember(ctx context.Context, groupID, accountID string) (*Response, error)

DeleteGroupMember deletes a user from a Gerrit internal group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#delete-group-member

func (*GroupsService) DeleteGroupMembers

func (s *GroupsService) DeleteGroupMembers(ctx context.Context, groupID string, input *MembersInput) (*Response, error)

DeleteGroupMembers delete one or several users from a Gerrit internal group. The users to be deleted from the group must be provided in the request body as a MembersInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#delete-group-members

func (*GroupsService) DeleteIncludedGroup

func (s *GroupsService) DeleteIncludedGroup(ctx context.Context, groupID, includeGroupID string) (*Response, error)

DeleteIncludedGroup deletes an included group from a Gerrit internal group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#include-group

func (*GroupsService) DeleteIncludedGroups

func (s *GroupsService) DeleteIncludedGroups(ctx context.Context, groupID string, input *GroupsInput) (*Response, error)

DeleteIncludedGroups delete one or several included groups from a Gerrit internal group. The groups to be deleted from the group must be provided in the request body as a GroupsInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#delete-included-groups

func (*GroupsService) GetAuditLog

func (s *GroupsService) GetAuditLog(ctx context.Context, groupID string) (*[]GroupAuditEventInfo, *Response, error)

GetAuditLog gets the audit log of a Gerrit internal group. The returned audit events are sorted by date in reverse order so that the newest audit event comes first.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-audit-log

func (*GroupsService) GetGroup

func (s *GroupsService) GetGroup(ctx context.Context, groupID string) (*GroupInfo, *Response, error)

GetGroup retrieves a group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group

func (*GroupsService) GetGroupDescription

func (s *GroupsService) GetGroupDescription(ctx context.Context, groupID string) (string, *Response, error)

GetGroupDescription retrieves the description of a group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-description

func (*GroupsService) GetGroupDetail

func (s *GroupsService) GetGroupDetail(ctx context.Context, groupID string) (*GroupInfo, *Response, error)

GetGroupDetail retrieves a group with the direct members and the directly included groups.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-detail

func (*GroupsService) GetGroupMember

func (s *GroupsService) GetGroupMember(ctx context.Context, groupID, accountID string) (*AccountInfo, *Response, error)

GetGroupMember retrieves a group member.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-member

func (*GroupsService) GetGroupName

func (s *GroupsService) GetGroupName(ctx context.Context, groupID string) (string, *Response, error)

GetGroupName retrieves the name of a group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-name

func (*GroupsService) GetGroupOptions

func (s *GroupsService) GetGroupOptions(ctx context.Context, groupID string) (*GroupOptionsInfo, *Response, error)

GetGroupOptions retrieves the options of a group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-options

func (*GroupsService) GetGroupOwner

func (s *GroupsService) GetGroupOwner(ctx context.Context, groupID string) (*GroupInfo, *Response, error)

GetGroupOwner retrieves the owner group of a Gerrit internal group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-group-owner

func (*GroupsService) GetIncludedGroup

func (s *GroupsService) GetIncludedGroup(ctx context.Context, groupID, includeGroupID string) (*GroupInfo, *Response, error)

GetIncludedGroup retrieves an included group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#get-included-group

func (*GroupsService) IncludeGroup

func (s *GroupsService) IncludeGroup(ctx context.Context, groupID, includeGroupID string) (*GroupInfo, *Response, error)

IncludeGroup includes an internal or external group into a Gerrit internal group. External groups must be specified using the UUID.

As response a GroupInfo entity is returned that describes the included group. The request also succeeds if the group is already included in this group, but then the HTTP response code is 200 OK.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#include-group

func (*GroupsService) IncludeGroups

func (s *GroupsService) IncludeGroups(ctx context.Context, groupID string, input *GroupsInput) (*[]GroupInfo, *Response, error)

IncludeGroups includes one or several groups into a Gerrit internal group. The groups to be included into the group must be provided in the request body as a GroupsInput entity.

As response a list of GroupInfo entities is returned that describes the groups that were specified in the GroupsInput. A GroupInfo entity is returned for each group specified in the input, independently of whether the group was newly included into the group or whether the group was already included in the group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#include-groups

func (*GroupsService) ListGroupMembers

func (s *GroupsService) ListGroupMembers(ctx context.Context, groupID string, opt *ListGroupMembersOptions) (*[]AccountInfo, *Response, error)

ListGroupMembers lists the direct members of a Gerrit internal group. The entries in the list are sorted by full name, preferred email and id.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#group-members

func (*GroupsService) ListGroups

func (s *GroupsService) ListGroups(ctx context.Context, opt *ListGroupsOptions) (*map[string]GroupInfo, *Response, error)

ListGroups lists the groups accessible by the caller. This is the same as using the ls-groups command over SSH, and accepts the same options as query parameters. The entries in the map are sorted by group name.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#list-groups

func (*GroupsService) ListIncludedGroups

func (s *GroupsService) ListIncludedGroups(ctx context.Context, groupID string) (*[]GroupInfo, *Response, error)

ListIncludedGroups lists the directly included groups of a group. The entries in the list are sorted by group name and UUID.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#included-groups

func (*GroupsService) RenameGroup

func (s *GroupsService) RenameGroup(ctx context.Context, groupID, name string) (*string, *Response, error)

RenameGroup renames a Gerrit internal group. The new group name must be provided in the request body.

As response the new group name is returned. If renaming the group fails because the new name is already in use the response is “409 Conflict”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#rename-group

func (*GroupsService) SetGroupDescription

func (s *GroupsService) SetGroupDescription(ctx context.Context, groupID, description string) (*string, *Response, error)

SetGroupDescription sets the description of a Gerrit internal group. The new group description must be provided in the request body.

As response the new group description is returned. If the description was deleted the response is “204 No Content”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#set-group-description

func (*GroupsService) SetGroupOptions

func (s *GroupsService) SetGroupOptions(ctx context.Context, groupID string, input *GroupOptionsInput) (*GroupOptionsInfo, *Response, error)

SetGroupOptions sets the options of a Gerrit internal group. The new group options must be provided in the request body as a GroupOptionsInput entity.

As response the new group options are returned as a GroupOptionsInfo entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#set-group-options

func (*GroupsService) SetGroupOwner

func (s *GroupsService) SetGroupOwner(ctx context.Context, groupID, owner string) (*GroupInfo, *Response, error)

SetGroupOwner sets the owner group of a Gerrit internal group. The new owner group must be provided in the request body. The new owner can be specified by name, by group UUID or by the legacy numeric group ID.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#set-group-owner

type HTTPPasswordInput

type HTTPPasswordInput struct {
	Generate     bool   `json:"generate,omitempty"`
	HTTPPassword string `json:"http_password,omitempty"`
}

HTTPPasswordInput entity contains information for setting/generating an HTTP password.

type HashtagsInput

type HashtagsInput struct {
	// The list of hashtags to be added to the change.
	Add []string `json:"add,omitempty"`

	// The list of hashtags to be removed from the change.
	Remove []string `json:"remove,omitempty"`
}

HashtagsInput entity contains information about hashtags to add to, and/or remove from, a change.

https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#hashtags-input

type HeadInput

type HeadInput struct {
	Ref string `json:"ref"`
}

HeadInput entity contains information for setting HEAD for a project.

type HitRatioInfo

type HitRatioInfo struct {
	Mem  int `json:"mem"`
	Disk int `json:"disk,omitempty"`
}

HitRatioInfo entity contains information about the hit ratio of a cache.

type IncludedInInfo

type IncludedInInfo struct {
	Branches []string          `json:"branches"`
	Tags     []string          `json:"tags"`
	External map[string]string `json:"external,omitempty"`
}

IncludedInInfo entity contains information about the branches a change was merged into and tags it was tagged with.

type Info

type Info struct {
	AllProjectsName string `json:"all_projects_name"`
	AllUsersName    string `json:"all_users_name"`
	DocURL          string `json:"doc_url,omitempty"`
	ReportBugURL    string `json:"report_bug_url,omitempty"`
	ReportBugText   string `json:"report_bug_text,omitempty"`
}

Info entity contains information about Gerrit configuration from the gerrit section.

type InheritedBooleanInfo

type InheritedBooleanInfo struct {
	Value           bool   `json:"value"`
	ConfiguredValue string `json:"configured_value"`
	InheritedValue  bool   `json:"inherited_value,omitempty"`
}

InheritedBooleanInfo entity represents a boolean value that can also be inherited.

type JvmSummaryInfo

type JvmSummaryInfo struct {
	VMVendor                string `json:"vm_vendor"`
	VMName                  string `json:"vm_name"`
	VMVersion               string `json:"vm_version"`
	OSName                  string `json:"os_name"`
	OSVersion               string `json:"os_version"`
	OSArch                  string `json:"os_arch"`
	User                    string `json:"user"`
	Host                    string `json:"host,omitempty"`
	CurrentWorkingDirectory string `json:"current_working_directory"`
	Site                    string `json:"site"`
}

JvmSummaryInfo entity contains information about the JVM.

type LabelInfo

type LabelInfo struct {
	Optional bool `json:"optional,omitempty"`

	// Fields set by LABELS
	Approved     AccountInfo `json:"approved,omitempty"`
	Rejected     AccountInfo `json:"rejected,omitempty"`
	Recommended  AccountInfo `json:"recommended,omitempty"`
	Disliked     AccountInfo `json:"disliked,omitempty"`
	Blocking     bool        `json:"blocking,omitempty"`
	Value        int         `json:"value,omitempty"`
	DefaultValue int         `json:"default_value,omitempty"`

	// Fields set by DETAILED_LABELS
	All    []ApprovalInfo    `json:"all,omitempty"`
	Values map[string]string `json:"values,omitempty"`
}

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

type ListAccessRightsOptions

type ListAccessRightsOptions struct {
	// The projects for which the access rights should be returned must be specified as project options.
	// The project can be specified multiple times.
	Project []string `url:"project,omitempty"`
}

ListAccessRightsOptions specifies the parameters to the AccessService.ListAccessRights.

type ListCachesOptions

type ListCachesOptions struct {
	// Format specifies the different output formats.
	Format string `url:"format,omitempty"`
}

ListCachesOptions specifies the different output formats.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#list-caches

type ListGroupMembersOptions

type ListGroupMembersOptions struct {
	// To resolve the included groups of a group recursively and to list all members the parameter recursive can be set.
	// Members from included external groups and from included groups which are not visible to the calling user are ignored.
	Recursive bool `url:"recursive,omitempty"`
}

ListGroupMembersOptions specifies the different options for the ListGroupMembers call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#group-members

type ListGroupsOptions

type ListGroupsOptions struct {
	// Group Options
	// Options fields can be obtained by adding o parameters, each option requires more lookups and slows down the query response time to the client so they are generally disabled by default.
	// Optional fields are:
	//	INCLUDES: include list of directly included groups.
	//	MEMBERS: include list of direct group members.
	Options []string `url:"o,omitempty"`

	// Check if a group is owned by the calling user
	// By setting the option owned and specifying a group to inspect with the option q, it is possible to find out, if this group is owned by the calling user.
	// If the group is owned by the calling user, the returned map contains this group. If the calling user doesn’t own this group an empty map is returned.
	Owned string `url:"owned,omitempty"`
	Group string `url:"q,omitempty"`

	// Group Limit
	// The /groups/ URL also accepts a limit integer in the n parameter. This limits the results to show n groups.
	Limit int `url:"n,omitempty"`
	// The /groups/ URL also accepts a start integer in the S parameter. The results will skip S groups from group list.
	Skip int `url:"S,omitempty"`
}

ListGroupsOptions specifies the different options for the ListGroups call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#list-groups

type MaxObjectSizeLimitInfo

type MaxObjectSizeLimitInfo struct {
	Value           string `json:"value,omitempty"`
	ConfiguredValue string `json:"configured_value,omitempty"`
	InheritedValue  string `json:"inherited_value,omitempty"`
}

MaxObjectSizeLimitInfo entity contains information about the max object size limit of a project.

type MemSummaryInfo

type MemSummaryInfo struct {
	Total     string `json:"total"`
	Used      string `json:"used"`
	Free      string `json:"free"`
	Buffers   string `json:"buffers"`
	Max       string `json:"max"`
	OpenFiles int    `json:"open_files,omitempty"`
}

MemSummaryInfo entity contains information about the current memory usage.

type MembersInput

type MembersInput struct {
	OneMember string   `json:"_one_member,omitempty"`
	Members   []string `json:"members,omitempty"`
}

MembersInput entity contains information about accounts that should be added as members to a group or that should be deleted from the group

type MergableOptions

type MergableOptions struct {
	// If the other-branches parameter is specified, the mergeability will also be checked for all other branches.
	OtherBranches bool `url:"other-branches,omitempty"`
}

MergableOptions specifies the parameters for GetMergable call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-mergeable

type MergeInput

type MergeInput struct {
	Source         string `json:"source"`
	SourceBranch   string `json:"source_branch,omitempty"`
	Strategy       string `json:"strategy,omitempty"`
	AllowConflicts bool   `json:"allow_conflicts,omitempty"`
}

The MergeInput entity contains information about the merge

Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#merge-input

type MergeableInfo

type MergeableInfo struct {
	SubmitType    string   `json:"submit_type"`
	Mergeable     bool     `json:"mergeable"`
	MergeableInto []string `json:"mergeable_into,omitempty"`
}

MergeableInfo entity contains information about the mergeability of a change.

type MoveInput

type MoveInput struct {
	DestinationBranch string `json:"destination_branch"`
	Message           string `json:"message,omitempty"`
	KeepAllVotes      bool   `json:"keep_all_votes"`
}

MoveInput entity contains information for moving a change.

type NotifyInfo

type NotifyInfo struct {
	Accounts []AccountInfo `json:"accounts"`
}

NotifyInfo entity contains detailed information about who should be notified about an update

type Number

type Number string

Number is a string representing a number. This type is only used in cases where the API being queried may return an inconsistent result.

func (*Number) Int

func (n *Number) Int() (int, error)

Int returns the current number as an integer

func (*Number) String

func (n *Number) String() string

String returns the string representing the current number.

func (*Number) UnmarshalJSON

func (n *Number) UnmarshalJSON(data []byte) error

UnmarshalJSON will marshal the provided data into the current *Number struct.

type ParentInfo

type ParentInfo struct {
	BranchName             string `json:"branch_name,omitempty"`
	CommitID               string `json:"commit_id,omitempty"`
	IsMergedInTargetBranch bool   `json:"is_merged_in_target_branch"`
	ChangeID               string `json:"change_id,omitempty"`
	ChangeNumber           int    `json:"change_number,omitempty"`
	PatchSetNumber         int    `json:"patch_set_number,omitempty"`
	ChangeStatus           string `json:"change_status,omitempty"`
}

The ParentInfo entity contains information about the parent commit of a patch-set.

type PatchOptions

type PatchOptions struct {
	// Adding query parameter zip (for example /changes/.../patch?zip) returns the patch as a single file inside of a ZIP archive.
	// Clients can expand the ZIP to obtain the plain text patch, avoiding the need for a base64 decoding step.
	// This option implies download.
	Zip bool `url:"zip,omitempty"`

	// Query parameter download (e.g. /changes/.../patch?download) will suggest the browser save the patch as commitsha1.diff.base64, for later processing by command line tools.
	Download bool `url:"download,omitempty"`

	// If the path parameter is set, the returned content is a diff of the single file that the path refers to.
	Path string `url:"path,omitempty"`
}

PatchOptions specifies the parameters for GetPatch call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-patch

type PatchSet

type PatchSet struct {
	Number    Number      `json:"number"`
	Revision  string      `json:"revision"`
	Parents   []string    `json:"parents"`
	Ref       string      `json:"ref"`
	Uploader  AccountInfo `json:"uploader"`
	Author    AccountInfo `json:"author"`
	CreatedOn int         `json:"createdOn"`
	IsDraft   bool        `json:"isDraft"`
	Kind      string      `json:"kind"`
}

PatchSet contains detailed information about a specific patch set.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/json.html#patchSet

type PermissionInfo

type PermissionInfo struct {
	Label     string                        `json:"label,omitempty"`
	Exclusive bool                          `json:"exclusive"`
	Rules     map[string]PermissionRuleInfo `json:"rules"`
}

PermissionInfo entity contains information about an assigned permission.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#permission-info

type PermissionRuleInfo

type PermissionRuleInfo struct {
	// TODO Possible values for action: ALLOW, DENY or BLOCK, INTERACTIVE and BATCH
	Action string `json:"action"`
	Force  bool   `json:"force"`
	Min    int    `json:"min"`
	Max    int    `json:"max"`
}

PermissionRuleInfo entity contains information about a permission rule that is assigned to group.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#permission-rule-info

type PluginConfigInfo

type PluginConfigInfo struct {
	// HasAvatars reports whether an avatar provider is registered.
	HasAvatars bool `json:"has_avatars,omitempty"`
}

PluginConfigInfo entity contains information about Gerrit extensions by plugins.

type PluginInfo

type PluginInfo struct {
	ID       string `json:"id"`
	Version  string `json:"version"`
	IndexURL string `json:"index_url,omitempty"`
	Disabled bool   `json:"disabled,omitempty"`
}

PluginInfo entity describes a plugin.

type PluginInput

type PluginInput struct {
	URL string `json:"url"`
}

PluginInput entity describes a plugin that should be installed.

type PluginOptions

type PluginOptions struct {
	// All enabled that all plugins are returned (enabled and disabled).
	All bool `url:"all,omitempty"`
}

PluginOptions specifies the different options for the ListPlugins call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#list-plugins

type PluginsService

type PluginsService struct {
	// contains filtered or unexported fields
}

PluginsService contains Plugin related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html

func (*PluginsService) DisablePlugin

func (s *PluginsService) DisablePlugin(ctx context.Context, pluginID string) (*PluginInfo, *Response, error)

DisablePlugin disables a plugin on the Gerrit server.

As response a PluginInfo entity is returned that describes the plugin.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#disable-plugin

func (*PluginsService) EnablePlugin

func (s *PluginsService) EnablePlugin(ctx context.Context, pluginID string) (*PluginInfo, *Response, error)

EnablePlugin enables a plugin on the Gerrit server.

As response a PluginInfo entity is returned that describes the plugin.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#enable-plugin

func (*PluginsService) GetPluginStatus

func (s *PluginsService) GetPluginStatus(ctx context.Context, pluginID string) (*PluginInfo, *Response, error)

GetPluginStatus retrieves the status of a plugin on the Gerrit server.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#get-plugin-status

func (*PluginsService) InstallPlugin

func (s *PluginsService) InstallPlugin(ctx context.Context, pluginID string, input *PluginInput) (*PluginInfo, *Response, error)

InstallPlugin installs a new plugin on the Gerrit server. If a plugin with the specified name already exists it is overwritten.

Note: if the plugin provides its own name in the MANIFEST file, then the plugin name from the MANIFEST file has precedence over the {plugin-id} above.

The plugin jar can either be sent as binary data in the request body or a URL to the plugin jar must be provided in the request body inside a PluginInput entity.

As response a PluginInfo entity is returned that describes the plugin. If an existing plugin was overwritten the response is “200 OK”.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-dashboard

func (*PluginsService) ListPlugins

func (s *PluginsService) ListPlugins(ctx context.Context, opt *PluginOptions) (*map[string]PluginInfo, *Response, error)

ListPlugins lists the plugins installed on the Gerrit server. Only the enabled plugins are returned unless the all option is specified.

To be allowed to see the installed plugins, a user must be a member of a group that is granted the 'View Plugins' capability or the 'Administrate Server' capability. The entries in the map are sorted by plugin ID.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#list-plugins

func (*PluginsService) ReloadPlugin

func (s *PluginsService) ReloadPlugin(ctx context.Context, pluginID string) (*PluginInfo, *Response, error)

ReloadPlugin reloads a plugin on the Gerrit server.

As response a PluginInfo entity is returned that describes the plugin.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-plugins.html#disable-plugin

type PreferencesInfo

type PreferencesInfo struct {
	ChangesPerPage            int               `json:"changes_per_page"`
	ShowSiteHeader            bool              `json:"show_site_header,omitempty"`
	UseFlashClipboard         bool              `json:"use_flash_clipboard,omitempty"`
	DownloadScheme            string            `json:"download_scheme"`
	DownloadCommand           string            `json:"download_command"`
	CopySelfOnEmail           bool              `json:"copy_self_on_email,omitempty"`
	DateFormat                string            `json:"date_format"`
	TimeFormat                string            `json:"time_format"`
	RelativeDateInChangeTable bool              `json:"relative_date_in_change_table,omitempty"`
	SizeBarInChangeTable      bool              `json:"size_bar_in_change_table,omitempty"`
	LegacycidInChangeTable    bool              `json:"legacycid_in_change_table,omitempty"`
	MuteCommonPathPrefixes    bool              `json:"mute_common_path_prefixes,omitempty"`
	ReviewCategoryStrategy    string            `json:"review_category_strategy"`
	DiffView                  string            `json:"diff_view"`
	My                        []TopMenuItemInfo `json:"my"`
	URLAliases                string            `json:"url_aliases,omitempty"`
}

PreferencesInfo entity contains information about a user’s preferences.

type PreferencesInput

type PreferencesInput struct {
	ChangesPerPage            int               `json:"changes_per_page,omitempty"`
	ShowSiteHeader            bool              `json:"show_site_header,omitempty"`
	UseFlashClipboard         bool              `json:"use_flash_clipboard,omitempty"`
	DownloadScheme            string            `json:"download_scheme,omitempty"`
	DownloadCommand           string            `json:"download_command,omitempty"`
	CopySelfOnEmail           bool              `json:"copy_self_on_email,omitempty"`
	DateFormat                string            `json:"date_format,omitempty"`
	TimeFormat                string            `json:"time_format,omitempty"`
	RelativeDateInChangeTable bool              `json:"relative_date_in_change_table,omitempty"`
	SizeBarInChangeTable      bool              `json:"size_bar_in_change_table,omitempty"`
	LegacycidInChangeTable    bool              `json:"legacycid_in_change_table,omitempty"`
	MuteCommonPathPrefixes    bool              `json:"mute_common_path_prefixes,omitempty"`
	ReviewCategoryStrategy    string            `json:"review_category_strategy,omitempty"`
	DiffView                  string            `json:"diff_view,omitempty"`
	My                        []TopMenuItemInfo `json:"my,omitempty"`
	URLAliases                string            `json:"url_aliases,omitempty"`
}

PreferencesInput entity contains information for setting the user preferences. Fields which are not set will not be updated.

type ProblemInfo

type ProblemInfo struct {
	Message string `json:"message"`
	Status  string `json:"status,omitempty"`
	Outcome string `json:"outcome,omitempty"`
}

ProblemInfo entity 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 ProjectAccessInfo

type ProjectAccessInfo struct {
	Revision       string                       `json:"revision"`
	InheritsFrom   ProjectInfo                  `json:"inherits_from"`
	Local          map[string]AccessSectionInfo `json:"local"`
	IsOwner        bool                         `json:"is_owner"`
	OwnerOf        []string                     `json:"owner_of"`
	CanUpload      bool                         `json:"can_upload"`
	CanAdd         bool                         `json:"can_add"`
	CanAddTags     bool                         `json:"can_add_tags"`
	ConfigVisible  bool                         `json:"config_visible"`
	Groups         map[string]GroupInfo         `json:"groups"`
	ConfigWebLinks []string                     `json:"configWebLinks"`
}

ProjectAccessInfo entity contains information about the access rights for a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#project-access-info

type ProjectAccessInput

type ProjectAccessInput struct {
	// A list of deductions to be applied to the project access as ProjectAccessInfo entities.
	Remove map[string]AccessSectionInfo `json:"remove"`

	// A list of additions to be applied to the project access as ProjectAccessInfo entities.
	Add map[string]AccessSectionInfo `json:"add"`

	// A commit message for this change.
	Message string `json:"message"`

	// A new parent for the project to inherit from. Changing the parent project requires administrative privileges.
	Parent string `json:"parent"`
}

ProjectAccessInput describes changes that should be applied to a project access config

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-access-input

type ProjectBaseOptions

type ProjectBaseOptions struct {
	// Limit the number of projects to be included in the results.
	Limit int `url:"n,omitempty"`

	// Skip the given number of branches from the beginning of the list.
	Skip string `url:"s,omitempty"`
}

ProjectBaseOptions specifies the really basic options for projects and sub functionality (e.g. Tags)

type ProjectDescriptionInput

type ProjectDescriptionInput struct {
	Description   string `json:"description,omitempty"`
	CommitMessage string `json:"commit_message,omitempty"`
}

ProjectDescriptionInput entity contains information for setting a project description.

type ProjectInfo

type ProjectInfo struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Parent      string            `json:"parent,omitempty"`
	Description string            `json:"description,omitempty"`
	State       string            `json:"state,omitempty"`
	Branches    map[string]string `json:"branches,omitempty"`
	WebLinks    []WebLinkInfo     `json:"web_links,omitempty"`
}

ProjectInfo entity contains information about a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info

type ProjectInput

type ProjectInput struct {
	Name                             string                       `json:"name,omitempty"`
	Parent                           string                       `json:"parent,omitempty"`
	Description                      string                       `json:"description,omitempty"`
	PermissionsOnly                  bool                         `json:"permissions_only"`
	CreateEmptyCommit                bool                         `json:"create_empty_commit"`
	SubmitType                       string                       `json:"submit_type,omitempty"`
	Branches                         []string                     `json:"branches,omitempty"`
	Owners                           []string                     `json:"owners,omitempty"`
	UseContributorAgreements         string                       `json:"use_contributor_agreements,omitempty"`
	UseSignedOffBy                   string                       `json:"use_signed_off_by,omitempty"`
	CreateNewChangeForAllNotInTarget string                       `json:"create_new_change_for_all_not_in_target,omitempty"`
	UseContentMerge                  string                       `json:"use_content_merge,omitempty"`
	RequireChangeID                  string                       `json:"require_change_id,omitempty"`
	MaxObjectSizeLimit               string                       `json:"max_object_size_limit,omitempty"`
	PluginConfigValues               map[string]map[string]string `json:"plugin_config_values,omitempty"`
}

ProjectInput entity contains information for the creation of a new project.

type ProjectOptions

type ProjectOptions struct {
	ProjectBaseOptions

	// Limit the results to the projects having the specified branch and include the sha1 of the branch in the results.
	Branch string `url:"b,omitempty"`

	// Include project description in the results.
	Description bool `url:"d,omitempty"`

	// Limit the results to those projects that start with the specified prefix.
	Prefix string `url:"p,omitempty"`

	// Limit the results to those projects that match the specified regex.
	// Boundary matchers '^' and '$' are implicit.
	// For example: the regex 'test.*' will match any projects that start with 'test' and regex '.*test' will match any project that end with 'test'.
	Regex string `url:"r,omitempty"`

	// Skip the given number of projects from the beginning of the list.
	Skip string `url:"S,omitempty"`

	// Limit the results to those projects that match the specified substring.
	Substring string `url:"m,omitempty"`

	// Get projects inheritance in a tree-like format.
	// This option does not work together with the branch option.
	Tree bool `url:"t,omitempty"`

	// Get projects with specified type: ALL, CODE, PERMISSIONS.
	Type string `url:"type,omitempty"`
}

ProjectOptions specifies the parameters to the ProjectsService.ListProjects.

type ProjectParentInput

type ProjectParentInput struct {
	Parent        string `json:"parent"`
	CommitMessage string `json:"commit_message,omitempty"`
}

ProjectParentInput entity contains information for setting a project parent.

type ProjectsService

type ProjectsService struct {
	// contains filtered or unexported fields
}

ProjectsService contains Project related REST endpoints

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html

func (*ProjectsService) AddUpdateDeleteAccessRights

func (s *ProjectsService) AddUpdateDeleteAccessRights(ctx context.Context, projectName string, input *ProjectAccessInput) (*ProjectAccessInfo, *Response, error)

AddUpdateDeleteAccessRights add, update and delete access rights for project

Sets access rights for the project using the diff schema provided by ProjectAccessInput. Deductions are used to remove access sections, permissions or permission rules. The backend will remove the entity with the finest granularity in the request, meaning that if an access section without permissions is posted, the access section will be removed; if an access section with a permission but no permission rules is posted, the permission will be removed; if an access section with a permission and a permission rule is posted, the permission rule will be removed.

Additionally, access sections and permissions will be cleaned up after applying the deductions by removing items that have no child elements.

After removals have been applied, additions will be applied.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-access

func (*ProjectsService) BanCommit

func (s *ProjectsService) BanCommit(ctx context.Context, projectName string, input *BanInput) (*BanResultInfo, *Response, error)

BanCommit marks commits as banned for the project. If a commit is banned Gerrit rejects every push that includes this commit with contains banned commit ...

Note: This REST endpoint only marks the commits as banned, but it does not remove the commits from the history of any central branch. This needs to be done manually. The commits to be banned must be specified in the request body as a BanInput entity.

The caller must be project owner.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#ban-commit

func (*ProjectsService) CheckAccess

func (s *ProjectsService) CheckAccess(ctx context.Context, projectName string, opt *CheckAccessOptions) (*AccessCheckInfo, *Response, error)

CheckAccess runs access checks for other users. This requires the View Access global capability.

The result is a AccessCheckInfo entity detailing the access of the given user for the given project, project-ref, or project-permission-ref combination.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#check-access

func (*ProjectsService) CreateAccessRightChange

func (s *ProjectsService) CreateAccessRightChange(ctx context.Context, projectName string, input *ProjectAccessInput) (*ChangeInfo, *Response, error)

CreateAccessRightChange sets access rights for the project using the diff schema provided by ProjectAccessInput

This takes the same input as Update Access Rights, but creates a pending change for review. Like Create Change, it returns a ChangeInfo entity describing the resulting change.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#create-access-change

func (*ProjectsService) CreateBranch

func (s *ProjectsService) CreateBranch(ctx context.Context, projectName, branchID string, input *BranchInput) (*BranchInfo, *Response, error)

CreateBranch creates a new branch. In the request body additional data for the branch can be provided as BranchInput.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#create-branch

func (*ProjectsService) CreateProject

func (s *ProjectsService) CreateProject(ctx context.Context, projectName string, input *ProjectInput) (*ProjectInfo, *Response, error)

CreateProject creates a new project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#create-project

func (*ProjectsService) CreateTag

func (s *ProjectsService) CreateTag(ctx context.Context, projectName, tagName string, input *TagInput) (*TagInfo, *Response, error)

CreateTag create a tag of a project

Gerrit API docs:https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#create-tag

func (*ProjectsService) DeleteBranch

func (s *ProjectsService) DeleteBranch(ctx context.Context, projectName, branchID string) (*Response, error)

DeleteBranch deletes a branch.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-branch

func (*ProjectsService) DeleteBranches

func (s *ProjectsService) DeleteBranches(ctx context.Context, projectName string, input *DeleteBranchesInput) (*Response, error)

DeleteBranches delete one or more branches. If some branches could not be deleted, the response is “409 Conflict” and the error message is contained in the response body.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-branches

func (*ProjectsService) DeleteDashboard

func (s *ProjectsService) DeleteDashboard(ctx context.Context, projectName, dashboardID string, input *DashboardInput) (*Response, error)

DeleteDashboard deletes a project dashboard. Currently only supported for the default dashboard.

The request body does not need to include a DashboardInput entity if no commit message is specified. Please note that some proxies prohibit request bodies for DELETE requests.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-dashboard

func (*ProjectsService) DeleteProject

func (s *ProjectsService) DeleteProject(ctx context.Context, projectName string, input *DeleteOptionsInfo) (*Response, error)

DeleteProject deletes a project

Note: requires installation of delete-project plugin

Gerrit API docs: https://gerrit.googlesource.com/plugins/delete-project/+/refs/heads/master/src/main/resources/Documentation/rest-api-projects.md

func (*ProjectsService) DeleteProjectDescription

func (s *ProjectsService) DeleteProjectDescription(ctx context.Context, projectName string) (*Response, error)

DeleteProjectDescription deletes the description of a project. The request body does not need to include a ProjectDescriptionInput entity if no commit message is specified.

Please note that some proxies prohibit request bodies for DELETE requests. In this case, if you want to specify a commit message, use PUT to delete the description.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-project-description

func (*ProjectsService) DeleteTag

func (s *ProjectsService) DeleteTag(ctx context.Context, projectName, tagName string) (*Response, error)

DeleteTag delete a tag of a project

Gerrit API docs:https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-tag

func (*ProjectsService) DeleteTags

func (s *ProjectsService) DeleteTags(ctx context.Context, projectName string, input *DeleteTagsInput) (*Response, error)

DeleteTags delete tags of a project

Gerrit API docs:https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-tags

func (*ProjectsService) GetBranch

func (s *ProjectsService) GetBranch(ctx context.Context, projectName, branchID string) (*BranchInfo, *Response, error)

GetBranch retrieves a branch of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-branch

func (*ProjectsService) GetBranchContent

func (s *ProjectsService) GetBranchContent(ctx context.Context, projectName, branchID, fileID string) (string, *Response, error)

GetBranchContent gets the content of a file from the HEAD revision of a certain branch. The content is returned as base64 encoded string.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-content

func (*ProjectsService) GetChildProject

func (s *ProjectsService) GetChildProject(ctx context.Context, projectName, childProjectName string, opt *ChildProjectOptions) (*ProjectInfo, *Response, error)

GetChildProject retrieves a child project. If a non-direct child project should be retrieved the parameter recursive must be set.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-child-project

func (*ProjectsService) GetCommit

func (s *ProjectsService) GetCommit(ctx context.Context, projectName, commitID string) (*CommitInfo, *Response, error)

GetCommit retrieves a commit of a project. The commit must be visible to the caller.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-commit

func (*ProjectsService) GetCommitContent

func (s *ProjectsService) GetCommitContent(ctx context.Context, projectName, commitID, fileID string) (string, *Response, error)

GetCommitContent gets the content of a file from a certain commit. The content is returned as base64 encoded string.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html##get-content-from-commit

func (*ProjectsService) GetConfig

func (s *ProjectsService) GetConfig(ctx context.Context, projectName string) (*ConfigInfo, *Response, error)

GetConfig gets some configuration information about a project. Note that this config info is not simply the contents of project.config; it generally contains fields that may have been inherited from parent projects.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-config

func (*ProjectsService) GetDashboard

func (s *ProjectsService) GetDashboard(ctx context.Context, projectName, dashboardName string) (*DashboardInfo, *Response, error)

GetDashboard list custom dashboards for a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-dashboard

func (*ProjectsService) GetHEAD

func (s *ProjectsService) GetHEAD(ctx context.Context, projectName string) (string, *Response, error)

GetHEAD retrieves for a project the name of the branch to which HEAD points.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-head

func (*ProjectsService) GetIncludeIn

func (s *ProjectsService) GetIncludeIn(ctx context.Context, projectName, commitID string) (*IncludedInInfo, *Response, error)

GetIncludeIn Retrieves the branches and tags in which a change is included. Branches that are not visible to the calling user according to the project’s read permissions are filtered out from the result.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-included-in

func (*ProjectsService) GetProject

func (s *ProjectsService) GetProject(ctx context.Context, projectName string) (*ProjectInfo, *Response, error)

GetProject retrieves a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-project

func (*ProjectsService) GetProjectDescription

func (s *ProjectsService) GetProjectDescription(ctx context.Context, projectName string) (string, *Response, error)

GetProjectDescription retrieves the description of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-project-description

func (*ProjectsService) GetProjectParent

func (s *ProjectsService) GetProjectParent(ctx context.Context, projectName string) (string, *Response, error)

GetProjectParent retrieves the name of a project’s parent project. For the All-Projects root project an empty string is returned.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-project-parent

func (*ProjectsService) GetReflog

func (s *ProjectsService) GetReflog(ctx context.Context, projectName, branchID string) (*[]ReflogEntryInfo, *Response, error)

GetReflog gets the reflog of a certain branch. The caller must be project owner.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-reflog

func (*ProjectsService) GetRepositoryStatistics

func (s *ProjectsService) GetRepositoryStatistics(ctx context.Context, projectName string) (*RepositoryStatisticsInfo, *Response, error)

GetRepositoryStatistics return statistics for the repository of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-repository-statistics

func (*ProjectsService) GetTag

func (s *ProjectsService) GetTag(ctx context.Context, projectName, tagName string) (*TagInfo, *Response, error)

GetTag retrieves a tag of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-tag

func (*ProjectsService) ListAccessRights

func (s *ProjectsService) ListAccessRights(ctx context.Context, projectName string) (*ProjectAccessInfo, *Response, error)

ListAccessRights lists the access rights for a single project

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-access

func (*ProjectsService) ListBranches

func (s *ProjectsService) ListBranches(ctx context.Context, projectName string, opt *BranchOptions) (*[]BranchInfo, *Response, error)

ListBranches list the branches of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-branches

func (*ProjectsService) ListChildProjects

func (s *ProjectsService) ListChildProjects(ctx context.Context, projectName string, opt *ChildProjectOptions) (*[]ProjectInfo, *Response, error)

ListChildProjects lists the direct child projects of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-child-projects

func (*ProjectsService) ListDashboards

func (s *ProjectsService) ListDashboards(ctx context.Context, projectName string) (*[]DashboardInfo, *Response, error)

ListDashboards list custom dashboards for a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-dashboards

func (*ProjectsService) ListProjects

func (s *ProjectsService) ListProjects(ctx context.Context, opt *ProjectOptions) (*map[string]ProjectInfo, *Response, error)

ListProjects lists the projects accessible by the caller. This is the same as using the ls-projects command over SSH, and accepts the same options as query parameters. The entries in the map are sorted by project name.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects

Example
instance := "https://chromium-review.googlesource.com/"
ctx := context.Background()
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
	panic(err)
}

opt := &gerrit.ProjectOptions{
	Description: true,
	Prefix:      "infra/infra/infra_l",
}
projects, _, err := client.Projects.ListProjects(ctx, opt)
if err != nil {
	panic(err)
}

for name, p := range *projects {
	fmt.Printf("%s - State: %s\n", name, p.State)
}
Output:

infra/infra/infra_libs - State: ACTIVE

func (*ProjectsService) ListTags

func (s *ProjectsService) ListTags(ctx context.Context, projectName string, opt *ProjectBaseOptions) (*[]TagInfo, *Response, error)

ListTags list the tags of a project.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-tags

func (*ProjectsService) RunGC

func (s *ProjectsService) RunGC(ctx context.Context, projectName string, input *GCInput) (*Response, error)

RunGC runs the Git garbage collection for the repository of a project. The response is the streamed output of the garbage collection.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#run-gc

func (*ProjectsService) SetConfig

func (s *ProjectsService) SetConfig(ctx context.Context, projectName string, input *ConfigInput) (*ConfigInfo, *Response, error)

SetConfig sets the configuration of a project. The new configuration must be provided in the request body as a ConfigInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-config

func (*ProjectsService) SetDashboard

func (s *ProjectsService) SetDashboard(ctx context.Context, projectName, dashboardID string, input *DashboardInput) (*DashboardInfo, *Response, error)

SetDashboard updates/Creates a project dashboard. Currently only supported for the default dashboard.

The creation/update information for the dashboard must be provided in the request body as a DashboardInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-dashboard

func (*ProjectsService) SetHEAD

func (s *ProjectsService) SetHEAD(ctx context.Context, projectName string, input *HeadInput) (*string, *Response, error)

SetHEAD sets HEAD for a project. The new ref to which HEAD should point must be provided in the request body inside a HeadInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-head

func (*ProjectsService) SetProjectDescription

func (s *ProjectsService) SetProjectDescription(ctx context.Context, projectName string, input *ProjectDescriptionInput) (*string, *Response, error)

SetProjectDescription sets the description of a project. The new project description must be provided in the request body inside a ProjectDescriptionInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-project-description

func (*ProjectsService) SetProjectParent

func (s *ProjectsService) SetProjectParent(ctx context.Context, projectName string, input *ProjectParentInput) (*string, *Response, error)

SetProjectParent sets the parent project for a project. The new name of the parent project must be provided in the request body inside a ProjectParentInput entity.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#set-project-parent

type QueryAccountOptions

type QueryAccountOptions struct {
	QueryOptions

	// The `S` or `start` query parameter can be supplied to skip a number of accounts from the list.
	Start int `url:"S,omitempty"`

	AccountOptions
}

QueryAccountOptions queries accounts visible to the caller.

type QueryChangeOptions

type QueryChangeOptions struct {
	QueryOptions

	// The S or start query parameter can be supplied to skip a number of changes from the list.
	Skip  int `url:"S,omitempty"`
	Start int `url:"start,omitempty"`

	ChangeOptions
}

QueryChangeOptions specifies the parameters to the ChangesService.QueryChanges.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

type QueryLimitInfo

type QueryLimitInfo struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

QueryLimitInfo entity contains information about the Query Limit of a user.

type QueryOptions

type QueryOptions struct {
	// Query parameter
	// Clients are allowed to specify more than one query by setting the q parameter multiple times.
	// In this case the result is an array of arrays, one per query in the same order the queries were given in.
	//
	// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/user-search.html#_search_operators
	Query []string `url:"q,omitempty"`

	// The n parameter can be used to limit the returned results.
	// If the n query parameter is supplied and additional changes exist that match the query beyond the end, the last change object has a _more_changes: true JSON field set.
	Limit int `url:"n,omitempty"`

	// The S or start query parameter can be supplied to skip a number of changes from the list.
	Start int `url:"start,omitempty"`
}

QueryOptions specifies global parameters to query changes / reviewers.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

type ReadyForReviewInput

type ReadyForReviewInput struct {
	Message string `json:"message,omitempty"`
}

ReadyForReviewInput entity contains information for transitioning a change from WIP to ready.

type RebaseInput

type RebaseInput struct {
	Base               string            `json:"base,omitempty"`
	Strategy           string            `json:"strategy,omitempty"`
	AllowConflicts     bool              `json:"allow_conflicts,omitempty"`
	OnBehalfOfUploader bool              `json:"on_behalf_of_uploader,omitempty"`
	CommitterEmail     string            `json:"committer_email,omitempty"`
	ValidationOptions  map[string]string `json:"validation_options,omitempty"`
}

RebaseInput entity contains information for changing parent when rebasing.

type ReceiveInfo

type ReceiveInfo struct {
	EnableSignedPush bool `json:"enableSignedPush,omitempty"`
}

ReceiveInfo entity contains information about the configuration of git-receive-pack behavior on the server.

type RefUpdate

type RefUpdate struct {
	OldRev  string `json:"oldRev"`
	NewRev  string `json:"newRev"`
	RefName string `json:"refName"`
	Project string `json:"project"`
}

RefUpdate contains data about a reference update.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/json.html#refUpdate

type ReflogEntryInfo

type ReflogEntryInfo struct {
	OldID   string        `json:"old_id"`
	NewID   string        `json:"new_id"`
	Who     GitPersonInfo `json:"who"`
	Comment string        `json:"comment"`
}

ReflogEntryInfo entity describes an entry in a reflog.

type RelatedChangeAndCommitInfo

type RelatedChangeAndCommitInfo struct {
	ChangeID              string     `json:"change_id,omitempty"`
	Commit                CommitInfo `json:"commit"`
	ChangeNumber          int        `json:"_change_number,omitempty"`
	RevisionNumber        int        `json:"_revision_number,omitempty"`
	CurrentRevisionNumber int        `json:"_current_revision_number,omitempty"`
	Status                string     `json:"status,omitempty"`
}

RelatedChangeAndCommitInfo entity contains information about a related change and commit.

type RelatedChangesInfo

type RelatedChangesInfo struct {
	Changes []RelatedChangeAndCommitInfo `json:"changes"`
}

RelatedChangesInfo entity contains information about related changes.

type RepositoryStatisticsInfo

type RepositoryStatisticsInfo struct {
	NumberOfLooseObjects  int `json:"number_of_loose_objects"`
	NumberOfLooseRefs     int `json:"number_of_loose_refs"`
	NumberOfPackFiles     int `json:"number_of_pack_files"`
	NumberOfPackedObjects int `json:"number_of_packed_objects"`
	NumberOfPackedRefs    int `json:"number_of_packed_refs"`
	SizeOfLooseObjects    int `json:"size_of_loose_objects"`
	SizeOfPackedObjects   int `json:"size_of_packed_objects"`
}

RepositoryStatisticsInfo entity contains information about statistics of a Git repository.

type Response

type Response struct {
	*http.Response
}

Response is a Gerrit API response. This wraps the standard http.Response returned from Gerrit.

type RestoreInput

type RestoreInput struct {
	Message string `json:"message,omitempty"`
}

RestoreInput entity contains information for restoring a change.

type RevertInput

type RevertInput struct {
	Message string `json:"message,omitempty"`
}

RevertInput entity contains information for reverting a change.

type ReviewInfo

type ReviewInfo struct {
	Labels map[string]int `json:"labels"`
}

ReviewInfo entity contains information about a review.

type ReviewInput

type ReviewInput struct {
	Message                          string                         `json:"message,omitempty"`
	Tag                              string                         `json:"tag,omitempty"`
	Labels                           map[string]int                 `json:"labels,omitempty"`
	Comments                         map[string][]CommentInput      `json:"comments,omitempty"`
	RobotComments                    map[string][]RobotCommentInput `json:"robot_comments,omitempty"`
	StrictLabels                     bool                           `json:"strict_labels,omitempty"`
	Drafts                           string                         `json:"drafts,omitempty"`
	Notify                           string                         `json:"notify,omitempty"`
	OmitDuplicateComments            bool                           `json:"omit_duplicate_comments,omitempty"`
	OnBehalfOf                       string                         `json:"on_behalf_of,omitempty"`
	Reviewers                        []ReviewerInput                `json:"reviewers,omitempty"`
	Ready                            bool                           `json:"ready,omitempty"`
	WorkInProgress                   bool                           `json:"work_in_progress,omitempty"`
	AddToAttentionSet                []AttentionSetInput            `json:"add_to_attention_set,omitempty"`
	RemoveFromAttentionSet           []AttentionSetInput            `json:"remove_from_attention_set,omitempty"`
	IgnoreAutomaticAttentionSetRules bool                           `json:"ignore_automatic_attention_set_rules,omitempty"`
}

ReviewInput entity contains information for adding a review to a revision.

type ReviewResult

type ReviewResult struct {
	ReviewInfo
	Reviewers  map[string]AddReviewerResult `json:"reviewers,omitempty"`
	Ready      bool                         `json:"ready,omitempty"`
	Error      string                       `json:"error,omitempty"`
	ChangeInfo ChangeInfo                   `json:"change_info"`
}

ReviewResult entity contains information regarding the updates that were made to a review.

type ReviewerInfo

type ReviewerInfo struct {
	AccountInfo
	Approvals map[string]string `json:"approvals"`
}

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

type ReviewerInput

type ReviewerInput struct {
	Reviewer  string `json:"reviewer"`
	Confirmed bool   `json:"confirmed,omitempty"`
}

ReviewerInput entity contains information for adding a reviewer to a change.

type ReviewerUpdateInfo

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

ReviewerUpdateInfo entity contains information about updates to change's reviewers set.

type RevisionInfo

type RevisionInfo struct {
	Kind              RevisionKind          `json:"kind,omitempty"`
	Draft             bool                  `json:"draft,omitempty"`
	Number            int                   `json:"_number"`
	Created           Timestamp             `json:"created"`
	Uploader          AccountInfo           `json:"uploader"`
	Ref               string                `json:"ref"`
	Fetch             map[string]FetchInfo  `json:"fetch"`
	Commit            CommitInfo            `json:"commit,omitempty"`
	Files             map[string]FileInfo   `json:"files,omitempty"`
	Actions           map[string]ActionInfo `json:"actions,omitempty"`
	Reviewed          bool                  `json:"reviewed,omitempty"`
	MessageWithFooter string                `json:"messageWithFooter,omitempty"`
	ParentsData       []ParentInfo          `json:"parents_data,omitempty"`
}

RevisionInfo entity contains information about a patch set.

type RevisionKind

type RevisionKind string

RevisionKind describes the change kind.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info

const (
	Rework                 RevisionKind = "REWORK"
	TrivialRebase          RevisionKind = "TRIVIAL_REBASE"
	MergeFirstParentUpdate RevisionKind = "MERGE_FIRST_PARENT_UPDATE"
	NoCodeChange           RevisionKind = "NO_CODE_CHANGE"
	NoChange               RevisionKind = "NO_CHANGE"
)

type RobotCommentInfo

type RobotCommentInfo struct {
	CommentInfo

	// The ID of the robot that generated this comment.
	RobotID string `json:"robot_id"`
	// An ID of the run of the robot.
	RobotRunID string `json:"robot_run_id"`
	// URL to more information.
	URL string `json:"url,omitempty"`
	// Robot specific properties as map that maps arbitrary keys to values.
	Properties map[string]string `json:"properties,omitempty"`
	// Suggested fixes for this robot comment as a list of FixSuggestionInfo
	// entities.
	FixSuggestions *FixSuggestionInfo `json:"fix_suggestions,omitempty"`
}

RobotCommentInfo entity contains information about a robot inline comment RobotCommentInfo has the same fields as CommentInfo. In addition RobotCommentInfo has the following fields: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#robot-comment-info

type RobotCommentInput

type RobotCommentInput struct {
	CommentInput

	// The ID of the robot that generated this comment.
	RobotID string `json:"robot_id"`
	// An ID of the run of the robot.
	RobotRunID string `json:"robot_run_id"`
	// URL to more information.
	URL string `json:"url,omitempty"`
	// Robot specific properties as map that maps arbitrary keys to values.
	Properties *map[string]*string `json:"properties,omitempty"`
	// Suggested fixes for this robot comment as a list of FixSuggestionInfo
	// entities.
	FixSuggestions *FixSuggestionInfo `json:"fix_suggestions,omitempty"`
}

RobotCommentInput entity contains information for creating an inline robot comment. https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#robot-comment-input

type RuleInput

type RuleInput struct {
	Rule    string `json:"rule"`
	Filters string `json:"filters,omitempty"`
}

RuleInput entity contains information to test a Prolog rule.

type SSHKeyInfo

type SSHKeyInfo struct {
	Seq          int    `json:"seq"`
	SSHPublicKey string `json:"ssh_public_key"`
	EncodedKey   string `json:"encoded_key"`
	Algorithm    string `json:"algorithm"`
	Comment      string `json:"comment,omitempty"`
	Valid        bool   `json:"valid"`
}

SSHKeyInfo entity contains information about an SSH key of a user.

type SSHdInfo

type SSHdInfo struct{}

SSHdInfo entity contains information about Gerrit configuration from the sshd section.

type ServerInfo

type ServerInfo struct {
	Auth       AuthInfo          `json:"auth"`
	Change     ChangeConfigInfo  `json:"change"`
	Download   DownloadInfo      `json:"download"`
	Gerrit     Info              `json:"gerrit"`
	Gitweb     map[string]string `json:"gitweb,omitempty"`
	Plugin     PluginConfigInfo  `json:"plugin"`
	Receive    ReceiveInfo       `json:"receive,omitempty"`
	SSHd       SSHdInfo          `json:"sshd,omitempty"`
	Suggest    SuggestInfo       `json:"suggest"`
	URLAliases map[string]string `json:"url_aliases,omitempty"`
	User       UserConfigInfo    `json:"user"`
}

ServerInfo entity contains information about the configuration of the Gerrit server.

type SubmitInfo

type SubmitInfo struct {
	Status     string `json:"status"`
	OnBehalfOf string `json:"on_behalf_of,omitempty"`
}

SubmitInfo entity contains information about the change status after submitting.

type SubmitInput

type SubmitInput struct {
	OnBehalfOf    string                       `json:"on_behalf_of,omitempty"`
	Notify        string                       `json:"notify,omitempty"`
	NotifyDetails map[RecipientType]NotifyInfo `json:"notify_details,omitempty"`
	WaitForMerge  bool                         `json:"wait_for_merge,omitempty"`
}

SubmitInput entity contains information for submitting a change.

type SubmitRecord

type SubmitRecord struct {
	Status       string                            `json:"status"`
	Ok           map[string]map[string]AccountInfo `json:"ok,omitempty"`
	Reject       map[string]map[string]AccountInfo `json:"reject,omitempty"`
	Need         map[string]interface{}            `json:"need,omitempty"`
	May          map[string]map[string]AccountInfo `json:"may,omitempty"`
	Impossible   map[string]interface{}            `json:"impossible,omitempty"`
	ErrorMessage string                            `json:"error_message,omitempty"`
}

SubmitRecord entity describes results from a submit_rule.

type SubmitRequirementExpressionInfo

type SubmitRequirementExpressionInfo struct {
	Expression   string   `json:"expression,omitempty"`
	Fulfilled    bool     `json:"fulfilled"`
	Status       string   `json:"status"`
	PassingAtoms []string `json:"passing_atoms,omitempty"`
	FailingAtoms []string `json:"failing_atoms,omitempty"`
	ErrorMessage string   `json:"error_message,omitempty"`
}

SubmitRequirementExpressionInfo entity contains information about a submit requirement exppression.

Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-expression-info

type SubmitRequirementResultInfo

type SubmitRequirementResultInfo struct {
	Name                           string                          `json:"name"`
	Description                    string                          `json:"description,omitempty"`
	Status                         string                          `json:"status"`
	IsLegacy                       bool                            `json:"is_legacy"`
	ApplicabilityExpressionResult  SubmitRequirementExpressionInfo `json:"applicability_expression_result,omitempty"`
	SubmittabilityExpressionResult SubmitRequirementExpressionInfo `json:"submittability_expression_result"`
	OverrideExpressionResult       SubmitRequirementExpressionInfo `json:"override_expression_result,omitempty"`
}

SubmitRequirementResultInfo entity describes the result of evaluating a submit requirement on a change.

Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info

type SuggestInfo

type SuggestInfo struct {
	From int `json:"from"`
}

SuggestInfo entity contains information about Gerrit configuration from the suggest section.

type SuggestedReviewerInfo

type SuggestedReviewerInfo struct {
	Account AccountInfo   `json:"account,omitempty"`
	Group   GroupBaseInfo `json:"group,omitempty"`
}

SuggestedReviewerInfo entity contains information about a reviewer that can be added to a change (an account or a group).

type SummaryInfo

type SummaryInfo struct {
	TaskSummary   TaskSummaryInfo `json:"task_summary"`
	MemSummary    MemSummaryInfo  `json:"mem_summary"`
	ThreadSummary ThemeInfo       `json:"thread_summary"`
	JVMSummary    JvmSummaryInfo  `json:"jvm_summary,omitempty"`
}

SummaryInfo entity contains information about the current state of the server.

type SummaryOptions

type SummaryOptions struct {
	// JVM includes a JVM summary.
	JVM bool `url:"jvm,omitempty"`
	// GC requests a Java garbage collection before computing the information about the Java memory heap.
	GC bool `url:"gc,omitempty"`
}

SummaryOptions specifies the different options for the GetSummary call.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#get-summary

type TagInfo

type TagInfo struct {
	Ref      string        `json:"ref"`
	Revision string        `json:"revision"`
	Object   string        `json:"object"`
	Message  string        `json:"message"`
	Tagger   GitPersonInfo `json:"tagger"`
	Created  *Timestamp    `json:"created,omitempty"`
}

TagInfo entity contains information about a tag.

type TagInput

type TagInput struct {
	Ref      string `json:"ref"`
	Revision string `json:"revision,omitempty"`
	Message  string `json:"message,omitempty"`
}

TagInput entity for create a tag.

type TaskInfo

type TaskInfo struct {
	ID         string `json:"id"`
	State      string `json:"state"`
	StartTime  string `json:"start_time"`
	Delay      int    `json:"delay"`
	Command    string `json:"command"`
	RemoteName string `json:"remote_name,omitempty"`
	Project    string `json:"project,omitempty"`
}

TaskInfo entity contains information about a task in a background work queue.

type TaskSummaryInfo

type TaskSummaryInfo struct {
	Total    int `json:"total,omitempty"`
	Running  int `json:"running,omitempty"`
	Ready    int `json:"ready,omitempty"`
	Sleeping int `json:"sleeping,omitempty"`
}

TaskSummaryInfo entity contains information about the current tasks.

type ThemeInfo

type ThemeInfo struct {
	CSS    string `type:"css,omitempty"`
	Header string `type:"header,omitempty"`
	Footer string `type:"footer,omitempty"`
}

ThemeInfo entity describes a theme.

type ThreadSummaryInfo

type ThreadSummaryInfo struct {
	CPUs    int                       `json:"cpus"`
	Threads int                       `json:"threads"`
	Counts  map[string]map[string]int `json:"counts"`
}

ThreadSummaryInfo entity contains information about the current threads.

type Timestamp

type Timestamp struct {
	// Time is an instant in time. Its time zone must be UTC.
	time.Time
}

Timestamp represents an instant in time with nanosecond precision, in UTC time zone. It encodes to and from JSON in Gerrit's timestamp format. All exported methods of time.Time can be called on Timestamp.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api.html#timestamp

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The time is a quoted string in Gerrit's timestamp format. An error is returned if t.Time time zone is not UTC.

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in Gerrit's timestamp format.

type TopMenuEntryInfo

type TopMenuEntryInfo struct {
	Name  string            `json:"name"`
	Items []TopMenuItemInfo `json:"items"`
}

TopMenuEntryInfo entity contains information about a top menu entry.

type TopMenuItemInfo

type TopMenuItemInfo struct {
	URL    string `json:"url"`
	Name   string `json:"name"`
	Target string `json:"target"`
	ID     string `json:"id,omitempty"`
}

TopMenuItemInfo entity contains information about a menu item in a top menu entry.

type TopicInput

type TopicInput struct {
	Topic string `json:"topic,omitempty"`
}

TopicInput entity contains information for setting a topic.

type UserConfigInfo

type UserConfigInfo struct {
	AnonymousCowardName string `json:"anonymous_coward_name"`
}

UserConfigInfo entity contains information about Gerrit configuration from the user section.

type UsernameInput

type UsernameInput struct {
	Username string `json:"username"`
}

UsernameInput entity contains information for setting the username for an account.

type WebLinkInfo

type WebLinkInfo struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	ImageURL string `json:"image_url"`
}

WebLinkInfo entity describes a link to an external site.

Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#web-link-info

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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