Crate google_books1[][src]

This documentation was generated from books crate version 1.0.8+20180824, where 20180824 is the exact revision of the books:v1 schema built by the mako code generator v1.0.8.

Everything else about the books v1 API can be found at the official documentation site. The original source code is on github.

Features

Handle the following Resources with ease from the central hub ...

Not what you are looking for ? Find all other Google APIs in their Rust documentation index.

Structure of this Library

The API is structured into the following primary items:

  • Hub
    • a central object to maintain state and allow accessing all Activities
    • creates Method Builders which in turn allow access to individual Call Builders
  • Resources
    • primary types that you can apply Activities to
    • a collection of properties and Parts
    • Parts
      • a collection of properties
      • never directly used in Activities
  • Activities
    • operations to apply to Resources

All structures are marked with applicable traits to further categorize them and ease browsing.

Generally speaking, you can invoke Activities like this:

let r = hub.resource().activity(...).doit()

Or specifically ...

This example is not tested
let r = hub.volumes().useruploaded_list(...).doit()
let r = hub.myconfig().sync_volume_licenses(...).doit()
let r = hub.volumes().list(...).doit()
let r = hub.volumes().associated_list(...).doit()
let r = hub.bookshelves().volumes_list(...).doit()
let r = hub.volumes().recommended_list(...).doit()
let r = hub.mylibrary().bookshelves_volumes_list(...).doit()
let r = hub.volumes().mybooks_list(...).doit()

The resource() and activity(...) calls create builders. The second one dealing with Activities supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be specified right away (i.e. (...)), whereas all optional ones can be build up as desired. The doit() method performs the actual communication with the server and returns the respective result.

Usage

Setting up your Project

To use this library, you would put the following lines into your Cargo.toml file:

[dependencies]
google-books1 = "*"
# This project intentionally uses an old version of Hyper. See
# https://github.com/Byron/google-apis-rs/issues/173 for more
# information.
hyper = "^0.10"
hyper-rustls = "^0.6"
serde = "^1.0"
serde_json = "^1.0"
yup-oauth2 = "^1.0"

A complete example

extern crate hyper;
extern crate hyper_rustls;
extern crate yup_oauth2 as oauth2;
extern crate google_books1 as books1;
use books1::{Result, Error};
use std::default::Default;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
use books1::Books;
 
// Get an ApplicationSecret instance by some means. It contains the `client_id` and 
// `client_secret`, among other things.
let secret: ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you, 
// unless you replace  `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
                              hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
                              <MemoryStorage as Default>::default(), None);
let mut hub = Books::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.volumes().list("q")
             .start_index(82)
             .source("gubergren")
             .show_preorders(false)
             .projection("aliquyam")
             .print_type("ea")
             .partner("no")
             .order_by("justo")
             .max_results(80)
             .max_allowed_maturity_rating("et")
             .library_restrict("et")
             .lang_restrict("diam")
             .filter("ipsum")
             .download("Lorem")
             .doit();
 
match result {
    Err(e) => match e {
        // The Error enum provides details about what exactly happened.
        // You can also just use its `Debug`, `Display` or `Error` traits
         Error::HttpError(_)
        |Error::MissingAPIKey
        |Error::MissingToken(_)
        |Error::Cancelled
        |Error::UploadSizeLimitExceeded(_, _)
        |Error::Failure(_)
        |Error::BadRequest(_)
        |Error::FieldClash(_)
        |Error::JsonDecodeError(_, _) => println!("{}", e),
    },
    Ok(res) => println!("Success: {:?}", res),
}

Handling Errors

All errors produced by the system are provided either as Result enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the Hub Delegate, or the Authenticator Delegate.

When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors.

Uploads and Downloads

If a method supports downloads, the response body, which is part of the Result, should be read by you to obtain the media. If such a method also supports a Response Result, it will return that by default. You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making this call: .param("alt", "media").

Methods supporting uploads can do so using up to 2 different protocols: simple and resumable. The distinctiveness of each is represented by customized doit(...) methods, which are then named upload(...) and upload_resumable(...) respectively.

Customization and Callbacks

You may alter the way an doit() method is called by providing a delegate to the Method Builder before making the final doit() call. Respective methods will be called to provide progress information, as well as determine whether the system should retry on failure.

