libraryagent

package
v0.15.1-0...-796286a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package libraryagent provides access to the Library Agent API.

For product documentation, see: https://cloud.google.com/docs/quota

Creating a client

Usage example:

import "google.golang.org/api/libraryagent/v1"
...
ctx := context.Background()
libraryagentService, err := libraryagent.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

libraryagentService, err := libraryagent.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
libraryagentService, err := libraryagent.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (
	// View and manage your data across Google Cloud Platform services
	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleExampleLibraryagentV1Book

type GoogleExampleLibraryagentV1Book struct {
	// Author: The name of the book author.
	Author string `json:"author,omitempty"`

	// Name: The resource name of the book.
	// Book names have the form `shelves/{shelf_id}/books/{book_id}`.
	// The name is ignored when creating a book.
	Name string `json:"name,omitempty"`

	// Read: Value indicating whether the book has been read.
	Read bool `json:"read,omitempty"`

	// Title: The title of the book.
	Title string `json:"title,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Author") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Author") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

GoogleExampleLibraryagentV1Book: A single book in the library.

func (*GoogleExampleLibraryagentV1Book) MarshalJSON

func (s *GoogleExampleLibraryagentV1Book) MarshalJSON() ([]byte, error)

type GoogleExampleLibraryagentV1ListBooksResponse

type GoogleExampleLibraryagentV1ListBooksResponse struct {
	// Books: The list of books.
	Books []*GoogleExampleLibraryagentV1Book `json:"books,omitempty"`

	// NextPageToken: A token to retrieve next page of results.
	// Pass this value in the
	// ListBooksRequest.page_token
	// field in the subsequent call to `ListBooks` method to retrieve the
	// next
	// page of results.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Books") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Books") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

GoogleExampleLibraryagentV1ListBooksResponse: Response message for LibraryAgent.ListBooks.

func (*GoogleExampleLibraryagentV1ListBooksResponse) MarshalJSON

type GoogleExampleLibraryagentV1ListShelvesResponse

type GoogleExampleLibraryagentV1ListShelvesResponse struct {
	// NextPageToken: A token to retrieve next page of results.
	// Pass this value in the
	// ListShelvesRequest.page_token
	// field in the subsequent call to `ListShelves` method to retrieve the
	// next
	// page of results.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// Shelves: The list of shelves.
	Shelves []*GoogleExampleLibraryagentV1Shelf `json:"shelves,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "NextPageToken") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

GoogleExampleLibraryagentV1ListShelvesResponse: Response message for LibraryAgent.ListShelves.

func (*GoogleExampleLibraryagentV1ListShelvesResponse) MarshalJSON

type GoogleExampleLibraryagentV1Shelf

type GoogleExampleLibraryagentV1Shelf struct {
	// Name: Output only. The resource name of the shelf.
	// Shelf names have the form `shelves/{shelf_id}`.
	// The name is ignored when creating a shelf.
	Name string `json:"name,omitempty"`

	// Theme: The theme of the shelf
	Theme string `json:"theme,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Name") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Name") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

GoogleExampleLibraryagentV1Shelf: A Shelf contains a collection of books with a theme.

func (*GoogleExampleLibraryagentV1Shelf) MarshalJSON

func (s *GoogleExampleLibraryagentV1Shelf) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Shelves *ShelvesService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type ShelvesBooksBorrowCall

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

func (*ShelvesBooksBorrowCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesBooksBorrowCall) Do

Do executes the "libraryagent.shelves.books.borrow" call. Exactly one of *GoogleExampleLibraryagentV1Book or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1Book.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesBooksBorrowCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesBooksBorrowCall) Header

func (c *ShelvesBooksBorrowCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type ShelvesBooksGetCall

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

func (*ShelvesBooksGetCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesBooksGetCall) Do

Do executes the "libraryagent.shelves.books.get" call. Exactly one of *GoogleExampleLibraryagentV1Book or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1Book.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesBooksGetCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesBooksGetCall) Header

func (c *ShelvesBooksGetCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ShelvesBooksGetCall) IfNoneMatch

func (c *ShelvesBooksGetCall) IfNoneMatch(entityTag string) *ShelvesBooksGetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

type ShelvesBooksListCall

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

func (*ShelvesBooksListCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesBooksListCall) Do

Do executes the "libraryagent.shelves.books.list" call. Exactly one of *GoogleExampleLibraryagentV1ListBooksResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1ListBooksResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesBooksListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesBooksListCall) Header

func (c *ShelvesBooksListCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ShelvesBooksListCall) IfNoneMatch

func (c *ShelvesBooksListCall) IfNoneMatch(entityTag string) *ShelvesBooksListCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*ShelvesBooksListCall) PageSize

func (c *ShelvesBooksListCall) PageSize(pageSize int64) *ShelvesBooksListCall

PageSize sets the optional parameter "pageSize": Requested page size. Server may return fewer books than requested. If unspecified, server will pick an appropriate default.

func (*ShelvesBooksListCall) PageToken

func (c *ShelvesBooksListCall) PageToken(pageToken string) *ShelvesBooksListCall

PageToken sets the optional parameter "pageToken": A token identifying a page of results the server should return. Typically, this is the value of ListBooksResponse.next_page_token. returned from the previous call to `ListBooks` method.

func (*ShelvesBooksListCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type ShelvesBooksReturnCall

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

func (*ShelvesBooksReturnCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesBooksReturnCall) Do

Do executes the "libraryagent.shelves.books.return" call. Exactly one of *GoogleExampleLibraryagentV1Book or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1Book.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesBooksReturnCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesBooksReturnCall) Header

func (c *ShelvesBooksReturnCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type ShelvesBooksService

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

func NewShelvesBooksService

func NewShelvesBooksService(s *Service) *ShelvesBooksService

func (*ShelvesBooksService) Borrow

Borrow: Borrow a book from the library. Returns the book if it is borrowed successfully. Returns NOT_FOUND if the book does not exist in the library. Returns quota exceeded error if the amount of books borrowed exceeds allocation quota in any dimensions.

func (*ShelvesBooksService) Get

Get: Gets a book. Returns NOT_FOUND if the book does not exist.

func (*ShelvesBooksService) List

List: Lists books in a shelf. The order is unspecified but deterministic. Newly created books will not necessarily be added to the end of this list. Returns NOT_FOUND if the shelf does not exist.

func (*ShelvesBooksService) Return

Return: Return a book to the library. Returns the book if it is returned to the library successfully. Returns error if the book does not belong to the library or the users didn't borrow before.

type ShelvesGetCall

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

func (*ShelvesGetCall) Context

func (c *ShelvesGetCall) Context(ctx context.Context) *ShelvesGetCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesGetCall) Do

Do executes the "libraryagent.shelves.get" call. Exactly one of *GoogleExampleLibraryagentV1Shelf or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1Shelf.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesGetCall) Fields

func (c *ShelvesGetCall) Fields(s ...googleapi.Field) *ShelvesGetCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesGetCall) Header

func (c *ShelvesGetCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ShelvesGetCall) IfNoneMatch

func (c *ShelvesGetCall) IfNoneMatch(entityTag string) *ShelvesGetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

type ShelvesListCall

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

func (*ShelvesListCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ShelvesListCall) Do

Do executes the "libraryagent.shelves.list" call. Exactly one of *GoogleExampleLibraryagentV1ListShelvesResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *GoogleExampleLibraryagentV1ListShelvesResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ShelvesListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ShelvesListCall) Header

func (c *ShelvesListCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ShelvesListCall) IfNoneMatch

func (c *ShelvesListCall) IfNoneMatch(entityTag string) *ShelvesListCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*ShelvesListCall) PageSize

func (c *ShelvesListCall) PageSize(pageSize int64) *ShelvesListCall

PageSize sets the optional parameter "pageSize": Requested page size. Server may return fewer shelves than requested. If unspecified, server will pick an appropriate default.

func (*ShelvesListCall) PageToken

func (c *ShelvesListCall) PageToken(pageToken string) *ShelvesListCall

PageToken sets the optional parameter "pageToken": A token identifying a page of results the server should return. Typically, this is the value of ListShelvesResponse.next_page_token returned from the previous call to `ListShelves` method.

func (*ShelvesListCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type ShelvesService

type ShelvesService struct {
	Books *ShelvesBooksService
	// contains filtered or unexported fields
}

func NewShelvesService

func NewShelvesService(s *Service) *ShelvesService

func (*ShelvesService) Get

func (r *ShelvesService) Get(name string) *ShelvesGetCall

Get: Gets a shelf. Returns NOT_FOUND if the shelf does not exist.

func (*ShelvesService) List

func (r *ShelvesService) List() *ShelvesListCall

List: Lists shelves. The order is unspecified but deterministic. Newly created shelves will not necessarily be added to the end of this list.

Jump to

Keyboard shortcuts

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