gerrit

package module
v0.0.0-...-dc90826 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: MIT Imports: 10 Imported by: 0

README

go-gerrit

GoDoc Build Status Coverage Status

go-gerrit is a Go(lang) client library for accessing the Gerrit Code Review API.

go-gerrit - Go(lang) client/library for Gerrit Code Review

Features

Installation

It is go gettable ...

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

... (optional) to run unit / example tests:

$ cd $GOPATH/src/github.com/andygrunwald/go-gerrit
$ go test -v

API / Usage

Please have a look at the GoDoc documentation for a detailed API description.

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

Authentication

Gerrit support multiple ways for authentication.

Some Gerrit instances hosted like the one hosted googlesource.com (e.g. Go(lang), 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 recieve 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.
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
More more more

In the examples chapter below you will find a few more examples. If you miss one or got a question how to do something please open a new issue with your question. We will be happy to answer them.

Examples

Further a few examples how the API can be used. A few more examples are available in the GoDoc examples section.

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()

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

	// Version: 2.11.3-1230-gb8336f1
}
Get all public projects

List all projects from cyanogenmod:

package main

import (
	"fmt"
	"github.com/andygrunwald/go-gerrit"
)

func main() {
	instance := "http://review.cyanogenmod.org/"
	client, err := gerrit.NewClient(instance, nil)
	if err != nil {
		panic(err)
	}

	opt := &gerrit.ProjectOptions{
		Description: true,
	}
	projects, _, err := client.Projects.ListProjects(opt)
	for name, p := range *projects {
		fmt.Printf("%s - State: %s\n", name, p.State)
	}

	// CyanogenMod/android_external_drm - State: ACTIVE
	// CyanogenMod/android_external_jhead - State: ACTIVE
	// CyanogenMod/android_external_libppp - State: ACTIVE
	// ...
}
Query changes

Get some changes of the kernel/common project from the Android Gerrit 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)

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

	// Project: kernel/common -> android: binder: Fix BR_ERROR usage and change LSM denials to use it. -> https://android-review.googlesource.com/150839
	// Project: kernel/common -> android: binder: fix duplicate error return. -> https://android-review.googlesource.com/155031
	// Project: kernel/common -> dm-verity: Add modes and emit uevent on corrupted blocks -> https://android-review.googlesource.com/169572
	// ...
}

FAQ

How is the source code organized?

The source code organisation was inspired by go-github by Google.

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

gerrit.Client can provide basic helper functions to avoid unnecessary code duplications such as building a new request, parse responses and so on.

Based on this structure implementing a new API functionality is straight forwarded. 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 or try to fix it. We welcome contribution!

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 recieve 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

Addionally 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

Constants

This section is empty.

Variables

This section is empty.

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 removed the "magic prefix line" of Gerris JSON response. 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.

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

Types

type AbandonInput

type AbandonInput struct {
	Message string `json:"message,omitempty"`
}

AbandonInput entity contains information for abandoning a change.

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

func (s *AccessService) ListAccessRights(opt *ListAccessRightsOptions) (*map[string]ProjectAccessInfo, *Response, error)

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 string `json:"registered_on"`
}

AccountDetailInfo entity contains detailled information about an account.

type AccountInfo

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

