google_bigquery2/lib.rs
1// DO NOT EDIT !
2// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
3// DO NOT EDIT !
4
5//! This documentation was generated from *bigquery* crate version *5.0.3+20230114*, where *20230114* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.3*.
6//!
7//! Everything else about the *bigquery* *v2* API can be found at the
8//! [official documentation site](https://cloud.google.com/bigquery/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/bigquery2).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](Bigquery) ...
13//!
14//! * [datasets](api::Dataset)
15//! * [*delete*](api::DatasetDeleteCall), [*get*](api::DatasetGetCall), [*insert*](api::DatasetInsertCall), [*list*](api::DatasetListCall), [*patch*](api::DatasetPatchCall) and [*update*](api::DatasetUpdateCall)
16//! * [jobs](api::Job)
17//! * [*cancel*](api::JobCancelCall), [*delete*](api::JobDeleteCall), [*get*](api::JobGetCall), [*get query results*](api::JobGetQueryResultCall), [*insert*](api::JobInsertCall), [*list*](api::JobListCall) and [*query*](api::JobQueryCall)
18//! * [models](api::Model)
19//! * [*delete*](api::ModelDeleteCall), [*get*](api::ModelGetCall), [*list*](api::ModelListCall) and [*patch*](api::ModelPatchCall)
20//! * projects
21//! * [*get service account*](api::ProjectGetServiceAccountCall) and [*list*](api::ProjectListCall)
22//! * [routines](api::Routine)
23//! * [*delete*](api::RoutineDeleteCall), [*get*](api::RoutineGetCall), [*insert*](api::RoutineInsertCall), [*list*](api::RoutineListCall) and [*update*](api::RoutineUpdateCall)
24//! * [row access policies](api::RowAccessPolicy)
25//! * [*get iam policy*](api::RowAccessPolicyGetIamPolicyCall), [*list*](api::RowAccessPolicyListCall), [*set iam policy*](api::RowAccessPolicySetIamPolicyCall) and [*test iam permissions*](api::RowAccessPolicyTestIamPermissionCall)
26//! * tabledata
27//! * [*insert all*](api::TabledataInsertAllCall) and [*list*](api::TabledataListCall)
28//! * [tables](api::Table)
29//! * [*delete*](api::TableDeleteCall), [*get*](api::TableGetCall), [*get iam policy*](api::TableGetIamPolicyCall), [*insert*](api::TableInsertCall), [*list*](api::TableListCall), [*patch*](api::TablePatchCall), [*set iam policy*](api::TableSetIamPolicyCall), [*test iam permissions*](api::TableTestIamPermissionCall) and [*update*](api::TableUpdateCall)
30//!
31//!
32//! Upload supported by ...
33//!
34//! * [*insert jobs*](api::JobInsertCall)
35//!
36//!
37//!
38//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
39//!
40//! # Structure of this Library
41//!
42//! The API is structured into the following primary items:
43//!
44//! * **[Hub](Bigquery)**
45//! * a central object to maintain state and allow accessing all *Activities*
46//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
47//! allow access to individual [*Call Builders*](client::CallBuilder)
48//! * **[Resources](client::Resource)**
49//! * primary types that you can apply *Activities* to
50//! * a collection of properties and *Parts*
51//! * **[Parts](client::Part)**
52//! * a collection of properties
53//! * never directly used in *Activities*
54//! * **[Activities](client::CallBuilder)**
55//! * operations to apply to *Resources*
56//!
57//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
58//!
59//! Generally speaking, you can invoke *Activities* like this:
60//!
61//! ```Rust,ignore
62//! let r = hub.resource().activity(...).doit().await
63//! ```
64//!
65//! Or specifically ...
66//!
67//! ```ignore
68//! let r = hub.tables().delete(...).doit().await
69//! let r = hub.tables().get(...).doit().await
70//! let r = hub.tables().get_iam_policy(...).doit().await
71//! let r = hub.tables().insert(...).doit().await
72//! let r = hub.tables().list(...).doit().await
73//! let r = hub.tables().patch(...).doit().await
74//! let r = hub.tables().set_iam_policy(...).doit().await
75//! let r = hub.tables().test_iam_permissions(...).doit().await
76//! let r = hub.tables().update(...).doit().await
77//! ```
78//!
79//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
80//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
81//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
82//! The `doit()` method performs the actual communication with the server and returns the respective result.
83//!
84//! # Usage
85//!
86//! ## Setting up your Project
87//!
88//! To use this library, you would put the following lines into your `Cargo.toml` file:
89//!
90//! ```toml
91//! [dependencies]
92//! google-bigquery2 = "*"
93//! serde = "^1.0"
94//! serde_json = "^1.0"
95//! ```
96//!
97//! ## A complete example
98//!
99//! ```test_harness,no_run
100//! extern crate hyper;
101//! extern crate hyper_rustls;
102//! extern crate google_bigquery2 as bigquery2;
103//! use bigquery2::{Result, Error};
104//! # async fn dox() {
105//! use std::default::Default;
106//! use bigquery2::{Bigquery, oauth2, hyper, hyper_rustls, chrono, FieldMask};
107//!
108//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
109//! // `client_secret`, among other things.
110//! let secret: oauth2::ApplicationSecret = Default::default();
111//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
112//! // unless you replace `None` with the desired Flow.
113//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
114//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
115//! // retrieve them from storage.
116//! let auth = oauth2::InstalledFlowAuthenticator::builder(
117//! secret,
118//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
119//! ).build().await.unwrap();
120//! let mut hub = Bigquery::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
121//! // You can configure optional parameters by calling the respective setters at will, and
122//! // execute the final call using `doit()`.
123//! // Values shown here are possibly random and not representative !
124//! let result = hub.tables().get("projectId", "datasetId", "tableId")
125//! .view("amet.")
126//! .selected_fields("takimata")
127//! .doit().await;
128//!
129//! match result {
130//! Err(e) => match e {
131//! // The Error enum provides details about what exactly happened.
132//! // You can also just use its `Debug`, `Display` or `Error` traits
133//! Error::HttpError(_)
134//! |Error::Io(_)
135//! |Error::MissingAPIKey
136//! |Error::MissingToken(_)
137//! |Error::Cancelled
138//! |Error::UploadSizeLimitExceeded(_, _)
139//! |Error::Failure(_)
140//! |Error::BadRequest(_)
141//! |Error::FieldClash(_)
142//! |Error::JsonDecodeError(_, _) => println!("{}", e),
143//! },
144//! Ok(res) => println!("Success: {:?}", res),
145//! }
146//! # }
147//! ```
148//! ## Handling Errors
149//!
150//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
151//! the doit() methods, or handed as possibly intermediate results to either the
152//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
153//!
154//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
155//! makes the system potentially resilient to all kinds of errors.
156//!
157//! ## Uploads and Downloads
158//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
159//! read by you to obtain the media.
160//! If such a method also supports a [Response Result](client::ResponseResult), it will return that by default.
161//! 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
162//! this call: `.param("alt", "media")`.
163//!
164//! Methods supporting uploads can do so using up to 2 different protocols:
165//! *simple* and *resumable*. The distinctiveness of each is represented by customized
166//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
167//!
168//! ## Customization and Callbacks
169//!
170//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
171//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
172//! Respective methods will be called to provide progress information, as well as determine whether the system should
173//! retry on failure.
174//!
175//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
176//!
177//! ## Optional Parts in Server-Requests
178//!
179//! All structures provided by this library are made to be [encodable](client::RequestValue) and
180//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
181//! are valid.
182//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
183//! the server to indicate either the set parts of the request or the desired parts in the response.
184//!
185//! ## Builder Arguments
186//!
187//! Using [method builders](client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
188//! These will always take a single argument, for which the following statements are true.
189//!
190//! * [PODs][wiki-pod] are handed by copy
191//! * strings are passed as `&str`
192//! * [request values](client::RequestValue) are moved
193//!
194//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
195//!
196//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
197//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
198//! [google-go-api]: https://github.com/google/google-api-go-client
199//!
200//!
201
202// Unused attributes happen thanks to defined, but unused structures
203// We don't warn about this, as depending on the API, some data structures or facilities are never used.
204// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
205// unused imports in fully featured APIs. Same with unused_mut ... .
206#![allow(unused_imports, unused_mut, dead_code)]
207
208// DO NOT EDIT !
209// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
210// DO NOT EDIT !
211
212// Re-export the hyper and hyper_rustls crate, they are required to build the hub
213pub use hyper;
214pub use hyper_rustls;
215pub extern crate google_apis_common as client;
216pub use client::chrono;
217pub mod api;
218
219// Re-export the hub type and some basic client structs
220pub use api::Bigquery;
221pub use client::{Result, Error, Delegate, FieldMask};
222
223// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
224#[cfg(feature = "yup-oauth2")]
225pub use client::oauth2;