The delegate trait is default-implemented, allowing you to customize it with minimal effort.

Optional Parts in Server-Requests

All structures provided by this library are made to be enocodable and decodable via json. Optionals are used to indicate that partial requests are responses are valid. Most optionals are are considered Parts which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response.

Builder Arguments

Using method builders, you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true.

Arguments will always be copied or cloned into the builder, to make them independent of their original life times.

Structs

Annotation

There is no detailed description.

AnnotationClientVersionRanges

Selection ranges sent from the client.

AnnotationCurrentVersionRanges

Selection ranges for the most recent content version.

AnnotationLayerSummary

There is no detailed description.

Annotationdata

There is no detailed description.

Annotations

There is no detailed description.

AnnotationsSummary

There is no detailed description.

AnnotationsSummaryLayers

There is no detailed description.

Annotationsdata

There is no detailed description.

Books

Central instance to access all Books related resource activities

BooksAnnotationsRange

There is no detailed description.

BooksCloudloadingResource

There is no detailed description.

BooksVolumesRecommendedRateResponse

There is no detailed description.

Bookshelf

There is no detailed description.

BookshelveGetCall

Retrieves metadata for a specific bookshelf for the specified user.

BookshelveListCall

Retrieves a list of public bookshelves for the specified user.

BookshelveMethods

A builder providing access to all methods supported on bookshelve resources. It is not used directly, but through the Books hub.

BookshelveVolumeListCall

Retrieves volumes in a specific bookshelf for the specified user.

Bookshelves

There is no detailed description.

Category

There is no detailed description.

CategoryItems

A list of onboarding categories.

CloudloadingAddBookCall

A builder for the addBook method supported by a cloudloading resource. It is not used directly, but through a CloudloadingMethods instance.

CloudloadingDeleteBookCall

Remove the book and its contents

CloudloadingMethods

A builder providing access to all methods supported on cloudloading resources. It is not used directly, but through the Books hub.

CloudloadingUpdateBookCall

A builder for the updateBook method supported by a cloudloading resource. It is not used directly, but through a CloudloadingMethods instance.

ConcurrentAccessRestriction

There is no detailed description.

DefaultDelegate

A delegate with a conservative default implementation, which is used if no other delegate is set.

DictionaryListOfflineMetadataCall

Returns a list of offline dictionary metadata available

DictionaryMethods

A builder providing access to all methods supported on dictionary resources. It is not used directly, but through the Books hub.

Discoveryclusters

There is no detailed description.

DiscoveryclustersClusters

There is no detailed description.

DiscoveryclustersClustersBannerWithContentContainer

There is no detailed description.

DownloadAccessRestriction

There is no detailed description.

DownloadAccesses

There is no detailed description.

ErrorResponse

A utility to represent detailed errors we might see in case there are BadRequests. The latter happen if the sent parameters or request structures are unsound

FamilyInfo

There is no detailed description.

FamilyInfoMembership

Family membership info of the user that made the request.

FamilysharingGetFamilyInfoCall

Gets information regarding the family that the user is part of.

FamilysharingMethods

A builder providing access to all methods supported on familysharing resources. It is not used directly, but through the Books hub.

FamilysharingShareCall

Initiates sharing of the content with the user's family. Empty response indicates success.

FamilysharingUnshareCall

Initiates revoking content that has already been shared with the user's family. Empty response indicates success.

LayerAnnotationDataGetCall

Gets the annotation data.

LayerAnnotationDataListCall

Gets the annotation data for a volume and layer.

LayerGetCall

Gets the layer summary for a volume.

LayerListCall

List the layer summaries for a volume.

LayerMethods

A builder providing access to all methods supported on layer resources. It is not used directly, but through the Books hub.

LayerVolumeAnnotationGetCall

Gets the volume annotation.

LayerVolumeAnnotationListCall

Gets the volume annotations for a volume and layer.

Layersummaries

There is no detailed description.

Layersummary

There is no detailed description.

Metadata

There is no detailed description.

MetadataItems

A list of offline dictionary metadata.

MethodInfo

Contains information about an API request.

MultiPartReader

Provides a Read interface that converts multiple parts into the protocol identified by RFC2387. Note: This implementation is just as rich as it needs to be to perform uploads to google APIs, and might not be a fully-featured implementation.

