google_doubleclicksearch2/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// View and manage your advertising data in DoubleClick Search
17 Full,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::Full => "https://www.googleapis.com/auth/doubleclicksearch",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::Full
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Doubleclicksearch related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_doubleclicksearch2 as doubleclicksearch2;
49/// use doubleclicksearch2::{Result, Error};
50/// # async fn dox() {
51/// use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = Doubleclicksearch::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.reports().get_file("reportId", -27)
93/// .doit().await;
94///
95/// match result {
96/// Err(e) => match e {
97/// // The Error enum provides details about what exactly happened.
98/// // You can also just use its `Debug`, `Display` or `Error` traits
99/// Error::HttpError(_)
100/// |Error::Io(_)
101/// |Error::MissingAPIKey
102/// |Error::MissingToken(_)
103/// |Error::Cancelled
104/// |Error::UploadSizeLimitExceeded(_, _)
105/// |Error::Failure(_)
106/// |Error::BadRequest(_)
107/// |Error::FieldClash(_)
108/// |Error::JsonDecodeError(_, _) => println!("{}", e),
109/// },
110/// Ok(res) => println!("Success: {:?}", res),
111/// }
112/// # }
113/// ```
114#[derive(Clone)]
115pub struct Doubleclicksearch<C> {
116 pub client: common::Client<C>,
117 pub auth: Box<dyn common::GetToken>,
118 _user_agent: String,
119 _base_url: String,
120 _root_url: String,
121}
122
123impl<C> common::Hub for Doubleclicksearch<C> {}
124
125impl<'a, C> Doubleclicksearch<C> {
126 pub fn new<A: 'static + common::GetToken>(
127 client: common::Client<C>,
128 auth: A,
129 ) -> Doubleclicksearch<C> {
130 Doubleclicksearch {
131 client,
132 auth: Box::new(auth),
133 _user_agent: "google-api-rust-client/7.0.0".to_string(),
134 _base_url: "https://doubleclicksearch.googleapis.com/".to_string(),
135 _root_url: "https://doubleclicksearch.googleapis.com/".to_string(),
136 }
137 }
138
139 pub fn conversion(&'a self) -> ConversionMethods<'a, C> {
140 ConversionMethods { hub: self }
141 }
142 pub fn reports(&'a self) -> ReportMethods<'a, C> {
143 ReportMethods { hub: self }
144 }
145 pub fn saved_columns(&'a self) -> SavedColumnMethods<'a, C> {
146 SavedColumnMethods { hub: self }
147 }
148
149 /// Set the user-agent header field to use in all requests to the server.
150 /// It defaults to `google-api-rust-client/7.0.0`.
151 ///
152 /// Returns the previously set user-agent.
153 pub fn user_agent(&mut self, agent_name: String) -> String {
154 std::mem::replace(&mut self._user_agent, agent_name)
155 }
156
157 /// Set the base url to use in all requests to the server.
158 /// It defaults to `https://doubleclicksearch.googleapis.com/`.
159 ///
160 /// Returns the previously set base url.
161 pub fn base_url(&mut self, new_base_url: String) -> String {
162 std::mem::replace(&mut self._base_url, new_base_url)
163 }
164
165 /// Set the root url to use in all requests to the server.
166 /// It defaults to `https://doubleclicksearch.googleapis.com/`.
167 ///
168 /// Returns the previously set root url.
169 pub fn root_url(&mut self, new_root_url: String) -> String {
170 std::mem::replace(&mut self._root_url, new_root_url)
171 }
172}
173
174// ############
175// SCHEMAS ###
176// ##########
177/// A message containing availability data relevant to DoubleClick Search.
178///
179/// This type is not used in any activity, and only used as *part* of another schema.
180///
181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
182#[serde_with::serde_as]
183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
184pub struct Availability {
185 /// DS advertiser ID.
186 #[serde(rename = "advertiserId")]
187 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
188 pub advertiser_id: Option<i64>,
189 /// DS agency ID.
190 #[serde(rename = "agencyId")]
191 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
192 pub agency_id: Option<i64>,
193 /// The time by which all conversions have been uploaded, in epoch millis UTC.
194 #[serde(rename = "availabilityTimestamp")]
195 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
196 pub availability_timestamp: Option<i64>,
197 /// Customer ID of a client account in the new Search Ads 360 experience.
198 #[serde(rename = "customerId")]
199 pub customer_id: Option<String>,
200 /// The numeric segmentation identifier (for example, DoubleClick Search Floodlight activity ID).
201 #[serde(rename = "segmentationId")]
202 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
203 pub segmentation_id: Option<i64>,
204 /// The friendly segmentation identifier (for example, DoubleClick Search Floodlight activity name).
205 #[serde(rename = "segmentationName")]
206 pub segmentation_name: Option<String>,
207 /// The segmentation type that this availability is for (its default value is `FLOODLIGHT`).
208 #[serde(rename = "segmentationType")]
209 pub segmentation_type: Option<String>,
210}
211
212impl common::Part for Availability {}
213
214/// A conversion containing data relevant to DoubleClick Search. Common DS3 API conversion fields: Id Range [1 - 2800]. Next Id to use: 33
215///
216/// This type is not used in any activity, and only used as *part* of another schema.
217///
218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
219#[serde_with::serde_as]
220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
221pub struct Conversion {
222 /// DS ad group ID.
223 #[serde(rename = "adGroupId")]
224 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
225 pub ad_group_id: Option<i64>,
226 /// DS ad ID.
227 #[serde(rename = "adId")]
228 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
229 pub ad_id: Option<i64>,
230 /// Represents consent for core platform services (CPS) preferences in settings. No default value. Acceptable values are: GRANTED: The desired consent status is to grant. Read the CPS preferences from GTE settings. DENIED: The desired consent status is to deny; CPS list is empty.
231 #[serde(rename = "adUserDataConsent")]
232 pub ad_user_data_consent: Option<String>,
233 /// DS advertiser ID.
234 #[serde(rename = "advertiserId")]
235 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
236 pub advertiser_id: Option<i64>,
237 /// DS agency ID.
238 #[serde(rename = "agencyId")]
239 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
240 pub agency_id: Option<i64>,
241 /// Available to advertisers only after contacting DoubleClick Search customer support.
242 #[serde(rename = "attributionModel")]
243 pub attribution_model: Option<String>,
244 /// DS campaign ID.
245 #[serde(rename = "campaignId")]
246 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
247 pub campaign_id: Option<i64>,
248 /// Sales channel for the product. Acceptable values are: - "`local`": a physical store - "`online`": an online store
249 pub channel: Option<String>,
250 /// DS click ID for the conversion.
251 #[serde(rename = "clickId")]
252 pub click_id: Option<String>,
253 /// For offline conversions, advertisers provide this ID. Advertisers can specify any ID that is meaningful to them. Each conversion in a request must specify a unique ID, and the combination of ID and timestamp must be unique amongst all conversions within the advertiser. For online conversions, DS copies the `dsConversionId` or `floodlightOrderId` into this property depending on the advertiser's Floodlight instructions.
254 #[serde(rename = "conversionId")]
255 pub conversion_id: Option<String>,
256 /// The time at which the conversion was last modified, in epoch millis UTC.
257 #[serde(rename = "conversionModifiedTimestamp")]
258 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
259 pub conversion_modified_timestamp: Option<i64>,
260 /// The time at which the conversion took place, in epoch millis UTC.
261 #[serde(rename = "conversionTimestamp")]
262 pub conversion_timestamp: Option<String>,
263 /// Available to advertisers only after contacting DoubleClick Search customer support.
264 #[serde(rename = "countMillis")]
265 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
266 pub count_millis: Option<i64>,
267 /// DS criterion (keyword) ID.
268 #[serde(rename = "criterionId")]
269 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
270 pub criterion_id: Option<i64>,
271 /// The currency code for the conversion's revenue. Should be in ISO 4217 alphabetic (3-char) format.
272 #[serde(rename = "currencyCode")]
273 pub currency_code: Option<String>,
274 /// Custom dimensions for the conversion, which can be used to filter data in a report.
275 #[serde(rename = "customDimension")]
276 pub custom_dimension: Option<Vec<CustomDimension>>,
277 /// Custom metrics for the conversion.
278 #[serde(rename = "customMetric")]
279 pub custom_metric: Option<Vec<CustomMetric>>,
280 /// Customer ID of a client account in the new Search Ads 360 experience.
281 #[serde(rename = "customerId")]
282 pub customer_id: Option<String>,
283 /// The type of device on which the conversion occurred.
284 #[serde(rename = "deviceType")]
285 pub device_type: Option<String>,
286 /// ID that DoubleClick Search generates for each conversion.
287 #[serde(rename = "dsConversionId")]
288 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
289 pub ds_conversion_id: Option<i64>,
290 /// DS engine account ID.
291 #[serde(rename = "engineAccountId")]
292 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
293 pub engine_account_id: Option<i64>,
294 /// The Floodlight order ID provided by the advertiser for the conversion.
295 #[serde(rename = "floodlightOrderId")]
296 pub floodlight_order_id: Option<String>,
297 /// ID that DS generates and uses to uniquely identify the inventory account that contains the product.
298 #[serde(rename = "inventoryAccountId")]
299 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
300 pub inventory_account_id: Option<i64>,
301 /// The country registered for the Merchant Center feed that contains the product. Use an ISO 3166 code to specify a country.
302 #[serde(rename = "productCountry")]
303 pub product_country: Option<String>,
304 /// DS product group ID.
305 #[serde(rename = "productGroupId")]
306 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
307 pub product_group_id: Option<i64>,
308 /// The product ID (SKU).
309 #[serde(rename = "productId")]
310 pub product_id: Option<String>,
311 /// The language registered for the Merchant Center feed that contains the product. Use an ISO 639 code to specify a language.
312 #[serde(rename = "productLanguage")]
313 pub product_language: Option<String>,
314 /// The quantity of this conversion, in millis.
315 #[serde(rename = "quantityMillis")]
316 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
317 pub quantity_millis: Option<i64>,
318 /// The revenue amount of this `TRANSACTION` conversion, in micros (value multiplied by 1000000, no decimal). For example, to specify a revenue value of "10" enter "10000000" (10 million) in your request.
319 #[serde(rename = "revenueMicros")]
320 pub revenue_micros: Option<String>,
321 /// The numeric segmentation identifier (for example, DoubleClick Search Floodlight activity ID).
322 #[serde(rename = "segmentationId")]
323 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
324 pub segmentation_id: Option<i64>,
325 /// The friendly segmentation identifier (for example, DoubleClick Search Floodlight activity name).
326 #[serde(rename = "segmentationName")]
327 pub segmentation_name: Option<String>,
328 /// The segmentation type of this conversion (for example, `FLOODLIGHT`).
329 #[serde(rename = "segmentationType")]
330 pub segmentation_type: Option<String>,
331 /// The state of the conversion, that is, either `ACTIVE` or `REMOVED`. Note: state DELETED is deprecated.
332 pub state: Option<String>,
333 /// The ID of the local store for which the product was advertised. Applicable only when the channel is "`local`".
334 #[serde(rename = "storeId")]
335 pub store_id: Option<String>,
336 /// The type of the conversion, that is, either `ACTION` or `TRANSACTION`. An `ACTION` conversion is an action by the user that has no monetarily quantifiable value, while a `TRANSACTION` conversion is an action that does have a monetarily quantifiable value. Examples are email list signups (`ACTION`) versus ecommerce purchases (`TRANSACTION`).
337 #[serde(rename = "type")]
338 pub type_: Option<String>,
339}
340
341impl common::Part for Conversion {}
342
343/// A list of conversions.
344///
345/// # Activities
346///
347/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
348/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
349///
350/// * [get conversion](ConversionGetCall) (response)
351/// * [get by customer id conversion](ConversionGetByCustomerIdCall) (response)
352/// * [insert conversion](ConversionInsertCall) (request|response)
353/// * [update conversion](ConversionUpdateCall) (request|response)
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct ConversionList {
358 /// The conversions being requested.
359 pub conversion: Option<Vec<Conversion>>,
360 /// Identifies this as a ConversionList resource. Value: the fixed string doubleclicksearch#conversionList.
361 pub kind: Option<String>,
362}
363
364impl common::RequestValue for ConversionList {}
365impl common::ResponseResult for ConversionList {}
366
367/// A message containing the custom dimension.
368///
369/// This type is not used in any activity, and only used as *part* of another schema.
370///
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct CustomDimension {
375 /// Custom dimension name.
376 pub name: Option<String>,
377 /// Custom dimension value.
378 pub value: Option<String>,
379}
380
381impl common::Part for CustomDimension {}
382
383/// A message containing the custom metric.
384///
385/// This type is not used in any activity, and only used as *part* of another schema.
386///
387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
388#[serde_with::serde_as]
389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct CustomMetric {
391 /// Custom metric name.
392 pub name: Option<String>,
393 /// Custom metric numeric value.
394 pub value: Option<f64>,
395}
396
397impl common::Part for CustomMetric {}
398
399/// File returned to https://developers.google.com/search-ads/v2/reference/reports/getIdMappingFile.
400///
401/// # Activities
402///
403/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
404/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
405///
406/// * [get id mapping file reports](ReportGetIdMappingFileCall) (response)
407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
408#[serde_with::serde_as]
409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
410pub struct IdMappingFile {
411 _never_set: Option<bool>,
412}
413
414impl common::ResponseResult for IdMappingFile {}
415
416/// A DoubleClick Search report. This object contains the report request, some report metadata such as currency code, and the generated report rows or report files.
417///
418/// # Activities
419///
420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
422///
423/// * [generate reports](ReportGenerateCall) (response)
424/// * [get reports](ReportGetCall) (response)
425/// * [get file reports](ReportGetFileCall) (none)
426/// * [get id mapping file reports](ReportGetIdMappingFileCall) (none)
427/// * [request reports](ReportRequestCall) (response)
428#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
429#[serde_with::serde_as]
430#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
431pub struct Report {
432 /// Asynchronous report only. Contains a list of generated report files once the report has successfully completed.
433 pub files: Option<Vec<ReportFiles>>,
434 /// Asynchronous report only. Id of the report.
435 pub id: Option<String>,
436 /// Asynchronous report only. True if and only if the report has completed successfully and the report files are ready to be downloaded.
437 #[serde(rename = "isReportReady")]
438 pub is_report_ready: Option<bool>,
439 /// Identifies this as a Report resource. Value: the fixed string `doubleclicksearch#report`.
440 pub kind: Option<String>,
441 /// The request that created the report. Optional fields not specified in the original request are filled with default values.
442 pub request: Option<ReportRequest>,
443 /// The number of report rows generated by the report, not including headers.
444 #[serde(rename = "rowCount")]
445 pub row_count: Option<i32>,
446 /// Synchronous report only. Generated report rows.
447 pub rows: Option<Vec<ReportRow>>,
448 /// The currency code of all monetary values produced in the report, including values that are set by users (e.g., keyword bid settings) and metrics (e.g., cost and revenue). The currency code of a report is determined by the `statisticsCurrency` field of the report request.
449 #[serde(rename = "statisticsCurrencyCode")]
450 pub statistics_currency_code: Option<String>,
451 /// If all statistics of the report are sourced from the same time zone, this would be it. Otherwise the field is unset.
452 #[serde(rename = "statisticsTimeZone")]
453 pub statistics_time_zone: Option<String>,
454}
455
456impl common::Resource for Report {}
457impl common::ResponseResult for Report {}
458
459/// A request object used to create a DoubleClick Search report.
460///
461/// This type is not used in any activity, and only used as *part* of another schema.
462///
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct ReportApiColumnSpec {
467 /// Name of a DoubleClick Search column to include in the report.
468 #[serde(rename = "columnName")]
469 pub column_name: Option<String>,
470 /// Segments a report by a custom dimension. The report must be scoped to an advertiser or lower, and the custom dimension must already be set up in DoubleClick Search. The custom dimension name, which appears in DoubleClick Search, is case sensitive.\ If used in a conversion report, returns the value of the specified custom dimension for the given conversion, if set. This column does not segment the conversion report.
471 #[serde(rename = "customDimensionName")]
472 pub custom_dimension_name: Option<String>,
473 /// Name of a custom metric to include in the report. The report must be scoped to an advertiser or lower, and the custom metric must already be set up in DoubleClick Search. The custom metric name, which appears in DoubleClick Search, is case sensitive.
474 #[serde(rename = "customMetricName")]
475 pub custom_metric_name: Option<String>,
476 /// Inclusive day in YYYY-MM-DD format. When provided, this overrides the overall time range of the report for this column only. Must be provided together with `startDate`.
477 #[serde(rename = "endDate")]
478 pub end_date: Option<String>,
479 /// Synchronous report only. Set to `true` to group by this column. Defaults to `false`.
480 #[serde(rename = "groupByColumn")]
481 pub group_by_column: Option<bool>,
482 /// Text used to identify this column in the report output; defaults to `columnName` or `savedColumnName` when not specified. This can be used to prevent collisions between DoubleClick Search columns and saved columns with the same name.
483 #[serde(rename = "headerText")]
484 pub header_text: Option<String>,
485 /// The platform that is used to provide data for the custom dimension. Acceptable values are "floodlight".
486 #[serde(rename = "platformSource")]
487 pub platform_source: Option<String>,
488 /// Returns metrics only for a specific type of product activity. Accepted values are: - "`sold`": returns metrics only for products that were sold - "`advertised`": returns metrics only for products that were advertised in a Shopping campaign, and that might or might not have been sold
489 #[serde(rename = "productReportPerspective")]
490 pub product_report_perspective: Option<String>,
491 /// Name of a saved column to include in the report. The report must be scoped at advertiser or lower, and this saved column must already be created in the DoubleClick Search UI.
492 #[serde(rename = "savedColumnName")]
493 pub saved_column_name: Option<String>,
494 /// Inclusive date in YYYY-MM-DD format. When provided, this overrides the overall time range of the report for this column only. Must be provided together with `endDate`.
495 #[serde(rename = "startDate")]
496 pub start_date: Option<String>,
497}
498
499impl common::Part for ReportApiColumnSpec {}
500
501/// A request object used to create a DoubleClick Search report.
502///
503/// # Activities
504///
505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
507///
508/// * [generate reports](ReportGenerateCall) (request)
509/// * [request reports](ReportRequestCall) (request)
510#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
511#[serde_with::serde_as]
512#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
513pub struct ReportRequest {
514 /// The columns to include in the report. This includes both DoubleClick Search columns and saved columns. For DoubleClick Search columns, only the `columnName` parameter is required. For saved columns only the `savedColumnName` parameter is required. Both `columnName` and `savedColumnName` cannot be set in the same stanza.\ The maximum number of columns per request is 300.
515 pub columns: Option<Vec<ReportApiColumnSpec>>,
516 /// Format that the report should be returned in. Currently `csv` or `tsv` is supported.
517 #[serde(rename = "downloadFormat")]
518 pub download_format: Option<String>,
519 /// A list of filters to be applied to the report.\ The maximum number of filters per request is 300.
520 pub filters: Option<Vec<ReportRequestFilters>>,
521 /// Determines if removed entities should be included in the report. Defaults to `false`. Deprecated, please use `includeRemovedEntities` instead.
522 #[serde(rename = "includeDeletedEntities")]
523 pub include_deleted_entities: Option<bool>,
524 /// Determines if removed entities should be included in the report. Defaults to `false`.
525 #[serde(rename = "includeRemovedEntities")]
526 pub include_removed_entities: Option<bool>,
527 /// Asynchronous report only. The maximum number of rows per report file. A large report is split into many files based on this field. Acceptable values are `1000000` to `100000000`, inclusive.
528 #[serde(rename = "maxRowsPerFile")]
529 pub max_rows_per_file: Option<i32>,
530 /// Synchronous report only. A list of columns and directions defining sorting to be performed on the report rows.\ The maximum number of orderings per request is 300.
531 #[serde(rename = "orderBy")]
532 pub order_by: Option<Vec<ReportRequestOrderBy>>,
533 /// The reportScope is a set of IDs that are used to determine which subset of entities will be returned in the report. The full lineage of IDs from the lowest scoped level desired up through agency is required.
534 #[serde(rename = "reportScope")]
535 pub report_scope: Option<ReportRequestReportScope>,
536 /// Determines the type of rows that are returned in the report. For example, if you specify `reportType: keyword`, each row in the report will contain data about a keyword. See the [Types of Reports](https://developers.google.com/search-ads/v2/report-types/) reference for the columns that are available for each type.
537 #[serde(rename = "reportType")]
538 pub report_type: Option<String>,
539 /// Synchronous report only. The maximum number of rows to return; additional rows are dropped. Acceptable values are `0` to `10000`, inclusive. Defaults to `10000`.
540 #[serde(rename = "rowCount")]
541 pub row_count: Option<i32>,
542 /// Synchronous report only. Zero-based index of the first row to return. Acceptable values are `0` to `50000`, inclusive. Defaults to `0`.
543 #[serde(rename = "startRow")]
544 pub start_row: Option<i32>,
545 /// Specifies the currency in which monetary will be returned. Possible values are: `usd`, `agency` (valid if the report is scoped to agency or lower), `advertiser` (valid if the report is scoped to * advertiser or lower), or `account` (valid if the report is scoped to engine account or lower).
546 #[serde(rename = "statisticsCurrency")]
547 pub statistics_currency: Option<String>,
548 /// If metrics are requested in a report, this argument will be used to restrict the metrics to a specific time range.
549 #[serde(rename = "timeRange")]
550 pub time_range: Option<ReportRequestTimeRange>,
551 /// If `true`, the report would only be created if all the requested stat data are sourced from a single timezone. Defaults to `false`.
552 #[serde(rename = "verifySingleTimeZone")]
553 pub verify_single_time_zone: Option<bool>,
554}
555
556impl common::RequestValue for ReportRequest {}
557
558/// A row in a DoubleClick Search report.
559///
560/// This type is not used in any activity, and only used as *part* of another schema.
561///
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct ReportRow(pub Option<HashMap<String, serde_json::Value>>);
566
567impl common::Part for ReportRow {}
568
569/// A saved column
570///
571/// # Activities
572///
573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
575///
576/// * [list saved columns](SavedColumnListCall) (none)
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct SavedColumn {
581 /// Identifies this as a SavedColumn resource. Value: the fixed string doubleclicksearch#savedColumn.
582 pub kind: Option<String>,
583 /// The name of the saved column.
584 #[serde(rename = "savedColumnName")]
585 pub saved_column_name: Option<String>,
586 /// The type of data this saved column will produce.
587 #[serde(rename = "type")]
588 pub type_: Option<String>,
589}
590
591impl common::Resource for SavedColumn {}
592
593/// A list of saved columns. Advertisers create saved columns to report on Floodlight activities, Google Analytics goals, or custom KPIs. To request reports with saved columns, you’ll need the saved column names that are available from this list.
594///
595/// # Activities
596///
597/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
598/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
599///
600/// * [list saved columns](SavedColumnListCall) (response)
601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
602#[serde_with::serde_as]
603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
604pub struct SavedColumnList {
605 /// The saved columns being requested.
606 pub items: Option<Vec<SavedColumn>>,
607 /// Identifies this as a SavedColumnList resource. Value: the fixed string doubleclicksearch#savedColumnList.
608 pub kind: Option<String>,
609}
610
611impl common::ResponseResult for SavedColumnList {}
612
613/// The request to update availability.
614///
615/// # Activities
616///
617/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
618/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
619///
620/// * [update availability conversion](ConversionUpdateAvailabilityCall) (request)
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct UpdateAvailabilityRequest {
625 /// The availabilities being requested.
626 pub availabilities: Option<Vec<Availability>>,
627}
628
629impl common::RequestValue for UpdateAvailabilityRequest {}
630
631/// The response to a update availability request.
632///
633/// # Activities
634///
635/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
636/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
637///
638/// * [update availability conversion](ConversionUpdateAvailabilityCall) (response)
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct UpdateAvailabilityResponse {
643 /// The availabilities being returned.
644 pub availabilities: Option<Vec<Availability>>,
645}
646
647impl common::ResponseResult for UpdateAvailabilityResponse {}
648
649/// Asynchronous report only. Contains a list of generated report files once the report has successfully completed.
650///
651/// This type is not used in any activity, and only used as *part* of another schema.
652///
653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
654#[serde_with::serde_as]
655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
656pub struct ReportFiles {
657 /// The size of this report file in bytes.
658 #[serde(rename = "byteCount")]
659 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
660 pub byte_count: Option<i64>,
661 /// Use this url to download the report file.
662 pub url: Option<String>,
663}
664
665impl common::NestedType for ReportFiles {}
666impl common::Part for ReportFiles {}
667
668/// A list of filters to be applied to the report.\ The maximum number of filters per request is 300.
669///
670/// This type is not used in any activity, and only used as *part* of another schema.
671///
672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
673#[serde_with::serde_as]
674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
675pub struct ReportRequestFilters {
676 /// Column to perform the filter on. This can be a DoubleClick Search column or a saved column.
677 pub column: Option<ReportApiColumnSpec>,
678 /// Operator to use in the filter. See the filter reference for a list of available operators.
679 pub operator: Option<String>,
680 /// A list of values to filter the column value against.\ The maximum number of filter values per request is 300.
681 pub values: Option<Vec<serde_json::Value>>,
682}
683
684impl common::NestedType for ReportRequestFilters {}
685impl common::Part for ReportRequestFilters {}
686
687/// Synchronous report only. A list of columns and directions defining sorting to be performed on the report rows.\ The maximum number of orderings per request is 300.
688///
689/// This type is not used in any activity, and only used as *part* of another schema.
690///
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct ReportRequestOrderBy {
695 /// Column to perform the sort on. This can be a DoubleClick Search-defined column or a saved column.
696 pub column: Option<ReportApiColumnSpec>,
697 /// The sort direction, which is either `ascending` or `descending`.
698 #[serde(rename = "sortOrder")]
699 pub sort_order: Option<String>,
700}
701
702impl common::NestedType for ReportRequestOrderBy {}
703impl common::Part for ReportRequestOrderBy {}
704
705/// The reportScope is a set of IDs that are used to determine which subset of entities will be returned in the report. The full lineage of IDs from the lowest scoped level desired up through agency is required.
706///
707/// This type is not used in any activity, and only used as *part* of another schema.
708///
709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
710#[serde_with::serde_as]
711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
712pub struct ReportRequestReportScope {
713 /// DS ad group ID.
714 #[serde(rename = "adGroupId")]
715 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
716 pub ad_group_id: Option<i64>,
717 /// DS ad ID.
718 #[serde(rename = "adId")]
719 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
720 pub ad_id: Option<i64>,
721 /// DS advertiser ID.
722 #[serde(rename = "advertiserId")]
723 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
724 pub advertiser_id: Option<i64>,
725 /// DS agency ID.
726 #[serde(rename = "agencyId")]
727 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
728 pub agency_id: Option<i64>,
729 /// DS campaign ID.
730 #[serde(rename = "campaignId")]
731 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
732 pub campaign_id: Option<i64>,
733 /// DS engine account ID.
734 #[serde(rename = "engineAccountId")]
735 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
736 pub engine_account_id: Option<i64>,
737 /// DS keyword ID.
738 #[serde(rename = "keywordId")]
739 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
740 pub keyword_id: Option<i64>,
741}
742
743impl common::NestedType for ReportRequestReportScope {}
744impl common::Part for ReportRequestReportScope {}
745
746/// If metrics are requested in a report, this argument will be used to restrict the metrics to a specific time range.
747///
748/// This type is not used in any activity, and only used as *part* of another schema.
749///
750#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
751#[serde_with::serde_as]
752#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
753pub struct ReportRequestTimeRange {
754 /// Inclusive UTC timestamp in RFC format, e.g., `2013-07-16T10:16:23.555Z`. See additional references on how changed attribute reports work.
755 #[serde(rename = "changedAttributesSinceTimestamp")]
756 pub changed_attributes_since_timestamp: Option<String>,
757 /// Inclusive UTC timestamp in RFC format, e.g., `2013-07-16T10:16:23.555Z`. See additional references on how changed metrics reports work.
758 #[serde(rename = "changedMetricsSinceTimestamp")]
759 pub changed_metrics_since_timestamp: Option<String>,
760 /// Inclusive date in YYYY-MM-DD format.
761 #[serde(rename = "endDate")]
762 pub end_date: Option<String>,
763 /// Inclusive date in YYYY-MM-DD format.
764 #[serde(rename = "startDate")]
765 pub start_date: Option<String>,
766}
767
768impl common::NestedType for ReportRequestTimeRange {}
769impl common::Part for ReportRequestTimeRange {}
770
771// ###################
772// MethodBuilders ###
773// #################
774
775/// A builder providing access to all methods supported on *conversion* resources.
776/// It is not used directly, but through the [`Doubleclicksearch`] hub.
777///
778/// # Example
779///
780/// Instantiate a resource builder
781///
782/// ```test_harness,no_run
783/// extern crate hyper;
784/// extern crate hyper_rustls;
785/// extern crate google_doubleclicksearch2 as doubleclicksearch2;
786///
787/// # async fn dox() {
788/// use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
789///
790/// let secret: yup_oauth2::ApplicationSecret = Default::default();
791/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
792/// .with_native_roots()
793/// .unwrap()
794/// .https_only()
795/// .enable_http2()
796/// .build();
797///
798/// let executor = hyper_util::rt::TokioExecutor::new();
799/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
800/// secret,
801/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
802/// yup_oauth2::client::CustomHyperClientBuilder::from(
803/// hyper_util::client::legacy::Client::builder(executor).build(connector),
804/// ),
805/// ).build().await.unwrap();
806///
807/// let client = hyper_util::client::legacy::Client::builder(
808/// hyper_util::rt::TokioExecutor::new()
809/// )
810/// .build(
811/// hyper_rustls::HttpsConnectorBuilder::new()
812/// .with_native_roots()
813/// .unwrap()
814/// .https_or_http()
815/// .enable_http2()
816/// .build()
817/// );
818/// let mut hub = Doubleclicksearch::new(client, auth);
819/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
820/// // like `get(...)`, `get_by_customer_id(...)`, `insert(...)`, `update(...)` and `update_availability(...)`
821/// // to build up your call.
822/// let rb = hub.conversion();
823/// # }
824/// ```
825pub struct ConversionMethods<'a, C>
826where
827 C: 'a,
828{
829 hub: &'a Doubleclicksearch<C>,
830}
831
832impl<'a, C> common::MethodsBuilder for ConversionMethods<'a, C> {}
833
834impl<'a, C> ConversionMethods<'a, C> {
835 /// Create a builder to help you perform the following task:
836 ///
837 /// Retrieves a list of conversions from a DoubleClick Search engine account.
838 ///
839 /// # Arguments
840 ///
841 /// * `agencyId` - Numeric ID of the agency.
842 /// * `advertiserId` - Numeric ID of the advertiser.
843 /// * `engineAccountId` - Numeric ID of the engine account.
844 /// * `endDate` - Last date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
845 /// * `rowCount` - The number of conversions to return per call.
846 /// * `startDate` - First date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
847 /// * `startRow` - The 0-based starting index for retrieving conversions results.
848 pub fn get(
849 &self,
850 agency_id: i64,
851 advertiser_id: i64,
852 engine_account_id: i64,
853 end_date: i32,
854 row_count: i32,
855 start_date: i32,
856 start_row: u32,
857 ) -> ConversionGetCall<'a, C> {
858 ConversionGetCall {
859 hub: self.hub,
860 _agency_id: agency_id,
861 _advertiser_id: advertiser_id,
862 _engine_account_id: engine_account_id,
863 _end_date: end_date,
864 _row_count: row_count,
865 _start_date: start_date,
866 _start_row: start_row,
867 _customer_id: Default::default(),
868 _criterion_id: Default::default(),
869 _campaign_id: Default::default(),
870 _ad_id: Default::default(),
871 _ad_group_id: Default::default(),
872 _delegate: Default::default(),
873 _additional_params: Default::default(),
874 _scopes: Default::default(),
875 }
876 }
877
878 /// Create a builder to help you perform the following task:
879 ///
880 /// Retrieves a list of conversions from a DoubleClick Search engine account.
881 ///
882 /// # Arguments
883 ///
884 /// * `customerId` - Customer ID of a client account in the new Search Ads 360 experience.
885 /// * `endDate` - Last date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
886 /// * `rowCount` - The number of conversions to return per call.
887 /// * `startDate` - First date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
888 /// * `startRow` - The 0-based starting index for retrieving conversions results.
889 pub fn get_by_customer_id(
890 &self,
891 customer_id: &str,
892 end_date: i32,
893 row_count: i32,
894 start_date: i32,
895 start_row: u32,
896 ) -> ConversionGetByCustomerIdCall<'a, C> {
897 ConversionGetByCustomerIdCall {
898 hub: self.hub,
899 _customer_id: customer_id.to_string(),
900 _end_date: end_date,
901 _row_count: row_count,
902 _start_date: start_date,
903 _start_row: start_row,
904 _engine_account_id: Default::default(),
905 _criterion_id: Default::default(),
906 _campaign_id: Default::default(),
907 _agency_id: Default::default(),
908 _advertiser_id: Default::default(),
909 _ad_id: Default::default(),
910 _ad_group_id: Default::default(),
911 _delegate: Default::default(),
912 _additional_params: Default::default(),
913 _scopes: Default::default(),
914 }
915 }
916
917 /// Create a builder to help you perform the following task:
918 ///
919 /// Inserts a batch of new conversions into DoubleClick Search.
920 ///
921 /// # Arguments
922 ///
923 /// * `request` - No description provided.
924 pub fn insert(&self, request: ConversionList) -> ConversionInsertCall<'a, C> {
925 ConversionInsertCall {
926 hub: self.hub,
927 _request: request,
928 _delegate: Default::default(),
929 _additional_params: Default::default(),
930 _scopes: Default::default(),
931 }
932 }
933
934 /// Create a builder to help you perform the following task:
935 ///
936 /// Updates a batch of conversions in DoubleClick Search.
937 ///
938 /// # Arguments
939 ///
940 /// * `request` - No description provided.
941 pub fn update(&self, request: ConversionList) -> ConversionUpdateCall<'a, C> {
942 ConversionUpdateCall {
943 hub: self.hub,
944 _request: request,
945 _delegate: Default::default(),
946 _additional_params: Default::default(),
947 _scopes: Default::default(),
948 }
949 }
950
951 /// Create a builder to help you perform the following task:
952 ///
953 /// Updates the availabilities of a batch of floodlight activities in DoubleClick Search.
954 ///
955 /// # Arguments
956 ///
957 /// * `request` - No description provided.
958 pub fn update_availability(
959 &self,
960 request: UpdateAvailabilityRequest,
961 ) -> ConversionUpdateAvailabilityCall<'a, C> {
962 ConversionUpdateAvailabilityCall {
963 hub: self.hub,
964 _request: request,
965 _delegate: Default::default(),
966 _additional_params: Default::default(),
967 _scopes: Default::default(),
968 }
969 }
970}
971
972/// A builder providing access to all methods supported on *report* resources.
973/// It is not used directly, but through the [`Doubleclicksearch`] hub.
974///
975/// # Example
976///
977/// Instantiate a resource builder
978///
979/// ```test_harness,no_run
980/// extern crate hyper;
981/// extern crate hyper_rustls;
982/// extern crate google_doubleclicksearch2 as doubleclicksearch2;
983///
984/// # async fn dox() {
985/// use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
986///
987/// let secret: yup_oauth2::ApplicationSecret = Default::default();
988/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
989/// .with_native_roots()
990/// .unwrap()
991/// .https_only()
992/// .enable_http2()
993/// .build();
994///
995/// let executor = hyper_util::rt::TokioExecutor::new();
996/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
997/// secret,
998/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
999/// yup_oauth2::client::CustomHyperClientBuilder::from(
1000/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1001/// ),
1002/// ).build().await.unwrap();
1003///
1004/// let client = hyper_util::client::legacy::Client::builder(
1005/// hyper_util::rt::TokioExecutor::new()
1006/// )
1007/// .build(
1008/// hyper_rustls::HttpsConnectorBuilder::new()
1009/// .with_native_roots()
1010/// .unwrap()
1011/// .https_or_http()
1012/// .enable_http2()
1013/// .build()
1014/// );
1015/// let mut hub = Doubleclicksearch::new(client, auth);
1016/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1017/// // like `generate(...)`, `get(...)`, `get_file(...)`, `get_id_mapping_file(...)` and `request(...)`
1018/// // to build up your call.
1019/// let rb = hub.reports();
1020/// # }
1021/// ```
1022pub struct ReportMethods<'a, C>
1023where
1024 C: 'a,
1025{
1026 hub: &'a Doubleclicksearch<C>,
1027}
1028
1029impl<'a, C> common::MethodsBuilder for ReportMethods<'a, C> {}
1030
1031impl<'a, C> ReportMethods<'a, C> {
1032 /// Create a builder to help you perform the following task:
1033 ///
1034 /// Generates and returns a report immediately.
1035 ///
1036 /// # Arguments
1037 ///
1038 /// * `request` - No description provided.
1039 pub fn generate(&self, request: ReportRequest) -> ReportGenerateCall<'a, C> {
1040 ReportGenerateCall {
1041 hub: self.hub,
1042 _request: request,
1043 _delegate: Default::default(),
1044 _additional_params: Default::default(),
1045 _scopes: Default::default(),
1046 }
1047 }
1048
1049 /// Create a builder to help you perform the following task:
1050 ///
1051 /// Polls for the status of a report request.
1052 ///
1053 /// # Arguments
1054 ///
1055 /// * `reportId` - ID of the report request being polled.
1056 pub fn get(&self, report_id: &str) -> ReportGetCall<'a, C> {
1057 ReportGetCall {
1058 hub: self.hub,
1059 _report_id: report_id.to_string(),
1060 _delegate: Default::default(),
1061 _additional_params: Default::default(),
1062 _scopes: Default::default(),
1063 }
1064 }
1065
1066 /// Create a builder to help you perform the following task:
1067 ///
1068 /// Downloads a report file encoded in UTF-8.
1069 ///
1070 /// # Arguments
1071 ///
1072 /// * `reportId` - ID of the report.
1073 /// * `reportFragment` - The index of the report fragment to download.
1074 pub fn get_file(&self, report_id: &str, report_fragment: i32) -> ReportGetFileCall<'a, C> {
1075 ReportGetFileCall {
1076 hub: self.hub,
1077 _report_id: report_id.to_string(),
1078 _report_fragment: report_fragment,
1079 _delegate: Default::default(),
1080 _additional_params: Default::default(),
1081 _scopes: Default::default(),
1082 }
1083 }
1084
1085 /// Create a builder to help you perform the following task:
1086 ///
1087 /// Downloads a csv file(encoded in UTF-8) that contains ID mappings between legacy SA360 and new SA360. The file includes all children entities of the given advertiser(e.g. engine accounts, campaigns, ad groups, etc.) that exist in both legacy SA360 and new SA360.
1088 ///
1089 /// # Arguments
1090 ///
1091 /// * `agencyId` - Legacy SA360 agency ID.
1092 /// * `advertiserId` - Legacy SA360 advertiser ID.
1093 pub fn get_id_mapping_file(
1094 &self,
1095 agency_id: i64,
1096 advertiser_id: i64,
1097 ) -> ReportGetIdMappingFileCall<'a, C> {
1098 ReportGetIdMappingFileCall {
1099 hub: self.hub,
1100 _agency_id: agency_id,
1101 _advertiser_id: advertiser_id,
1102 _delegate: Default::default(),
1103 _additional_params: Default::default(),
1104 _scopes: Default::default(),
1105 }
1106 }
1107
1108 /// Create a builder to help you perform the following task:
1109 ///
1110 /// Inserts a report request into the reporting system.
1111 ///
1112 /// # Arguments
1113 ///
1114 /// * `request` - No description provided.
1115 pub fn request(&self, request: ReportRequest) -> ReportRequestCall<'a, C> {
1116 ReportRequestCall {
1117 hub: self.hub,
1118 _request: request,
1119 _delegate: Default::default(),
1120 _additional_params: Default::default(),
1121 _scopes: Default::default(),
1122 }
1123 }
1124}
1125
1126/// A builder providing access to all methods supported on *savedColumn* resources.
1127/// It is not used directly, but through the [`Doubleclicksearch`] hub.
1128///
1129/// # Example
1130///
1131/// Instantiate a resource builder
1132///
1133/// ```test_harness,no_run
1134/// extern crate hyper;
1135/// extern crate hyper_rustls;
1136/// extern crate google_doubleclicksearch2 as doubleclicksearch2;
1137///
1138/// # async fn dox() {
1139/// use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1140///
1141/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1142/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1143/// .with_native_roots()
1144/// .unwrap()
1145/// .https_only()
1146/// .enable_http2()
1147/// .build();
1148///
1149/// let executor = hyper_util::rt::TokioExecutor::new();
1150/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1151/// secret,
1152/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1153/// yup_oauth2::client::CustomHyperClientBuilder::from(
1154/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1155/// ),
1156/// ).build().await.unwrap();
1157///
1158/// let client = hyper_util::client::legacy::Client::builder(
1159/// hyper_util::rt::TokioExecutor::new()
1160/// )
1161/// .build(
1162/// hyper_rustls::HttpsConnectorBuilder::new()
1163/// .with_native_roots()
1164/// .unwrap()
1165/// .https_or_http()
1166/// .enable_http2()
1167/// .build()
1168/// );
1169/// let mut hub = Doubleclicksearch::new(client, auth);
1170/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1171/// // like `list(...)`
1172/// // to build up your call.
1173/// let rb = hub.saved_columns();
1174/// # }
1175/// ```
1176pub struct SavedColumnMethods<'a, C>
1177where
1178 C: 'a,
1179{
1180 hub: &'a Doubleclicksearch<C>,
1181}
1182
1183impl<'a, C> common::MethodsBuilder for SavedColumnMethods<'a, C> {}
1184
1185impl<'a, C> SavedColumnMethods<'a, C> {
1186 /// Create a builder to help you perform the following task:
1187 ///
1188 /// Retrieve the list of saved columns for a specified advertiser.
1189 ///
1190 /// # Arguments
1191 ///
1192 /// * `agencyId` - DS ID of the agency.
1193 /// * `advertiserId` - DS ID of the advertiser.
1194 pub fn list(&self, agency_id: i64, advertiser_id: i64) -> SavedColumnListCall<'a, C> {
1195 SavedColumnListCall {
1196 hub: self.hub,
1197 _agency_id: agency_id,
1198 _advertiser_id: advertiser_id,
1199 _delegate: Default::default(),
1200 _additional_params: Default::default(),
1201 _scopes: Default::default(),
1202 }
1203 }
1204}
1205
1206// ###################
1207// CallBuilders ###
1208// #################
1209
1210/// Retrieves a list of conversions from a DoubleClick Search engine account.
1211///
1212/// A builder for the *get* method supported by a *conversion* resource.
1213/// It is not used directly, but through a [`ConversionMethods`] instance.
1214///
1215/// # Example
1216///
1217/// Instantiate a resource method builder
1218///
1219/// ```test_harness,no_run
1220/// # extern crate hyper;
1221/// # extern crate hyper_rustls;
1222/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
1223/// # async fn dox() {
1224/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1225///
1226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1227/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1228/// # .with_native_roots()
1229/// # .unwrap()
1230/// # .https_only()
1231/// # .enable_http2()
1232/// # .build();
1233///
1234/// # let executor = hyper_util::rt::TokioExecutor::new();
1235/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1236/// # secret,
1237/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1238/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1239/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1240/// # ),
1241/// # ).build().await.unwrap();
1242///
1243/// # let client = hyper_util::client::legacy::Client::builder(
1244/// # hyper_util::rt::TokioExecutor::new()
1245/// # )
1246/// # .build(
1247/// # hyper_rustls::HttpsConnectorBuilder::new()
1248/// # .with_native_roots()
1249/// # .unwrap()
1250/// # .https_or_http()
1251/// # .enable_http2()
1252/// # .build()
1253/// # );
1254/// # let mut hub = Doubleclicksearch::new(client, auth);
1255/// // You can configure optional parameters by calling the respective setters at will, and
1256/// // execute the final call using `doit()`.
1257/// // Values shown here are possibly random and not representative !
1258/// let result = hub.conversion().get(-8, -80, -2, -59, -52, -20, 46)
1259/// .customer_id("gubergren")
1260/// .criterion_id(-51)
1261/// .campaign_id(-12)
1262/// .ad_id(-75)
1263/// .ad_group_id(-4)
1264/// .doit().await;
1265/// # }
1266/// ```
1267pub struct ConversionGetCall<'a, C>
1268where
1269 C: 'a,
1270{
1271 hub: &'a Doubleclicksearch<C>,
1272 _agency_id: i64,
1273 _advertiser_id: i64,
1274 _engine_account_id: i64,
1275 _end_date: i32,
1276 _row_count: i32,
1277 _start_date: i32,
1278 _start_row: u32,
1279 _customer_id: Option<String>,
1280 _criterion_id: Option<i64>,
1281 _campaign_id: Option<i64>,
1282 _ad_id: Option<i64>,
1283 _ad_group_id: Option<i64>,
1284 _delegate: Option<&'a mut dyn common::Delegate>,
1285 _additional_params: HashMap<String, String>,
1286 _scopes: BTreeSet<String>,
1287}
1288
1289impl<'a, C> common::CallBuilder for ConversionGetCall<'a, C> {}
1290
1291impl<'a, C> ConversionGetCall<'a, C>
1292where
1293 C: common::Connector,
1294{
1295 /// Perform the operation you have build so far.
1296 pub async fn doit(mut self) -> common::Result<(common::Response, ConversionList)> {
1297 use std::borrow::Cow;
1298 use std::io::{Read, Seek};
1299
1300 use common::{url::Params, ToParts};
1301 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1302
1303 let mut dd = common::DefaultDelegate;
1304 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1305 dlg.begin(common::MethodInfo {
1306 id: "doubleclicksearch.conversion.get",
1307 http_method: hyper::Method::GET,
1308 });
1309
1310 for &field in [
1311 "alt",
1312 "agencyId",
1313 "advertiserId",
1314 "engineAccountId",
1315 "endDate",
1316 "rowCount",
1317 "startDate",
1318 "startRow",
1319 "customerId",
1320 "criterionId",
1321 "campaignId",
1322 "adId",
1323 "adGroupId",
1324 ]
1325 .iter()
1326 {
1327 if self._additional_params.contains_key(field) {
1328 dlg.finished(false);
1329 return Err(common::Error::FieldClash(field));
1330 }
1331 }
1332
1333 let mut params = Params::with_capacity(14 + self._additional_params.len());
1334 params.push("agencyId", self._agency_id.to_string());
1335 params.push("advertiserId", self._advertiser_id.to_string());
1336 params.push("engineAccountId", self._engine_account_id.to_string());
1337 params.push("endDate", self._end_date.to_string());
1338 params.push("rowCount", self._row_count.to_string());
1339 params.push("startDate", self._start_date.to_string());
1340 params.push("startRow", self._start_row.to_string());
1341 if let Some(value) = self._customer_id.as_ref() {
1342 params.push("customerId", value);
1343 }
1344 if let Some(value) = self._criterion_id.as_ref() {
1345 params.push("criterionId", value.to_string());
1346 }
1347 if let Some(value) = self._campaign_id.as_ref() {
1348 params.push("campaignId", value.to_string());
1349 }
1350 if let Some(value) = self._ad_id.as_ref() {
1351 params.push("adId", value.to_string());
1352 }
1353 if let Some(value) = self._ad_group_id.as_ref() {
1354 params.push("adGroupId", value.to_string());
1355 }
1356
1357 params.extend(self._additional_params.iter());
1358
1359 params.push("alt", "json");
1360 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/engine/{engineAccountId}/conversion";
1361 if self._scopes.is_empty() {
1362 self._scopes.insert(Scope::Full.as_ref().to_string());
1363 }
1364
1365 #[allow(clippy::single_element_loop)]
1366 for &(find_this, param_name) in [
1367 ("{agencyId}", "agencyId"),
1368 ("{advertiserId}", "advertiserId"),
1369 ("{engineAccountId}", "engineAccountId"),
1370 ]
1371 .iter()
1372 {
1373 url = params.uri_replacement(url, param_name, find_this, false);
1374 }
1375 {
1376 let to_remove = ["engineAccountId", "advertiserId", "agencyId"];
1377 params.remove_params(&to_remove);
1378 }
1379
1380 let url = params.parse_with_url(&url);
1381
1382 loop {
1383 let token = match self
1384 .hub
1385 .auth
1386 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1387 .await
1388 {
1389 Ok(token) => token,
1390 Err(e) => match dlg.token(e) {
1391 Ok(token) => token,
1392 Err(e) => {
1393 dlg.finished(false);
1394 return Err(common::Error::MissingToken(e));
1395 }
1396 },
1397 };
1398 let mut req_result = {
1399 let client = &self.hub.client;
1400 dlg.pre_request();
1401 let mut req_builder = hyper::Request::builder()
1402 .method(hyper::Method::GET)
1403 .uri(url.as_str())
1404 .header(USER_AGENT, self.hub._user_agent.clone());
1405
1406 if let Some(token) = token.as_ref() {
1407 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1408 }
1409
1410 let request = req_builder
1411 .header(CONTENT_LENGTH, 0_u64)
1412 .body(common::to_body::<String>(None));
1413
1414 client.request(request.unwrap()).await
1415 };
1416
1417 match req_result {
1418 Err(err) => {
1419 if let common::Retry::After(d) = dlg.http_error(&err) {
1420 sleep(d).await;
1421 continue;
1422 }
1423 dlg.finished(false);
1424 return Err(common::Error::HttpError(err));
1425 }
1426 Ok(res) => {
1427 let (mut parts, body) = res.into_parts();
1428 let mut body = common::Body::new(body);
1429 if !parts.status.is_success() {
1430 let bytes = common::to_bytes(body).await.unwrap_or_default();
1431 let error = serde_json::from_str(&common::to_string(&bytes));
1432 let response = common::to_response(parts, bytes.into());
1433
1434 if let common::Retry::After(d) =
1435 dlg.http_failure(&response, error.as_ref().ok())
1436 {
1437 sleep(d).await;
1438 continue;
1439 }
1440
1441 dlg.finished(false);
1442
1443 return Err(match error {
1444 Ok(value) => common::Error::BadRequest(value),
1445 _ => common::Error::Failure(response),
1446 });
1447 }
1448 let response = {
1449 let bytes = common::to_bytes(body).await.unwrap_or_default();
1450 let encoded = common::to_string(&bytes);
1451 match serde_json::from_str(&encoded) {
1452 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1453 Err(error) => {
1454 dlg.response_json_decode_error(&encoded, &error);
1455 return Err(common::Error::JsonDecodeError(
1456 encoded.to_string(),
1457 error,
1458 ));
1459 }
1460 }
1461 };
1462
1463 dlg.finished(true);
1464 return Ok(response);
1465 }
1466 }
1467 }
1468 }
1469
1470 /// Numeric ID of the agency.
1471 ///
1472 /// Sets the *agency id* path property to the given value.
1473 ///
1474 /// Even though the property as already been set when instantiating this call,
1475 /// we provide this method for API completeness.
1476 pub fn agency_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1477 self._agency_id = new_value;
1478 self
1479 }
1480 /// Numeric ID of the advertiser.
1481 ///
1482 /// Sets the *advertiser id* path property to the given value.
1483 ///
1484 /// Even though the property as already been set when instantiating this call,
1485 /// we provide this method for API completeness.
1486 pub fn advertiser_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1487 self._advertiser_id = new_value;
1488 self
1489 }
1490 /// Numeric ID of the engine account.
1491 ///
1492 /// Sets the *engine account id* path property to the given value.
1493 ///
1494 /// Even though the property as already been set when instantiating this call,
1495 /// we provide this method for API completeness.
1496 pub fn engine_account_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1497 self._engine_account_id = new_value;
1498 self
1499 }
1500 /// Last date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
1501 ///
1502 /// Sets the *end date* query property to the given value.
1503 ///
1504 /// Even though the property as already been set when instantiating this call,
1505 /// we provide this method for API completeness.
1506 pub fn end_date(mut self, new_value: i32) -> ConversionGetCall<'a, C> {
1507 self._end_date = new_value;
1508 self
1509 }
1510 /// The number of conversions to return per call.
1511 ///
1512 /// Sets the *row count* query property to the given value.
1513 ///
1514 /// Even though the property as already been set when instantiating this call,
1515 /// we provide this method for API completeness.
1516 pub fn row_count(mut self, new_value: i32) -> ConversionGetCall<'a, C> {
1517 self._row_count = new_value;
1518 self
1519 }
1520 /// First date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
1521 ///
1522 /// Sets the *start date* query property to the given value.
1523 ///
1524 /// Even though the property as already been set when instantiating this call,
1525 /// we provide this method for API completeness.
1526 pub fn start_date(mut self, new_value: i32) -> ConversionGetCall<'a, C> {
1527 self._start_date = new_value;
1528 self
1529 }
1530 /// The 0-based starting index for retrieving conversions results.
1531 ///
1532 /// Sets the *start row* query property to the given value.
1533 ///
1534 /// Even though the property as already been set when instantiating this call,
1535 /// we provide this method for API completeness.
1536 pub fn start_row(mut self, new_value: u32) -> ConversionGetCall<'a, C> {
1537 self._start_row = new_value;
1538 self
1539 }
1540 /// Customer ID of a client account in the new Search Ads 360 experience.
1541 ///
1542 /// Sets the *customer id* query property to the given value.
1543 pub fn customer_id(mut self, new_value: &str) -> ConversionGetCall<'a, C> {
1544 self._customer_id = Some(new_value.to_string());
1545 self
1546 }
1547 /// Numeric ID of the criterion.
1548 ///
1549 /// Sets the *criterion id* query property to the given value.
1550 pub fn criterion_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1551 self._criterion_id = Some(new_value);
1552 self
1553 }
1554 /// Numeric ID of the campaign.
1555 ///
1556 /// Sets the *campaign id* query property to the given value.
1557 pub fn campaign_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1558 self._campaign_id = Some(new_value);
1559 self
1560 }
1561 /// Numeric ID of the ad.
1562 ///
1563 /// Sets the *ad id* query property to the given value.
1564 pub fn ad_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1565 self._ad_id = Some(new_value);
1566 self
1567 }
1568 /// Numeric ID of the ad group.
1569 ///
1570 /// Sets the *ad group id* query property to the given value.
1571 pub fn ad_group_id(mut self, new_value: i64) -> ConversionGetCall<'a, C> {
1572 self._ad_group_id = Some(new_value);
1573 self
1574 }
1575 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1576 /// while executing the actual API request.
1577 ///
1578 /// ````text
1579 /// It should be used to handle progress information, and to implement a certain level of resilience.
1580 /// ````
1581 ///
1582 /// Sets the *delegate* property to the given value.
1583 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ConversionGetCall<'a, C> {
1584 self._delegate = Some(new_value);
1585 self
1586 }
1587
1588 /// Set any additional parameter of the query string used in the request.
1589 /// It should be used to set parameters which are not yet available through their own
1590 /// setters.
1591 ///
1592 /// Please note that this method must not be used to set any of the known parameters
1593 /// which have their own setter method. If done anyway, the request will fail.
1594 ///
1595 /// # Additional Parameters
1596 ///
1597 /// * *$.xgafv* (query-string) - V1 error format.
1598 /// * *access_token* (query-string) - OAuth access token.
1599 /// * *alt* (query-string) - Data format for response.
1600 /// * *callback* (query-string) - JSONP
1601 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1602 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1603 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1604 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1605 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1606 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1607 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1608 pub fn param<T>(mut self, name: T, value: T) -> ConversionGetCall<'a, C>
1609 where
1610 T: AsRef<str>,
1611 {
1612 self._additional_params
1613 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1614 self
1615 }
1616
1617 /// Identifies the authorization scope for the method you are building.
1618 ///
1619 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1620 /// [`Scope::Full`].
1621 ///
1622 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1623 /// tokens for more than one scope.
1624 ///
1625 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1626 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1627 /// sufficient, a read-write scope will do as well.
1628 pub fn add_scope<St>(mut self, scope: St) -> ConversionGetCall<'a, C>
1629 where
1630 St: AsRef<str>,
1631 {
1632 self._scopes.insert(String::from(scope.as_ref()));
1633 self
1634 }
1635 /// Identifies the authorization scope(s) for the method you are building.
1636 ///
1637 /// See [`Self::add_scope()`] for details.
1638 pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionGetCall<'a, C>
1639 where
1640 I: IntoIterator<Item = St>,
1641 St: AsRef<str>,
1642 {
1643 self._scopes
1644 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1645 self
1646 }
1647
1648 /// Removes all scopes, and no default scope will be used either.
1649 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1650 /// for details).
1651 pub fn clear_scopes(mut self) -> ConversionGetCall<'a, C> {
1652 self._scopes.clear();
1653 self
1654 }
1655}
1656
1657/// Retrieves a list of conversions from a DoubleClick Search engine account.
1658///
1659/// A builder for the *getByCustomerId* method supported by a *conversion* resource.
1660/// It is not used directly, but through a [`ConversionMethods`] instance.
1661///
1662/// # Example
1663///
1664/// Instantiate a resource method builder
1665///
1666/// ```test_harness,no_run
1667/// # extern crate hyper;
1668/// # extern crate hyper_rustls;
1669/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
1670/// # async fn dox() {
1671/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1672///
1673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1674/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1675/// # .with_native_roots()
1676/// # .unwrap()
1677/// # .https_only()
1678/// # .enable_http2()
1679/// # .build();
1680///
1681/// # let executor = hyper_util::rt::TokioExecutor::new();
1682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1683/// # secret,
1684/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1685/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1686/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1687/// # ),
1688/// # ).build().await.unwrap();
1689///
1690/// # let client = hyper_util::client::legacy::Client::builder(
1691/// # hyper_util::rt::TokioExecutor::new()
1692/// # )
1693/// # .build(
1694/// # hyper_rustls::HttpsConnectorBuilder::new()
1695/// # .with_native_roots()
1696/// # .unwrap()
1697/// # .https_or_http()
1698/// # .enable_http2()
1699/// # .build()
1700/// # );
1701/// # let mut hub = Doubleclicksearch::new(client, auth);
1702/// // You can configure optional parameters by calling the respective setters at will, and
1703/// // execute the final call using `doit()`.
1704/// // Values shown here are possibly random and not representative !
1705/// let result = hub.conversion().get_by_customer_id("customerId", -55, -88, -47, 81)
1706/// .engine_account_id(-50)
1707/// .criterion_id(-93)
1708/// .campaign_id(-37)
1709/// .agency_id(-12)
1710/// .advertiser_id(-16)
1711/// .ad_id(-57)
1712/// .ad_group_id(-50)
1713/// .doit().await;
1714/// # }
1715/// ```
1716pub struct ConversionGetByCustomerIdCall<'a, C>
1717where
1718 C: 'a,
1719{
1720 hub: &'a Doubleclicksearch<C>,
1721 _customer_id: String,
1722 _end_date: i32,
1723 _row_count: i32,
1724 _start_date: i32,
1725 _start_row: u32,
1726 _engine_account_id: Option<i64>,
1727 _criterion_id: Option<i64>,
1728 _campaign_id: Option<i64>,
1729 _agency_id: Option<i64>,
1730 _advertiser_id: Option<i64>,
1731 _ad_id: Option<i64>,
1732 _ad_group_id: Option<i64>,
1733 _delegate: Option<&'a mut dyn common::Delegate>,
1734 _additional_params: HashMap<String, String>,
1735 _scopes: BTreeSet<String>,
1736}
1737
1738impl<'a, C> common::CallBuilder for ConversionGetByCustomerIdCall<'a, C> {}
1739
1740impl<'a, C> ConversionGetByCustomerIdCall<'a, C>
1741where
1742 C: common::Connector,
1743{
1744 /// Perform the operation you have build so far.
1745 pub async fn doit(mut self) -> common::Result<(common::Response, ConversionList)> {
1746 use std::borrow::Cow;
1747 use std::io::{Read, Seek};
1748
1749 use common::{url::Params, ToParts};
1750 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1751
1752 let mut dd = common::DefaultDelegate;
1753 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1754 dlg.begin(common::MethodInfo {
1755 id: "doubleclicksearch.conversion.getByCustomerId",
1756 http_method: hyper::Method::GET,
1757 });
1758
1759 for &field in [
1760 "alt",
1761 "customerId",
1762 "endDate",
1763 "rowCount",
1764 "startDate",
1765 "startRow",
1766 "engineAccountId",
1767 "criterionId",
1768 "campaignId",
1769 "agencyId",
1770 "advertiserId",
1771 "adId",
1772 "adGroupId",
1773 ]
1774 .iter()
1775 {
1776 if self._additional_params.contains_key(field) {
1777 dlg.finished(false);
1778 return Err(common::Error::FieldClash(field));
1779 }
1780 }
1781
1782 let mut params = Params::with_capacity(14 + self._additional_params.len());
1783 params.push("customerId", self._customer_id);
1784 params.push("endDate", self._end_date.to_string());
1785 params.push("rowCount", self._row_count.to_string());
1786 params.push("startDate", self._start_date.to_string());
1787 params.push("startRow", self._start_row.to_string());
1788 if let Some(value) = self._engine_account_id.as_ref() {
1789 params.push("engineAccountId", value.to_string());
1790 }
1791 if let Some(value) = self._criterion_id.as_ref() {
1792 params.push("criterionId", value.to_string());
1793 }
1794 if let Some(value) = self._campaign_id.as_ref() {
1795 params.push("campaignId", value.to_string());
1796 }
1797 if let Some(value) = self._agency_id.as_ref() {
1798 params.push("agencyId", value.to_string());
1799 }
1800 if let Some(value) = self._advertiser_id.as_ref() {
1801 params.push("advertiserId", value.to_string());
1802 }
1803 if let Some(value) = self._ad_id.as_ref() {
1804 params.push("adId", value.to_string());
1805 }
1806 if let Some(value) = self._ad_group_id.as_ref() {
1807 params.push("adGroupId", value.to_string());
1808 }
1809
1810 params.extend(self._additional_params.iter());
1811
1812 params.push("alt", "json");
1813 let mut url =
1814 self.hub._base_url.clone() + "doubleclicksearch/v2/customer/{customerId}/conversion";
1815 if self._scopes.is_empty() {
1816 self._scopes.insert(Scope::Full.as_ref().to_string());
1817 }
1818
1819 #[allow(clippy::single_element_loop)]
1820 for &(find_this, param_name) in [("{customerId}", "customerId")].iter() {
1821 url = params.uri_replacement(url, param_name, find_this, false);
1822 }
1823 {
1824 let to_remove = ["customerId"];
1825 params.remove_params(&to_remove);
1826 }
1827
1828 let url = params.parse_with_url(&url);
1829
1830 loop {
1831 let token = match self
1832 .hub
1833 .auth
1834 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1835 .await
1836 {
1837 Ok(token) => token,
1838 Err(e) => match dlg.token(e) {
1839 Ok(token) => token,
1840 Err(e) => {
1841 dlg.finished(false);
1842 return Err(common::Error::MissingToken(e));
1843 }
1844 },
1845 };
1846 let mut req_result = {
1847 let client = &self.hub.client;
1848 dlg.pre_request();
1849 let mut req_builder = hyper::Request::builder()
1850 .method(hyper::Method::GET)
1851 .uri(url.as_str())
1852 .header(USER_AGENT, self.hub._user_agent.clone());
1853
1854 if let Some(token) = token.as_ref() {
1855 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1856 }
1857
1858 let request = req_builder
1859 .header(CONTENT_LENGTH, 0_u64)
1860 .body(common::to_body::<String>(None));
1861
1862 client.request(request.unwrap()).await
1863 };
1864
1865 match req_result {
1866 Err(err) => {
1867 if let common::Retry::After(d) = dlg.http_error(&err) {
1868 sleep(d).await;
1869 continue;
1870 }
1871 dlg.finished(false);
1872 return Err(common::Error::HttpError(err));
1873 }
1874 Ok(res) => {
1875 let (mut parts, body) = res.into_parts();
1876 let mut body = common::Body::new(body);
1877 if !parts.status.is_success() {
1878 let bytes = common::to_bytes(body).await.unwrap_or_default();
1879 let error = serde_json::from_str(&common::to_string(&bytes));
1880 let response = common::to_response(parts, bytes.into());
1881
1882 if let common::Retry::After(d) =
1883 dlg.http_failure(&response, error.as_ref().ok())
1884 {
1885 sleep(d).await;
1886 continue;
1887 }
1888
1889 dlg.finished(false);
1890
1891 return Err(match error {
1892 Ok(value) => common::Error::BadRequest(value),
1893 _ => common::Error::Failure(response),
1894 });
1895 }
1896 let response = {
1897 let bytes = common::to_bytes(body).await.unwrap_or_default();
1898 let encoded = common::to_string(&bytes);
1899 match serde_json::from_str(&encoded) {
1900 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1901 Err(error) => {
1902 dlg.response_json_decode_error(&encoded, &error);
1903 return Err(common::Error::JsonDecodeError(
1904 encoded.to_string(),
1905 error,
1906 ));
1907 }
1908 }
1909 };
1910
1911 dlg.finished(true);
1912 return Ok(response);
1913 }
1914 }
1915 }
1916 }
1917
1918 /// Customer ID of a client account in the new Search Ads 360 experience.
1919 ///
1920 /// Sets the *customer id* path property to the given value.
1921 ///
1922 /// Even though the property as already been set when instantiating this call,
1923 /// we provide this method for API completeness.
1924 pub fn customer_id(mut self, new_value: &str) -> ConversionGetByCustomerIdCall<'a, C> {
1925 self._customer_id = new_value.to_string();
1926 self
1927 }
1928 /// Last date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
1929 ///
1930 /// Sets the *end date* query property to the given value.
1931 ///
1932 /// Even though the property as already been set when instantiating this call,
1933 /// we provide this method for API completeness.
1934 pub fn end_date(mut self, new_value: i32) -> ConversionGetByCustomerIdCall<'a, C> {
1935 self._end_date = new_value;
1936 self
1937 }
1938 /// The number of conversions to return per call.
1939 ///
1940 /// Sets the *row count* query property to the given value.
1941 ///
1942 /// Even though the property as already been set when instantiating this call,
1943 /// we provide this method for API completeness.
1944 pub fn row_count(mut self, new_value: i32) -> ConversionGetByCustomerIdCall<'a, C> {
1945 self._row_count = new_value;
1946 self
1947 }
1948 /// First date (inclusive) on which to retrieve conversions. Format is yyyymmdd.
1949 ///
1950 /// Sets the *start date* query property to the given value.
1951 ///
1952 /// Even though the property as already been set when instantiating this call,
1953 /// we provide this method for API completeness.
1954 pub fn start_date(mut self, new_value: i32) -> ConversionGetByCustomerIdCall<'a, C> {
1955 self._start_date = new_value;
1956 self
1957 }
1958 /// The 0-based starting index for retrieving conversions results.
1959 ///
1960 /// Sets the *start row* query property to the given value.
1961 ///
1962 /// Even though the property as already been set when instantiating this call,
1963 /// we provide this method for API completeness.
1964 pub fn start_row(mut self, new_value: u32) -> ConversionGetByCustomerIdCall<'a, C> {
1965 self._start_row = new_value;
1966 self
1967 }
1968 /// Numeric ID of the engine account.
1969 ///
1970 /// Sets the *engine account id* query property to the given value.
1971 pub fn engine_account_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
1972 self._engine_account_id = Some(new_value);
1973 self
1974 }
1975 /// Numeric ID of the criterion.
1976 ///
1977 /// Sets the *criterion id* query property to the given value.
1978 pub fn criterion_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
1979 self._criterion_id = Some(new_value);
1980 self
1981 }
1982 /// Numeric ID of the campaign.
1983 ///
1984 /// Sets the *campaign id* query property to the given value.
1985 pub fn campaign_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
1986 self._campaign_id = Some(new_value);
1987 self
1988 }
1989 /// Numeric ID of the agency.
1990 ///
1991 /// Sets the *agency id* query property to the given value.
1992 pub fn agency_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
1993 self._agency_id = Some(new_value);
1994 self
1995 }
1996 /// Numeric ID of the advertiser.
1997 ///
1998 /// Sets the *advertiser id* query property to the given value.
1999 pub fn advertiser_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
2000 self._advertiser_id = Some(new_value);
2001 self
2002 }
2003 /// Numeric ID of the ad.
2004 ///
2005 /// Sets the *ad id* query property to the given value.
2006 pub fn ad_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
2007 self._ad_id = Some(new_value);
2008 self
2009 }
2010 /// Numeric ID of the ad group.
2011 ///
2012 /// Sets the *ad group id* query property to the given value.
2013 pub fn ad_group_id(mut self, new_value: i64) -> ConversionGetByCustomerIdCall<'a, C> {
2014 self._ad_group_id = Some(new_value);
2015 self
2016 }
2017 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2018 /// while executing the actual API request.
2019 ///
2020 /// ````text
2021 /// It should be used to handle progress information, and to implement a certain level of resilience.
2022 /// ````
2023 ///
2024 /// Sets the *delegate* property to the given value.
2025 pub fn delegate(
2026 mut self,
2027 new_value: &'a mut dyn common::Delegate,
2028 ) -> ConversionGetByCustomerIdCall<'a, C> {
2029 self._delegate = Some(new_value);
2030 self
2031 }
2032
2033 /// Set any additional parameter of the query string used in the request.
2034 /// It should be used to set parameters which are not yet available through their own
2035 /// setters.
2036 ///
2037 /// Please note that this method must not be used to set any of the known parameters
2038 /// which have their own setter method. If done anyway, the request will fail.
2039 ///
2040 /// # Additional Parameters
2041 ///
2042 /// * *$.xgafv* (query-string) - V1 error format.
2043 /// * *access_token* (query-string) - OAuth access token.
2044 /// * *alt* (query-string) - Data format for response.
2045 /// * *callback* (query-string) - JSONP
2046 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2047 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2048 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2049 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2050 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2051 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2052 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2053 pub fn param<T>(mut self, name: T, value: T) -> ConversionGetByCustomerIdCall<'a, C>
2054 where
2055 T: AsRef<str>,
2056 {
2057 self._additional_params
2058 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2059 self
2060 }
2061
2062 /// Identifies the authorization scope for the method you are building.
2063 ///
2064 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2065 /// [`Scope::Full`].
2066 ///
2067 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2068 /// tokens for more than one scope.
2069 ///
2070 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2071 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2072 /// sufficient, a read-write scope will do as well.
2073 pub fn add_scope<St>(mut self, scope: St) -> ConversionGetByCustomerIdCall<'a, C>
2074 where
2075 St: AsRef<str>,
2076 {
2077 self._scopes.insert(String::from(scope.as_ref()));
2078 self
2079 }
2080 /// Identifies the authorization scope(s) for the method you are building.
2081 ///
2082 /// See [`Self::add_scope()`] for details.
2083 pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionGetByCustomerIdCall<'a, C>
2084 where
2085 I: IntoIterator<Item = St>,
2086 St: AsRef<str>,
2087 {
2088 self._scopes
2089 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2090 self
2091 }
2092
2093 /// Removes all scopes, and no default scope will be used either.
2094 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2095 /// for details).
2096 pub fn clear_scopes(mut self) -> ConversionGetByCustomerIdCall<'a, C> {
2097 self._scopes.clear();
2098 self
2099 }
2100}
2101
2102/// Inserts a batch of new conversions into DoubleClick Search.
2103///
2104/// A builder for the *insert* method supported by a *conversion* resource.
2105/// It is not used directly, but through a [`ConversionMethods`] instance.
2106///
2107/// # Example
2108///
2109/// Instantiate a resource method builder
2110///
2111/// ```test_harness,no_run
2112/// # extern crate hyper;
2113/// # extern crate hyper_rustls;
2114/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
2115/// use doubleclicksearch2::api::ConversionList;
2116/// # async fn dox() {
2117/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2118///
2119/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2120/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2121/// # .with_native_roots()
2122/// # .unwrap()
2123/// # .https_only()
2124/// # .enable_http2()
2125/// # .build();
2126///
2127/// # let executor = hyper_util::rt::TokioExecutor::new();
2128/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2129/// # secret,
2130/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2131/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2132/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2133/// # ),
2134/// # ).build().await.unwrap();
2135///
2136/// # let client = hyper_util::client::legacy::Client::builder(
2137/// # hyper_util::rt::TokioExecutor::new()
2138/// # )
2139/// # .build(
2140/// # hyper_rustls::HttpsConnectorBuilder::new()
2141/// # .with_native_roots()
2142/// # .unwrap()
2143/// # .https_or_http()
2144/// # .enable_http2()
2145/// # .build()
2146/// # );
2147/// # let mut hub = Doubleclicksearch::new(client, auth);
2148/// // As the method needs a request, you would usually fill it with the desired information
2149/// // into the respective structure. Some of the parts shown here might not be applicable !
2150/// // Values shown here are possibly random and not representative !
2151/// let mut req = ConversionList::default();
2152///
2153/// // You can configure optional parameters by calling the respective setters at will, and
2154/// // execute the final call using `doit()`.
2155/// // Values shown here are possibly random and not representative !
2156/// let result = hub.conversion().insert(req)
2157/// .doit().await;
2158/// # }
2159/// ```
2160pub struct ConversionInsertCall<'a, C>
2161where
2162 C: 'a,
2163{
2164 hub: &'a Doubleclicksearch<C>,
2165 _request: ConversionList,
2166 _delegate: Option<&'a mut dyn common::Delegate>,
2167 _additional_params: HashMap<String, String>,
2168 _scopes: BTreeSet<String>,
2169}
2170
2171impl<'a, C> common::CallBuilder for ConversionInsertCall<'a, C> {}
2172
2173impl<'a, C> ConversionInsertCall<'a, C>
2174where
2175 C: common::Connector,
2176{
2177 /// Perform the operation you have build so far.
2178 pub async fn doit(mut self) -> common::Result<(common::Response, ConversionList)> {
2179 use std::borrow::Cow;
2180 use std::io::{Read, Seek};
2181
2182 use common::{url::Params, ToParts};
2183 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2184
2185 let mut dd = common::DefaultDelegate;
2186 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2187 dlg.begin(common::MethodInfo {
2188 id: "doubleclicksearch.conversion.insert",
2189 http_method: hyper::Method::POST,
2190 });
2191
2192 for &field in ["alt"].iter() {
2193 if self._additional_params.contains_key(field) {
2194 dlg.finished(false);
2195 return Err(common::Error::FieldClash(field));
2196 }
2197 }
2198
2199 let mut params = Params::with_capacity(3 + self._additional_params.len());
2200
2201 params.extend(self._additional_params.iter());
2202
2203 params.push("alt", "json");
2204 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/conversion";
2205 if self._scopes.is_empty() {
2206 self._scopes.insert(Scope::Full.as_ref().to_string());
2207 }
2208
2209 let url = params.parse_with_url(&url);
2210
2211 let mut json_mime_type = mime::APPLICATION_JSON;
2212 let mut request_value_reader = {
2213 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2214 common::remove_json_null_values(&mut value);
2215 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2216 serde_json::to_writer(&mut dst, &value).unwrap();
2217 dst
2218 };
2219 let request_size = request_value_reader
2220 .seek(std::io::SeekFrom::End(0))
2221 .unwrap();
2222 request_value_reader
2223 .seek(std::io::SeekFrom::Start(0))
2224 .unwrap();
2225
2226 loop {
2227 let token = match self
2228 .hub
2229 .auth
2230 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2231 .await
2232 {
2233 Ok(token) => token,
2234 Err(e) => match dlg.token(e) {
2235 Ok(token) => token,
2236 Err(e) => {
2237 dlg.finished(false);
2238 return Err(common::Error::MissingToken(e));
2239 }
2240 },
2241 };
2242 request_value_reader
2243 .seek(std::io::SeekFrom::Start(0))
2244 .unwrap();
2245 let mut req_result = {
2246 let client = &self.hub.client;
2247 dlg.pre_request();
2248 let mut req_builder = hyper::Request::builder()
2249 .method(hyper::Method::POST)
2250 .uri(url.as_str())
2251 .header(USER_AGENT, self.hub._user_agent.clone());
2252
2253 if let Some(token) = token.as_ref() {
2254 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2255 }
2256
2257 let request = req_builder
2258 .header(CONTENT_TYPE, json_mime_type.to_string())
2259 .header(CONTENT_LENGTH, request_size as u64)
2260 .body(common::to_body(
2261 request_value_reader.get_ref().clone().into(),
2262 ));
2263
2264 client.request(request.unwrap()).await
2265 };
2266
2267 match req_result {
2268 Err(err) => {
2269 if let common::Retry::After(d) = dlg.http_error(&err) {
2270 sleep(d).await;
2271 continue;
2272 }
2273 dlg.finished(false);
2274 return Err(common::Error::HttpError(err));
2275 }
2276 Ok(res) => {
2277 let (mut parts, body) = res.into_parts();
2278 let mut body = common::Body::new(body);
2279 if !parts.status.is_success() {
2280 let bytes = common::to_bytes(body).await.unwrap_or_default();
2281 let error = serde_json::from_str(&common::to_string(&bytes));
2282 let response = common::to_response(parts, bytes.into());
2283
2284 if let common::Retry::After(d) =
2285 dlg.http_failure(&response, error.as_ref().ok())
2286 {
2287 sleep(d).await;
2288 continue;
2289 }
2290
2291 dlg.finished(false);
2292
2293 return Err(match error {
2294 Ok(value) => common::Error::BadRequest(value),
2295 _ => common::Error::Failure(response),
2296 });
2297 }
2298 let response = {
2299 let bytes = common::to_bytes(body).await.unwrap_or_default();
2300 let encoded = common::to_string(&bytes);
2301 match serde_json::from_str(&encoded) {
2302 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2303 Err(error) => {
2304 dlg.response_json_decode_error(&encoded, &error);
2305 return Err(common::Error::JsonDecodeError(
2306 encoded.to_string(),
2307 error,
2308 ));
2309 }
2310 }
2311 };
2312
2313 dlg.finished(true);
2314 return Ok(response);
2315 }
2316 }
2317 }
2318 }
2319
2320 ///
2321 /// Sets the *request* property to the given value.
2322 ///
2323 /// Even though the property as already been set when instantiating this call,
2324 /// we provide this method for API completeness.
2325 pub fn request(mut self, new_value: ConversionList) -> ConversionInsertCall<'a, C> {
2326 self._request = new_value;
2327 self
2328 }
2329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2330 /// while executing the actual API request.
2331 ///
2332 /// ````text
2333 /// It should be used to handle progress information, and to implement a certain level of resilience.
2334 /// ````
2335 ///
2336 /// Sets the *delegate* property to the given value.
2337 pub fn delegate(
2338 mut self,
2339 new_value: &'a mut dyn common::Delegate,
2340 ) -> ConversionInsertCall<'a, C> {
2341 self._delegate = Some(new_value);
2342 self
2343 }
2344
2345 /// Set any additional parameter of the query string used in the request.
2346 /// It should be used to set parameters which are not yet available through their own
2347 /// setters.
2348 ///
2349 /// Please note that this method must not be used to set any of the known parameters
2350 /// which have their own setter method. If done anyway, the request will fail.
2351 ///
2352 /// # Additional Parameters
2353 ///
2354 /// * *$.xgafv* (query-string) - V1 error format.
2355 /// * *access_token* (query-string) - OAuth access token.
2356 /// * *alt* (query-string) - Data format for response.
2357 /// * *callback* (query-string) - JSONP
2358 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2359 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2360 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2361 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2362 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2363 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2364 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2365 pub fn param<T>(mut self, name: T, value: T) -> ConversionInsertCall<'a, C>
2366 where
2367 T: AsRef<str>,
2368 {
2369 self._additional_params
2370 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2371 self
2372 }
2373
2374 /// Identifies the authorization scope for the method you are building.
2375 ///
2376 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2377 /// [`Scope::Full`].
2378 ///
2379 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2380 /// tokens for more than one scope.
2381 ///
2382 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2383 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2384 /// sufficient, a read-write scope will do as well.
2385 pub fn add_scope<St>(mut self, scope: St) -> ConversionInsertCall<'a, C>
2386 where
2387 St: AsRef<str>,
2388 {
2389 self._scopes.insert(String::from(scope.as_ref()));
2390 self
2391 }
2392 /// Identifies the authorization scope(s) for the method you are building.
2393 ///
2394 /// See [`Self::add_scope()`] for details.
2395 pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionInsertCall<'a, C>
2396 where
2397 I: IntoIterator<Item = St>,
2398 St: AsRef<str>,
2399 {
2400 self._scopes
2401 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2402 self
2403 }
2404
2405 /// Removes all scopes, and no default scope will be used either.
2406 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2407 /// for details).
2408 pub fn clear_scopes(mut self) -> ConversionInsertCall<'a, C> {
2409 self._scopes.clear();
2410 self
2411 }
2412}
2413
2414/// Updates a batch of conversions in DoubleClick Search.
2415///
2416/// A builder for the *update* method supported by a *conversion* resource.
2417/// It is not used directly, but through a [`ConversionMethods`] instance.
2418///
2419/// # Example
2420///
2421/// Instantiate a resource method builder
2422///
2423/// ```test_harness,no_run
2424/// # extern crate hyper;
2425/// # extern crate hyper_rustls;
2426/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
2427/// use doubleclicksearch2::api::ConversionList;
2428/// # async fn dox() {
2429/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2430///
2431/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2432/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2433/// # .with_native_roots()
2434/// # .unwrap()
2435/// # .https_only()
2436/// # .enable_http2()
2437/// # .build();
2438///
2439/// # let executor = hyper_util::rt::TokioExecutor::new();
2440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2441/// # secret,
2442/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2443/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2444/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2445/// # ),
2446/// # ).build().await.unwrap();
2447///
2448/// # let client = hyper_util::client::legacy::Client::builder(
2449/// # hyper_util::rt::TokioExecutor::new()
2450/// # )
2451/// # .build(
2452/// # hyper_rustls::HttpsConnectorBuilder::new()
2453/// # .with_native_roots()
2454/// # .unwrap()
2455/// # .https_or_http()
2456/// # .enable_http2()
2457/// # .build()
2458/// # );
2459/// # let mut hub = Doubleclicksearch::new(client, auth);
2460/// // As the method needs a request, you would usually fill it with the desired information
2461/// // into the respective structure. Some of the parts shown here might not be applicable !
2462/// // Values shown here are possibly random and not representative !
2463/// let mut req = ConversionList::default();
2464///
2465/// // You can configure optional parameters by calling the respective setters at will, and
2466/// // execute the final call using `doit()`.
2467/// // Values shown here are possibly random and not representative !
2468/// let result = hub.conversion().update(req)
2469/// .doit().await;
2470/// # }
2471/// ```
2472pub struct ConversionUpdateCall<'a, C>
2473where
2474 C: 'a,
2475{
2476 hub: &'a Doubleclicksearch<C>,
2477 _request: ConversionList,
2478 _delegate: Option<&'a mut dyn common::Delegate>,
2479 _additional_params: HashMap<String, String>,
2480 _scopes: BTreeSet<String>,
2481}
2482
2483impl<'a, C> common::CallBuilder for ConversionUpdateCall<'a, C> {}
2484
2485impl<'a, C> ConversionUpdateCall<'a, C>
2486where
2487 C: common::Connector,
2488{
2489 /// Perform the operation you have build so far.
2490 pub async fn doit(mut self) -> common::Result<(common::Response, ConversionList)> {
2491 use std::borrow::Cow;
2492 use std::io::{Read, Seek};
2493
2494 use common::{url::Params, ToParts};
2495 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2496
2497 let mut dd = common::DefaultDelegate;
2498 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2499 dlg.begin(common::MethodInfo {
2500 id: "doubleclicksearch.conversion.update",
2501 http_method: hyper::Method::PUT,
2502 });
2503
2504 for &field in ["alt"].iter() {
2505 if self._additional_params.contains_key(field) {
2506 dlg.finished(false);
2507 return Err(common::Error::FieldClash(field));
2508 }
2509 }
2510
2511 let mut params = Params::with_capacity(3 + self._additional_params.len());
2512
2513 params.extend(self._additional_params.iter());
2514
2515 params.push("alt", "json");
2516 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/conversion";
2517 if self._scopes.is_empty() {
2518 self._scopes.insert(Scope::Full.as_ref().to_string());
2519 }
2520
2521 let url = params.parse_with_url(&url);
2522
2523 let mut json_mime_type = mime::APPLICATION_JSON;
2524 let mut request_value_reader = {
2525 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2526 common::remove_json_null_values(&mut value);
2527 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2528 serde_json::to_writer(&mut dst, &value).unwrap();
2529 dst
2530 };
2531 let request_size = request_value_reader
2532 .seek(std::io::SeekFrom::End(0))
2533 .unwrap();
2534 request_value_reader
2535 .seek(std::io::SeekFrom::Start(0))
2536 .unwrap();
2537
2538 loop {
2539 let token = match self
2540 .hub
2541 .auth
2542 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2543 .await
2544 {
2545 Ok(token) => token,
2546 Err(e) => match dlg.token(e) {
2547 Ok(token) => token,
2548 Err(e) => {
2549 dlg.finished(false);
2550 return Err(common::Error::MissingToken(e));
2551 }
2552 },
2553 };
2554 request_value_reader
2555 .seek(std::io::SeekFrom::Start(0))
2556 .unwrap();
2557 let mut req_result = {
2558 let client = &self.hub.client;
2559 dlg.pre_request();
2560 let mut req_builder = hyper::Request::builder()
2561 .method(hyper::Method::PUT)
2562 .uri(url.as_str())
2563 .header(USER_AGENT, self.hub._user_agent.clone());
2564
2565 if let Some(token) = token.as_ref() {
2566 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2567 }
2568
2569 let request = req_builder
2570 .header(CONTENT_TYPE, json_mime_type.to_string())
2571 .header(CONTENT_LENGTH, request_size as u64)
2572 .body(common::to_body(
2573 request_value_reader.get_ref().clone().into(),
2574 ));
2575
2576 client.request(request.unwrap()).await
2577 };
2578
2579 match req_result {
2580 Err(err) => {
2581 if let common::Retry::After(d) = dlg.http_error(&err) {
2582 sleep(d).await;
2583 continue;
2584 }
2585 dlg.finished(false);
2586 return Err(common::Error::HttpError(err));
2587 }
2588 Ok(res) => {
2589 let (mut parts, body) = res.into_parts();
2590 let mut body = common::Body::new(body);
2591 if !parts.status.is_success() {
2592 let bytes = common::to_bytes(body).await.unwrap_or_default();
2593 let error = serde_json::from_str(&common::to_string(&bytes));
2594 let response = common::to_response(parts, bytes.into());
2595
2596 if let common::Retry::After(d) =
2597 dlg.http_failure(&response, error.as_ref().ok())
2598 {
2599 sleep(d).await;
2600 continue;
2601 }
2602
2603 dlg.finished(false);
2604
2605 return Err(match error {
2606 Ok(value) => common::Error::BadRequest(value),
2607 _ => common::Error::Failure(response),
2608 });
2609 }
2610 let response = {
2611 let bytes = common::to_bytes(body).await.unwrap_or_default();
2612 let encoded = common::to_string(&bytes);
2613 match serde_json::from_str(&encoded) {
2614 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2615 Err(error) => {
2616 dlg.response_json_decode_error(&encoded, &error);
2617 return Err(common::Error::JsonDecodeError(
2618 encoded.to_string(),
2619 error,
2620 ));
2621 }
2622 }
2623 };
2624
2625 dlg.finished(true);
2626 return Ok(response);
2627 }
2628 }
2629 }
2630 }
2631
2632 ///
2633 /// Sets the *request* property to the given value.
2634 ///
2635 /// Even though the property as already been set when instantiating this call,
2636 /// we provide this method for API completeness.
2637 pub fn request(mut self, new_value: ConversionList) -> ConversionUpdateCall<'a, C> {
2638 self._request = new_value;
2639 self
2640 }
2641 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2642 /// while executing the actual API request.
2643 ///
2644 /// ````text
2645 /// It should be used to handle progress information, and to implement a certain level of resilience.
2646 /// ````
2647 ///
2648 /// Sets the *delegate* property to the given value.
2649 pub fn delegate(
2650 mut self,
2651 new_value: &'a mut dyn common::Delegate,
2652 ) -> ConversionUpdateCall<'a, C> {
2653 self._delegate = Some(new_value);
2654 self
2655 }
2656
2657 /// Set any additional parameter of the query string used in the request.
2658 /// It should be used to set parameters which are not yet available through their own
2659 /// setters.
2660 ///
2661 /// Please note that this method must not be used to set any of the known parameters
2662 /// which have their own setter method. If done anyway, the request will fail.
2663 ///
2664 /// # Additional Parameters
2665 ///
2666 /// * *$.xgafv* (query-string) - V1 error format.
2667 /// * *access_token* (query-string) - OAuth access token.
2668 /// * *alt* (query-string) - Data format for response.
2669 /// * *callback* (query-string) - JSONP
2670 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2671 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2672 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2673 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2674 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2675 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2676 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2677 pub fn param<T>(mut self, name: T, value: T) -> ConversionUpdateCall<'a, C>
2678 where
2679 T: AsRef<str>,
2680 {
2681 self._additional_params
2682 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2683 self
2684 }
2685
2686 /// Identifies the authorization scope for the method you are building.
2687 ///
2688 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2689 /// [`Scope::Full`].
2690 ///
2691 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2692 /// tokens for more than one scope.
2693 ///
2694 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2695 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2696 /// sufficient, a read-write scope will do as well.
2697 pub fn add_scope<St>(mut self, scope: St) -> ConversionUpdateCall<'a, C>
2698 where
2699 St: AsRef<str>,
2700 {
2701 self._scopes.insert(String::from(scope.as_ref()));
2702 self
2703 }
2704 /// Identifies the authorization scope(s) for the method you are building.
2705 ///
2706 /// See [`Self::add_scope()`] for details.
2707 pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionUpdateCall<'a, C>
2708 where
2709 I: IntoIterator<Item = St>,
2710 St: AsRef<str>,
2711 {
2712 self._scopes
2713 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2714 self
2715 }
2716
2717 /// Removes all scopes, and no default scope will be used either.
2718 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2719 /// for details).
2720 pub fn clear_scopes(mut self) -> ConversionUpdateCall<'a, C> {
2721 self._scopes.clear();
2722 self
2723 }
2724}
2725
2726/// Updates the availabilities of a batch of floodlight activities in DoubleClick Search.
2727///
2728/// A builder for the *updateAvailability* method supported by a *conversion* resource.
2729/// It is not used directly, but through a [`ConversionMethods`] instance.
2730///
2731/// # Example
2732///
2733/// Instantiate a resource method builder
2734///
2735/// ```test_harness,no_run
2736/// # extern crate hyper;
2737/// # extern crate hyper_rustls;
2738/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
2739/// use doubleclicksearch2::api::UpdateAvailabilityRequest;
2740/// # async fn dox() {
2741/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2742///
2743/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2744/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2745/// # .with_native_roots()
2746/// # .unwrap()
2747/// # .https_only()
2748/// # .enable_http2()
2749/// # .build();
2750///
2751/// # let executor = hyper_util::rt::TokioExecutor::new();
2752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2753/// # secret,
2754/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2755/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2756/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2757/// # ),
2758/// # ).build().await.unwrap();
2759///
2760/// # let client = hyper_util::client::legacy::Client::builder(
2761/// # hyper_util::rt::TokioExecutor::new()
2762/// # )
2763/// # .build(
2764/// # hyper_rustls::HttpsConnectorBuilder::new()
2765/// # .with_native_roots()
2766/// # .unwrap()
2767/// # .https_or_http()
2768/// # .enable_http2()
2769/// # .build()
2770/// # );
2771/// # let mut hub = Doubleclicksearch::new(client, auth);
2772/// // As the method needs a request, you would usually fill it with the desired information
2773/// // into the respective structure. Some of the parts shown here might not be applicable !
2774/// // Values shown here are possibly random and not representative !
2775/// let mut req = UpdateAvailabilityRequest::default();
2776///
2777/// // You can configure optional parameters by calling the respective setters at will, and
2778/// // execute the final call using `doit()`.
2779/// // Values shown here are possibly random and not representative !
2780/// let result = hub.conversion().update_availability(req)
2781/// .doit().await;
2782/// # }
2783/// ```
2784pub struct ConversionUpdateAvailabilityCall<'a, C>
2785where
2786 C: 'a,
2787{
2788 hub: &'a Doubleclicksearch<C>,
2789 _request: UpdateAvailabilityRequest,
2790 _delegate: Option<&'a mut dyn common::Delegate>,
2791 _additional_params: HashMap<String, String>,
2792 _scopes: BTreeSet<String>,
2793}
2794
2795impl<'a, C> common::CallBuilder for ConversionUpdateAvailabilityCall<'a, C> {}
2796
2797impl<'a, C> ConversionUpdateAvailabilityCall<'a, C>
2798where
2799 C: common::Connector,
2800{
2801 /// Perform the operation you have build so far.
2802 pub async fn doit(mut self) -> common::Result<(common::Response, UpdateAvailabilityResponse)> {
2803 use std::borrow::Cow;
2804 use std::io::{Read, Seek};
2805
2806 use common::{url::Params, ToParts};
2807 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2808
2809 let mut dd = common::DefaultDelegate;
2810 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2811 dlg.begin(common::MethodInfo {
2812 id: "doubleclicksearch.conversion.updateAvailability",
2813 http_method: hyper::Method::POST,
2814 });
2815
2816 for &field in ["alt"].iter() {
2817 if self._additional_params.contains_key(field) {
2818 dlg.finished(false);
2819 return Err(common::Error::FieldClash(field));
2820 }
2821 }
2822
2823 let mut params = Params::with_capacity(3 + self._additional_params.len());
2824
2825 params.extend(self._additional_params.iter());
2826
2827 params.push("alt", "json");
2828 let mut url =
2829 self.hub._base_url.clone() + "doubleclicksearch/v2/conversion/updateAvailability";
2830 if self._scopes.is_empty() {
2831 self._scopes.insert(Scope::Full.as_ref().to_string());
2832 }
2833
2834 let url = params.parse_with_url(&url);
2835
2836 let mut json_mime_type = mime::APPLICATION_JSON;
2837 let mut request_value_reader = {
2838 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2839 common::remove_json_null_values(&mut value);
2840 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2841 serde_json::to_writer(&mut dst, &value).unwrap();
2842 dst
2843 };
2844 let request_size = request_value_reader
2845 .seek(std::io::SeekFrom::End(0))
2846 .unwrap();
2847 request_value_reader
2848 .seek(std::io::SeekFrom::Start(0))
2849 .unwrap();
2850
2851 loop {
2852 let token = match self
2853 .hub
2854 .auth
2855 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2856 .await
2857 {
2858 Ok(token) => token,
2859 Err(e) => match dlg.token(e) {
2860 Ok(token) => token,
2861 Err(e) => {
2862 dlg.finished(false);
2863 return Err(common::Error::MissingToken(e));
2864 }
2865 },
2866 };
2867 request_value_reader
2868 .seek(std::io::SeekFrom::Start(0))
2869 .unwrap();
2870 let mut req_result = {
2871 let client = &self.hub.client;
2872 dlg.pre_request();
2873 let mut req_builder = hyper::Request::builder()
2874 .method(hyper::Method::POST)
2875 .uri(url.as_str())
2876 .header(USER_AGENT, self.hub._user_agent.clone());
2877
2878 if let Some(token) = token.as_ref() {
2879 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2880 }
2881
2882 let request = req_builder
2883 .header(CONTENT_TYPE, json_mime_type.to_string())
2884 .header(CONTENT_LENGTH, request_size as u64)
2885 .body(common::to_body(
2886 request_value_reader.get_ref().clone().into(),
2887 ));
2888
2889 client.request(request.unwrap()).await
2890 };
2891
2892 match req_result {
2893 Err(err) => {
2894 if let common::Retry::After(d) = dlg.http_error(&err) {
2895 sleep(d).await;
2896 continue;
2897 }
2898 dlg.finished(false);
2899 return Err(common::Error::HttpError(err));
2900 }
2901 Ok(res) => {
2902 let (mut parts, body) = res.into_parts();
2903 let mut body = common::Body::new(body);
2904 if !parts.status.is_success() {
2905 let bytes = common::to_bytes(body).await.unwrap_or_default();
2906 let error = serde_json::from_str(&common::to_string(&bytes));
2907 let response = common::to_response(parts, bytes.into());
2908
2909 if let common::Retry::After(d) =
2910 dlg.http_failure(&response, error.as_ref().ok())
2911 {
2912 sleep(d).await;
2913 continue;
2914 }
2915
2916 dlg.finished(false);
2917
2918 return Err(match error {
2919 Ok(value) => common::Error::BadRequest(value),
2920 _ => common::Error::Failure(response),
2921 });
2922 }
2923 let response = {
2924 let bytes = common::to_bytes(body).await.unwrap_or_default();
2925 let encoded = common::to_string(&bytes);
2926 match serde_json::from_str(&encoded) {
2927 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2928 Err(error) => {
2929 dlg.response_json_decode_error(&encoded, &error);
2930 return Err(common::Error::JsonDecodeError(
2931 encoded.to_string(),
2932 error,
2933 ));
2934 }
2935 }
2936 };
2937
2938 dlg.finished(true);
2939 return Ok(response);
2940 }
2941 }
2942 }
2943 }
2944
2945 ///
2946 /// Sets the *request* property to the given value.
2947 ///
2948 /// Even though the property as already been set when instantiating this call,
2949 /// we provide this method for API completeness.
2950 pub fn request(
2951 mut self,
2952 new_value: UpdateAvailabilityRequest,
2953 ) -> ConversionUpdateAvailabilityCall<'a, C> {
2954 self._request = new_value;
2955 self
2956 }
2957 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2958 /// while executing the actual API request.
2959 ///
2960 /// ````text
2961 /// It should be used to handle progress information, and to implement a certain level of resilience.
2962 /// ````
2963 ///
2964 /// Sets the *delegate* property to the given value.
2965 pub fn delegate(
2966 mut self,
2967 new_value: &'a mut dyn common::Delegate,
2968 ) -> ConversionUpdateAvailabilityCall<'a, C> {
2969 self._delegate = Some(new_value);
2970 self
2971 }
2972
2973 /// Set any additional parameter of the query string used in the request.
2974 /// It should be used to set parameters which are not yet available through their own
2975 /// setters.
2976 ///
2977 /// Please note that this method must not be used to set any of the known parameters
2978 /// which have their own setter method. If done anyway, the request will fail.
2979 ///
2980 /// # Additional Parameters
2981 ///
2982 /// * *$.xgafv* (query-string) - V1 error format.
2983 /// * *access_token* (query-string) - OAuth access token.
2984 /// * *alt* (query-string) - Data format for response.
2985 /// * *callback* (query-string) - JSONP
2986 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2987 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2988 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2989 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2990 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2991 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2992 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2993 pub fn param<T>(mut self, name: T, value: T) -> ConversionUpdateAvailabilityCall<'a, C>
2994 where
2995 T: AsRef<str>,
2996 {
2997 self._additional_params
2998 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2999 self
3000 }
3001
3002 /// Identifies the authorization scope for the method you are building.
3003 ///
3004 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3005 /// [`Scope::Full`].
3006 ///
3007 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3008 /// tokens for more than one scope.
3009 ///
3010 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3011 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3012 /// sufficient, a read-write scope will do as well.
3013 pub fn add_scope<St>(mut self, scope: St) -> ConversionUpdateAvailabilityCall<'a, C>
3014 where
3015 St: AsRef<str>,
3016 {
3017 self._scopes.insert(String::from(scope.as_ref()));
3018 self
3019 }
3020 /// Identifies the authorization scope(s) for the method you are building.
3021 ///
3022 /// See [`Self::add_scope()`] for details.
3023 pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionUpdateAvailabilityCall<'a, C>
3024 where
3025 I: IntoIterator<Item = St>,
3026 St: AsRef<str>,
3027 {
3028 self._scopes
3029 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3030 self
3031 }
3032
3033 /// Removes all scopes, and no default scope will be used either.
3034 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3035 /// for details).
3036 pub fn clear_scopes(mut self) -> ConversionUpdateAvailabilityCall<'a, C> {
3037 self._scopes.clear();
3038 self
3039 }
3040}
3041
3042/// Generates and returns a report immediately.
3043///
3044/// A builder for the *generate* method supported by a *report* resource.
3045/// It is not used directly, but through a [`ReportMethods`] instance.
3046///
3047/// # Example
3048///
3049/// Instantiate a resource method builder
3050///
3051/// ```test_harness,no_run
3052/// # extern crate hyper;
3053/// # extern crate hyper_rustls;
3054/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
3055/// use doubleclicksearch2::api::ReportRequest;
3056/// # async fn dox() {
3057/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3058///
3059/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3060/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3061/// # .with_native_roots()
3062/// # .unwrap()
3063/// # .https_only()
3064/// # .enable_http2()
3065/// # .build();
3066///
3067/// # let executor = hyper_util::rt::TokioExecutor::new();
3068/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3069/// # secret,
3070/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3071/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3072/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3073/// # ),
3074/// # ).build().await.unwrap();
3075///
3076/// # let client = hyper_util::client::legacy::Client::builder(
3077/// # hyper_util::rt::TokioExecutor::new()
3078/// # )
3079/// # .build(
3080/// # hyper_rustls::HttpsConnectorBuilder::new()
3081/// # .with_native_roots()
3082/// # .unwrap()
3083/// # .https_or_http()
3084/// # .enable_http2()
3085/// # .build()
3086/// # );
3087/// # let mut hub = Doubleclicksearch::new(client, auth);
3088/// // As the method needs a request, you would usually fill it with the desired information
3089/// // into the respective structure. Some of the parts shown here might not be applicable !
3090/// // Values shown here are possibly random and not representative !
3091/// let mut req = ReportRequest::default();
3092///
3093/// // You can configure optional parameters by calling the respective setters at will, and
3094/// // execute the final call using `doit()`.
3095/// // Values shown here are possibly random and not representative !
3096/// let result = hub.reports().generate(req)
3097/// .doit().await;
3098/// # }
3099/// ```
3100pub struct ReportGenerateCall<'a, C>
3101where
3102 C: 'a,
3103{
3104 hub: &'a Doubleclicksearch<C>,
3105 _request: ReportRequest,
3106 _delegate: Option<&'a mut dyn common::Delegate>,
3107 _additional_params: HashMap<String, String>,
3108 _scopes: BTreeSet<String>,
3109}
3110
3111impl<'a, C> common::CallBuilder for ReportGenerateCall<'a, C> {}
3112
3113impl<'a, C> ReportGenerateCall<'a, C>
3114where
3115 C: common::Connector,
3116{
3117 /// Perform the operation you have build so far.
3118 pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
3119 use std::borrow::Cow;
3120 use std::io::{Read, Seek};
3121
3122 use common::{url::Params, ToParts};
3123 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3124
3125 let mut dd = common::DefaultDelegate;
3126 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3127 dlg.begin(common::MethodInfo {
3128 id: "doubleclicksearch.reports.generate",
3129 http_method: hyper::Method::POST,
3130 });
3131
3132 for &field in ["alt"].iter() {
3133 if self._additional_params.contains_key(field) {
3134 dlg.finished(false);
3135 return Err(common::Error::FieldClash(field));
3136 }
3137 }
3138
3139 let mut params = Params::with_capacity(3 + self._additional_params.len());
3140
3141 params.extend(self._additional_params.iter());
3142
3143 params.push("alt", "json");
3144 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/reports/generate";
3145 if self._scopes.is_empty() {
3146 self._scopes.insert(Scope::Full.as_ref().to_string());
3147 }
3148
3149 let url = params.parse_with_url(&url);
3150
3151 let mut json_mime_type = mime::APPLICATION_JSON;
3152 let mut request_value_reader = {
3153 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3154 common::remove_json_null_values(&mut value);
3155 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3156 serde_json::to_writer(&mut dst, &value).unwrap();
3157 dst
3158 };
3159 let request_size = request_value_reader
3160 .seek(std::io::SeekFrom::End(0))
3161 .unwrap();
3162 request_value_reader
3163 .seek(std::io::SeekFrom::Start(0))
3164 .unwrap();
3165
3166 loop {
3167 let token = match self
3168 .hub
3169 .auth
3170 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3171 .await
3172 {
3173 Ok(token) => token,
3174 Err(e) => match dlg.token(e) {
3175 Ok(token) => token,
3176 Err(e) => {
3177 dlg.finished(false);
3178 return Err(common::Error::MissingToken(e));
3179 }
3180 },
3181 };
3182 request_value_reader
3183 .seek(std::io::SeekFrom::Start(0))
3184 .unwrap();
3185 let mut req_result = {
3186 let client = &self.hub.client;
3187 dlg.pre_request();
3188 let mut req_builder = hyper::Request::builder()
3189 .method(hyper::Method::POST)
3190 .uri(url.as_str())
3191 .header(USER_AGENT, self.hub._user_agent.clone());
3192
3193 if let Some(token) = token.as_ref() {
3194 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3195 }
3196
3197 let request = req_builder
3198 .header(CONTENT_TYPE, json_mime_type.to_string())
3199 .header(CONTENT_LENGTH, request_size as u64)
3200 .body(common::to_body(
3201 request_value_reader.get_ref().clone().into(),
3202 ));
3203
3204 client.request(request.unwrap()).await
3205 };
3206
3207 match req_result {
3208 Err(err) => {
3209 if let common::Retry::After(d) = dlg.http_error(&err) {
3210 sleep(d).await;
3211 continue;
3212 }
3213 dlg.finished(false);
3214 return Err(common::Error::HttpError(err));
3215 }
3216 Ok(res) => {
3217 let (mut parts, body) = res.into_parts();
3218 let mut body = common::Body::new(body);
3219 if !parts.status.is_success() {
3220 let bytes = common::to_bytes(body).await.unwrap_or_default();
3221 let error = serde_json::from_str(&common::to_string(&bytes));
3222 let response = common::to_response(parts, bytes.into());
3223
3224 if let common::Retry::After(d) =
3225 dlg.http_failure(&response, error.as_ref().ok())
3226 {
3227 sleep(d).await;
3228 continue;
3229 }
3230
3231 dlg.finished(false);
3232
3233 return Err(match error {
3234 Ok(value) => common::Error::BadRequest(value),
3235 _ => common::Error::Failure(response),
3236 });
3237 }
3238 let response = {
3239 let bytes = common::to_bytes(body).await.unwrap_or_default();
3240 let encoded = common::to_string(&bytes);
3241 match serde_json::from_str(&encoded) {
3242 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3243 Err(error) => {
3244 dlg.response_json_decode_error(&encoded, &error);
3245 return Err(common::Error::JsonDecodeError(
3246 encoded.to_string(),
3247 error,
3248 ));
3249 }
3250 }
3251 };
3252
3253 dlg.finished(true);
3254 return Ok(response);
3255 }
3256 }
3257 }
3258 }
3259
3260 ///
3261 /// Sets the *request* property to the given value.
3262 ///
3263 /// Even though the property as already been set when instantiating this call,
3264 /// we provide this method for API completeness.
3265 pub fn request(mut self, new_value: ReportRequest) -> ReportGenerateCall<'a, C> {
3266 self._request = new_value;
3267 self
3268 }
3269 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3270 /// while executing the actual API request.
3271 ///
3272 /// ````text
3273 /// It should be used to handle progress information, and to implement a certain level of resilience.
3274 /// ````
3275 ///
3276 /// Sets the *delegate* property to the given value.
3277 pub fn delegate(
3278 mut self,
3279 new_value: &'a mut dyn common::Delegate,
3280 ) -> ReportGenerateCall<'a, C> {
3281 self._delegate = Some(new_value);
3282 self
3283 }
3284
3285 /// Set any additional parameter of the query string used in the request.
3286 /// It should be used to set parameters which are not yet available through their own
3287 /// setters.
3288 ///
3289 /// Please note that this method must not be used to set any of the known parameters
3290 /// which have their own setter method. If done anyway, the request will fail.
3291 ///
3292 /// # Additional Parameters
3293 ///
3294 /// * *$.xgafv* (query-string) - V1 error format.
3295 /// * *access_token* (query-string) - OAuth access token.
3296 /// * *alt* (query-string) - Data format for response.
3297 /// * *callback* (query-string) - JSONP
3298 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3299 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3300 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3301 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3302 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3303 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3304 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3305 pub fn param<T>(mut self, name: T, value: T) -> ReportGenerateCall<'a, C>
3306 where
3307 T: AsRef<str>,
3308 {
3309 self._additional_params
3310 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3311 self
3312 }
3313
3314 /// Identifies the authorization scope for the method you are building.
3315 ///
3316 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3317 /// [`Scope::Full`].
3318 ///
3319 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3320 /// tokens for more than one scope.
3321 ///
3322 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3323 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3324 /// sufficient, a read-write scope will do as well.
3325 pub fn add_scope<St>(mut self, scope: St) -> ReportGenerateCall<'a, C>
3326 where
3327 St: AsRef<str>,
3328 {
3329 self._scopes.insert(String::from(scope.as_ref()));
3330 self
3331 }
3332 /// Identifies the authorization scope(s) for the method you are building.
3333 ///
3334 /// See [`Self::add_scope()`] for details.
3335 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportGenerateCall<'a, C>
3336 where
3337 I: IntoIterator<Item = St>,
3338 St: AsRef<str>,
3339 {
3340 self._scopes
3341 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3342 self
3343 }
3344
3345 /// Removes all scopes, and no default scope will be used either.
3346 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3347 /// for details).
3348 pub fn clear_scopes(mut self) -> ReportGenerateCall<'a, C> {
3349 self._scopes.clear();
3350 self
3351 }
3352}
3353
3354/// Polls for the status of a report request.
3355///
3356/// A builder for the *get* method supported by a *report* resource.
3357/// It is not used directly, but through a [`ReportMethods`] instance.
3358///
3359/// # Example
3360///
3361/// Instantiate a resource method builder
3362///
3363/// ```test_harness,no_run
3364/// # extern crate hyper;
3365/// # extern crate hyper_rustls;
3366/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
3367/// # async fn dox() {
3368/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3369///
3370/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3371/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3372/// # .with_native_roots()
3373/// # .unwrap()
3374/// # .https_only()
3375/// # .enable_http2()
3376/// # .build();
3377///
3378/// # let executor = hyper_util::rt::TokioExecutor::new();
3379/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3380/// # secret,
3381/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3382/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3383/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3384/// # ),
3385/// # ).build().await.unwrap();
3386///
3387/// # let client = hyper_util::client::legacy::Client::builder(
3388/// # hyper_util::rt::TokioExecutor::new()
3389/// # )
3390/// # .build(
3391/// # hyper_rustls::HttpsConnectorBuilder::new()
3392/// # .with_native_roots()
3393/// # .unwrap()
3394/// # .https_or_http()
3395/// # .enable_http2()
3396/// # .build()
3397/// # );
3398/// # let mut hub = Doubleclicksearch::new(client, auth);
3399/// // You can configure optional parameters by calling the respective setters at will, and
3400/// // execute the final call using `doit()`.
3401/// // Values shown here are possibly random and not representative !
3402/// let result = hub.reports().get("reportId")
3403/// .doit().await;
3404/// # }
3405/// ```
3406pub struct ReportGetCall<'a, C>
3407where
3408 C: 'a,
3409{
3410 hub: &'a Doubleclicksearch<C>,
3411 _report_id: String,
3412 _delegate: Option<&'a mut dyn common::Delegate>,
3413 _additional_params: HashMap<String, String>,
3414 _scopes: BTreeSet<String>,
3415}
3416
3417impl<'a, C> common::CallBuilder for ReportGetCall<'a, C> {}
3418
3419impl<'a, C> ReportGetCall<'a, C>
3420where
3421 C: common::Connector,
3422{
3423 /// Perform the operation you have build so far.
3424 pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
3425 use std::borrow::Cow;
3426 use std::io::{Read, Seek};
3427
3428 use common::{url::Params, ToParts};
3429 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3430
3431 let mut dd = common::DefaultDelegate;
3432 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3433 dlg.begin(common::MethodInfo {
3434 id: "doubleclicksearch.reports.get",
3435 http_method: hyper::Method::GET,
3436 });
3437
3438 for &field in ["alt", "reportId"].iter() {
3439 if self._additional_params.contains_key(field) {
3440 dlg.finished(false);
3441 return Err(common::Error::FieldClash(field));
3442 }
3443 }
3444
3445 let mut params = Params::with_capacity(3 + self._additional_params.len());
3446 params.push("reportId", self._report_id);
3447
3448 params.extend(self._additional_params.iter());
3449
3450 params.push("alt", "json");
3451 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/reports/{reportId}";
3452 if self._scopes.is_empty() {
3453 self._scopes.insert(Scope::Full.as_ref().to_string());
3454 }
3455
3456 #[allow(clippy::single_element_loop)]
3457 for &(find_this, param_name) in [("{reportId}", "reportId")].iter() {
3458 url = params.uri_replacement(url, param_name, find_this, false);
3459 }
3460 {
3461 let to_remove = ["reportId"];
3462 params.remove_params(&to_remove);
3463 }
3464
3465 let url = params.parse_with_url(&url);
3466
3467 loop {
3468 let token = match self
3469 .hub
3470 .auth
3471 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3472 .await
3473 {
3474 Ok(token) => token,
3475 Err(e) => match dlg.token(e) {
3476 Ok(token) => token,
3477 Err(e) => {
3478 dlg.finished(false);
3479 return Err(common::Error::MissingToken(e));
3480 }
3481 },
3482 };
3483 let mut req_result = {
3484 let client = &self.hub.client;
3485 dlg.pre_request();
3486 let mut req_builder = hyper::Request::builder()
3487 .method(hyper::Method::GET)
3488 .uri(url.as_str())
3489 .header(USER_AGENT, self.hub._user_agent.clone());
3490
3491 if let Some(token) = token.as_ref() {
3492 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3493 }
3494
3495 let request = req_builder
3496 .header(CONTENT_LENGTH, 0_u64)
3497 .body(common::to_body::<String>(None));
3498
3499 client.request(request.unwrap()).await
3500 };
3501
3502 match req_result {
3503 Err(err) => {
3504 if let common::Retry::After(d) = dlg.http_error(&err) {
3505 sleep(d).await;
3506 continue;
3507 }
3508 dlg.finished(false);
3509 return Err(common::Error::HttpError(err));
3510 }
3511 Ok(res) => {
3512 let (mut parts, body) = res.into_parts();
3513 let mut body = common::Body::new(body);
3514 if !parts.status.is_success() {
3515 let bytes = common::to_bytes(body).await.unwrap_or_default();
3516 let error = serde_json::from_str(&common::to_string(&bytes));
3517 let response = common::to_response(parts, bytes.into());
3518
3519 if let common::Retry::After(d) =
3520 dlg.http_failure(&response, error.as_ref().ok())
3521 {
3522 sleep(d).await;
3523 continue;
3524 }
3525
3526 dlg.finished(false);
3527
3528 return Err(match error {
3529 Ok(value) => common::Error::BadRequest(value),
3530 _ => common::Error::Failure(response),
3531 });
3532 }
3533 let response = {
3534 let bytes = common::to_bytes(body).await.unwrap_or_default();
3535 let encoded = common::to_string(&bytes);
3536 match serde_json::from_str(&encoded) {
3537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3538 Err(error) => {
3539 dlg.response_json_decode_error(&encoded, &error);
3540 return Err(common::Error::JsonDecodeError(
3541 encoded.to_string(),
3542 error,
3543 ));
3544 }
3545 }
3546 };
3547
3548 dlg.finished(true);
3549 return Ok(response);
3550 }
3551 }
3552 }
3553 }
3554
3555 /// ID of the report request being polled.
3556 ///
3557 /// Sets the *report id* path property to the given value.
3558 ///
3559 /// Even though the property as already been set when instantiating this call,
3560 /// we provide this method for API completeness.
3561 pub fn report_id(mut self, new_value: &str) -> ReportGetCall<'a, C> {
3562 self._report_id = new_value.to_string();
3563 self
3564 }
3565 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3566 /// while executing the actual API request.
3567 ///
3568 /// ````text
3569 /// It should be used to handle progress information, and to implement a certain level of resilience.
3570 /// ````
3571 ///
3572 /// Sets the *delegate* property to the given value.
3573 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportGetCall<'a, C> {
3574 self._delegate = Some(new_value);
3575 self
3576 }
3577
3578 /// Set any additional parameter of the query string used in the request.
3579 /// It should be used to set parameters which are not yet available through their own
3580 /// setters.
3581 ///
3582 /// Please note that this method must not be used to set any of the known parameters
3583 /// which have their own setter method. If done anyway, the request will fail.
3584 ///
3585 /// # Additional Parameters
3586 ///
3587 /// * *$.xgafv* (query-string) - V1 error format.
3588 /// * *access_token* (query-string) - OAuth access token.
3589 /// * *alt* (query-string) - Data format for response.
3590 /// * *callback* (query-string) - JSONP
3591 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3592 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3593 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3594 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3595 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3596 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3597 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3598 pub fn param<T>(mut self, name: T, value: T) -> ReportGetCall<'a, C>
3599 where
3600 T: AsRef<str>,
3601 {
3602 self._additional_params
3603 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3604 self
3605 }
3606
3607 /// Identifies the authorization scope for the method you are building.
3608 ///
3609 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3610 /// [`Scope::Full`].
3611 ///
3612 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3613 /// tokens for more than one scope.
3614 ///
3615 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3616 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3617 /// sufficient, a read-write scope will do as well.
3618 pub fn add_scope<St>(mut self, scope: St) -> ReportGetCall<'a, C>
3619 where
3620 St: AsRef<str>,
3621 {
3622 self._scopes.insert(String::from(scope.as_ref()));
3623 self
3624 }
3625 /// Identifies the authorization scope(s) for the method you are building.
3626 ///
3627 /// See [`Self::add_scope()`] for details.
3628 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportGetCall<'a, C>
3629 where
3630 I: IntoIterator<Item = St>,
3631 St: AsRef<str>,
3632 {
3633 self._scopes
3634 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3635 self
3636 }
3637
3638 /// Removes all scopes, and no default scope will be used either.
3639 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3640 /// for details).
3641 pub fn clear_scopes(mut self) -> ReportGetCall<'a, C> {
3642 self._scopes.clear();
3643 self
3644 }
3645}
3646
3647/// Downloads a report file encoded in UTF-8.
3648///
3649/// This method supports **media download**. To enable it, adjust the builder like this:
3650/// `.param("alt", "media")`.
3651///
3652/// A builder for the *getFile* method supported by a *report* resource.
3653/// It is not used directly, but through a [`ReportMethods`] instance.
3654///
3655/// # Example
3656///
3657/// Instantiate a resource method builder
3658///
3659/// ```test_harness,no_run
3660/// # extern crate hyper;
3661/// # extern crate hyper_rustls;
3662/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
3663/// # async fn dox() {
3664/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3665///
3666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3668/// # .with_native_roots()
3669/// # .unwrap()
3670/// # .https_only()
3671/// # .enable_http2()
3672/// # .build();
3673///
3674/// # let executor = hyper_util::rt::TokioExecutor::new();
3675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3676/// # secret,
3677/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3678/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3679/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3680/// # ),
3681/// # ).build().await.unwrap();
3682///
3683/// # let client = hyper_util::client::legacy::Client::builder(
3684/// # hyper_util::rt::TokioExecutor::new()
3685/// # )
3686/// # .build(
3687/// # hyper_rustls::HttpsConnectorBuilder::new()
3688/// # .with_native_roots()
3689/// # .unwrap()
3690/// # .https_or_http()
3691/// # .enable_http2()
3692/// # .build()
3693/// # );
3694/// # let mut hub = Doubleclicksearch::new(client, auth);
3695/// // You can configure optional parameters by calling the respective setters at will, and
3696/// // execute the final call using `doit()`.
3697/// // Values shown here are possibly random and not representative !
3698/// let result = hub.reports().get_file("reportId", -62)
3699/// .doit().await;
3700/// # }
3701/// ```
3702pub struct ReportGetFileCall<'a, C>
3703where
3704 C: 'a,
3705{
3706 hub: &'a Doubleclicksearch<C>,
3707 _report_id: String,
3708 _report_fragment: i32,
3709 _delegate: Option<&'a mut dyn common::Delegate>,
3710 _additional_params: HashMap<String, String>,
3711 _scopes: BTreeSet<String>,
3712}
3713
3714impl<'a, C> common::CallBuilder for ReportGetFileCall<'a, C> {}
3715
3716impl<'a, C> ReportGetFileCall<'a, C>
3717where
3718 C: common::Connector,
3719{
3720 /// Perform the operation you have build so far.
3721 pub async fn doit(mut self) -> common::Result<common::Response> {
3722 use std::borrow::Cow;
3723 use std::io::{Read, Seek};
3724
3725 use common::{url::Params, ToParts};
3726 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3727
3728 let mut dd = common::DefaultDelegate;
3729 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3730 dlg.begin(common::MethodInfo {
3731 id: "doubleclicksearch.reports.getFile",
3732 http_method: hyper::Method::GET,
3733 });
3734
3735 for &field in ["reportId", "reportFragment"].iter() {
3736 if self._additional_params.contains_key(field) {
3737 dlg.finished(false);
3738 return Err(common::Error::FieldClash(field));
3739 }
3740 }
3741
3742 let mut params = Params::with_capacity(3 + self._additional_params.len());
3743 params.push("reportId", self._report_id);
3744 params.push("reportFragment", self._report_fragment.to_string());
3745
3746 params.extend(self._additional_params.iter());
3747
3748 let mut url = self.hub._base_url.clone()
3749 + "doubleclicksearch/v2/reports/{reportId}/files/{reportFragment}";
3750 if self._scopes.is_empty() {
3751 self._scopes.insert(Scope::Full.as_ref().to_string());
3752 }
3753
3754 #[allow(clippy::single_element_loop)]
3755 for &(find_this, param_name) in [
3756 ("{reportId}", "reportId"),
3757 ("{reportFragment}", "reportFragment"),
3758 ]
3759 .iter()
3760 {
3761 url = params.uri_replacement(url, param_name, find_this, false);
3762 }
3763 {
3764 let to_remove = ["reportFragment", "reportId"];
3765 params.remove_params(&to_remove);
3766 }
3767
3768 let url = params.parse_with_url(&url);
3769
3770 loop {
3771 let token = match self
3772 .hub
3773 .auth
3774 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3775 .await
3776 {
3777 Ok(token) => token,
3778 Err(e) => match dlg.token(e) {
3779 Ok(token) => token,
3780 Err(e) => {
3781 dlg.finished(false);
3782 return Err(common::Error::MissingToken(e));
3783 }
3784 },
3785 };
3786 let mut req_result = {
3787 let client = &self.hub.client;
3788 dlg.pre_request();
3789 let mut req_builder = hyper::Request::builder()
3790 .method(hyper::Method::GET)
3791 .uri(url.as_str())
3792 .header(USER_AGENT, self.hub._user_agent.clone());
3793
3794 if let Some(token) = token.as_ref() {
3795 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3796 }
3797
3798 let request = req_builder
3799 .header(CONTENT_LENGTH, 0_u64)
3800 .body(common::to_body::<String>(None));
3801
3802 client.request(request.unwrap()).await
3803 };
3804
3805 match req_result {
3806 Err(err) => {
3807 if let common::Retry::After(d) = dlg.http_error(&err) {
3808 sleep(d).await;
3809 continue;
3810 }
3811 dlg.finished(false);
3812 return Err(common::Error::HttpError(err));
3813 }
3814 Ok(res) => {
3815 let (mut parts, body) = res.into_parts();
3816 let mut body = common::Body::new(body);
3817 if !parts.status.is_success() {
3818 let bytes = common::to_bytes(body).await.unwrap_or_default();
3819 let error = serde_json::from_str(&common::to_string(&bytes));
3820 let response = common::to_response(parts, bytes.into());
3821
3822 if let common::Retry::After(d) =
3823 dlg.http_failure(&response, error.as_ref().ok())
3824 {
3825 sleep(d).await;
3826 continue;
3827 }
3828
3829 dlg.finished(false);
3830
3831 return Err(match error {
3832 Ok(value) => common::Error::BadRequest(value),
3833 _ => common::Error::Failure(response),
3834 });
3835 }
3836 let response = common::Response::from_parts(parts, body);
3837
3838 dlg.finished(true);
3839 return Ok(response);
3840 }
3841 }
3842 }
3843 }
3844
3845 /// ID of the report.
3846 ///
3847 /// Sets the *report id* path property to the given value.
3848 ///
3849 /// Even though the property as already been set when instantiating this call,
3850 /// we provide this method for API completeness.
3851 pub fn report_id(mut self, new_value: &str) -> ReportGetFileCall<'a, C> {
3852 self._report_id = new_value.to_string();
3853 self
3854 }
3855 /// The index of the report fragment to download.
3856 ///
3857 /// Sets the *report fragment* path property to the given value.
3858 ///
3859 /// Even though the property as already been set when instantiating this call,
3860 /// we provide this method for API completeness.
3861 pub fn report_fragment(mut self, new_value: i32) -> ReportGetFileCall<'a, C> {
3862 self._report_fragment = new_value;
3863 self
3864 }
3865 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3866 /// while executing the actual API request.
3867 ///
3868 /// ````text
3869 /// It should be used to handle progress information, and to implement a certain level of resilience.
3870 /// ````
3871 ///
3872 /// Sets the *delegate* property to the given value.
3873 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportGetFileCall<'a, C> {
3874 self._delegate = Some(new_value);
3875 self
3876 }
3877
3878 /// Set any additional parameter of the query string used in the request.
3879 /// It should be used to set parameters which are not yet available through their own
3880 /// setters.
3881 ///
3882 /// Please note that this method must not be used to set any of the known parameters
3883 /// which have their own setter method. If done anyway, the request will fail.
3884 ///
3885 /// # Additional Parameters
3886 ///
3887 /// * *$.xgafv* (query-string) - V1 error format.
3888 /// * *access_token* (query-string) - OAuth access token.
3889 /// * *alt* (query-string) - Data format for response.
3890 /// * *callback* (query-string) - JSONP
3891 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3892 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3893 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3894 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3895 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3896 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3897 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3898 pub fn param<T>(mut self, name: T, value: T) -> ReportGetFileCall<'a, C>
3899 where
3900 T: AsRef<str>,
3901 {
3902 self._additional_params
3903 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3904 self
3905 }
3906
3907 /// Identifies the authorization scope for the method you are building.
3908 ///
3909 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3910 /// [`Scope::Full`].
3911 ///
3912 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3913 /// tokens for more than one scope.
3914 ///
3915 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3916 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3917 /// sufficient, a read-write scope will do as well.
3918 pub fn add_scope<St>(mut self, scope: St) -> ReportGetFileCall<'a, C>
3919 where
3920 St: AsRef<str>,
3921 {
3922 self._scopes.insert(String::from(scope.as_ref()));
3923 self
3924 }
3925 /// Identifies the authorization scope(s) for the method you are building.
3926 ///
3927 /// See [`Self::add_scope()`] for details.
3928 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportGetFileCall<'a, C>
3929 where
3930 I: IntoIterator<Item = St>,
3931 St: AsRef<str>,
3932 {
3933 self._scopes
3934 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3935 self
3936 }
3937
3938 /// Removes all scopes, and no default scope will be used either.
3939 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3940 /// for details).
3941 pub fn clear_scopes(mut self) -> ReportGetFileCall<'a, C> {
3942 self._scopes.clear();
3943 self
3944 }
3945}
3946
3947/// Downloads a csv file(encoded in UTF-8) that contains ID mappings between legacy SA360 and new SA360. The file includes all children entities of the given advertiser(e.g. engine accounts, campaigns, ad groups, etc.) that exist in both legacy SA360 and new SA360.
3948///
3949/// This method supports **media download**. To enable it, adjust the builder like this:
3950/// `.param("alt", "media")`.
3951/// Please note that due to missing multi-part support on the server side, you will only receive the media,
3952/// but not the `IdMappingFile` structure that you would usually get. The latter will be a default value.
3953///
3954/// A builder for the *getIdMappingFile* method supported by a *report* resource.
3955/// It is not used directly, but through a [`ReportMethods`] instance.
3956///
3957/// # Example
3958///
3959/// Instantiate a resource method builder
3960///
3961/// ```test_harness,no_run
3962/// # extern crate hyper;
3963/// # extern crate hyper_rustls;
3964/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
3965/// # async fn dox() {
3966/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3967///
3968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3970/// # .with_native_roots()
3971/// # .unwrap()
3972/// # .https_only()
3973/// # .enable_http2()
3974/// # .build();
3975///
3976/// # let executor = hyper_util::rt::TokioExecutor::new();
3977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3978/// # secret,
3979/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3980/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3981/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3982/// # ),
3983/// # ).build().await.unwrap();
3984///
3985/// # let client = hyper_util::client::legacy::Client::builder(
3986/// # hyper_util::rt::TokioExecutor::new()
3987/// # )
3988/// # .build(
3989/// # hyper_rustls::HttpsConnectorBuilder::new()
3990/// # .with_native_roots()
3991/// # .unwrap()
3992/// # .https_or_http()
3993/// # .enable_http2()
3994/// # .build()
3995/// # );
3996/// # let mut hub = Doubleclicksearch::new(client, auth);
3997/// // You can configure optional parameters by calling the respective setters at will, and
3998/// // execute the final call using `doit()`.
3999/// // Values shown here are possibly random and not representative !
4000/// let result = hub.reports().get_id_mapping_file(-17, -99)
4001/// .doit().await;
4002/// # }
4003/// ```
4004pub struct ReportGetIdMappingFileCall<'a, C>
4005where
4006 C: 'a,
4007{
4008 hub: &'a Doubleclicksearch<C>,
4009 _agency_id: i64,
4010 _advertiser_id: i64,
4011 _delegate: Option<&'a mut dyn common::Delegate>,
4012 _additional_params: HashMap<String, String>,
4013 _scopes: BTreeSet<String>,
4014}
4015
4016impl<'a, C> common::CallBuilder for ReportGetIdMappingFileCall<'a, C> {}
4017
4018impl<'a, C> ReportGetIdMappingFileCall<'a, C>
4019where
4020 C: common::Connector,
4021{
4022 /// Perform the operation you have build so far.
4023 pub async fn doit(mut self) -> common::Result<(common::Response, IdMappingFile)> {
4024 use std::borrow::Cow;
4025 use std::io::{Read, Seek};
4026
4027 use common::{url::Params, ToParts};
4028 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4029
4030 let mut dd = common::DefaultDelegate;
4031 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4032 dlg.begin(common::MethodInfo {
4033 id: "doubleclicksearch.reports.getIdMappingFile",
4034 http_method: hyper::Method::GET,
4035 });
4036
4037 for &field in ["agencyId", "advertiserId"].iter() {
4038 if self._additional_params.contains_key(field) {
4039 dlg.finished(false);
4040 return Err(common::Error::FieldClash(field));
4041 }
4042 }
4043
4044 let mut params = Params::with_capacity(3 + self._additional_params.len());
4045 params.push("agencyId", self._agency_id.to_string());
4046 params.push("advertiserId", self._advertiser_id.to_string());
4047
4048 params.extend(self._additional_params.iter());
4049
4050 let (alt_field_missing, enable_resource_parsing) = {
4051 if let Some(value) = params.get("alt") {
4052 (false, value == "json")
4053 } else {
4054 (true, true)
4055 }
4056 };
4057 if alt_field_missing {
4058 params.push("alt", "json");
4059 }
4060 let mut url = self.hub._base_url.clone()
4061 + "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/idmapping";
4062 if self._scopes.is_empty() {
4063 self._scopes.insert(Scope::Full.as_ref().to_string());
4064 }
4065
4066 #[allow(clippy::single_element_loop)]
4067 for &(find_this, param_name) in [
4068 ("{agencyId}", "agencyId"),
4069 ("{advertiserId}", "advertiserId"),
4070 ]
4071 .iter()
4072 {
4073 url = params.uri_replacement(url, param_name, find_this, false);
4074 }
4075 {
4076 let to_remove = ["advertiserId", "agencyId"];
4077 params.remove_params(&to_remove);
4078 }
4079
4080 let url = params.parse_with_url(&url);
4081
4082 loop {
4083 let token = match self
4084 .hub
4085 .auth
4086 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4087 .await
4088 {
4089 Ok(token) => token,
4090 Err(e) => match dlg.token(e) {
4091 Ok(token) => token,
4092 Err(e) => {
4093 dlg.finished(false);
4094 return Err(common::Error::MissingToken(e));
4095 }
4096 },
4097 };
4098 let mut req_result = {
4099 let client = &self.hub.client;
4100 dlg.pre_request();
4101 let mut req_builder = hyper::Request::builder()
4102 .method(hyper::Method::GET)
4103 .uri(url.as_str())
4104 .header(USER_AGENT, self.hub._user_agent.clone());
4105
4106 if let Some(token) = token.as_ref() {
4107 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4108 }
4109
4110 let request = req_builder
4111 .header(CONTENT_LENGTH, 0_u64)
4112 .body(common::to_body::<String>(None));
4113
4114 client.request(request.unwrap()).await
4115 };
4116
4117 match req_result {
4118 Err(err) => {
4119 if let common::Retry::After(d) = dlg.http_error(&err) {
4120 sleep(d).await;
4121 continue;
4122 }
4123 dlg.finished(false);
4124 return Err(common::Error::HttpError(err));
4125 }
4126 Ok(res) => {
4127 let (mut parts, body) = res.into_parts();
4128 let mut body = common::Body::new(body);
4129 if !parts.status.is_success() {
4130 let bytes = common::to_bytes(body).await.unwrap_or_default();
4131 let error = serde_json::from_str(&common::to_string(&bytes));
4132 let response = common::to_response(parts, bytes.into());
4133
4134 if let common::Retry::After(d) =
4135 dlg.http_failure(&response, error.as_ref().ok())
4136 {
4137 sleep(d).await;
4138 continue;
4139 }
4140
4141 dlg.finished(false);
4142
4143 return Err(match error {
4144 Ok(value) => common::Error::BadRequest(value),
4145 _ => common::Error::Failure(response),
4146 });
4147 }
4148 let response = if enable_resource_parsing {
4149 let bytes = common::to_bytes(body).await.unwrap_or_default();
4150 let encoded = common::to_string(&bytes);
4151 match serde_json::from_str(&encoded) {
4152 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4153 Err(error) => {
4154 dlg.response_json_decode_error(&encoded, &error);
4155 return Err(common::Error::JsonDecodeError(
4156 encoded.to_string(),
4157 error,
4158 ));
4159 }
4160 }
4161 } else {
4162 (
4163 common::Response::from_parts(parts, body),
4164 Default::default(),
4165 )
4166 };
4167
4168 dlg.finished(true);
4169 return Ok(response);
4170 }
4171 }
4172 }
4173 }
4174
4175 /// Legacy SA360 agency ID.
4176 ///
4177 /// Sets the *agency id* path property to the given value.
4178 ///
4179 /// Even though the property as already been set when instantiating this call,
4180 /// we provide this method for API completeness.
4181 pub fn agency_id(mut self, new_value: i64) -> ReportGetIdMappingFileCall<'a, C> {
4182 self._agency_id = new_value;
4183 self
4184 }
4185 /// Legacy SA360 advertiser ID.
4186 ///
4187 /// Sets the *advertiser id* path property to the given value.
4188 ///
4189 /// Even though the property as already been set when instantiating this call,
4190 /// we provide this method for API completeness.
4191 pub fn advertiser_id(mut self, new_value: i64) -> ReportGetIdMappingFileCall<'a, C> {
4192 self._advertiser_id = new_value;
4193 self
4194 }
4195 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4196 /// while executing the actual API request.
4197 ///
4198 /// ````text
4199 /// It should be used to handle progress information, and to implement a certain level of resilience.
4200 /// ````
4201 ///
4202 /// Sets the *delegate* property to the given value.
4203 pub fn delegate(
4204 mut self,
4205 new_value: &'a mut dyn common::Delegate,
4206 ) -> ReportGetIdMappingFileCall<'a, C> {
4207 self._delegate = Some(new_value);
4208 self
4209 }
4210
4211 /// Set any additional parameter of the query string used in the request.
4212 /// It should be used to set parameters which are not yet available through their own
4213 /// setters.
4214 ///
4215 /// Please note that this method must not be used to set any of the known parameters
4216 /// which have their own setter method. If done anyway, the request will fail.
4217 ///
4218 /// # Additional Parameters
4219 ///
4220 /// * *$.xgafv* (query-string) - V1 error format.
4221 /// * *access_token* (query-string) - OAuth access token.
4222 /// * *alt* (query-string) - Data format for response.
4223 /// * *callback* (query-string) - JSONP
4224 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4225 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4226 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4227 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4228 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4229 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4230 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4231 pub fn param<T>(mut self, name: T, value: T) -> ReportGetIdMappingFileCall<'a, C>
4232 where
4233 T: AsRef<str>,
4234 {
4235 self._additional_params
4236 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4237 self
4238 }
4239
4240 /// Identifies the authorization scope for the method you are building.
4241 ///
4242 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4243 /// [`Scope::Full`].
4244 ///
4245 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4246 /// tokens for more than one scope.
4247 ///
4248 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4249 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4250 /// sufficient, a read-write scope will do as well.
4251 pub fn add_scope<St>(mut self, scope: St) -> ReportGetIdMappingFileCall<'a, C>
4252 where
4253 St: AsRef<str>,
4254 {
4255 self._scopes.insert(String::from(scope.as_ref()));
4256 self
4257 }
4258 /// Identifies the authorization scope(s) for the method you are building.
4259 ///
4260 /// See [`Self::add_scope()`] for details.
4261 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportGetIdMappingFileCall<'a, C>
4262 where
4263 I: IntoIterator<Item = St>,
4264 St: AsRef<str>,
4265 {
4266 self._scopes
4267 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4268 self
4269 }
4270
4271 /// Removes all scopes, and no default scope will be used either.
4272 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4273 /// for details).
4274 pub fn clear_scopes(mut self) -> ReportGetIdMappingFileCall<'a, C> {
4275 self._scopes.clear();
4276 self
4277 }
4278}
4279
4280/// Inserts a report request into the reporting system.
4281///
4282/// A builder for the *request* method supported by a *report* resource.
4283/// It is not used directly, but through a [`ReportMethods`] instance.
4284///
4285/// # Example
4286///
4287/// Instantiate a resource method builder
4288///
4289/// ```test_harness,no_run
4290/// # extern crate hyper;
4291/// # extern crate hyper_rustls;
4292/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
4293/// use doubleclicksearch2::api::ReportRequest;
4294/// # async fn dox() {
4295/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4296///
4297/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4298/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4299/// # .with_native_roots()
4300/// # .unwrap()
4301/// # .https_only()
4302/// # .enable_http2()
4303/// # .build();
4304///
4305/// # let executor = hyper_util::rt::TokioExecutor::new();
4306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4307/// # secret,
4308/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4309/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4310/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4311/// # ),
4312/// # ).build().await.unwrap();
4313///
4314/// # let client = hyper_util::client::legacy::Client::builder(
4315/// # hyper_util::rt::TokioExecutor::new()
4316/// # )
4317/// # .build(
4318/// # hyper_rustls::HttpsConnectorBuilder::new()
4319/// # .with_native_roots()
4320/// # .unwrap()
4321/// # .https_or_http()
4322/// # .enable_http2()
4323/// # .build()
4324/// # );
4325/// # let mut hub = Doubleclicksearch::new(client, auth);
4326/// // As the method needs a request, you would usually fill it with the desired information
4327/// // into the respective structure. Some of the parts shown here might not be applicable !
4328/// // Values shown here are possibly random and not representative !
4329/// let mut req = ReportRequest::default();
4330///
4331/// // You can configure optional parameters by calling the respective setters at will, and
4332/// // execute the final call using `doit()`.
4333/// // Values shown here are possibly random and not representative !
4334/// let result = hub.reports().request(req)
4335/// .doit().await;
4336/// # }
4337/// ```
4338pub struct ReportRequestCall<'a, C>
4339where
4340 C: 'a,
4341{
4342 hub: &'a Doubleclicksearch<C>,
4343 _request: ReportRequest,
4344 _delegate: Option<&'a mut dyn common::Delegate>,
4345 _additional_params: HashMap<String, String>,
4346 _scopes: BTreeSet<String>,
4347}
4348
4349impl<'a, C> common::CallBuilder for ReportRequestCall<'a, C> {}
4350
4351impl<'a, C> ReportRequestCall<'a, C>
4352where
4353 C: common::Connector,
4354{
4355 /// Perform the operation you have build so far.
4356 pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
4357 use std::borrow::Cow;
4358 use std::io::{Read, Seek};
4359
4360 use common::{url::Params, ToParts};
4361 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4362
4363 let mut dd = common::DefaultDelegate;
4364 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4365 dlg.begin(common::MethodInfo {
4366 id: "doubleclicksearch.reports.request",
4367 http_method: hyper::Method::POST,
4368 });
4369
4370 for &field in ["alt"].iter() {
4371 if self._additional_params.contains_key(field) {
4372 dlg.finished(false);
4373 return Err(common::Error::FieldClash(field));
4374 }
4375 }
4376
4377 let mut params = Params::with_capacity(3 + self._additional_params.len());
4378
4379 params.extend(self._additional_params.iter());
4380
4381 params.push("alt", "json");
4382 let mut url = self.hub._base_url.clone() + "doubleclicksearch/v2/reports";
4383 if self._scopes.is_empty() {
4384 self._scopes.insert(Scope::Full.as_ref().to_string());
4385 }
4386
4387 let url = params.parse_with_url(&url);
4388
4389 let mut json_mime_type = mime::APPLICATION_JSON;
4390 let mut request_value_reader = {
4391 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4392 common::remove_json_null_values(&mut value);
4393 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4394 serde_json::to_writer(&mut dst, &value).unwrap();
4395 dst
4396 };
4397 let request_size = request_value_reader
4398 .seek(std::io::SeekFrom::End(0))
4399 .unwrap();
4400 request_value_reader
4401 .seek(std::io::SeekFrom::Start(0))
4402 .unwrap();
4403
4404 loop {
4405 let token = match self
4406 .hub
4407 .auth
4408 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4409 .await
4410 {
4411 Ok(token) => token,
4412 Err(e) => match dlg.token(e) {
4413 Ok(token) => token,
4414 Err(e) => {
4415 dlg.finished(false);
4416 return Err(common::Error::MissingToken(e));
4417 }
4418 },
4419 };
4420 request_value_reader
4421 .seek(std::io::SeekFrom::Start(0))
4422 .unwrap();
4423 let mut req_result = {
4424 let client = &self.hub.client;
4425 dlg.pre_request();
4426 let mut req_builder = hyper::Request::builder()
4427 .method(hyper::Method::POST)
4428 .uri(url.as_str())
4429 .header(USER_AGENT, self.hub._user_agent.clone());
4430
4431 if let Some(token) = token.as_ref() {
4432 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4433 }
4434
4435 let request = req_builder
4436 .header(CONTENT_TYPE, json_mime_type.to_string())
4437 .header(CONTENT_LENGTH, request_size as u64)
4438 .body(common::to_body(
4439 request_value_reader.get_ref().clone().into(),
4440 ));
4441
4442 client.request(request.unwrap()).await
4443 };
4444
4445 match req_result {
4446 Err(err) => {
4447 if let common::Retry::After(d) = dlg.http_error(&err) {
4448 sleep(d).await;
4449 continue;
4450 }
4451 dlg.finished(false);
4452 return Err(common::Error::HttpError(err));
4453 }
4454 Ok(res) => {
4455 let (mut parts, body) = res.into_parts();
4456 let mut body = common::Body::new(body);
4457 if !parts.status.is_success() {
4458 let bytes = common::to_bytes(body).await.unwrap_or_default();
4459 let error = serde_json::from_str(&common::to_string(&bytes));
4460 let response = common::to_response(parts, bytes.into());
4461
4462 if let common::Retry::After(d) =
4463 dlg.http_failure(&response, error.as_ref().ok())
4464 {
4465 sleep(d).await;
4466 continue;
4467 }
4468
4469 dlg.finished(false);
4470
4471 return Err(match error {
4472 Ok(value) => common::Error::BadRequest(value),
4473 _ => common::Error::Failure(response),
4474 });
4475 }
4476 let response = {
4477 let bytes = common::to_bytes(body).await.unwrap_or_default();
4478 let encoded = common::to_string(&bytes);
4479 match serde_json::from_str(&encoded) {
4480 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4481 Err(error) => {
4482 dlg.response_json_decode_error(&encoded, &error);
4483 return Err(common::Error::JsonDecodeError(
4484 encoded.to_string(),
4485 error,
4486 ));
4487 }
4488 }
4489 };
4490
4491 dlg.finished(true);
4492 return Ok(response);
4493 }
4494 }
4495 }
4496 }
4497
4498 ///
4499 /// Sets the *request* property to the given value.
4500 ///
4501 /// Even though the property as already been set when instantiating this call,
4502 /// we provide this method for API completeness.
4503 pub fn request(mut self, new_value: ReportRequest) -> ReportRequestCall<'a, C> {
4504 self._request = new_value;
4505 self
4506 }
4507 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4508 /// while executing the actual API request.
4509 ///
4510 /// ````text
4511 /// It should be used to handle progress information, and to implement a certain level of resilience.
4512 /// ````
4513 ///
4514 /// Sets the *delegate* property to the given value.
4515 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportRequestCall<'a, C> {
4516 self._delegate = Some(new_value);
4517 self
4518 }
4519
4520 /// Set any additional parameter of the query string used in the request.
4521 /// It should be used to set parameters which are not yet available through their own
4522 /// setters.
4523 ///
4524 /// Please note that this method must not be used to set any of the known parameters
4525 /// which have their own setter method. If done anyway, the request will fail.
4526 ///
4527 /// # Additional Parameters
4528 ///
4529 /// * *$.xgafv* (query-string) - V1 error format.
4530 /// * *access_token* (query-string) - OAuth access token.
4531 /// * *alt* (query-string) - Data format for response.
4532 /// * *callback* (query-string) - JSONP
4533 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4534 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4535 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4536 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4537 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4538 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4539 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4540 pub fn param<T>(mut self, name: T, value: T) -> ReportRequestCall<'a, C>
4541 where
4542 T: AsRef<str>,
4543 {
4544 self._additional_params
4545 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4546 self
4547 }
4548
4549 /// Identifies the authorization scope for the method you are building.
4550 ///
4551 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4552 /// [`Scope::Full`].
4553 ///
4554 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4555 /// tokens for more than one scope.
4556 ///
4557 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4558 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4559 /// sufficient, a read-write scope will do as well.
4560 pub fn add_scope<St>(mut self, scope: St) -> ReportRequestCall<'a, C>
4561 where
4562 St: AsRef<str>,
4563 {
4564 self._scopes.insert(String::from(scope.as_ref()));
4565 self
4566 }
4567 /// Identifies the authorization scope(s) for the method you are building.
4568 ///
4569 /// See [`Self::add_scope()`] for details.
4570 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportRequestCall<'a, C>
4571 where
4572 I: IntoIterator<Item = St>,
4573 St: AsRef<str>,
4574 {
4575 self._scopes
4576 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4577 self
4578 }
4579
4580 /// Removes all scopes, and no default scope will be used either.
4581 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4582 /// for details).
4583 pub fn clear_scopes(mut self) -> ReportRequestCall<'a, C> {
4584 self._scopes.clear();
4585 self
4586 }
4587}
4588
4589/// Retrieve the list of saved columns for a specified advertiser.
4590///
4591/// A builder for the *list* method supported by a *savedColumn* resource.
4592/// It is not used directly, but through a [`SavedColumnMethods`] instance.
4593///
4594/// # Example
4595///
4596/// Instantiate a resource method builder
4597///
4598/// ```test_harness,no_run
4599/// # extern crate hyper;
4600/// # extern crate hyper_rustls;
4601/// # extern crate google_doubleclicksearch2 as doubleclicksearch2;
4602/// # async fn dox() {
4603/// # use doubleclicksearch2::{Doubleclicksearch, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4604///
4605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4606/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4607/// # .with_native_roots()
4608/// # .unwrap()
4609/// # .https_only()
4610/// # .enable_http2()
4611/// # .build();
4612///
4613/// # let executor = hyper_util::rt::TokioExecutor::new();
4614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4615/// # secret,
4616/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4617/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4618/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4619/// # ),
4620/// # ).build().await.unwrap();
4621///
4622/// # let client = hyper_util::client::legacy::Client::builder(
4623/// # hyper_util::rt::TokioExecutor::new()
4624/// # )
4625/// # .build(
4626/// # hyper_rustls::HttpsConnectorBuilder::new()
4627/// # .with_native_roots()
4628/// # .unwrap()
4629/// # .https_or_http()
4630/// # .enable_http2()
4631/// # .build()
4632/// # );
4633/// # let mut hub = Doubleclicksearch::new(client, auth);
4634/// // You can configure optional parameters by calling the respective setters at will, and
4635/// // execute the final call using `doit()`.
4636/// // Values shown here are possibly random and not representative !
4637/// let result = hub.saved_columns().list(-56, -25)
4638/// .doit().await;
4639/// # }
4640/// ```
4641pub struct SavedColumnListCall<'a, C>
4642where
4643 C: 'a,
4644{
4645 hub: &'a Doubleclicksearch<C>,
4646 _agency_id: i64,
4647 _advertiser_id: i64,
4648 _delegate: Option<&'a mut dyn common::Delegate>,
4649 _additional_params: HashMap<String, String>,
4650 _scopes: BTreeSet<String>,
4651}
4652
4653impl<'a, C> common::CallBuilder for SavedColumnListCall<'a, C> {}
4654
4655impl<'a, C> SavedColumnListCall<'a, C>
4656where
4657 C: common::Connector,
4658{
4659 /// Perform the operation you have build so far.
4660 pub async fn doit(mut self) -> common::Result<(common::Response, SavedColumnList)> {
4661 use std::borrow::Cow;
4662 use std::io::{Read, Seek};
4663
4664 use common::{url::Params, ToParts};
4665 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4666
4667 let mut dd = common::DefaultDelegate;
4668 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4669 dlg.begin(common::MethodInfo {
4670 id: "doubleclicksearch.savedColumns.list",
4671 http_method: hyper::Method::GET,
4672 });
4673
4674 for &field in ["alt", "agencyId", "advertiserId"].iter() {
4675 if self._additional_params.contains_key(field) {
4676 dlg.finished(false);
4677 return Err(common::Error::FieldClash(field));
4678 }
4679 }
4680
4681 let mut params = Params::with_capacity(4 + self._additional_params.len());
4682 params.push("agencyId", self._agency_id.to_string());
4683 params.push("advertiserId", self._advertiser_id.to_string());
4684
4685 params.extend(self._additional_params.iter());
4686
4687 params.push("alt", "json");
4688 let mut url = self.hub._base_url.clone()
4689 + "doubleclicksearch/v2/agency/{agencyId}/advertiser/{advertiserId}/savedcolumns";
4690 if self._scopes.is_empty() {
4691 self._scopes.insert(Scope::Full.as_ref().to_string());
4692 }
4693
4694 #[allow(clippy::single_element_loop)]
4695 for &(find_this, param_name) in [
4696 ("{agencyId}", "agencyId"),
4697 ("{advertiserId}", "advertiserId"),
4698 ]
4699 .iter()
4700 {
4701 url = params.uri_replacement(url, param_name, find_this, false);
4702 }
4703 {
4704 let to_remove = ["advertiserId", "agencyId"];
4705 params.remove_params(&to_remove);
4706 }
4707
4708 let url = params.parse_with_url(&url);
4709
4710 loop {
4711 let token = match self
4712 .hub
4713 .auth
4714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4715 .await
4716 {
4717 Ok(token) => token,
4718 Err(e) => match dlg.token(e) {
4719 Ok(token) => token,
4720 Err(e) => {
4721 dlg.finished(false);
4722 return Err(common::Error::MissingToken(e));
4723 }
4724 },
4725 };
4726 let mut req_result = {
4727 let client = &self.hub.client;
4728 dlg.pre_request();
4729 let mut req_builder = hyper::Request::builder()
4730 .method(hyper::Method::GET)
4731 .uri(url.as_str())
4732 .header(USER_AGENT, self.hub._user_agent.clone());
4733
4734 if let Some(token) = token.as_ref() {
4735 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4736 }
4737
4738 let request = req_builder
4739 .header(CONTENT_LENGTH, 0_u64)
4740 .body(common::to_body::<String>(None));
4741
4742 client.request(request.unwrap()).await
4743 };
4744
4745 match req_result {
4746 Err(err) => {
4747 if let common::Retry::After(d) = dlg.http_error(&err) {
4748 sleep(d).await;
4749 continue;
4750 }
4751 dlg.finished(false);
4752 return Err(common::Error::HttpError(err));
4753 }
4754 Ok(res) => {
4755 let (mut parts, body) = res.into_parts();
4756 let mut body = common::Body::new(body);
4757 if !parts.status.is_success() {
4758 let bytes = common::to_bytes(body).await.unwrap_or_default();
4759 let error = serde_json::from_str(&common::to_string(&bytes));
4760 let response = common::to_response(parts, bytes.into());
4761
4762 if let common::Retry::After(d) =
4763 dlg.http_failure(&response, error.as_ref().ok())
4764 {
4765 sleep(d).await;
4766 continue;
4767 }
4768
4769 dlg.finished(false);
4770
4771 return Err(match error {
4772 Ok(value) => common::Error::BadRequest(value),
4773 _ => common::Error::Failure(response),
4774 });
4775 }
4776 let response = {
4777 let bytes = common::to_bytes(body).await.unwrap_or_default();
4778 let encoded = common::to_string(&bytes);
4779 match serde_json::from_str(&encoded) {
4780 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4781 Err(error) => {
4782 dlg.response_json_decode_error(&encoded, &error);
4783 return Err(common::Error::JsonDecodeError(
4784 encoded.to_string(),
4785 error,
4786 ));
4787 }
4788 }
4789 };
4790
4791 dlg.finished(true);
4792 return Ok(response);
4793 }
4794 }
4795 }
4796 }
4797
4798 /// DS ID of the agency.
4799 ///
4800 /// Sets the *agency id* path property to the given value.
4801 ///
4802 /// Even though the property as already been set when instantiating this call,
4803 /// we provide this method for API completeness.
4804 pub fn agency_id(mut self, new_value: i64) -> SavedColumnListCall<'a, C> {
4805 self._agency_id = new_value;
4806 self
4807 }
4808 /// DS ID of the advertiser.
4809 ///
4810 /// Sets the *advertiser id* path property to the given value.
4811 ///
4812 /// Even though the property as already been set when instantiating this call,
4813 /// we provide this method for API completeness.
4814 pub fn advertiser_id(mut self, new_value: i64) -> SavedColumnListCall<'a, C> {
4815 self._advertiser_id = new_value;
4816 self
4817 }
4818 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4819 /// while executing the actual API request.
4820 ///
4821 /// ````text
4822 /// It should be used to handle progress information, and to implement a certain level of resilience.
4823 /// ````
4824 ///
4825 /// Sets the *delegate* property to the given value.
4826 pub fn delegate(
4827 mut self,
4828 new_value: &'a mut dyn common::Delegate,
4829 ) -> SavedColumnListCall<'a, C> {
4830 self._delegate = Some(new_value);
4831 self
4832 }
4833
4834 /// Set any additional parameter of the query string used in the request.
4835 /// It should be used to set parameters which are not yet available through their own
4836 /// setters.
4837 ///
4838 /// Please note that this method must not be used to set any of the known parameters
4839 /// which have their own setter method. If done anyway, the request will fail.
4840 ///
4841 /// # Additional Parameters
4842 ///
4843 /// * *$.xgafv* (query-string) - V1 error format.
4844 /// * *access_token* (query-string) - OAuth access token.
4845 /// * *alt* (query-string) - Data format for response.
4846 /// * *callback* (query-string) - JSONP
4847 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4848 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4849 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4850 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4851 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4852 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4853 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4854 pub fn param<T>(mut self, name: T, value: T) -> SavedColumnListCall<'a, C>
4855 where
4856 T: AsRef<str>,
4857 {
4858 self._additional_params
4859 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4860 self
4861 }
4862
4863 /// Identifies the authorization scope for the method you are building.
4864 ///
4865 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4866 /// [`Scope::Full`].
4867 ///
4868 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4869 /// tokens for more than one scope.
4870 ///
4871 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4872 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4873 /// sufficient, a read-write scope will do as well.
4874 pub fn add_scope<St>(mut self, scope: St) -> SavedColumnListCall<'a, C>
4875 where
4876 St: AsRef<str>,
4877 {
4878 self._scopes.insert(String::from(scope.as_ref()));
4879 self
4880 }
4881 /// Identifies the authorization scope(s) for the method you are building.
4882 ///
4883 /// See [`Self::add_scope()`] for details.
4884 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedColumnListCall<'a, C>
4885 where
4886 I: IntoIterator<Item = St>,
4887 St: AsRef<str>,
4888 {
4889 self._scopes
4890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4891 self
4892 }
4893
4894 /// Removes all scopes, and no default scope will be used either.
4895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4896 /// for details).
4897 pub fn clear_scopes(mut self) -> SavedColumnListCall<'a, C> {
4898 self._scopes.clear();
4899 self
4900 }
4901}