google_retail2/
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 *Cloud Retail* crate version *7.0.0+20251218*, where *20251218* is the exact revision of the *retail:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v7.0.0*.
6//!
7//! Everything else about the *Cloud Retail* *v2* API can be found at the
8//! [official documentation site](https://cloud.google.com/recommendations).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/retail2).
10//! # Features
11//!
12//! Handle the following *Resources* with ease from the central [hub](CloudRetail) ...
13//!
14//! * projects
15//!  * [*locations catalogs attributes config add catalog attribute*](api::ProjectLocationCatalogAttributesConfigAddCatalogAttributeCall), [*locations catalogs attributes config remove catalog attribute*](api::ProjectLocationCatalogAttributesConfigRemoveCatalogAttributeCall), [*locations catalogs attributes config replace catalog attribute*](api::ProjectLocationCatalogAttributesConfigReplaceCatalogAttributeCall), [*locations catalogs branches operations get*](api::ProjectLocationCatalogBranchOperationGetCall), [*locations catalogs branches products add fulfillment places*](api::ProjectLocationCatalogBranchProductAddFulfillmentPlaceCall), [*locations catalogs branches products add local inventories*](api::ProjectLocationCatalogBranchProductAddLocalInventoryCall), [*locations catalogs branches products create*](api::ProjectLocationCatalogBranchProductCreateCall), [*locations catalogs branches products delete*](api::ProjectLocationCatalogBranchProductDeleteCall), [*locations catalogs branches products get*](api::ProjectLocationCatalogBranchProductGetCall), [*locations catalogs branches products import*](api::ProjectLocationCatalogBranchProductImportCall), [*locations catalogs branches products list*](api::ProjectLocationCatalogBranchProductListCall), [*locations catalogs branches products patch*](api::ProjectLocationCatalogBranchProductPatchCall), [*locations catalogs branches products purge*](api::ProjectLocationCatalogBranchProductPurgeCall), [*locations catalogs branches products remove fulfillment places*](api::ProjectLocationCatalogBranchProductRemoveFulfillmentPlaceCall), [*locations catalogs branches products remove local inventories*](api::ProjectLocationCatalogBranchProductRemoveLocalInventoryCall), [*locations catalogs branches products set inventory*](api::ProjectLocationCatalogBranchProductSetInventoryCall), [*locations catalogs complete query*](api::ProjectLocationCatalogCompleteQueryCall), [*locations catalogs completion data import*](api::ProjectLocationCatalogCompletionDataImportCall), [*locations catalogs controls create*](api::ProjectLocationCatalogControlCreateCall), [*locations catalogs controls delete*](api::ProjectLocationCatalogControlDeleteCall), [*locations catalogs controls get*](api::ProjectLocationCatalogControlGetCall), [*locations catalogs controls list*](api::ProjectLocationCatalogControlListCall), [*locations catalogs controls patch*](api::ProjectLocationCatalogControlPatchCall), [*locations catalogs export analytics metrics*](api::ProjectLocationCatalogExportAnalyticsMetricCall), [*locations catalogs generative question batch update*](api::ProjectLocationCatalogGenerativeQuestionBatchUpdateCall), [*locations catalogs generative questions list*](api::ProjectLocationCatalogGenerativeQuestionListCall), [*locations catalogs get attributes config*](api::ProjectLocationCatalogGetAttributesConfigCall), [*locations catalogs get completion config*](api::ProjectLocationCatalogGetCompletionConfigCall), [*locations catalogs get conversational search customization config*](api::ProjectLocationCatalogGetConversationalSearchCustomizationConfigCall), [*locations catalogs get default branch*](api::ProjectLocationCatalogGetDefaultBranchCall), [*locations catalogs get generative question feature*](api::ProjectLocationCatalogGetGenerativeQuestionFeatureCall), [*locations catalogs list*](api::ProjectLocationCatalogListCall), [*locations catalogs models create*](api::ProjectLocationCatalogModelCreateCall), [*locations catalogs models delete*](api::ProjectLocationCatalogModelDeleteCall), [*locations catalogs models get*](api::ProjectLocationCatalogModelGetCall), [*locations catalogs models list*](api::ProjectLocationCatalogModelListCall), [*locations catalogs models patch*](api::ProjectLocationCatalogModelPatchCall), [*locations catalogs models pause*](api::ProjectLocationCatalogModelPauseCall), [*locations catalogs models resume*](api::ProjectLocationCatalogModelResumeCall), [*locations catalogs models tune*](api::ProjectLocationCatalogModelTuneCall), [*locations catalogs operations get*](api::ProjectLocationCatalogOperationGetCall), [*locations catalogs operations list*](api::ProjectLocationCatalogOperationListCall), [*locations catalogs patch*](api::ProjectLocationCatalogPatchCall), [*locations catalogs placements conversational search*](api::ProjectLocationCatalogPlacementConversationalSearchCall), [*locations catalogs placements predict*](api::ProjectLocationCatalogPlacementPredictCall), [*locations catalogs placements search*](api::ProjectLocationCatalogPlacementSearchCall), [*locations catalogs serving configs add control*](api::ProjectLocationCatalogServingConfigAddControlCall), [*locations catalogs serving configs conversational search*](api::ProjectLocationCatalogServingConfigConversationalSearchCall), [*locations catalogs serving configs create*](api::ProjectLocationCatalogServingConfigCreateCall), [*locations catalogs serving configs delete*](api::ProjectLocationCatalogServingConfigDeleteCall), [*locations catalogs serving configs get*](api::ProjectLocationCatalogServingConfigGetCall), [*locations catalogs serving configs list*](api::ProjectLocationCatalogServingConfigListCall), [*locations catalogs serving configs patch*](api::ProjectLocationCatalogServingConfigPatchCall), [*locations catalogs serving configs predict*](api::ProjectLocationCatalogServingConfigPredictCall), [*locations catalogs serving configs remove control*](api::ProjectLocationCatalogServingConfigRemoveControlCall), [*locations catalogs serving configs search*](api::ProjectLocationCatalogServingConfigSearchCall), [*locations catalogs set default branch*](api::ProjectLocationCatalogSetDefaultBranchCall), [*locations catalogs update attributes config*](api::ProjectLocationCatalogUpdateAttributesConfigCall), [*locations catalogs update completion config*](api::ProjectLocationCatalogUpdateCompletionConfigCall), [*locations catalogs update conversational search customization config*](api::ProjectLocationCatalogUpdateConversationalSearchCustomizationConfigCall), [*locations catalogs update generative question*](api::ProjectLocationCatalogUpdateGenerativeQuestionCall), [*locations catalogs update generative question feature*](api::ProjectLocationCatalogUpdateGenerativeQuestionFeatureCall), [*locations catalogs user events collect*](api::ProjectLocationCatalogUserEventCollectCall), [*locations catalogs user events import*](api::ProjectLocationCatalogUserEventImportCall), [*locations catalogs user events purge*](api::ProjectLocationCatalogUserEventPurgeCall), [*locations catalogs user events rejoin*](api::ProjectLocationCatalogUserEventRejoinCall), [*locations catalogs user events write*](api::ProjectLocationCatalogUserEventWriteCall), [*locations operations get*](api::ProjectLocationOperationGetCall), [*locations operations list*](api::ProjectLocationOperationListCall), [*operations get*](api::ProjectOperationGetCall) and [*operations list*](api::ProjectOperationListCall)
16//!
17//!
18//!
19//!
20//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
21//!
22//! # Structure of this Library
23//!
24//! The API is structured into the following primary items:
25//!
26//! * **[Hub](CloudRetail)**
27//!     * a central object to maintain state and allow accessing all *Activities*
28//!     * creates [*Method Builders*](common::MethodsBuilder) which in turn
29//!       allow access to individual [*Call Builders*](common::CallBuilder)
30//! * **[Resources](common::Resource)**
31//!     * primary types that you can apply *Activities* to
32//!     * a collection of properties and *Parts*
33//!     * **[Parts](common::Part)**
34//!         * a collection of properties
35//!         * never directly used in *Activities*
36//! * **[Activities](common::CallBuilder)**
37//!     * operations to apply to *Resources*
38//!
39//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
40//!
41//! Generally speaking, you can invoke *Activities* like this:
42//!
43//! ```Rust,ignore
44//! let r = hub.resource().activity(...).doit().await
45//! ```
46//!
47//! Or specifically ...
48//!
49//! ```ignore
50//! let r = hub.projects().locations_catalogs_branches_operations_get(...).doit().await
51//! let r = hub.projects().locations_catalogs_branches_products_add_fulfillment_places(...).doit().await
52//! let r = hub.projects().locations_catalogs_branches_products_add_local_inventories(...).doit().await
53//! let r = hub.projects().locations_catalogs_branches_products_import(...).doit().await
54//! let r = hub.projects().locations_catalogs_branches_products_purge(...).doit().await
55//! let r = hub.projects().locations_catalogs_branches_products_remove_fulfillment_places(...).doit().await
56//! let r = hub.projects().locations_catalogs_branches_products_remove_local_inventories(...).doit().await
57//! let r = hub.projects().locations_catalogs_branches_products_set_inventory(...).doit().await
58//! let r = hub.projects().locations_catalogs_completion_data_import(...).doit().await
59//! let r = hub.projects().locations_catalogs_models_create(...).doit().await
60//! let r = hub.projects().locations_catalogs_models_tune(...).doit().await
61//! let r = hub.projects().locations_catalogs_operations_get(...).doit().await
62//! let r = hub.projects().locations_catalogs_user_events_import(...).doit().await
63//! let r = hub.projects().locations_catalogs_user_events_purge(...).doit().await
64//! let r = hub.projects().locations_catalogs_user_events_rejoin(...).doit().await
65//! let r = hub.projects().locations_catalogs_export_analytics_metrics(...).doit().await
66//! let r = hub.projects().locations_operations_get(...).doit().await
67//! let r = hub.projects().operations_get(...).doit().await
68//! ```
69//!
70//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
71//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
72//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
73//! The `doit()` method performs the actual communication with the server and returns the respective result.
74//!
75//! # Usage
76//!
77//! ## Setting up your Project
78//!
79//! To use this library, you would put the following lines into your `Cargo.toml` file:
80//!
81//! ```toml
82//! [dependencies]
83//! google-retail2 = "*"
84//! serde = "1"
85//! serde_json = "1"
86//! ```
87//!
88//! ## A complete example
89//!
90//! ```test_harness,no_run
91//! extern crate hyper;
92//! extern crate hyper_rustls;
93//! extern crate google_retail2 as retail2;
94//! use retail2::api::GoogleCloudRetailV2Model;
95//! use retail2::{Result, Error};
96//! # async fn dox() {
97//! use retail2::{CloudRetail, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
98//!
99//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
100//! // `client_secret`, among other things.
101//! let secret: yup_oauth2::ApplicationSecret = Default::default();
102//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
103//! // unless you replace  `None` with the desired Flow.
104//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
105//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
106//! // retrieve them from storage.
107//! let connector = hyper_rustls::HttpsConnectorBuilder::new()
108//!     .with_native_roots()
109//!     .unwrap()
110//!     .https_only()
111//!     .enable_http2()
112//!     .build();
113//!
114//! let executor = hyper_util::rt::TokioExecutor::new();
115//! let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
116//!     secret,
117//!     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
118//!     yup_oauth2::client::CustomHyperClientBuilder::from(
119//!         hyper_util::client::legacy::Client::builder(executor).build(connector),
120//!     ),
121//! ).build().await.unwrap();
122//!
123//! let client = hyper_util::client::legacy::Client::builder(
124//!     hyper_util::rt::TokioExecutor::new()
125//! )
126//! .build(
127//!     hyper_rustls::HttpsConnectorBuilder::new()
128//!         .with_native_roots()
129//!         .unwrap()
130//!         .https_or_http()
131//!         .enable_http2()
132//!         .build()
133//! );
134//! let mut hub = CloudRetail::new(client, auth);
135//! // As the method needs a request, you would usually fill it with the desired information
136//! // into the respective structure. Some of the parts shown here might not be applicable !
137//! // Values shown here are possibly random and not representative !
138//! let mut req = GoogleCloudRetailV2Model::default();
139//!
140//! // You can configure optional parameters by calling the respective setters at will, and
141//! // execute the final call using `doit()`.
142//! // Values shown here are possibly random and not representative !
143//! let result = hub.projects().locations_catalogs_models_create(req, "parent")
144//!              .dry_run(false)
145//!              .doit().await;
146//!
147//! match result {
148//!     Err(e) => match e {
149//!         // The Error enum provides details about what exactly happened.
150//!         // You can also just use its `Debug`, `Display` or `Error` traits
151//!          Error::HttpError(_)
152//!         |Error::Io(_)
153//!         |Error::MissingAPIKey
154//!         |Error::MissingToken(_)
155//!         |Error::Cancelled
156//!         |Error::UploadSizeLimitExceeded(_, _)
157//!         |Error::Failure(_)
158//!         |Error::BadRequest(_)
159//!         |Error::FieldClash(_)
160//!         |Error::JsonDecodeError(_, _) => println!("{}", e),
161//!     },
162//!     Ok(res) => println!("Success: {:?}", res),
163//! }
164//! # }
165//! ```
166//! ## Handling Errors
167//!
168//! All errors produced by the system are provided either as [Result](common::Result) enumeration as return value of
169//! the doit() methods, or handed as possibly intermediate results to either the
170//! [Hub Delegate](common::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
171//!
172//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
173//! makes the system potentially resilient to all kinds of errors.
174//!
175//! ## Uploads and Downloads
176//! If a method supports downloads, the response body, which is part of the [Result](common::Result), should be
177//! read by you to obtain the media.
178//! If such a method also supports a [Response Result](common::ResponseResult), it will return that by default.
179//! 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
180//! this call: `.param("alt", "media")`.
181//!
182//! Methods supporting uploads can do so using up to 2 different protocols:
183//! *simple* and *resumable*. The distinctiveness of each is represented by customized
184//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
185//!
186//! ## Customization and Callbacks
187//!
188//! You may alter the way an `doit()` method is called by providing a [delegate](common::Delegate) to the
189//! [Method Builder](common::CallBuilder) before making the final `doit()` call.
190//! Respective methods will be called to provide progress information, as well as determine whether the system should
191//! retry on failure.
192//!
193//! The [delegate trait](common::Delegate) is default-implemented, allowing you to customize it with minimal effort.
194//!
195//! ## Optional Parts in Server-Requests
196//!
197//! All structures provided by this library are made to be [encodable](common::RequestValue) and
198//! [decodable](common::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
199//! are valid.
200//! Most optionals are are considered [Parts](common::Part) which are identifiable by name, which will be sent to
201//! the server to indicate either the set parts of the request or the desired parts in the response.
202//!
203//! ## Builder Arguments
204//!
205//! Using [method builders](common::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods.
206//! These will always take a single argument, for which the following statements are true.
207//!
208//! * [PODs][wiki-pod] are handed by copy
209//! * strings are passed as `&str`
210//! * [request values](common::RequestValue) are moved
211//!
212//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
213//!
214//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
215//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
216//! [google-go-api]: https://github.com/google/google-api-go-client
217//!
218//! ## Cargo Features
219//!
220//! * `utoipa` - Add support for [utoipa](https://crates.io/crates/utoipa) and derive `utoipa::ToSchema` on all
221//! the types. You'll have to import and register the required types in `#[openapi(schemas(...))]`, otherwise the
222//! generated `openapi` spec would be invalid.
223//!
224//!
225//!
226
227// Unused attributes happen thanks to defined, but unused structures We don't
228// warn about this, as depending on the API, some data structures or facilities
229// are never used. Instead of pre-determining this, we just disable the lint.
230// It's manually tuned to not have any unused imports in fully featured APIs.
231// Same with unused_mut.
232#![allow(unused_imports, unused_mut, dead_code)]
233
234// DO NOT EDIT !
235// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
236// DO NOT EDIT !
237
238pub extern crate hyper;
239pub extern crate hyper_rustls;
240pub extern crate hyper_util;
241#[cfg(feature = "yup-oauth2")]
242pub extern crate yup_oauth2;
243
244pub extern crate google_apis_common as common;
245pub use common::{Delegate, Error, FieldMask, Result};
246
247pub mod api;
248pub use api::CloudRetail;