MyconfigGetUserSettingCall

Gets the current settings for the user.

MyconfigMethods

A builder providing access to all methods supported on myconfig resources. It is not used directly, but through the Books hub.

MyconfigReleaseDownloadAccesCall

Release downloaded content access restriction.

MyconfigRequestAccesCall

Request concurrent and download access restrictions.

MyconfigSyncVolumeLicenseCall

Request downloaded content access for specified volumes on the My eBooks shelf.

MyconfigUpdateUserSettingCall

Sets the settings for the user. If a sub-object is specified, it will overwrite the existing sub-object stored in the server. Unspecified sub-objects will retain the existing value.

MylibraryAnnotationDeleteCall

Deletes an annotation.

MylibraryAnnotationInsertCall

Inserts a new annotation.

MylibraryAnnotationListCall

Retrieves a list of annotations, possibly filtered.

MylibraryAnnotationSummaryCall

Gets the summary of specified layers.

MylibraryAnnotationUpdateCall

Updates an existing annotation.

MylibraryBookshelveAddVolumeCall

Adds a volume to a bookshelf.

MylibraryBookshelveClearVolumeCall

Clears all volumes from a bookshelf.

MylibraryBookshelveGetCall

Retrieves metadata for a specific bookshelf belonging to the authenticated user.

MylibraryBookshelveListCall

Retrieves a list of bookshelves belonging to the authenticated user.

MylibraryBookshelveMoveVolumeCall

Moves a volume within a bookshelf.

MylibraryBookshelveRemoveVolumeCall

Removes a volume from a bookshelf.

MylibraryBookshelveVolumeListCall

Gets volume information for volumes on a bookshelf.

MylibraryMethods

A builder providing access to all methods supported on mylibrary resources. It is not used directly, but through the Books hub.

MylibraryReadingpositionGetCall

Retrieves my reading position information for a volume.

MylibraryReadingpositionSetPositionCall

Sets my reading position information for a volume.

Notification

There is no detailed description.

NotificationGetCall

Returns notification details for a given notification id.

NotificationMethods

A builder providing access to all methods supported on notification resources. It is not used directly, but through the Books hub.

Offers

There is no detailed description.

OffersItems

A list of offers.

OffersItemsItems

There is no detailed description.

OnboardingListCategoryCall

List categories for onboarding experience.

OnboardingListCategoryVolumeCall

List available volumes under categories for onboarding experience.

OnboardingMethods

A builder providing access to all methods supported on onboarding resources. It is not used directly, but through the Books hub.

PersonalizedstreamGetCall

Returns a stream of personalized book clusters

PersonalizedstreamMethods

A builder providing access to all methods supported on personalizedstream resources. It is not used directly, but through the Books hub.

PromoofferAcceptCall

A builder for the accept method supported by a promooffer resource. It is not used directly, but through a PromoofferMethods instance.

PromoofferDismisCall

A builder for the dismiss method supported by a promooffer resource. It is not used directly, but through a PromoofferMethods instance.

PromoofferGetCall

Returns a list of promo offers available to the user

PromoofferMethods

A builder providing access to all methods supported on promooffer resources. It is not used directly, but through the Books hub.

ReadingPosition

There is no detailed description.

RequestAccess

There is no detailed description.

Review

There is no detailed description.

ReviewAuthor

Author of this review.

ReviewSource

Information regarding the source of this review, when the review is not from a Google Books user.

Series

There is no detailed description.

SeriesSeries

There is no detailed description.

Seriesmembership

There is no detailed description.

SeryGetCall

Returns Series metadata for the given series ids.

SeryMembershipGetCall

Returns Series membership data given the series id.

SeryMethods

A builder providing access to all methods supported on sery resources. It is not used directly, but through the Books hub.

Usersettings

There is no detailed description.

UsersettingsNotesExport

User settings in sub-objects, each for different purposes.

UsersettingsNotification

There is no detailed description.

UsersettingsNotificationMatchMyInterests

There is no detailed description.

UsersettingsNotificationMoreFromAuthors

There is no detailed description.

UsersettingsNotificationMoreFromSeries

There is no detailed description.

UsersettingsNotificationPriceDrop

There is no detailed description.

UsersettingsNotificationRewardExpirations

There is no detailed description.

Volume

There is no detailed description.

