Skip to content

Commit

Permalink
Improve documentation consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitshur committed May 6, 2018
1 parent 70bbb05 commit 027139b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ type ChangeOptions struct {
AdditionalFields []string `url:"o,omitempty"`
}

// QueryChanges visible to the caller.
// QueryChanges lists changes visible to the caller.
// The query string must be provided by the q parameter.
// The n parameter can be used to limit the returned results.
//
Expand Down
18 changes: 8 additions & 10 deletions gerrit.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ import (

// A Client manages communication with the Gerrit API.
type Client struct {
// HTTP client used to communicate with the API.
// client is the HTTP client used to communicate with the API.
client *http.Client

// Base URL for API requests.
// BaseURL should always be specified with a trailing slash.
baseURL *url.URL

// Gerrit service for authentication
// Gerrit service for authentication.
Authentication *AuthenticationService

// Services used for talking to different parts of the standard
// Gerrit API.
// Services used for talking to different parts of the standard Gerrit API.
Access *AccessService
Accounts *AccountsService
Changes *ChangesService
Expand All @@ -42,8 +41,7 @@ type Client struct {
Plugins *PluginsService
Projects *ProjectsService

// Additional services used for talking to non-standard Gerrit
// APIs.
// Additional services used for talking to non-standard Gerrit APIs.
EventsLog *EventsLogService
}

Expand All @@ -58,11 +56,11 @@ var (
// gerritURL argument was blank.
ErrNoInstanceGiven = errors.New("no Gerrit instance given")

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

// ErrAuthenticationFailed is returned by NewClientFromURL in the event the provided
// ErrAuthenticationFailed is returned by NewClient in the event the provided
// credentials didn't allow us to query account information using digest, basic or cookie
// auth.
ErrAuthenticationFailed = errors.New("failed to authenticate using the provided credentials")
Expand All @@ -82,7 +80,7 @@ var (
// example. These credentials may either be a user name and password or
// name and value as in the case of cookie based authentication. If the url contains
// credentials then this function will attempt to validate the credentials before
// returning the client. `ErrAuthenticationFailed` will be returned if the credentials
// returning the client. ErrAuthenticationFailed will be returned if the credentials
// cannot be validated. The process of validating the credentials is relatively simple and
// only requires that the provided user have permission to GET /a/accounts/self.
func NewClient(endpoint string, httpClient *http.Client) (*Client, error) {
Expand Down Expand Up @@ -185,7 +183,7 @@ func NewClient(endpoint string, httpClient *http.Client) (*Client, error) {
return c, nil
}

// checkAuth is used by NewClientFromURL to check if the current credentials are
// checkAuth is used by NewClient to check if the current credentials are
// valid. If the response is 401 Unauthorized then the error will be discarded.
func checkAuth(client *Client) (bool, error) {
_, response, err := client.Accounts.GetAccount("self")
Expand Down

0 comments on commit 027139b

Please sign in to comment.