AccountInfo entity contains information about an account.

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 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(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(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(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(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(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(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(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(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(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(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(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(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(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) GetAccountName

func (s *AccountsService) GetAccountName(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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) SetAccountName

func (s *AccountsService) SetAccountName(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#create-account

func (*AccountsService) SetActive

func (s *AccountsService) SetActive(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(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(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(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(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(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(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(opt *QueryOptions) (*[]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#get-starred-changes

func (*AccountsService) UnstarChange

func (s *AccountsService) UnstarChange(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 {
	Reviewers []ReviewerInfo `json:"reviewers,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 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) 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

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"`
	Project            string                  `json:"project"`
	Branch             string                  `json:"branch"`
	Topic              string                  `json:"topic,omitempty"`
	ChangeID           string                  `json:"change_id"`
	Subject            string                  `json:"subject"`
	Status             string                  `json:"status"`
	Created            string                  `json:"created"`
	Updated            string                  `json:"updated"`
	Starred            bool                    `json:"starred,omitempty"`
	Reviewed           bool                    `json:"reviewed,omitempty"`
	Mergeable          bool                    `json:"mergeable,omitempty"`
	Insertions         int                     `json:"insertions"`
	Deletions          int                     `json:"deletions"`
	Number             int                     `json:"_number"`
	Owner              AccountInfo             `json:"owner"`
	Actions            map[string]ActionInfo   `json:"actions,omitempty"`
	Labels             Labels                  `json:"labels,omitempty"`
	PermittedLabels    map[string][]string     `json:"permitted_labels,omitempty"`
	RemovableReviewers []AccountInfo           `json:"removable_reviewers,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"`
	BaseChange         string                  `json:"base_change,omitempty"`
}

ChangeInfo entity contains information about a change.

type ChangeMessageInfo

type ChangeMessageInfo struct {
	ID             string      `json:"id"`
	Author         AccountInfo `json:"author,omitempty"`
	Date           string      `json:"date"`
	Message        string      `json:"message"`
	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) AddReviewer

func (s *ChangesService) AddReviewer(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(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(changeID, filePath 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(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(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(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(input *ChangeInfo) (*ChangeInfo, *Response, error)

CreateChange creates a new change. The change info ChangeInfo 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(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) DeleteChangeEdit

func (s *ChangesService) DeleteChangeEdit(changeID, filePath 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-file

func (*ChangesService) DeleteDraft

func (s *ChangesService) DeleteDraft(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) DeleteDraftChange

func (s *ChangesService) DeleteDraftChange(changeID string) (*Response, error)

DeleteDraftChange deletes a draft change.

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

func (*ChangesService) DeleteDraftRevision

func (s *ChangesService) DeleteDraftRevision(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(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(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(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(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) FixChange

func (s *ChangesService) FixChange(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(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(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

func (*ChangesService) GetChangeEditDetails

func (s *ChangesService) GetChangeEditDetails(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(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(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(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(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(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(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) GetIncludedIn

func (s *ChangesService) GetIncludedIn(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(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(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(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(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(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(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(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(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(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(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(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(changeID, revisionID string) (*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(changeID, revisionID string) (*[]FileInfo, *Response, error)

ListFilesReviewed lists the files that were modified, added or deleted in a revision. The difference between ListFiles and ListFilesReviewed is that the caller has marked these files 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(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(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(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) PublishChangeEdit

func (s *ChangesService) PublishChangeEdit(changeID 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

func (*ChangesService) PublishDraftChange

func (s *ChangesService) PublishDraftChange(changeID 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(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(opt *QueryChangeOptions) (*[]ChangeInfo, *Response, error)

QueryChanges 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

func (*ChangesService) RebaseChangeEdit

func (s *ChangesService) RebaseChangeEdit(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) RetrieveCommitMessageFromChangeEdit

func (s *ChangesService) RetrieveCommitMessageFromChangeEdit(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(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(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(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) SetReview

func (s *ChangesService) SetReview(changeID, revisionID string, input *ReviewInput) (*ReviewInfo, *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(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(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) SuggestReviewers

func (s *ChangesService) SuggestReviewers(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(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(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(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 CherryPickInput

type CherryPickInput struct {
	Message     string `json:"message"`
	Destination string `json:"destination"`
}

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 Gerrit API.
	Access   *AccessService
	Accounts *AccountsService
	Changes  *ChangesService
	Config   *ConfigService
	Groups   *GroupsService
	Plugins  *PluginsService
	Projects *ProjectsService
	// contains filtered or unexported fields
}

A Client manages communication with the Gerrit API.

func NewClient

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

NewClient returns a new Gerrit API client. gerritInstance has to be the HTTP endpoint of the Gerrit instance. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Call

func (c *Client) Call(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(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) NewRequest

func (c *Client) NewRequest(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   string       `json:"updated"`
	Author    AccountInfo  `json:"author,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   string       `json:"updated,omitempty"`
	Message   string       `json:"message,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 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(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(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(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(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(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() (*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(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(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() (*[]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() (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

func (*ConfigService) ListCaches

func (s *ConfigService) ListCaches(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() (*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() (*[]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 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 []struct {
	SkipLength int
	MarkLength int
}

DiffIntralineInfo entity contains information about intraline edits in a file.

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 bool `url:"base,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 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"`
}

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

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 GCInput

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

GCInput entity contains information to run the Git garbage collection.

type GerritInfo

type GerritInfo 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"`
}

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

type GitPersonInfo

type GitPersonInfo struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Date  string `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 string      `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"`
	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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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 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 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 Labels

type Labels struct {
	Verified   LabelInfo `json:"Verified,omitempty"`
	CodeReview LabelInfo `json:"Code-Review,omitempty"`
}

Labels entity contains the labels Verified & CodeReview, 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 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 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"`
}

PatchOptions specifies the parameters for GetPatch call.

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

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 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(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(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(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(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(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(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"`
	ConfigVisible bool                         `json:"config_visible"`
}

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 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"`
	UseSignedOffBy                   string                       `json:"use_signed_off_by"`
	CreateNewChangeForAllNotInTarget string                       `json:"create_new_change_for_all_not_in_target"`
	UseContentMerge                  string                       `json:"use_content_merge"`
	RequireChangeID                  string                       `json:"require_change_id"`
	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 {
	// 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 number of projects to be included in the results.
	Limit int `url:"n,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) BanCommit

func (s *ProjectsService) BanCommit(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) CreateBranch

func (s *ProjectsService) CreateBranch(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(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) DeleteBranch

func (s *ProjectsService) DeleteBranch(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(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(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) DeleteProjectDescription

func (s *ProjectsService) DeleteProjectDescription(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) GetBranch

func (s *ProjectsService) GetBranch(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(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(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(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(projectName, branchID, fileID string) (string, *Response, error)

GetCommitContent 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) GetConfig

func (s *ProjectsService) GetConfig(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(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(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) GetProject

func (s *ProjectsService) GetProject(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(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(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(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(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(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) ListBranches

func (s *ProjectsService) ListBranches(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(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(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(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

func (*ProjectsService) ListTags

func (s *ProjectsService) ListTags(projectName string) (*[]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) SetConfig

func (s *ProjectsService) SetConfig(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(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(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(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(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 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"`
}

QueryOptions specifies global parameters to query changes / reviewers.

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

type RebaseInput

type RebaseInput struct {
	Base string `json:"base,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 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"`
	Labels       map[string]string         `json:"labels,omitempty"`
	Comments     map[string][]CommentInput `json:"comments,omitempty"`
	StrictLabels bool                      `json:"strict_labels,omitempty"`
	Drafts       string                    `json:"drafts,omitempty"`
	Notify       string                    `json:"notify,omitempty"`
	OnBehalfOf   string                    `json:"on_behalf_of,omitempty"`
}

ReviewInput entity contains information for adding a review to a revision.

type ReviewerInfo

type ReviewerInfo struct {
	AccountInfo
	Approvals 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 RevisionInfo

type RevisionInfo struct {
	Draft             bool                  `json:"draft,omitempty"`
	Number            int                   `json:"_number"`
	Created           string                `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"`
}

RevisionInfo entity contains information about a patch set.

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     GerritInfo        `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 {
	WaitForMerge bool `json:"wait_for_merge"`
}

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 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"`
}

TagInfo entity contains information about 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 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

Jump to

Keyboard shortcuts

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