Volume2

There is no detailed description.

VolumeAccessInfo

Any information about a volume related to reading or obtaining that volume text. This information can depend on country (books may be public domain in one country but not in another, e.g.).

VolumeAccessInfoEpub

Information about epub content. (In LITE projection.)

VolumeAccessInfoPdf

Information about pdf content. (In LITE projection.)

VolumeAssociatedListCall

Return a list of associated books.

VolumeGetCall

Gets volume information for a single volume.

VolumeLayerInfo

What layers exist in this volume and high level information about them.

VolumeLayerInfoLayers

A layer should appear here if and only if the layer exists for this book.

VolumeListCall

Performs a book search.

VolumeMethods

A builder providing access to all methods supported on volume resources. It is not used directly, but through the Books hub.

VolumeMybookListCall

Return a list of books in My Library.

VolumeRecommendedInfo

Recommendation related information for this volume.

VolumeRecommendedListCall

Return a list of recommended books for the current user.

VolumeRecommendedRateCall

Rate a recommended book for the current user.

VolumeSaleInfo

Any information about a volume related to the eBookstore and/or purchaseability. This information can depend on the country where the request originates from (i.e. books may not be for sale in certain countries).

VolumeSaleInfoListPrice

Suggested retail price. (In LITE projection.)

VolumeSaleInfoOffers

Offers available for this volume (sales and rentals).

VolumeSaleInfoOffersListPrice

Offer list (=undiscounted) price in Micros.

VolumeSaleInfoOffersRentalDuration

The rental duration (for rental offers only).

VolumeSaleInfoOffersRetailPrice

Offer retail (=discounted) price in Micros

VolumeSaleInfoRetailPrice

The actual selling price of the book. This is the same as the suggested retail or list price unless there are offers or discounts on this volume. (In LITE projection.)

VolumeSearchInfo

Search result information related to this volume.

VolumeUserInfo

User specific information related to this volume. (e.g. page this user last read or whether they purchased this book)

VolumeUserInfoCopy

Copy/Paste accounting information.

VolumeUserInfoFamilySharing

Information on the ability to share with the family.

VolumeUserInfoRentalPeriod

Period during this book is/was a valid rental.

VolumeUserInfoUserUploadedVolumeInfo

There is no detailed description.

VolumeUseruploadedListCall

Return a list of books uploaded by the current user.

VolumeVolumeInfo

General volume information.

VolumeVolumeInfoDimensions

Physical dimensions of this volume.

VolumeVolumeInfoImageLinks

A list of image links for all the sizes that are available. (In LITE projection.)

VolumeVolumeInfoIndustryIdentifiers

Industry standard identifiers for this volume.

VolumeVolumeInfoPanelizationSummary

A top-level summary of the panelization info in this volume.

Volumeannotation

There is no detailed description.

VolumeannotationContentRanges

The content ranges to identify the selected text.

Volumeannotations

There is no detailed description.

Volumes

There is no detailed description.

Volumeseriesinfo

There is no detailed description.

VolumeseriesinfoVolumeSeries

There is no detailed description.

VolumeseriesinfoVolumeSeriesIssue

List of issues. Applicable only for Collection Edition and Omnibus.

Enums

Error
Scope

Identifies the an OAuth2 authorization scope. A scope is needed when requesting an authorization token.

Traits

CallBuilder

Identifies types which represent builders for a particular resource method

Delegate

A trait specifying functionality to help controlling any request performed by the API. The trait has a conservative default implementation.

Hub

Identifies the Hub. There is only one per library, this trait is supposed to make intended use more explicit. The hub allows to access all resource methods more easily.

MethodsBuilder

Identifies types for building methods of a particular resource type

NestedType

Identifies types which are only used by other types internally. They have no special meaning, this trait just marks them for completeness.

Part

Identifies types which are only used as part of other types, which usually are carrying the Resource trait.

ReadSeek

A utility to specify reader types which provide seeking capabilities too

RequestValue

Identifies types which are used in API requests.

Resource

Identifies types which can be inserted and deleted. Types with this trait are most commonly used by clients of this API.

ResponseResult

Identifies types which are used in API responses.

ToParts

A trait for all types that can convert themselves into a parts string

Functions

remove_json_null_values

Type Definitions

Result

A universal result type used as return for all calls.