libraryagent

package
v0.196.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package libraryagent provides access to the Library Agent API.

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

Library status

These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.

When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.

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 google.golang.org/api/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 google.golang.org/api/option.WithTokenSource:

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

See google.golang.org/api/option.ClientOption for details on options.

Index

Constants

View Source
const (
	// See, edit, configure, and delete your Google Cloud data and see the email
	// address for your Google Account.
	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 or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	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. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	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 or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	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. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	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 or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	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. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	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 or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	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. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	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.

func (*ShelvesBooksBorrowCall) Do

Do executes the "libraryagent.shelves.books.borrow" call. 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 details.

func (*ShelvesBooksBorrowCall) Header

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

Header returns a http.Header that can be modified by the caller to add 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.

func (*ShelvesBooksGetCall) Do

Do executes the "libraryagent.shelves.books.get" call. 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 details.

func (*ShelvesBooksGetCall) Header

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

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

func (*ShelvesBooksGetCall) IfNoneMatch

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

IfNoneMatch sets an 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.

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.

func (*ShelvesBooksListCall) Do

Do executes the "libraryagent.shelves.books.list" call. 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 details.

func (*ShelvesBooksListCall) Header

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

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

func (*ShelvesBooksListCall) IfNoneMatch

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

IfNoneMatch sets an 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.

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.

func (*ShelvesBooksReturnCall) Do

Do executes the "libraryagent.shelves.books.return" call. 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 details.

func (*ShelvesBooksReturnCall) Header

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

Header returns a http.Header that can be modified by the caller to add 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.

- name: The name of the book to borrow.

func (*ShelvesBooksService) Get

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

- name: The name of the book to retrieve.

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.

- parent: The name of the shelf whose books we'd like to list.

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.

- name: The name of the book to return.

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.

func (*ShelvesGetCall) Do

Do executes the "libraryagent.shelves.get" call. 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 details.

func (*ShelvesGetCall) Header

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

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

func (*ShelvesGetCall) IfNoneMatch

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

IfNoneMatch sets an 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.

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.

func (*ShelvesListCall) Do

Do executes the "libraryagent.shelves.list" call. 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 details.

func (*ShelvesListCall) Header

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

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

func (*ShelvesListCall) IfNoneMatch

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

IfNoneMatch sets an 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.

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.

- name: The name of the shelf to retrieve.

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