google_sheets4/
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    /// See, edit, create, and delete all of your Google Drive files
17    Drive,
18
19    /// See, edit, create, and delete only the specific Google Drive files you use with this app
20    DriveFile,
21
22    /// See and download all your Google Drive files
23    DriveReadonly,
24
25    /// See, edit, create, and delete all your Google Sheets spreadsheets
26    Spreadsheet,
27
28    /// See all your Google Sheets spreadsheets
29    SpreadsheetReadonly,
30}
31
32impl AsRef<str> for Scope {
33    fn as_ref(&self) -> &str {
34        match *self {
35            Scope::Drive => "https://www.googleapis.com/auth/drive",
36            Scope::DriveFile => "https://www.googleapis.com/auth/drive.file",
37            Scope::DriveReadonly => "https://www.googleapis.com/auth/drive.readonly",
38            Scope::Spreadsheet => "https://www.googleapis.com/auth/spreadsheets",
39            Scope::SpreadsheetReadonly => "https://www.googleapis.com/auth/spreadsheets.readonly",
40        }
41    }
42}
43
44#[allow(clippy::derivable_impls)]
45impl Default for Scope {
46    fn default() -> Scope {
47        Scope::DriveReadonly
48    }
49}
50
51// ########
52// HUB ###
53// ######
54
55/// Central instance to access all Sheets related resource activities
56///
57/// # Examples
58///
59/// Instantiate a new hub
60///
61/// ```test_harness,no_run
62/// extern crate hyper;
63/// extern crate hyper_rustls;
64/// extern crate google_sheets4 as sheets4;
65/// use sheets4::api::ValueRange;
66/// use sheets4::{Result, Error};
67/// # async fn dox() {
68/// use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
69///
70/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
71/// // `client_secret`, among other things.
72/// let secret: yup_oauth2::ApplicationSecret = Default::default();
73/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
74/// // unless you replace  `None` with the desired Flow.
75/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
76/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
77/// // retrieve them from storage.
78/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
79///     .with_native_roots()
80///     .unwrap()
81///     .https_only()
82///     .enable_http2()
83///     .build();
84///
85/// let executor = hyper_util::rt::TokioExecutor::new();
86/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
87///     secret,
88///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
89///     yup_oauth2::client::CustomHyperClientBuilder::from(
90///         hyper_util::client::legacy::Client::builder(executor).build(connector),
91///     ),
92/// ).build().await.unwrap();
93///
94/// let client = hyper_util::client::legacy::Client::builder(
95///     hyper_util::rt::TokioExecutor::new()
96/// )
97/// .build(
98///     hyper_rustls::HttpsConnectorBuilder::new()
99///         .with_native_roots()
100///         .unwrap()
101///         .https_or_http()
102///         .enable_http2()
103///         .build()
104/// );
105/// let mut hub = Sheets::new(client, auth);
106/// // As the method needs a request, you would usually fill it with the desired information
107/// // into the respective structure. Some of the parts shown here might not be applicable !
108/// // Values shown here are possibly random and not representative !
109/// let mut req = ValueRange::default();
110///
111/// // You can configure optional parameters by calling the respective setters at will, and
112/// // execute the final call using `doit()`.
113/// // Values shown here are possibly random and not representative !
114/// let result = hub.spreadsheets().values_append(req, "spreadsheetId", "range")
115///              .value_input_option("dolor")
116///              .response_value_render_option("ea")
117///              .response_date_time_render_option("ipsum")
118///              .insert_data_option("invidunt")
119///              .include_values_in_response(true)
120///              .doit().await;
121///
122/// match result {
123///     Err(e) => match e {
124///         // The Error enum provides details about what exactly happened.
125///         // You can also just use its `Debug`, `Display` or `Error` traits
126///          Error::HttpError(_)
127///         |Error::Io(_)
128///         |Error::MissingAPIKey
129///         |Error::MissingToken(_)
130///         |Error::Cancelled
131///         |Error::UploadSizeLimitExceeded(_, _)
132///         |Error::Failure(_)
133///         |Error::BadRequest(_)
134///         |Error::FieldClash(_)
135///         |Error::JsonDecodeError(_, _) => println!("{}", e),
136///     },
137///     Ok(res) => println!("Success: {:?}", res),
138/// }
139/// # }
140/// ```
141#[derive(Clone)]
142pub struct Sheets<C> {
143    pub client: common::Client<C>,
144    pub auth: Box<dyn common::GetToken>,
145    _user_agent: String,
146    _base_url: String,
147    _root_url: String,
148}
149
150impl<C> common::Hub for Sheets<C> {}
151
152impl<'a, C> Sheets<C> {
153    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Sheets<C> {
154        Sheets {
155            client,
156            auth: Box::new(auth),
157            _user_agent: "google-api-rust-client/7.0.0".to_string(),
158            _base_url: "https://sheets.googleapis.com/".to_string(),
159            _root_url: "https://sheets.googleapis.com/".to_string(),
160        }
161    }
162
163    pub fn spreadsheets(&'a self) -> SpreadsheetMethods<'a, C> {
164        SpreadsheetMethods { hub: self }
165    }
166
167    /// Set the user-agent header field to use in all requests to the server.
168    /// It defaults to `google-api-rust-client/7.0.0`.
169    ///
170    /// Returns the previously set user-agent.
171    pub fn user_agent(&mut self, agent_name: String) -> String {
172        std::mem::replace(&mut self._user_agent, agent_name)
173    }
174
175    /// Set the base url to use in all requests to the server.
176    /// It defaults to `https://sheets.googleapis.com/`.
177    ///
178    /// Returns the previously set base url.
179    pub fn base_url(&mut self, new_base_url: String) -> String {
180        std::mem::replace(&mut self._base_url, new_base_url)
181    }
182
183    /// Set the root url to use in all requests to the server.
184    /// It defaults to `https://sheets.googleapis.com/`.
185    ///
186    /// Returns the previously set root url.
187    pub fn root_url(&mut self, new_root_url: String) -> String {
188        std::mem::replace(&mut self._root_url, new_root_url)
189    }
190}
191
192// ############
193// SCHEMAS ###
194// ##########
195/// Adds a new banded range to the spreadsheet.
196///
197/// This type is not used in any activity, and only used as *part* of another schema.
198///
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct AddBandingRequest {
203    /// The banded range to add. The bandedRangeId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a range that already exists.)
204    #[serde(rename = "bandedRange")]
205    pub banded_range: Option<BandedRange>,
206}
207
208impl common::Part for AddBandingRequest {}
209
210/// The result of adding a banded range.
211///
212/// This type is not used in any activity, and only used as *part* of another schema.
213///
214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
215#[serde_with::serde_as]
216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
217pub struct AddBandingResponse {
218    /// The banded range that was added.
219    #[serde(rename = "bandedRange")]
220    pub banded_range: Option<BandedRange>,
221}
222
223impl common::Part for AddBandingResponse {}
224
225/// Adds a chart to a sheet in the spreadsheet.
226///
227/// This type is not used in any activity, and only used as *part* of another schema.
228///
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct AddChartRequest {
233    /// The chart that should be added to the spreadsheet, including the position where it should be placed. The chartId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of an embedded object that already exists.)
234    pub chart: Option<EmbeddedChart>,
235}
236
237impl common::Part for AddChartRequest {}
238
239/// The result of adding a chart to a spreadsheet.
240///
241/// This type is not used in any activity, and only used as *part* of another schema.
242///
243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
244#[serde_with::serde_as]
245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
246pub struct AddChartResponse {
247    /// The newly added chart.
248    pub chart: Option<EmbeddedChart>,
249}
250
251impl common::Part for AddChartResponse {}
252
253/// Adds a new conditional format rule at the given index. All subsequent rules' indexes are incremented.
254///
255/// This type is not used in any activity, and only used as *part* of another schema.
256///
257#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
258#[serde_with::serde_as]
259#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
260pub struct AddConditionalFormatRuleRequest {
261    /// The zero-based index where the rule should be inserted.
262    pub index: Option<i32>,
263    /// The rule to add.
264    pub rule: Option<ConditionalFormatRule>,
265}
266
267impl common::Part for AddConditionalFormatRuleRequest {}
268
269/// Adds a data source. After the data source is added successfully, an associated DATA_SOURCE sheet is created and an execution is triggered to refresh the sheet to read data from the data source. The request requires an additional `bigquery.readonly` OAuth scope if you are adding a BigQuery data source.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct AddDataSourceRequest {
277    /// The data source to add.
278    #[serde(rename = "dataSource")]
279    pub data_source: Option<DataSource>,
280}
281
282impl common::Part for AddDataSourceRequest {}
283
284/// The result of adding a data source.
285///
286/// This type is not used in any activity, and only used as *part* of another schema.
287///
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct AddDataSourceResponse {
292    /// The data execution status.
293    #[serde(rename = "dataExecutionStatus")]
294    pub data_execution_status: Option<DataExecutionStatus>,
295    /// The data source that was created.
296    #[serde(rename = "dataSource")]
297    pub data_source: Option<DataSource>,
298}
299
300impl common::Part for AddDataSourceResponse {}
301
302/// Creates a group over the specified range. If the requested range is a superset of the range of an existing group G, then the depth of G is incremented and this new group G' has the depth of that group. For example, a group [C:D, depth 1] + [B:E] results in groups [B:E, depth 1] and [C:D, depth 2]. If the requested range is a subset of the range of an existing group G, then the depth of the new group G' becomes one greater than the depth of G. For example, a group [B:E, depth 1] + [C:D] results in groups [B:E, depth 1] and [C:D, depth 2]. If the requested range starts before and ends within, or starts within and ends after, the range of an existing group G, then the range of the existing group G becomes the union of the ranges, and the new group G' has depth one greater than the depth of G and range as the intersection of the ranges. For example, a group [B:D, depth 1] + [C:E] results in groups [B:E, depth 1] and [C:D, depth 2].
303///
304/// This type is not used in any activity, and only used as *part* of another schema.
305///
306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
307#[serde_with::serde_as]
308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
309pub struct AddDimensionGroupRequest {
310    /// The range over which to create a group.
311    pub range: Option<DimensionRange>,
312}
313
314impl common::Part for AddDimensionGroupRequest {}
315
316/// The result of adding a group.
317///
318/// This type is not used in any activity, and only used as *part* of another schema.
319///
320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
321#[serde_with::serde_as]
322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
323pub struct AddDimensionGroupResponse {
324    /// All groups of a dimension after adding a group to that dimension.
325    #[serde(rename = "dimensionGroups")]
326    pub dimension_groups: Option<Vec<DimensionGroup>>,
327}
328
329impl common::Part for AddDimensionGroupResponse {}
330
331/// Adds a filter view.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct AddFilterViewRequest {
339    /// The filter to add. The filterViewId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a filter that already exists.)
340    pub filter: Option<FilterView>,
341}
342
343impl common::Part for AddFilterViewRequest {}
344
345/// The result of adding a filter view.
346///
347/// This type is not used in any activity, and only used as *part* of another schema.
348///
349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
350#[serde_with::serde_as]
351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
352pub struct AddFilterViewResponse {
353    /// The newly added filter view.
354    pub filter: Option<FilterView>,
355}
356
357impl common::Part for AddFilterViewResponse {}
358
359/// Adds a named range to the spreadsheet.
360///
361/// This type is not used in any activity, and only used as *part* of another schema.
362///
363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
364#[serde_with::serde_as]
365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
366pub struct AddNamedRangeRequest {
367    /// The named range to add. The namedRangeId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a range that already exists.)
368    #[serde(rename = "namedRange")]
369    pub named_range: Option<NamedRange>,
370}
371
372impl common::Part for AddNamedRangeRequest {}
373
374/// The result of adding a named range.
375///
376/// This type is not used in any activity, and only used as *part* of another schema.
377///
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct AddNamedRangeResponse {
382    /// The named range to add.
383    #[serde(rename = "namedRange")]
384    pub named_range: Option<NamedRange>,
385}
386
387impl common::Part for AddNamedRangeResponse {}
388
389/// Adds a new protected range.
390///
391/// This type is not used in any activity, and only used as *part* of another schema.
392///
393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
394#[serde_with::serde_as]
395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
396pub struct AddProtectedRangeRequest {
397    /// The protected range to be added. The protectedRangeId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a range that already exists.)
398    #[serde(rename = "protectedRange")]
399    pub protected_range: Option<ProtectedRange>,
400}
401
402impl common::Part for AddProtectedRangeRequest {}
403
404/// The result of adding a new protected range.
405///
406/// This type is not used in any activity, and only used as *part* of another schema.
407///
408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
409#[serde_with::serde_as]
410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
411pub struct AddProtectedRangeResponse {
412    /// The newly added protected range.
413    #[serde(rename = "protectedRange")]
414    pub protected_range: Option<ProtectedRange>,
415}
416
417impl common::Part for AddProtectedRangeResponse {}
418
419/// Adds a new sheet. When a sheet is added at a given index, all subsequent sheets' indexes are incremented. To add an object sheet, use AddChartRequest instead and specify EmbeddedObjectPosition.sheetId or EmbeddedObjectPosition.newSheet.
420///
421/// This type is not used in any activity, and only used as *part* of another schema.
422///
423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
424#[serde_with::serde_as]
425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
426pub struct AddSheetRequest {
427    /// The properties the new sheet should have. All properties are optional. The sheetId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a sheet that already exists.)
428    pub properties: Option<SheetProperties>,
429}
430
431impl common::Part for AddSheetRequest {}
432
433/// The result of adding a sheet.
434///
435/// This type is not used in any activity, and only used as *part* of another schema.
436///
437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
438#[serde_with::serde_as]
439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
440pub struct AddSheetResponse {
441    /// The properties of the newly added sheet.
442    pub properties: Option<SheetProperties>,
443}
444
445impl common::Part for AddSheetResponse {}
446
447/// Adds a slicer to a sheet in the spreadsheet.
448///
449/// This type is not used in any activity, and only used as *part* of another schema.
450///
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct AddSlicerRequest {
455    /// The slicer that should be added to the spreadsheet, including the position where it should be placed. The slicerId field is optional; if one is not set, an id will be randomly generated. (It is an error to specify the ID of a slicer that already exists.)
456    pub slicer: Option<Slicer>,
457}
458
459impl common::Part for AddSlicerRequest {}
460
461/// The result of adding a slicer to a spreadsheet.
462///
463/// This type is not used in any activity, and only used as *part* of another schema.
464///
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct AddSlicerResponse {
469    /// The newly added slicer.
470    pub slicer: Option<Slicer>,
471}
472
473impl common::Part for AddSlicerResponse {}
474
475/// Adds a new table to the spreadsheet.
476///
477/// This type is not used in any activity, and only used as *part* of another schema.
478///
479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
480#[serde_with::serde_as]
481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
482pub struct AddTableRequest {
483    /// Required. The table to add.
484    pub table: Option<Table>,
485}
486
487impl common::Part for AddTableRequest {}
488
489/// The result of adding a table.
490///
491/// This type is not used in any activity, and only used as *part* of another schema.
492///
493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
494#[serde_with::serde_as]
495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
496pub struct AddTableResponse {
497    /// Output only. The table that was added.
498    pub table: Option<Table>,
499}
500
501impl common::Part for AddTableResponse {}
502
503/// Adds new cells after the last row with data in a sheet, inserting new rows into the sheet if necessary.
504///
505/// This type is not used in any activity, and only used as *part* of another schema.
506///
507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
508#[serde_with::serde_as]
509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
510pub struct AppendCellsRequest {
511    /// The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; 'row.values.' should not be specified. A single `"*"` can be used as short-hand for listing every field.
512    pub fields: Option<common::FieldMask>,
513    /// The data to append.
514    pub rows: Option<Vec<RowData>>,
515    /// The sheet ID to append the data to.
516    #[serde(rename = "sheetId")]
517    pub sheet_id: Option<i32>,
518    /// The ID of the table to append data to. The data will be only appended to the table body. This field also takes precedence over the `sheet_id` field.
519    #[serde(rename = "tableId")]
520    pub table_id: Option<String>,
521}
522
523impl common::Part for AppendCellsRequest {}
524
525/// Appends rows or columns to the end of a sheet.
526///
527/// This type is not used in any activity, and only used as *part* of another schema.
528///
529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
530#[serde_with::serde_as]
531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
532pub struct AppendDimensionRequest {
533    /// Whether rows or columns should be appended.
534    pub dimension: Option<String>,
535    /// The number of rows or columns to append.
536    pub length: Option<i32>,
537    /// The sheet to append rows or columns to.
538    #[serde(rename = "sheetId")]
539    pub sheet_id: Option<i32>,
540}
541
542impl common::Part for AppendDimensionRequest {}
543
544/// The response when updating a range of values in a spreadsheet.
545///
546/// # Activities
547///
548/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
549/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
550///
551/// * [values append spreadsheets](SpreadsheetValueAppendCall) (response)
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct AppendValuesResponse {
556    /// The spreadsheet the updates were applied to.
557    #[serde(rename = "spreadsheetId")]
558    pub spreadsheet_id: Option<String>,
559    /// The range (in A1 notation) of the table that values are being appended to (before the values were appended). Empty if no table was found.
560    #[serde(rename = "tableRange")]
561    pub table_range: Option<String>,
562    /// Information about the updates that were applied.
563    pub updates: Option<UpdateValuesResponse>,
564}
565
566impl common::ResponseResult for AppendValuesResponse {}
567
568/// Fills in more data based on existing data.
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct AutoFillRequest {
576    /// The range to autofill. This will examine the range and detect the location that has data and automatically fill that data in to the rest of the range.
577    pub range: Option<GridRange>,
578    /// The source and destination areas to autofill. This explicitly lists the source of the autofill and where to extend that data.
579    #[serde(rename = "sourceAndDestination")]
580    pub source_and_destination: Option<SourceAndDestination>,
581    /// True if we should generate data with the "alternate" series. This differs based on the type and amount of source data.
582    #[serde(rename = "useAlternateSeries")]
583    pub use_alternate_series: Option<bool>,
584}
585
586impl common::Part for AutoFillRequest {}
587
588/// Automatically resizes one or more dimensions based on the contents of the cells in that dimension.
589///
590/// This type is not used in any activity, and only used as *part* of another schema.
591///
592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
593#[serde_with::serde_as]
594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
595pub struct AutoResizeDimensionsRequest {
596    /// The dimensions on a data source sheet to automatically resize.
597    #[serde(rename = "dataSourceSheetDimensions")]
598    pub data_source_sheet_dimensions: Option<DataSourceSheetDimensionRange>,
599    /// The dimensions to automatically resize.
600    pub dimensions: Option<DimensionRange>,
601}
602
603impl common::Part for AutoResizeDimensionsRequest {}
604
605/// A banded (alternating colors) range in a sheet.
606///
607/// This type is not used in any activity, and only used as *part* of another schema.
608///
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct BandedRange {
613    /// The ID of the banded range. If unset, refer to banded_range_reference.
614    #[serde(rename = "bandedRangeId")]
615    pub banded_range_id: Option<i32>,
616    /// Output only. The reference of the banded range, used to identify the ID that is not supported by the banded_range_id.
617    #[serde(rename = "bandedRangeReference")]
618    pub banded_range_reference: Option<String>,
619    /// Properties for column bands. These properties are applied on a column- by-column basis throughout all the columns in the range. At least one of row_properties or column_properties must be specified.
620    #[serde(rename = "columnProperties")]
621    pub column_properties: Option<BandingProperties>,
622    /// The range over which these properties are applied.
623    pub range: Option<GridRange>,
624    /// Properties for row bands. These properties are applied on a row-by-row basis throughout all the rows in the range. At least one of row_properties or column_properties must be specified.
625    #[serde(rename = "rowProperties")]
626    pub row_properties: Option<BandingProperties>,
627}
628
629impl common::Part for BandedRange {}
630
631/// Properties referring a single dimension (either row or column). If both BandedRange.row_properties and BandedRange.column_properties are set, the fill colors are applied to cells according to the following rules: * header_color and footer_color take priority over band colors. * first_band_color takes priority over second_band_color. * row_properties takes priority over column_properties. For example, the first row color takes priority over the first column color, but the first column color takes priority over the second row color. Similarly, the row header takes priority over the column header in the top left cell, but the column header takes priority over the first row color if the row header is not set.
632///
633/// This type is not used in any activity, and only used as *part* of another schema.
634///
635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
636#[serde_with::serde_as]
637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
638pub struct BandingProperties {
639    /// The first color that is alternating. (Required) Deprecated: Use first_band_color_style.
640    #[serde(rename = "firstBandColor")]
641    pub first_band_color: Option<Color>,
642    /// The first color that is alternating. (Required) If first_band_color is also set, this field takes precedence.
643    #[serde(rename = "firstBandColorStyle")]
644    pub first_band_color_style: Option<ColorStyle>,
645    /// The color of the last row or column. If this field is not set, the last row or column is filled with either first_band_color or second_band_color, depending on the color of the previous row or column. Deprecated: Use footer_color_style.
646    #[serde(rename = "footerColor")]
647    pub footer_color: Option<Color>,
648    /// The color of the last row or column. If this field is not set, the last row or column is filled with either first_band_color or second_band_color, depending on the color of the previous row or column. If footer_color is also set, this field takes precedence.
649    #[serde(rename = "footerColorStyle")]
650    pub footer_color_style: Option<ColorStyle>,
651    /// The color of the first row or column. If this field is set, the first row or column is filled with this color and the colors alternate between first_band_color and second_band_color starting from the second row or column. Otherwise, the first row or column is filled with first_band_color and the colors proceed to alternate as they normally would. Deprecated: Use header_color_style.
652    #[serde(rename = "headerColor")]
653    pub header_color: Option<Color>,
654    /// The color of the first row or column. If this field is set, the first row or column is filled with this color and the colors alternate between first_band_color and second_band_color starting from the second row or column. Otherwise, the first row or column is filled with first_band_color and the colors proceed to alternate as they normally would. If header_color is also set, this field takes precedence.
655    #[serde(rename = "headerColorStyle")]
656    pub header_color_style: Option<ColorStyle>,
657    /// The second color that is alternating. (Required) Deprecated: Use second_band_color_style.
658    #[serde(rename = "secondBandColor")]
659    pub second_band_color: Option<Color>,
660    /// The second color that is alternating. (Required) If second_band_color is also set, this field takes precedence.
661    #[serde(rename = "secondBandColorStyle")]
662    pub second_band_color_style: Option<ColorStyle>,
663}
664
665impl common::Part for BandingProperties {}
666
667/// Formatting options for baseline value.
668///
669/// This type is not used in any activity, and only used as *part* of another schema.
670///
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct BaselineValueFormat {
675    /// The comparison type of key value with baseline value.
676    #[serde(rename = "comparisonType")]
677    pub comparison_type: Option<String>,
678    /// Description which is appended after the baseline value. This field is optional.
679    pub description: Option<String>,
680    /// Color to be used, in case baseline value represents a negative change for key value. This field is optional. Deprecated: Use negative_color_style.
681    #[serde(rename = "negativeColor")]
682    pub negative_color: Option<Color>,
683    /// Color to be used, in case baseline value represents a negative change for key value. This field is optional. If negative_color is also set, this field takes precedence.
684    #[serde(rename = "negativeColorStyle")]
685    pub negative_color_style: Option<ColorStyle>,
686    /// Specifies the horizontal text positioning of baseline value. This field is optional. If not specified, default positioning is used.
687    pub position: Option<TextPosition>,
688    /// Color to be used, in case baseline value represents a positive change for key value. This field is optional. Deprecated: Use positive_color_style.
689    #[serde(rename = "positiveColor")]
690    pub positive_color: Option<Color>,
691    /// Color to be used, in case baseline value represents a positive change for key value. This field is optional. If positive_color is also set, this field takes precedence.
692    #[serde(rename = "positiveColorStyle")]
693    pub positive_color_style: Option<ColorStyle>,
694    /// Text formatting options for baseline value. The link field is not supported.
695    #[serde(rename = "textFormat")]
696    pub text_format: Option<TextFormat>,
697}
698
699impl common::Part for BaselineValueFormat {}
700
701/// An axis of the chart. A chart may not have more than one axis per axis position.
702///
703/// This type is not used in any activity, and only used as *part* of another schema.
704///
705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
706#[serde_with::serde_as]
707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
708pub struct BasicChartAxis {
709    /// The format of the title. Only valid if the axis is not associated with the domain. The link field is not supported.
710    pub format: Option<TextFormat>,
711    /// The position of this axis.
712    pub position: Option<String>,
713    /// The title of this axis. If set, this overrides any title inferred from headers of the data.
714    pub title: Option<String>,
715    /// The axis title text position.
716    #[serde(rename = "titleTextPosition")]
717    pub title_text_position: Option<TextPosition>,
718    /// The view window options for this axis.
719    #[serde(rename = "viewWindowOptions")]
720    pub view_window_options: Option<ChartAxisViewWindowOptions>,
721}
722
723impl common::Part for BasicChartAxis {}
724
725/// The domain of a chart. For example, if charting stock prices over time, this would be the date.
726///
727/// This type is not used in any activity, and only used as *part* of another schema.
728///
729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
730#[serde_with::serde_as]
731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
732pub struct BasicChartDomain {
733    /// The data of the domain. For example, if charting stock prices over time, this is the data representing the dates.
734    pub domain: Option<ChartData>,
735    /// True to reverse the order of the domain values (horizontal axis).
736    pub reversed: Option<bool>,
737}
738
739impl common::Part for BasicChartDomain {}
740
741/// A single series of data in a chart. For example, if charting stock prices over time, multiple series may exist, one for the "Open Price", "High Price", "Low Price" and "Close Price".
742///
743/// This type is not used in any activity, and only used as *part* of another schema.
744///
745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
746#[serde_with::serde_as]
747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
748pub struct BasicChartSeries {
749    /// The color for elements (such as bars, lines, and points) associated with this series. If empty, a default color is used. Deprecated: Use color_style.
750    pub color: Option<Color>,
751    /// The color for elements (such as bars, lines, and points) associated with this series. If empty, a default color is used. If color is also set, this field takes precedence.
752    #[serde(rename = "colorStyle")]
753    pub color_style: Option<ColorStyle>,
754    /// Information about the data labels for this series.
755    #[serde(rename = "dataLabel")]
756    pub data_label: Option<DataLabel>,
757    /// The line style of this series. Valid only if the chartType is AREA, LINE, or SCATTER. COMBO charts are also supported if the series chart type is AREA or LINE.
758    #[serde(rename = "lineStyle")]
759    pub line_style: Option<LineStyle>,
760    /// The style for points associated with this series. Valid only if the chartType is AREA, LINE, or SCATTER. COMBO charts are also supported if the series chart type is AREA, LINE, or SCATTER. If empty, a default point style is used.
761    #[serde(rename = "pointStyle")]
762    pub point_style: Option<PointStyle>,
763    /// The data being visualized in this chart series.
764    pub series: Option<ChartData>,
765    /// Style override settings for series data points.
766    #[serde(rename = "styleOverrides")]
767    pub style_overrides: Option<Vec<BasicSeriesDataPointStyleOverride>>,
768    /// The minor axis that will specify the range of values for this series. For example, if charting stocks over time, the "Volume" series may want to be pinned to the right with the prices pinned to the left, because the scale of trading volume is different than the scale of prices. It is an error to specify an axis that isn't a valid minor axis for the chart's type.
769    #[serde(rename = "targetAxis")]
770    pub target_axis: Option<String>,
771    /// The type of this series. Valid only if the chartType is COMBO. Different types will change the way the series is visualized. Only LINE, AREA, and COLUMN are supported.
772    #[serde(rename = "type")]
773    pub type_: Option<String>,
774}
775
776impl common::Part for BasicChartSeries {}
777
778/// The specification for a basic chart. See BasicChartType for the list of charts this supports.
779///
780/// This type is not used in any activity, and only used as *part* of another schema.
781///
782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
783#[serde_with::serde_as]
784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
785pub struct BasicChartSpec {
786    /// The axis on the chart.
787    pub axis: Option<Vec<BasicChartAxis>>,
788    /// The type of the chart.
789    #[serde(rename = "chartType")]
790    pub chart_type: Option<String>,
791    /// The behavior of tooltips and data highlighting when hovering on data and chart area.
792    #[serde(rename = "compareMode")]
793    pub compare_mode: Option<String>,
794    /// The domain of data this is charting. Only a single domain is supported.
795    pub domains: Option<Vec<BasicChartDomain>>,
796    /// The number of rows or columns in the data that are "headers". If not set, Google Sheets will guess how many rows are headers based on the data. (Note that BasicChartAxis.title may override the axis title inferred from the header values.)
797    #[serde(rename = "headerCount")]
798    pub header_count: Option<i32>,
799    /// If some values in a series are missing, gaps may appear in the chart (e.g, segments of lines in a line chart will be missing). To eliminate these gaps set this to true. Applies to Line, Area, and Combo charts.
800    #[serde(rename = "interpolateNulls")]
801    pub interpolate_nulls: Option<bool>,
802    /// The position of the chart legend.
803    #[serde(rename = "legendPosition")]
804    pub legend_position: Option<String>,
805    /// Gets whether all lines should be rendered smooth or straight by default. Applies to Line charts.
806    #[serde(rename = "lineSmoothing")]
807    pub line_smoothing: Option<bool>,
808    /// The data this chart is visualizing.
809    pub series: Option<Vec<BasicChartSeries>>,
810    /// The stacked type for charts that support vertical stacking. Applies to Area, Bar, Column, Combo, and Stepped Area charts.
811    #[serde(rename = "stackedType")]
812    pub stacked_type: Option<String>,
813    /// True to make the chart 3D. Applies to Bar and Column charts.
814    #[serde(rename = "threeDimensional")]
815    pub three_dimensional: Option<bool>,
816    /// Controls whether to display additional data labels on stacked charts which sum the total value of all stacked values at each value along the domain axis. These data labels can only be set when chart_type is one of AREA, BAR, COLUMN, COMBO or STEPPED_AREA and stacked_type is either STACKED or PERCENT_STACKED. In addition, for COMBO, this will only be supported if there is only one type of stackable series type or one type has more series than the others and each of the other types have no more than one series. For example, if a chart has two stacked bar series and one area series, the total data labels will be supported. If it has three bar series and two area series, total data labels are not allowed. Neither CUSTOM nor placement can be set on the total_data_label.
817    #[serde(rename = "totalDataLabel")]
818    pub total_data_label: Option<DataLabel>,
819}
820
821impl common::Part for BasicChartSpec {}
822
823/// The default filter associated with a sheet.
824///
825/// This type is not used in any activity, and only used as *part* of another schema.
826///
827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
828#[serde_with::serde_as]
829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
830pub struct BasicFilter {
831    /// The criteria for showing/hiding values per column. The map's key is the column index, and the value is the criteria for that column. This field is deprecated in favor of filter_specs.
832    pub criteria: Option<HashMap<String, FilterCriteria>>,
833    /// The filter criteria per column. Both criteria and filter_specs are populated in responses. If both fields are specified in an update request, this field takes precedence.
834    #[serde(rename = "filterSpecs")]
835    pub filter_specs: Option<Vec<FilterSpec>>,
836    /// The range the filter covers.
837    pub range: Option<GridRange>,
838    /// The sort order per column. Later specifications are used when values are equal in the earlier specifications.
839    #[serde(rename = "sortSpecs")]
840    pub sort_specs: Option<Vec<SortSpec>>,
841    /// The table this filter is backed by, if any. When writing, only one of range or table_id may be set.
842    #[serde(rename = "tableId")]
843    pub table_id: Option<String>,
844}
845
846impl common::Part for BasicFilter {}
847
848/// Style override settings for a single series data point.
849///
850/// This type is not used in any activity, and only used as *part* of another schema.
851///
852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
853#[serde_with::serde_as]
854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
855pub struct BasicSeriesDataPointStyleOverride {
856    /// Color of the series data point. If empty, the series default is used. Deprecated: Use color_style.
857    pub color: Option<Color>,
858    /// Color of the series data point. If empty, the series default is used. If color is also set, this field takes precedence.
859    #[serde(rename = "colorStyle")]
860    pub color_style: Option<ColorStyle>,
861    /// The zero-based index of the series data point.
862    pub index: Option<i32>,
863    /// Point style of the series data point. Valid only if the chartType is AREA, LINE, or SCATTER. COMBO charts are also supported if the series chart type is AREA, LINE, or SCATTER. If empty, the series default is used.
864    #[serde(rename = "pointStyle")]
865    pub point_style: Option<PointStyle>,
866}
867
868impl common::Part for BasicSeriesDataPointStyleOverride {}
869
870/// The request for clearing more than one range selected by a DataFilter in a spreadsheet.
871///
872/// # Activities
873///
874/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
875/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
876///
877/// * [values batch clear by data filter spreadsheets](SpreadsheetValueBatchClearByDataFilterCall) (request)
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct BatchClearValuesByDataFilterRequest {
882    /// The DataFilters used to determine which ranges to clear.
883    #[serde(rename = "dataFilters")]
884    pub data_filters: Option<Vec<DataFilter>>,
885}
886
887impl common::RequestValue for BatchClearValuesByDataFilterRequest {}
888
889/// The response when clearing a range of values selected with DataFilters in a spreadsheet.
890///
891/// # Activities
892///
893/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
894/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
895///
896/// * [values batch clear by data filter spreadsheets](SpreadsheetValueBatchClearByDataFilterCall) (response)
897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
898#[serde_with::serde_as]
899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct BatchClearValuesByDataFilterResponse {
901    /// The ranges that were cleared, in [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). If the requests are for an unbounded range or a ranger larger than the bounds of the sheet, this is the actual ranges that were cleared, bounded to the sheet's limits.
902    #[serde(rename = "clearedRanges")]
903    pub cleared_ranges: Option<Vec<String>>,
904    /// The spreadsheet the updates were applied to.
905    #[serde(rename = "spreadsheetId")]
906    pub spreadsheet_id: Option<String>,
907}
908
909impl common::ResponseResult for BatchClearValuesByDataFilterResponse {}
910
911/// The request for clearing more than one range of values in a spreadsheet.
912///
913/// # Activities
914///
915/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
916/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
917///
918/// * [values batch clear spreadsheets](SpreadsheetValueBatchClearCall) (request)
919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
920#[serde_with::serde_as]
921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
922pub struct BatchClearValuesRequest {
923    /// The ranges to clear, in [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell).
924    pub ranges: Option<Vec<String>>,
925}
926
927impl common::RequestValue for BatchClearValuesRequest {}
928
929/// The response when clearing a range of values in a spreadsheet.
930///
931/// # Activities
932///
933/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
934/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
935///
936/// * [values batch clear spreadsheets](SpreadsheetValueBatchClearCall) (response)
937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
938#[serde_with::serde_as]
939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
940pub struct BatchClearValuesResponse {
941    /// The ranges that were cleared, in A1 notation. If the requests are for an unbounded range or a ranger larger than the bounds of the sheet, this is the actual ranges that were cleared, bounded to the sheet's limits.
942    #[serde(rename = "clearedRanges")]
943    pub cleared_ranges: Option<Vec<String>>,
944    /// The spreadsheet the updates were applied to.
945    #[serde(rename = "spreadsheetId")]
946    pub spreadsheet_id: Option<String>,
947}
948
949impl common::ResponseResult for BatchClearValuesResponse {}
950
951/// The request for retrieving a range of values in a spreadsheet selected by a set of DataFilters.
952///
953/// # Activities
954///
955/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
956/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
957///
958/// * [values batch get by data filter spreadsheets](SpreadsheetValueBatchGetByDataFilterCall) (request)
959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
960#[serde_with::serde_as]
961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
962pub struct BatchGetValuesByDataFilterRequest {
963    /// The data filters used to match the ranges of values to retrieve. Ranges that match any of the specified data filters are included in the response.
964    #[serde(rename = "dataFilters")]
965    pub data_filters: Option<Vec<DataFilter>>,
966    /// How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
967    #[serde(rename = "dateTimeRenderOption")]
968    pub date_time_render_option: Option<String>,
969    /// The major dimension that results should use. For example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, then a request that selects that range and sets `majorDimension=ROWS` returns `[[1,2],[3,4]]`, whereas a request that sets `majorDimension=COLUMNS` returns `[[1,3],[2,4]]`.
970    #[serde(rename = "majorDimension")]
971    pub major_dimension: Option<String>,
972    /// How values should be represented in the output. The default render option is FORMATTED_VALUE.
973    #[serde(rename = "valueRenderOption")]
974    pub value_render_option: Option<String>,
975}
976
977impl common::RequestValue for BatchGetValuesByDataFilterRequest {}
978
979/// The response when retrieving more than one range of values in a spreadsheet selected by DataFilters.
980///
981/// # Activities
982///
983/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
984/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
985///
986/// * [values batch get by data filter spreadsheets](SpreadsheetValueBatchGetByDataFilterCall) (response)
987#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
988#[serde_with::serde_as]
989#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
990pub struct BatchGetValuesByDataFilterResponse {
991    /// The ID of the spreadsheet the data was retrieved from.
992    #[serde(rename = "spreadsheetId")]
993    pub spreadsheet_id: Option<String>,
994    /// The requested values with the list of data filters that matched them.
995    #[serde(rename = "valueRanges")]
996    pub value_ranges: Option<Vec<MatchedValueRange>>,
997}
998
999impl common::ResponseResult for BatchGetValuesByDataFilterResponse {}
1000
1001/// The response when retrieving more than one range of values in a spreadsheet.
1002///
1003/// # Activities
1004///
1005/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1006/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1007///
1008/// * [values batch get spreadsheets](SpreadsheetValueBatchGetCall) (response)
1009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1010#[serde_with::serde_as]
1011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1012pub struct BatchGetValuesResponse {
1013    /// The ID of the spreadsheet the data was retrieved from.
1014    #[serde(rename = "spreadsheetId")]
1015    pub spreadsheet_id: Option<String>,
1016    /// The requested values. The order of the ValueRanges is the same as the order of the requested ranges.
1017    #[serde(rename = "valueRanges")]
1018    pub value_ranges: Option<Vec<ValueRange>>,
1019}
1020
1021impl common::ResponseResult for BatchGetValuesResponse {}
1022
1023/// The request for updating any aspect of a spreadsheet.
1024///
1025/// # Activities
1026///
1027/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1028/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1029///
1030/// * [batch update spreadsheets](SpreadsheetBatchUpdateCall) (request)
1031#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1032#[serde_with::serde_as]
1033#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1034pub struct BatchUpdateSpreadsheetRequest {
1035    /// Determines if the update response should include the spreadsheet resource.
1036    #[serde(rename = "includeSpreadsheetInResponse")]
1037    pub include_spreadsheet_in_response: Option<bool>,
1038    /// A list of updates to apply to the spreadsheet. Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied.
1039    pub requests: Option<Vec<Request>>,
1040    /// True if grid data should be returned. Meaningful only if include_spreadsheet_in_response is 'true'. This parameter is ignored if a field mask was set in the request.
1041    #[serde(rename = "responseIncludeGridData")]
1042    pub response_include_grid_data: Option<bool>,
1043    /// Limits the ranges included in the response spreadsheet. Meaningful only if include_spreadsheet_in_response is 'true'.
1044    #[serde(rename = "responseRanges")]
1045    pub response_ranges: Option<Vec<String>>,
1046}
1047
1048impl common::RequestValue for BatchUpdateSpreadsheetRequest {}
1049
1050/// The reply for batch updating a spreadsheet.
1051///
1052/// # Activities
1053///
1054/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1055/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1056///
1057/// * [batch update spreadsheets](SpreadsheetBatchUpdateCall) (response)
1058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1059#[serde_with::serde_as]
1060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1061pub struct BatchUpdateSpreadsheetResponse {
1062    /// The reply of the updates. This maps 1:1 with the updates, although replies to some requests may be empty.
1063    pub replies: Option<Vec<Response>>,
1064    /// The spreadsheet the updates were applied to.
1065    #[serde(rename = "spreadsheetId")]
1066    pub spreadsheet_id: Option<String>,
1067    /// The spreadsheet after updates were applied. This is only set if BatchUpdateSpreadsheetRequest.include_spreadsheet_in_response is `true`.
1068    #[serde(rename = "updatedSpreadsheet")]
1069    pub updated_spreadsheet: Option<Spreadsheet>,
1070}
1071
1072impl common::ResponseResult for BatchUpdateSpreadsheetResponse {}
1073
1074/// The request for updating more than one range of values in a spreadsheet.
1075///
1076/// # Activities
1077///
1078/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1079/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1080///
1081/// * [values batch update by data filter spreadsheets](SpreadsheetValueBatchUpdateByDataFilterCall) (request)
1082#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1083#[serde_with::serde_as]
1084#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1085pub struct BatchUpdateValuesByDataFilterRequest {
1086    /// The new values to apply to the spreadsheet. If more than one range is matched by the specified DataFilter the specified values are applied to all of those ranges.
1087    pub data: Option<Vec<DataFilterValueRange>>,
1088    /// Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. The `updatedData` field within each of the BatchUpdateValuesResponse.responses contains the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns).
1089    #[serde(rename = "includeValuesInResponse")]
1090    pub include_values_in_response: Option<bool>,
1091    /// Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
1092    #[serde(rename = "responseDateTimeRenderOption")]
1093    pub response_date_time_render_option: Option<String>,
1094    /// Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
1095    #[serde(rename = "responseValueRenderOption")]
1096    pub response_value_render_option: Option<String>,
1097    /// How the input data should be interpreted.
1098    #[serde(rename = "valueInputOption")]
1099    pub value_input_option: Option<String>,
1100}
1101
1102impl common::RequestValue for BatchUpdateValuesByDataFilterRequest {}
1103
1104/// The response when updating a range of values in a spreadsheet.
1105///
1106/// # Activities
1107///
1108/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1109/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1110///
1111/// * [values batch update by data filter spreadsheets](SpreadsheetValueBatchUpdateByDataFilterCall) (response)
1112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1113#[serde_with::serde_as]
1114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1115pub struct BatchUpdateValuesByDataFilterResponse {
1116    /// The response for each range updated.
1117    pub responses: Option<Vec<UpdateValuesByDataFilterResponse>>,
1118    /// The spreadsheet the updates were applied to.
1119    #[serde(rename = "spreadsheetId")]
1120    pub spreadsheet_id: Option<String>,
1121    /// The total number of cells updated.
1122    #[serde(rename = "totalUpdatedCells")]
1123    pub total_updated_cells: Option<i32>,
1124    /// The total number of columns where at least one cell in the column was updated.
1125    #[serde(rename = "totalUpdatedColumns")]
1126    pub total_updated_columns: Option<i32>,
1127    /// The total number of rows where at least one cell in the row was updated.
1128    #[serde(rename = "totalUpdatedRows")]
1129    pub total_updated_rows: Option<i32>,
1130    /// The total number of sheets where at least one cell in the sheet was updated.
1131    #[serde(rename = "totalUpdatedSheets")]
1132    pub total_updated_sheets: Option<i32>,
1133}
1134
1135impl common::ResponseResult for BatchUpdateValuesByDataFilterResponse {}
1136
1137/// The request for updating more than one range of values in a spreadsheet.
1138///
1139/// # Activities
1140///
1141/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1142/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1143///
1144/// * [values batch update spreadsheets](SpreadsheetValueBatchUpdateCall) (request)
1145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1146#[serde_with::serde_as]
1147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1148pub struct BatchUpdateValuesRequest {
1149    /// The new values to apply to the spreadsheet.
1150    pub data: Option<Vec<ValueRange>>,
1151    /// Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. The `updatedData` field within each of the BatchUpdateValuesResponse.responses contains the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns).
1152    #[serde(rename = "includeValuesInResponse")]
1153    pub include_values_in_response: Option<bool>,
1154    /// Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
1155    #[serde(rename = "responseDateTimeRenderOption")]
1156    pub response_date_time_render_option: Option<String>,
1157    /// Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
1158    #[serde(rename = "responseValueRenderOption")]
1159    pub response_value_render_option: Option<String>,
1160    /// How the input data should be interpreted.
1161    #[serde(rename = "valueInputOption")]
1162    pub value_input_option: Option<String>,
1163}
1164
1165impl common::RequestValue for BatchUpdateValuesRequest {}
1166
1167/// The response when updating a range of values in a spreadsheet.
1168///
1169/// # Activities
1170///
1171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1173///
1174/// * [values batch update spreadsheets](SpreadsheetValueBatchUpdateCall) (response)
1175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1176#[serde_with::serde_as]
1177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1178pub struct BatchUpdateValuesResponse {
1179    /// One UpdateValuesResponse per requested range, in the same order as the requests appeared.
1180    pub responses: Option<Vec<UpdateValuesResponse>>,
1181    /// The spreadsheet the updates were applied to.
1182    #[serde(rename = "spreadsheetId")]
1183    pub spreadsheet_id: Option<String>,
1184    /// The total number of cells updated.
1185    #[serde(rename = "totalUpdatedCells")]
1186    pub total_updated_cells: Option<i32>,
1187    /// The total number of columns where at least one cell in the column was updated.
1188    #[serde(rename = "totalUpdatedColumns")]
1189    pub total_updated_columns: Option<i32>,
1190    /// The total number of rows where at least one cell in the row was updated.
1191    #[serde(rename = "totalUpdatedRows")]
1192    pub total_updated_rows: Option<i32>,
1193    /// The total number of sheets where at least one cell in the sheet was updated.
1194    #[serde(rename = "totalUpdatedSheets")]
1195    pub total_updated_sheets: Option<i32>,
1196}
1197
1198impl common::ResponseResult for BatchUpdateValuesResponse {}
1199
1200/// The specification of a BigQuery data source that's connected to a sheet.
1201///
1202/// This type is not used in any activity, and only used as *part* of another schema.
1203///
1204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1205#[serde_with::serde_as]
1206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1207pub struct BigQueryDataSourceSpec {
1208    /// The ID of a BigQuery enabled Google Cloud project with a billing account attached. For any queries executed against the data source, the project is charged.
1209    #[serde(rename = "projectId")]
1210    pub project_id: Option<String>,
1211    /// A BigQueryQuerySpec.
1212    #[serde(rename = "querySpec")]
1213    pub query_spec: Option<BigQueryQuerySpec>,
1214    /// A BigQueryTableSpec.
1215    #[serde(rename = "tableSpec")]
1216    pub table_spec: Option<BigQueryTableSpec>,
1217}
1218
1219impl common::Part for BigQueryDataSourceSpec {}
1220
1221/// Specifies a custom BigQuery query.
1222///
1223/// This type is not used in any activity, and only used as *part* of another schema.
1224///
1225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1226#[serde_with::serde_as]
1227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1228pub struct BigQueryQuerySpec {
1229    /// The raw query string.
1230    #[serde(rename = "rawQuery")]
1231    pub raw_query: Option<String>,
1232}
1233
1234impl common::Part for BigQueryQuerySpec {}
1235
1236/// Specifies a BigQuery table definition. Only [native tables](https://cloud.google.com/bigquery/docs/tables-intro) are allowed.
1237///
1238/// This type is not used in any activity, and only used as *part* of another schema.
1239///
1240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1241#[serde_with::serde_as]
1242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1243pub struct BigQueryTableSpec {
1244    /// The BigQuery dataset id.
1245    #[serde(rename = "datasetId")]
1246    pub dataset_id: Option<String>,
1247    /// The BigQuery table id.
1248    #[serde(rename = "tableId")]
1249    pub table_id: Option<String>,
1250    /// The ID of a BigQuery project the table belongs to. If not specified, the project_id is assumed.
1251    #[serde(rename = "tableProjectId")]
1252    pub table_project_id: Option<String>,
1253}
1254
1255impl common::Part for BigQueryTableSpec {}
1256
1257/// A condition that can evaluate to true or false. BooleanConditions are used by conditional formatting, data validation, and the criteria in filters.
1258///
1259/// This type is not used in any activity, and only used as *part* of another schema.
1260///
1261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1262#[serde_with::serde_as]
1263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1264pub struct BooleanCondition {
1265    /// The type of condition.
1266    #[serde(rename = "type")]
1267    pub type_: Option<String>,
1268    /// The values of the condition. The number of supported values depends on the condition type. Some support zero values, others one or two values, and ConditionType.ONE_OF_LIST supports an arbitrary number of values.
1269    pub values: Option<Vec<ConditionValue>>,
1270}
1271
1272impl common::Part for BooleanCondition {}
1273
1274/// A rule that may or may not match, depending on the condition.
1275///
1276/// This type is not used in any activity, and only used as *part* of another schema.
1277///
1278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1279#[serde_with::serde_as]
1280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1281pub struct BooleanRule {
1282    /// The condition of the rule. If the condition evaluates to true, the format is applied.
1283    pub condition: Option<BooleanCondition>,
1284    /// The format to apply. Conditional formatting can only apply a subset of formatting: bold, italic, strikethrough, foreground color and, background color.
1285    pub format: Option<CellFormat>,
1286}
1287
1288impl common::Part for BooleanRule {}
1289
1290/// A border along a cell.
1291///
1292/// This type is not used in any activity, and only used as *part* of another schema.
1293///
1294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1295#[serde_with::serde_as]
1296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1297pub struct Border {
1298    /// The color of the border. Deprecated: Use color_style.
1299    pub color: Option<Color>,
1300    /// The color of the border. If color is also set, this field takes precedence.
1301    #[serde(rename = "colorStyle")]
1302    pub color_style: Option<ColorStyle>,
1303    /// The style of the border.
1304    pub style: Option<String>,
1305    /// The width of the border, in pixels. Deprecated; the width is determined by the "style" field.
1306    pub width: Option<i32>,
1307}
1308
1309impl common::Part for Border {}
1310
1311/// The borders of the cell.
1312///
1313/// This type is not used in any activity, and only used as *part* of another schema.
1314///
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct Borders {
1319    /// The bottom border of the cell.
1320    pub bottom: Option<Border>,
1321    /// The left border of the cell.
1322    pub left: Option<Border>,
1323    /// The right border of the cell.
1324    pub right: Option<Border>,
1325    /// The top border of the cell.
1326    pub top: Option<Border>,
1327}
1328
1329impl common::Part for Borders {}
1330
1331/// A bubble chart.
1332///
1333/// This type is not used in any activity, and only used as *part* of another schema.
1334///
1335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1336#[serde_with::serde_as]
1337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1338pub struct BubbleChartSpec {
1339    /// The bubble border color. Deprecated: Use bubble_border_color_style.
1340    #[serde(rename = "bubbleBorderColor")]
1341    pub bubble_border_color: Option<Color>,
1342    /// The bubble border color. If bubble_border_color is also set, this field takes precedence.
1343    #[serde(rename = "bubbleBorderColorStyle")]
1344    pub bubble_border_color_style: Option<ColorStyle>,
1345    /// The data containing the bubble labels. These do not need to be unique.
1346    #[serde(rename = "bubbleLabels")]
1347    pub bubble_labels: Option<ChartData>,
1348    /// The max radius size of the bubbles, in pixels. If specified, the field must be a positive value.
1349    #[serde(rename = "bubbleMaxRadiusSize")]
1350    pub bubble_max_radius_size: Option<i32>,
1351    /// The minimum radius size of the bubbles, in pixels. If specific, the field must be a positive value.
1352    #[serde(rename = "bubbleMinRadiusSize")]
1353    pub bubble_min_radius_size: Option<i32>,
1354    /// The opacity of the bubbles between 0 and 1.0. 0 is fully transparent and 1 is fully opaque.
1355    #[serde(rename = "bubbleOpacity")]
1356    pub bubble_opacity: Option<f32>,
1357    /// The data containing the bubble sizes. Bubble sizes are used to draw the bubbles at different sizes relative to each other. If specified, group_ids must also be specified. This field is optional.
1358    #[serde(rename = "bubbleSizes")]
1359    pub bubble_sizes: Option<ChartData>,
1360    /// The format of the text inside the bubbles. Strikethrough, underline, and link are not supported.
1361    #[serde(rename = "bubbleTextStyle")]
1362    pub bubble_text_style: Option<TextFormat>,
1363    /// The data containing the bubble x-values. These values locate the bubbles in the chart horizontally.
1364    pub domain: Option<ChartData>,
1365    /// The data containing the bubble group IDs. All bubbles with the same group ID are drawn in the same color. If bubble_sizes is specified then this field must also be specified but may contain blank values. This field is optional.
1366    #[serde(rename = "groupIds")]
1367    pub group_ids: Option<ChartData>,
1368    /// Where the legend of the chart should be drawn.
1369    #[serde(rename = "legendPosition")]
1370    pub legend_position: Option<String>,
1371    /// The data containing the bubble y-values. These values locate the bubbles in the chart vertically.
1372    pub series: Option<ChartData>,
1373}
1374
1375impl common::Part for BubbleChartSpec {}
1376
1377/// Cancels one or multiple refreshes of data source objects in the spreadsheet by the specified references. The request requires an additional `bigquery.readonly` OAuth scope if you are cancelling a refresh on a BigQuery data source.
1378///
1379/// This type is not used in any activity, and only used as *part* of another schema.
1380///
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct CancelDataSourceRefreshRequest {
1385    /// Reference to a DataSource. If specified, cancels all associated data source object refreshes for this data source.
1386    #[serde(rename = "dataSourceId")]
1387    pub data_source_id: Option<String>,
1388    /// Cancels all existing data source object refreshes for all data sources in the spreadsheet.
1389    #[serde(rename = "isAll")]
1390    pub is_all: Option<bool>,
1391    /// References to data source objects whose refreshes are to be cancelled.
1392    pub references: Option<DataSourceObjectReferences>,
1393}
1394
1395impl common::Part for CancelDataSourceRefreshRequest {}
1396
1397/// The response from cancelling one or multiple data source object refreshes.
1398///
1399/// This type is not used in any activity, and only used as *part* of another schema.
1400///
1401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1402#[serde_with::serde_as]
1403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1404pub struct CancelDataSourceRefreshResponse {
1405    /// The cancellation statuses of refreshes of all data source objects specified in the request. If is_all is specified, the field contains only those in failure status. Refreshing and canceling refresh the same data source object is also not allowed in the same `batchUpdate`.
1406    pub statuses: Option<Vec<CancelDataSourceRefreshStatus>>,
1407}
1408
1409impl common::Part for CancelDataSourceRefreshResponse {}
1410
1411/// The status of cancelling a single data source object refresh.
1412///
1413/// This type is not used in any activity, and only used as *part* of another schema.
1414///
1415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1416#[serde_with::serde_as]
1417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1418pub struct CancelDataSourceRefreshStatus {
1419    /// Reference to the data source object whose refresh is being cancelled.
1420    pub reference: Option<DataSourceObjectReference>,
1421    /// The cancellation status.
1422    #[serde(rename = "refreshCancellationStatus")]
1423    pub refresh_cancellation_status: Option<RefreshCancellationStatus>,
1424}
1425
1426impl common::Part for CancelDataSourceRefreshStatus {}
1427
1428/// A candlestick chart.
1429///
1430/// This type is not used in any activity, and only used as *part* of another schema.
1431///
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct CandlestickChartSpec {
1436    /// The Candlestick chart data. Only one CandlestickData is supported.
1437    pub data: Option<Vec<CandlestickData>>,
1438    /// The domain data (horizontal axis) for the candlestick chart. String data will be treated as discrete labels, other data will be treated as continuous values.
1439    pub domain: Option<CandlestickDomain>,
1440}
1441
1442impl common::Part for CandlestickChartSpec {}
1443
1444/// The Candlestick chart data, each containing the low, open, close, and high values for a series.
1445///
1446/// This type is not used in any activity, and only used as *part* of another schema.
1447///
1448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1449#[serde_with::serde_as]
1450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1451pub struct CandlestickData {
1452    /// The range data (vertical axis) for the close/final value for each candle. This is the top of the candle body. If greater than the open value the candle will be filled. Otherwise the candle will be hollow.
1453    #[serde(rename = "closeSeries")]
1454    pub close_series: Option<CandlestickSeries>,
1455    /// The range data (vertical axis) for the high/maximum value for each candle. This is the top of the candle's center line.
1456    #[serde(rename = "highSeries")]
1457    pub high_series: Option<CandlestickSeries>,
1458    /// The range data (vertical axis) for the low/minimum value for each candle. This is the bottom of the candle's center line.
1459    #[serde(rename = "lowSeries")]
1460    pub low_series: Option<CandlestickSeries>,
1461    /// The range data (vertical axis) for the open/initial value for each candle. This is the bottom of the candle body. If less than the close value the candle will be filled. Otherwise the candle will be hollow.
1462    #[serde(rename = "openSeries")]
1463    pub open_series: Option<CandlestickSeries>,
1464}
1465
1466impl common::Part for CandlestickData {}
1467
1468/// The domain of a CandlestickChart.
1469///
1470/// This type is not used in any activity, and only used as *part* of another schema.
1471///
1472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1473#[serde_with::serde_as]
1474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1475pub struct CandlestickDomain {
1476    /// The data of the CandlestickDomain.
1477    pub data: Option<ChartData>,
1478    /// True to reverse the order of the domain values (horizontal axis).
1479    pub reversed: Option<bool>,
1480}
1481
1482impl common::Part for CandlestickDomain {}
1483
1484/// The series of a CandlestickData.
1485///
1486/// This type is not used in any activity, and only used as *part* of another schema.
1487///
1488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1489#[serde_with::serde_as]
1490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1491pub struct CandlestickSeries {
1492    /// The data of the CandlestickSeries.
1493    pub data: Option<ChartData>,
1494}
1495
1496impl common::Part for CandlestickSeries {}
1497
1498/// Data about a specific cell.
1499///
1500/// This type is not used in any activity, and only used as *part* of another schema.
1501///
1502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1503#[serde_with::serde_as]
1504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1505pub struct CellData {
1506    /// Optional. Runs of chips applied to subsections of the cell. Properties of a run start at a specific index in the text and continue until the next run. When reading, all chipped and non-chipped runs are included. Non-chipped runs will have an empty Chip. When writing, only runs with chips are included. Runs containing chips are of length 1 and are represented in the user-entered text by an “@” placeholder symbol. New runs will overwrite any prior runs. Writing a new user_entered_value will erase previous runs.
1507    #[serde(rename = "chipRuns")]
1508    pub chip_runs: Option<Vec<ChipRun>>,
1509    /// Output only. Information about a data source formula on the cell. The field is set if user_entered_value is a formula referencing some DATA_SOURCE sheet, e.g. `=SUM(DataSheet!Column)`.
1510    #[serde(rename = "dataSourceFormula")]
1511    pub data_source_formula: Option<DataSourceFormula>,
1512    /// A data source table anchored at this cell. The size of data source table itself is computed dynamically based on its configuration. Only the first cell of the data source table contains the data source table definition. The other cells will contain the display values of the data source table result in their effective_value fields.
1513    #[serde(rename = "dataSourceTable")]
1514    pub data_source_table: Option<DataSourceTable>,
1515    /// A data validation rule on the cell, if any. When writing, the new data validation rule will overwrite any prior rule.
1516    #[serde(rename = "dataValidation")]
1517    pub data_validation: Option<DataValidationRule>,
1518    /// The effective format being used by the cell. This includes the results of applying any conditional formatting and, if the cell contains a formula, the computed number format. If the effective format is the default format, effective format will not be written. This field is read-only.
1519    #[serde(rename = "effectiveFormat")]
1520    pub effective_format: Option<CellFormat>,
1521    /// The effective value of the cell. For cells with formulas, this is the calculated value. For cells with literals, this is the same as the user_entered_value. This field is read-only.
1522    #[serde(rename = "effectiveValue")]
1523    pub effective_value: Option<ExtendedValue>,
1524    /// The formatted value of the cell. This is the value as it's shown to the user. This field is read-only.
1525    #[serde(rename = "formattedValue")]
1526    pub formatted_value: Option<String>,
1527    /// A hyperlink this cell points to, if any. If the cell contains multiple hyperlinks, this field will be empty. This field is read-only. To set it, use a `=HYPERLINK` formula in the userEnteredValue.formulaValue field. A cell-level link can also be set from the userEnteredFormat.textFormat field. Alternatively, set a hyperlink in the textFormatRun.format.link field that spans the entire cell.
1528    pub hyperlink: Option<String>,
1529    /// Any note on the cell.
1530    pub note: Option<String>,
1531    /// A pivot table anchored at this cell. The size of pivot table itself is computed dynamically based on its data, grouping, filters, values, etc. Only the top-left cell of the pivot table contains the pivot table definition. The other cells will contain the calculated values of the results of the pivot in their effective_value fields.
1532    #[serde(rename = "pivotTable")]
1533    pub pivot_table: Option<PivotTable>,
1534    /// Runs of rich text applied to subsections of the cell. Runs are only valid on user entered strings, not formulas, bools, or numbers. Properties of a run start at a specific index in the text and continue until the next run. Runs will inherit the properties of the cell unless explicitly changed. When writing, the new runs will overwrite any prior runs. When writing a new user_entered_value, previous runs are erased.
1535    #[serde(rename = "textFormatRuns")]
1536    pub text_format_runs: Option<Vec<TextFormatRun>>,
1537    /// The format the user entered for the cell. When writing, the new format will be merged with the existing format.
1538    #[serde(rename = "userEnteredFormat")]
1539    pub user_entered_format: Option<CellFormat>,
1540    /// The value the user entered in the cell. e.g., `1234`, `'Hello'`, or `=NOW()` Note: Dates, Times and DateTimes are represented as doubles in serial number format.
1541    #[serde(rename = "userEnteredValue")]
1542    pub user_entered_value: Option<ExtendedValue>,
1543}
1544
1545impl common::Part for CellData {}
1546
1547/// The format of a cell.
1548///
1549/// This type is not used in any activity, and only used as *part* of another schema.
1550///
1551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1552#[serde_with::serde_as]
1553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1554pub struct CellFormat {
1555    /// The background color of the cell. Deprecated: Use background_color_style.
1556    #[serde(rename = "backgroundColor")]
1557    pub background_color: Option<Color>,
1558    /// The background color of the cell. If background_color is also set, this field takes precedence.
1559    #[serde(rename = "backgroundColorStyle")]
1560    pub background_color_style: Option<ColorStyle>,
1561    /// The borders of the cell.
1562    pub borders: Option<Borders>,
1563    /// The horizontal alignment of the value in the cell.
1564    #[serde(rename = "horizontalAlignment")]
1565    pub horizontal_alignment: Option<String>,
1566    /// If one exists, how a hyperlink should be displayed in the cell.
1567    #[serde(rename = "hyperlinkDisplayType")]
1568    pub hyperlink_display_type: Option<String>,
1569    /// A format describing how number values should be represented to the user.
1570    #[serde(rename = "numberFormat")]
1571    pub number_format: Option<NumberFormat>,
1572    /// The padding of the cell.
1573    pub padding: Option<Padding>,
1574    /// The direction of the text in the cell.
1575    #[serde(rename = "textDirection")]
1576    pub text_direction: Option<String>,
1577    /// The format of the text in the cell (unless overridden by a format run). Setting a cell-level link here clears the cell's existing links. Setting the link field in a TextFormatRun takes precedence over the cell-level link.
1578    #[serde(rename = "textFormat")]
1579    pub text_format: Option<TextFormat>,
1580    /// The rotation applied to text in the cell.
1581    #[serde(rename = "textRotation")]
1582    pub text_rotation: Option<TextRotation>,
1583    /// The vertical alignment of the value in the cell.
1584    #[serde(rename = "verticalAlignment")]
1585    pub vertical_alignment: Option<String>,
1586    /// The wrap strategy for the value in the cell.
1587    #[serde(rename = "wrapStrategy")]
1588    pub wrap_strategy: Option<String>,
1589}
1590
1591impl common::Part for CellFormat {}
1592
1593/// The options that define a "view window" for a chart (such as the visible values in an axis).
1594///
1595/// This type is not used in any activity, and only used as *part* of another schema.
1596///
1597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1598#[serde_with::serde_as]
1599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1600pub struct ChartAxisViewWindowOptions {
1601    /// The maximum numeric value to be shown in this view window. If unset, will automatically determine a maximum value that looks good for the data.
1602    #[serde(rename = "viewWindowMax")]
1603    pub view_window_max: Option<f64>,
1604    /// The minimum numeric value to be shown in this view window. If unset, will automatically determine a minimum value that looks good for the data.
1605    #[serde(rename = "viewWindowMin")]
1606    pub view_window_min: Option<f64>,
1607    /// The view window's mode.
1608    #[serde(rename = "viewWindowMode")]
1609    pub view_window_mode: Option<String>,
1610}
1611
1612impl common::Part for ChartAxisViewWindowOptions {}
1613
1614/// Custom number formatting options for chart attributes.
1615///
1616/// This type is not used in any activity, and only used as *part* of another schema.
1617///
1618#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1619#[serde_with::serde_as]
1620#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1621pub struct ChartCustomNumberFormatOptions {
1622    /// Custom prefix to be prepended to the chart attribute. This field is optional.
1623    pub prefix: Option<String>,
1624    /// Custom suffix to be appended to the chart attribute. This field is optional.
1625    pub suffix: Option<String>,
1626}
1627
1628impl common::Part for ChartCustomNumberFormatOptions {}
1629
1630/// The data included in a domain or series.
1631///
1632/// This type is not used in any activity, and only used as *part* of another schema.
1633///
1634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1635#[serde_with::serde_as]
1636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1637pub struct ChartData {
1638    /// The aggregation type for the series of a data source chart. Only supported for data source charts.
1639    #[serde(rename = "aggregateType")]
1640    pub aggregate_type: Option<String>,
1641    /// The reference to the data source column that the data reads from.
1642    #[serde(rename = "columnReference")]
1643    pub column_reference: Option<DataSourceColumnReference>,
1644    /// The rule to group the data by if the ChartData backs the domain of a data source chart. Only supported for data source charts.
1645    #[serde(rename = "groupRule")]
1646    pub group_rule: Option<ChartGroupRule>,
1647    /// The source ranges of the data.
1648    #[serde(rename = "sourceRange")]
1649    pub source_range: Option<ChartSourceRange>,
1650}
1651
1652impl common::Part for ChartData {}
1653
1654/// Allows you to organize the date-time values in a source data column into buckets based on selected parts of their date or time values.
1655///
1656/// This type is not used in any activity, and only used as *part* of another schema.
1657///
1658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1659#[serde_with::serde_as]
1660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1661pub struct ChartDateTimeRule {
1662    /// The type of date-time grouping to apply.
1663    #[serde(rename = "type")]
1664    pub type_: Option<String>,
1665}
1666
1667impl common::Part for ChartDateTimeRule {}
1668
1669/// An optional setting on the ChartData of the domain of a data source chart that defines buckets for the values in the domain rather than breaking out each individual value. For example, when plotting a data source chart, you can specify a histogram rule on the domain (it should only contain numeric values), grouping its values into buckets. Any values of a chart series that fall into the same bucket are aggregated based on the aggregate_type.
1670///
1671/// This type is not used in any activity, and only used as *part* of another schema.
1672///
1673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1674#[serde_with::serde_as]
1675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1676pub struct ChartGroupRule {
1677    /// A ChartDateTimeRule.
1678    #[serde(rename = "dateTimeRule")]
1679    pub date_time_rule: Option<ChartDateTimeRule>,
1680    /// A ChartHistogramRule
1681    #[serde(rename = "histogramRule")]
1682    pub histogram_rule: Option<ChartHistogramRule>,
1683}
1684
1685impl common::Part for ChartGroupRule {}
1686
1687/// Allows you to organize numeric values in a source data column into buckets of constant size.
1688///
1689/// This type is not used in any activity, and only used as *part* of another schema.
1690///
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct ChartHistogramRule {
1695    /// The size of the buckets that are created. Must be positive.
1696    #[serde(rename = "intervalSize")]
1697    pub interval_size: Option<f64>,
1698    /// The maximum value at which items are placed into buckets. Values greater than the maximum are grouped into a single bucket. If omitted, it is determined by the maximum item value.
1699    #[serde(rename = "maxValue")]
1700    pub max_value: Option<f64>,
1701    /// The minimum value at which items are placed into buckets. Values that are less than the minimum are grouped into a single bucket. If omitted, it is determined by the minimum item value.
1702    #[serde(rename = "minValue")]
1703    pub min_value: Option<f64>,
1704}
1705
1706impl common::Part for ChartHistogramRule {}
1707
1708/// Source ranges for a chart.
1709///
1710/// This type is not used in any activity, and only used as *part* of another schema.
1711///
1712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1713#[serde_with::serde_as]
1714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1715pub struct ChartSourceRange {
1716    /// The ranges of data for a series or domain. Exactly one dimension must have a length of 1, and all sources in the list must have the same dimension with length 1. The domain (if it exists) & all series must have the same number of source ranges. If using more than one source range, then the source range at a given offset must be in order and contiguous across the domain and series. For example, these are valid configurations: domain sources: A1:A5 series1 sources: B1:B5 series2 sources: D6:D10 domain sources: A1:A5, C10:C12 series1 sources: B1:B5, D10:D12 series2 sources: C1:C5, E10:E12
1717    pub sources: Option<Vec<GridRange>>,
1718}
1719
1720impl common::Part for ChartSourceRange {}
1721
1722/// The specifications of a chart.
1723///
1724/// This type is not used in any activity, and only used as *part* of another schema.
1725///
1726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1727#[serde_with::serde_as]
1728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1729pub struct ChartSpec {
1730    /// The alternative text that describes the chart. This is often used for accessibility.
1731    #[serde(rename = "altText")]
1732    pub alt_text: Option<String>,
1733    /// The background color of the entire chart. Not applicable to Org charts. Deprecated: Use background_color_style.
1734    #[serde(rename = "backgroundColor")]
1735    pub background_color: Option<Color>,
1736    /// The background color of the entire chart. Not applicable to Org charts. If background_color is also set, this field takes precedence.
1737    #[serde(rename = "backgroundColorStyle")]
1738    pub background_color_style: Option<ColorStyle>,
1739    /// A basic chart specification, can be one of many kinds of charts. See BasicChartType for the list of all charts this supports.
1740    #[serde(rename = "basicChart")]
1741    pub basic_chart: Option<BasicChartSpec>,
1742    /// A bubble chart specification.
1743    #[serde(rename = "bubbleChart")]
1744    pub bubble_chart: Option<BubbleChartSpec>,
1745    /// A candlestick chart specification.
1746    #[serde(rename = "candlestickChart")]
1747    pub candlestick_chart: Option<CandlestickChartSpec>,
1748    /// If present, the field contains data source chart specific properties.
1749    #[serde(rename = "dataSourceChartProperties")]
1750    pub data_source_chart_properties: Option<DataSourceChartProperties>,
1751    /// The filters applied to the source data of the chart. Only supported for data source charts.
1752    #[serde(rename = "filterSpecs")]
1753    pub filter_specs: Option<Vec<FilterSpec>>,
1754    /// The name of the font to use by default for all chart text (e.g. title, axis labels, legend). If a font is specified for a specific part of the chart it will override this font name.
1755    #[serde(rename = "fontName")]
1756    pub font_name: Option<String>,
1757    /// Determines how the charts will use hidden rows or columns.
1758    #[serde(rename = "hiddenDimensionStrategy")]
1759    pub hidden_dimension_strategy: Option<String>,
1760    /// A histogram chart specification.
1761    #[serde(rename = "histogramChart")]
1762    pub histogram_chart: Option<HistogramChartSpec>,
1763    /// True to make a chart fill the entire space in which it's rendered with minimum padding. False to use the default padding. (Not applicable to Geo and Org charts.)
1764    pub maximized: Option<bool>,
1765    /// An org chart specification.
1766    #[serde(rename = "orgChart")]
1767    pub org_chart: Option<OrgChartSpec>,
1768    /// A pie chart specification.
1769    #[serde(rename = "pieChart")]
1770    pub pie_chart: Option<PieChartSpec>,
1771    /// A scorecard chart specification.
1772    #[serde(rename = "scorecardChart")]
1773    pub scorecard_chart: Option<ScorecardChartSpec>,
1774    /// The order to sort the chart data by. Only a single sort spec is supported. Only supported for data source charts.
1775    #[serde(rename = "sortSpecs")]
1776    pub sort_specs: Option<Vec<SortSpec>>,
1777    /// The subtitle of the chart.
1778    pub subtitle: Option<String>,
1779    /// The subtitle text format. Strikethrough, underline, and link are not supported.
1780    #[serde(rename = "subtitleTextFormat")]
1781    pub subtitle_text_format: Option<TextFormat>,
1782    /// The subtitle text position. This field is optional.
1783    #[serde(rename = "subtitleTextPosition")]
1784    pub subtitle_text_position: Option<TextPosition>,
1785    /// The title of the chart.
1786    pub title: Option<String>,
1787    /// The title text format. Strikethrough, underline, and link are not supported.
1788    #[serde(rename = "titleTextFormat")]
1789    pub title_text_format: Option<TextFormat>,
1790    /// The title text position. This field is optional.
1791    #[serde(rename = "titleTextPosition")]
1792    pub title_text_position: Option<TextPosition>,
1793    /// A treemap chart specification.
1794    #[serde(rename = "treemapChart")]
1795    pub treemap_chart: Option<TreemapChartSpec>,
1796    /// A waterfall chart specification.
1797    #[serde(rename = "waterfallChart")]
1798    pub waterfall_chart: Option<WaterfallChartSpec>,
1799}
1800
1801impl common::Part for ChartSpec {}
1802
1803/// The Smart Chip.
1804///
1805/// This type is not used in any activity, and only used as *part* of another schema.
1806///
1807#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1808#[serde_with::serde_as]
1809#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1810pub struct Chip {
1811    /// Properties of a linked person.
1812    #[serde(rename = "personProperties")]
1813    pub person_properties: Option<PersonProperties>,
1814    /// Properties of a rich link.
1815    #[serde(rename = "richLinkProperties")]
1816    pub rich_link_properties: Option<RichLinkProperties>,
1817}
1818
1819impl common::Part for Chip {}
1820
1821/// The run of a chip. The chip continues until the start index of the next run.
1822///
1823/// This type is not used in any activity, and only used as *part* of another schema.
1824///
1825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1826#[serde_with::serde_as]
1827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1828pub struct ChipRun {
1829    /// Optional. The chip of this run.
1830    pub chip: Option<Chip>,
1831    /// Required. The zero-based character index where this run starts, in UTF-16 code units.
1832    #[serde(rename = "startIndex")]
1833    pub start_index: Option<i32>,
1834}
1835
1836impl common::Part for ChipRun {}
1837
1838/// Clears the basic filter, if any exists on the sheet.
1839///
1840/// This type is not used in any activity, and only used as *part* of another schema.
1841///
1842#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1843#[serde_with::serde_as]
1844#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1845pub struct ClearBasicFilterRequest {
1846    /// The sheet ID on which the basic filter should be cleared.
1847    #[serde(rename = "sheetId")]
1848    pub sheet_id: Option<i32>,
1849}
1850
1851impl common::Part for ClearBasicFilterRequest {}
1852
1853/// The request for clearing a range of values in a spreadsheet.
1854///
1855/// # Activities
1856///
1857/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1858/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1859///
1860/// * [values clear spreadsheets](SpreadsheetValueClearCall) (request)
1861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1862#[serde_with::serde_as]
1863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1864pub struct ClearValuesRequest {
1865    _never_set: Option<bool>,
1866}
1867
1868impl common::RequestValue for ClearValuesRequest {}
1869
1870/// The response when clearing a range of values in a spreadsheet.
1871///
1872/// # Activities
1873///
1874/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1875/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1876///
1877/// * [values clear spreadsheets](SpreadsheetValueClearCall) (response)
1878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1879#[serde_with::serde_as]
1880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1881pub struct ClearValuesResponse {
1882    /// The range (in A1 notation) that was cleared. (If the request was for an unbounded range or a ranger larger than the bounds of the sheet, this will be the actual range that was cleared, bounded to the sheet's limits.)
1883    #[serde(rename = "clearedRange")]
1884    pub cleared_range: Option<String>,
1885    /// The spreadsheet the updates were applied to.
1886    #[serde(rename = "spreadsheetId")]
1887    pub spreadsheet_id: Option<String>,
1888}
1889
1890impl common::ResponseResult for ClearValuesResponse {}
1891
1892/// Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
1893///
1894/// This type is not used in any activity, and only used as *part* of another schema.
1895///
1896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1897#[serde_with::serde_as]
1898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1899pub struct Color {
1900    /// The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0).
1901    pub alpha: Option<f32>,
1902    /// The amount of blue in the color as a value in the interval [0, 1].
1903    pub blue: Option<f32>,
1904    /// The amount of green in the color as a value in the interval [0, 1].
1905    pub green: Option<f32>,
1906    /// The amount of red in the color as a value in the interval [0, 1].
1907    pub red: Option<f32>,
1908}
1909
1910impl common::Part for Color {}
1911
1912/// A color value.
1913///
1914/// This type is not used in any activity, and only used as *part* of another schema.
1915///
1916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1917#[serde_with::serde_as]
1918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1919pub struct ColorStyle {
1920    /// RGB color. The [`alpha`](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/other#Color.FIELDS.alpha) value in the [`Color`](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/other#color) object isn't generally supported.
1921    #[serde(rename = "rgbColor")]
1922    pub rgb_color: Option<Color>,
1923    /// Theme color.
1924    #[serde(rename = "themeColor")]
1925    pub theme_color: Option<String>,
1926}
1927
1928impl common::Part for ColorStyle {}
1929
1930/// The value of the condition.
1931///
1932/// This type is not used in any activity, and only used as *part* of another schema.
1933///
1934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1935#[serde_with::serde_as]
1936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1937pub struct ConditionValue {
1938    /// A relative date (based on the current date). Valid only if the type is DATE_BEFORE, DATE_AFTER, DATE_ON_OR_BEFORE or DATE_ON_OR_AFTER. Relative dates are not supported in data validation. They are supported only in conditional formatting and conditional filters.
1939    #[serde(rename = "relativeDate")]
1940    pub relative_date: Option<String>,
1941    /// A value the condition is based on. The value is parsed as if the user typed into a cell. Formulas are supported (and must begin with an `=` or a '+').
1942    #[serde(rename = "userEnteredValue")]
1943    pub user_entered_value: Option<String>,
1944}
1945
1946impl common::Part for ConditionValue {}
1947
1948/// A rule describing a conditional format.
1949///
1950/// This type is not used in any activity, and only used as *part* of another schema.
1951///
1952#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1953#[serde_with::serde_as]
1954#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1955pub struct ConditionalFormatRule {
1956    /// The formatting is either "on" or "off" according to the rule.
1957    #[serde(rename = "booleanRule")]
1958    pub boolean_rule: Option<BooleanRule>,
1959    /// The formatting will vary based on the gradients in the rule.
1960    #[serde(rename = "gradientRule")]
1961    pub gradient_rule: Option<GradientRule>,
1962    /// The ranges that are formatted if the condition is true. All the ranges must be on the same grid.
1963    pub ranges: Option<Vec<GridRange>>,
1964}
1965
1966impl common::Part for ConditionalFormatRule {}
1967
1968/// Copies data from the source to the destination.
1969///
1970/// This type is not used in any activity, and only used as *part* of another schema.
1971///
1972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1973#[serde_with::serde_as]
1974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1975pub struct CopyPasteRequest {
1976    /// The location to paste to. If the range covers a span that's a multiple of the source's height or width, then the data will be repeated to fill in the destination range. If the range is smaller than the source range, the entire source data will still be copied (beyond the end of the destination range).
1977    pub destination: Option<GridRange>,
1978    /// How that data should be oriented when pasting.
1979    #[serde(rename = "pasteOrientation")]
1980    pub paste_orientation: Option<String>,
1981    /// What kind of data to paste.
1982    #[serde(rename = "pasteType")]
1983    pub paste_type: Option<String>,
1984    /// The source range to copy.
1985    pub source: Option<GridRange>,
1986}
1987
1988impl common::Part for CopyPasteRequest {}
1989
1990/// The request to copy a sheet across spreadsheets.
1991///
1992/// # Activities
1993///
1994/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1995/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1996///
1997/// * [sheets copy to spreadsheets](SpreadsheetSheetCopyToCall) (request)
1998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1999#[serde_with::serde_as]
2000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2001pub struct CopySheetToAnotherSpreadsheetRequest {
2002    /// The ID of the spreadsheet to copy the sheet to.
2003    #[serde(rename = "destinationSpreadsheetId")]
2004    pub destination_spreadsheet_id: Option<String>,
2005}
2006
2007impl common::RequestValue for CopySheetToAnotherSpreadsheetRequest {}
2008
2009/// A request to create developer metadata.
2010///
2011/// This type is not used in any activity, and only used as *part* of another schema.
2012///
2013#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2014#[serde_with::serde_as]
2015#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2016pub struct CreateDeveloperMetadataRequest {
2017    /// The developer metadata to create.
2018    #[serde(rename = "developerMetadata")]
2019    pub developer_metadata: Option<DeveloperMetadata>,
2020}
2021
2022impl common::Part for CreateDeveloperMetadataRequest {}
2023
2024/// The response from creating developer metadata.
2025///
2026/// This type is not used in any activity, and only used as *part* of another schema.
2027///
2028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2029#[serde_with::serde_as]
2030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2031pub struct CreateDeveloperMetadataResponse {
2032    /// The developer metadata that was created.
2033    #[serde(rename = "developerMetadata")]
2034    pub developer_metadata: Option<DeveloperMetadata>,
2035}
2036
2037impl common::Part for CreateDeveloperMetadataResponse {}
2038
2039/// Moves data from the source to the destination.
2040///
2041/// This type is not used in any activity, and only used as *part* of another schema.
2042///
2043#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2044#[serde_with::serde_as]
2045#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2046pub struct CutPasteRequest {
2047    /// The top-left coordinate where the data should be pasted.
2048    pub destination: Option<GridCoordinate>,
2049    /// What kind of data to paste. All the source data will be cut, regardless of what is pasted.
2050    #[serde(rename = "pasteType")]
2051    pub paste_type: Option<String>,
2052    /// The source data to cut.
2053    pub source: Option<GridRange>,
2054}
2055
2056impl common::Part for CutPasteRequest {}
2057
2058/// The data execution status. A data execution is created to sync a data source object with the latest data from a DataSource. It is usually scheduled to run at background, you can check its state to tell if an execution completes There are several scenarios where a data execution is triggered to run: * Adding a data source creates an associated data source sheet as well as a data execution to sync the data from the data source to the sheet. * Updating a data source creates a data execution to refresh the associated data source sheet similarly. * You can send refresh request to explicitly refresh one or multiple data source objects.
2059///
2060/// This type is not used in any activity, and only used as *part* of another schema.
2061///
2062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2063#[serde_with::serde_as]
2064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2065pub struct DataExecutionStatus {
2066    /// The error code.
2067    #[serde(rename = "errorCode")]
2068    pub error_code: Option<String>,
2069    /// The error message, which may be empty.
2070    #[serde(rename = "errorMessage")]
2071    pub error_message: Option<String>,
2072    /// Gets the time the data last successfully refreshed.
2073    #[serde(rename = "lastRefreshTime")]
2074    pub last_refresh_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2075    /// The state of the data execution.
2076    pub state: Option<String>,
2077}
2078
2079impl common::Part for DataExecutionStatus {}
2080
2081/// Filter that describes what data should be selected or returned from a request.
2082///
2083/// This type is not used in any activity, and only used as *part* of another schema.
2084///
2085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2086#[serde_with::serde_as]
2087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2088pub struct DataFilter {
2089    /// Selects data that matches the specified A1 range.
2090    #[serde(rename = "a1Range")]
2091    pub a1_range: Option<String>,
2092    /// Selects data associated with the developer metadata matching the criteria described by this DeveloperMetadataLookup.
2093    #[serde(rename = "developerMetadataLookup")]
2094    pub developer_metadata_lookup: Option<DeveloperMetadataLookup>,
2095    /// Selects data that matches the range described by the GridRange.
2096    #[serde(rename = "gridRange")]
2097    pub grid_range: Option<GridRange>,
2098}
2099
2100impl common::Part for DataFilter {}
2101
2102/// A range of values whose location is specified by a DataFilter.
2103///
2104/// This type is not used in any activity, and only used as *part* of another schema.
2105///
2106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2107#[serde_with::serde_as]
2108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2109pub struct DataFilterValueRange {
2110    /// The data filter describing the location of the values in the spreadsheet.
2111    #[serde(rename = "dataFilter")]
2112    pub data_filter: Option<DataFilter>,
2113    /// The major dimension of the values.
2114    #[serde(rename = "majorDimension")]
2115    pub major_dimension: Option<String>,
2116    /// The data to be written. If the provided values exceed any of the ranges matched by the data filter then the request fails. If the provided values are less than the matched ranges only the specified values are written, existing values in the matched ranges remain unaffected.
2117    pub values: Option<Vec<Vec<serde_json::Value>>>,
2118}
2119
2120impl common::Part for DataFilterValueRange {}
2121
2122/// Settings for one set of data labels. Data labels are annotations that appear next to a set of data, such as the points on a line chart, and provide additional information about what the data represents, such as a text representation of the value behind that point on the graph.
2123///
2124/// This type is not used in any activity, and only used as *part* of another schema.
2125///
2126#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2127#[serde_with::serde_as]
2128#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2129pub struct DataLabel {
2130    /// Data to use for custom labels. Only used if type is set to CUSTOM. This data must be the same length as the series or other element this data label is applied to. In addition, if the series is split into multiple source ranges, this source data must come from the next column in the source data. For example, if the series is B2:B4,E6:E8 then this data must come from C2:C4,F6:F8.
2131    #[serde(rename = "customLabelData")]
2132    pub custom_label_data: Option<ChartData>,
2133    /// The placement of the data label relative to the labeled data.
2134    pub placement: Option<String>,
2135    /// The text format used for the data label. The link field is not supported.
2136    #[serde(rename = "textFormat")]
2137    pub text_format: Option<TextFormat>,
2138    /// The type of the data label.
2139    #[serde(rename = "type")]
2140    pub type_: Option<String>,
2141}
2142
2143impl common::Part for DataLabel {}
2144
2145/// Information about an external data source in the spreadsheet.
2146///
2147/// This type is not used in any activity, and only used as *part* of another schema.
2148///
2149#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2150#[serde_with::serde_as]
2151#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2152pub struct DataSource {
2153    /// All calculated columns in the data source.
2154    #[serde(rename = "calculatedColumns")]
2155    pub calculated_columns: Option<Vec<DataSourceColumn>>,
2156    /// The spreadsheet-scoped unique ID that identifies the data source. Example: 1080547365.
2157    #[serde(rename = "dataSourceId")]
2158    pub data_source_id: Option<String>,
2159    /// The ID of the Sheet connected with the data source. The field cannot be changed once set. When creating a data source, an associated DATA_SOURCE sheet is also created, if the field is not specified, the ID of the created sheet will be randomly generated.
2160    #[serde(rename = "sheetId")]
2161    pub sheet_id: Option<i32>,
2162    /// The DataSourceSpec for the data source connected with this spreadsheet.
2163    pub spec: Option<DataSourceSpec>,
2164}
2165
2166impl common::Part for DataSource {}
2167
2168/// Properties of a data source chart.
2169///
2170/// This type is not used in any activity, and only used as *part* of another schema.
2171///
2172#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2173#[serde_with::serde_as]
2174#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2175pub struct DataSourceChartProperties {
2176    /// Output only. The data execution status.
2177    #[serde(rename = "dataExecutionStatus")]
2178    pub data_execution_status: Option<DataExecutionStatus>,
2179    /// ID of the data source that the chart is associated with.
2180    #[serde(rename = "dataSourceId")]
2181    pub data_source_id: Option<String>,
2182}
2183
2184impl common::Part for DataSourceChartProperties {}
2185
2186/// A column in a data source.
2187///
2188/// This type is not used in any activity, and only used as *part* of another schema.
2189///
2190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2191#[serde_with::serde_as]
2192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2193pub struct DataSourceColumn {
2194    /// The formula of the calculated column.
2195    pub formula: Option<String>,
2196    /// The column reference.
2197    pub reference: Option<DataSourceColumnReference>,
2198}
2199
2200impl common::Part for DataSourceColumn {}
2201
2202/// An unique identifier that references a data source column.
2203///
2204/// This type is not used in any activity, and only used as *part* of another schema.
2205///
2206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2207#[serde_with::serde_as]
2208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2209pub struct DataSourceColumnReference {
2210    /// The display name of the column. It should be unique within a data source.
2211    pub name: Option<String>,
2212}
2213
2214impl common::Part for DataSourceColumnReference {}
2215
2216/// A data source formula.
2217///
2218/// This type is not used in any activity, and only used as *part* of another schema.
2219///
2220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2221#[serde_with::serde_as]
2222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2223pub struct DataSourceFormula {
2224    /// Output only. The data execution status.
2225    #[serde(rename = "dataExecutionStatus")]
2226    pub data_execution_status: Option<DataExecutionStatus>,
2227    /// The ID of the data source the formula is associated with.
2228    #[serde(rename = "dataSourceId")]
2229    pub data_source_id: Option<String>,
2230}
2231
2232impl common::Part for DataSourceFormula {}
2233
2234/// Reference to a data source object.
2235///
2236/// This type is not used in any activity, and only used as *part* of another schema.
2237///
2238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2239#[serde_with::serde_as]
2240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2241pub struct DataSourceObjectReference {
2242    /// References to a data source chart.
2243    #[serde(rename = "chartId")]
2244    pub chart_id: Option<i32>,
2245    /// References to a cell containing DataSourceFormula.
2246    #[serde(rename = "dataSourceFormulaCell")]
2247    pub data_source_formula_cell: Option<GridCoordinate>,
2248    /// References to a data source PivotTable anchored at the cell.
2249    #[serde(rename = "dataSourcePivotTableAnchorCell")]
2250    pub data_source_pivot_table_anchor_cell: Option<GridCoordinate>,
2251    /// References to a DataSourceTable anchored at the cell.
2252    #[serde(rename = "dataSourceTableAnchorCell")]
2253    pub data_source_table_anchor_cell: Option<GridCoordinate>,
2254    /// References to a DATA_SOURCE sheet.
2255    #[serde(rename = "sheetId")]
2256    pub sheet_id: Option<String>,
2257}
2258
2259impl common::Part for DataSourceObjectReference {}
2260
2261/// A list of references to data source objects.
2262///
2263/// This type is not used in any activity, and only used as *part* of another schema.
2264///
2265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2266#[serde_with::serde_as]
2267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2268pub struct DataSourceObjectReferences {
2269    /// The references.
2270    pub references: Option<Vec<DataSourceObjectReference>>,
2271}
2272
2273impl common::Part for DataSourceObjectReferences {}
2274
2275/// A parameter in a data source's query. The parameter allows the user to pass in values from the spreadsheet into a query.
2276///
2277/// This type is not used in any activity, and only used as *part* of another schema.
2278///
2279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2280#[serde_with::serde_as]
2281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2282pub struct DataSourceParameter {
2283    /// Named parameter. Must be a legitimate identifier for the DataSource that supports it. For example, [BigQuery identifier](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#identifiers).
2284    pub name: Option<String>,
2285    /// ID of a NamedRange. Its size must be 1x1.
2286    #[serde(rename = "namedRangeId")]
2287    pub named_range_id: Option<String>,
2288    /// A range that contains the value of the parameter. Its size must be 1x1.
2289    pub range: Option<GridRange>,
2290}
2291
2292impl common::Part for DataSourceParameter {}
2293
2294/// A schedule for data to refresh every day in a given time interval.
2295///
2296/// This type is not used in any activity, and only used as *part* of another schema.
2297///
2298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2299#[serde_with::serde_as]
2300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2301pub struct DataSourceRefreshDailySchedule {
2302    /// The start time of a time interval in which a data source refresh is scheduled. Only `hours` part is used. The time interval size defaults to that in the Sheets editor.
2303    #[serde(rename = "startTime")]
2304    pub start_time: Option<TimeOfDay>,
2305}
2306
2307impl common::Part for DataSourceRefreshDailySchedule {}
2308
2309/// A monthly schedule for data to refresh on specific days in the month in a given time interval.
2310///
2311/// This type is not used in any activity, and only used as *part* of another schema.
2312///
2313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2314#[serde_with::serde_as]
2315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2316pub struct DataSourceRefreshMonthlySchedule {
2317    /// Days of the month to refresh. Only 1-28 are supported, mapping to the 1st to the 28th day. At least one day must be specified.
2318    #[serde(rename = "daysOfMonth")]
2319    pub days_of_month: Option<Vec<i32>>,
2320    /// The start time of a time interval in which a data source refresh is scheduled. Only `hours` part is used. The time interval size defaults to that in the Sheets editor.
2321    #[serde(rename = "startTime")]
2322    pub start_time: Option<TimeOfDay>,
2323}
2324
2325impl common::Part for DataSourceRefreshMonthlySchedule {}
2326
2327/// Schedule for refreshing the data source. Data sources in the spreadsheet are refreshed within a time interval. You can specify the start time by clicking the Scheduled Refresh button in the Sheets editor, but the interval is fixed at 4 hours. For example, if you specify a start time of 8 AM , the refresh will take place between 8 AM and 12 PM every day.
2328///
2329/// This type is not used in any activity, and only used as *part* of another schema.
2330///
2331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2332#[serde_with::serde_as]
2333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2334pub struct DataSourceRefreshSchedule {
2335    /// Daily refresh schedule.
2336    #[serde(rename = "dailySchedule")]
2337    pub daily_schedule: Option<DataSourceRefreshDailySchedule>,
2338    /// True if the refresh schedule is enabled, or false otherwise.
2339    pub enabled: Option<bool>,
2340    /// Monthly refresh schedule.
2341    #[serde(rename = "monthlySchedule")]
2342    pub monthly_schedule: Option<DataSourceRefreshMonthlySchedule>,
2343    /// Output only. The time interval of the next run.
2344    #[serde(rename = "nextRun")]
2345    pub next_run: Option<Interval>,
2346    /// The scope of the refresh. Must be ALL_DATA_SOURCES.
2347    #[serde(rename = "refreshScope")]
2348    pub refresh_scope: Option<String>,
2349    /// Weekly refresh schedule.
2350    #[serde(rename = "weeklySchedule")]
2351    pub weekly_schedule: Option<DataSourceRefreshWeeklySchedule>,
2352}
2353
2354impl common::Part for DataSourceRefreshSchedule {}
2355
2356/// A weekly schedule for data to refresh on specific days in a given time interval.
2357///
2358/// This type is not used in any activity, and only used as *part* of another schema.
2359///
2360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2361#[serde_with::serde_as]
2362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2363pub struct DataSourceRefreshWeeklySchedule {
2364    /// Days of the week to refresh. At least one day must be specified.
2365    #[serde(rename = "daysOfWeek")]
2366    pub days_of_week: Option<Vec<String>>,
2367    /// The start time of a time interval in which a data source refresh is scheduled. Only `hours` part is used. The time interval size defaults to that in the Sheets editor.
2368    #[serde(rename = "startTime")]
2369    pub start_time: Option<TimeOfDay>,
2370}
2371
2372impl common::Part for DataSourceRefreshWeeklySchedule {}
2373
2374/// A range along a single dimension on a DATA_SOURCE sheet.
2375///
2376/// This type is not used in any activity, and only used as *part* of another schema.
2377///
2378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2379#[serde_with::serde_as]
2380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2381pub struct DataSourceSheetDimensionRange {
2382    /// The columns on the data source sheet.
2383    #[serde(rename = "columnReferences")]
2384    pub column_references: Option<Vec<DataSourceColumnReference>>,
2385    /// The ID of the data source sheet the range is on.
2386    #[serde(rename = "sheetId")]
2387    pub sheet_id: Option<i32>,
2388}
2389
2390impl common::Part for DataSourceSheetDimensionRange {}
2391
2392/// Additional properties of a DATA_SOURCE sheet.
2393///
2394/// This type is not used in any activity, and only used as *part* of another schema.
2395///
2396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2397#[serde_with::serde_as]
2398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2399pub struct DataSourceSheetProperties {
2400    /// The columns displayed on the sheet, corresponding to the values in RowData.
2401    pub columns: Option<Vec<DataSourceColumn>>,
2402    /// The data execution status.
2403    #[serde(rename = "dataExecutionStatus")]
2404    pub data_execution_status: Option<DataExecutionStatus>,
2405    /// ID of the DataSource the sheet is connected to.
2406    #[serde(rename = "dataSourceId")]
2407    pub data_source_id: Option<String>,
2408}
2409
2410impl common::Part for DataSourceSheetProperties {}
2411
2412/// This specifies the details of the data source. For example, for BigQuery, this specifies information about the BigQuery source.
2413///
2414/// This type is not used in any activity, and only used as *part* of another schema.
2415///
2416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2417#[serde_with::serde_as]
2418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2419pub struct DataSourceSpec {
2420    /// A BigQueryDataSourceSpec.
2421    #[serde(rename = "bigQuery")]
2422    pub big_query: Option<BigQueryDataSourceSpec>,
2423    /// A LookerDatasourceSpec.
2424    pub looker: Option<LookerDataSourceSpec>,
2425    /// The parameters of the data source, used when querying the data source.
2426    pub parameters: Option<Vec<DataSourceParameter>>,
2427}
2428
2429impl common::Part for DataSourceSpec {}
2430
2431/// A data source table, which allows the user to import a static table of data from the DataSource into Sheets. This is also known as "Extract" in the Sheets editor.
2432///
2433/// This type is not used in any activity, and only used as *part* of another schema.
2434///
2435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2436#[serde_with::serde_as]
2437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2438pub struct DataSourceTable {
2439    /// The type to select columns for the data source table. Defaults to SELECTED.
2440    #[serde(rename = "columnSelectionType")]
2441    pub column_selection_type: Option<String>,
2442    /// Columns selected for the data source table. The column_selection_type must be SELECTED.
2443    pub columns: Option<Vec<DataSourceColumnReference>>,
2444    /// Output only. The data execution status.
2445    #[serde(rename = "dataExecutionStatus")]
2446    pub data_execution_status: Option<DataExecutionStatus>,
2447    /// The ID of the data source the data source table is associated with.
2448    #[serde(rename = "dataSourceId")]
2449    pub data_source_id: Option<String>,
2450    /// Filter specifications in the data source table.
2451    #[serde(rename = "filterSpecs")]
2452    pub filter_specs: Option<Vec<FilterSpec>>,
2453    /// The limit of rows to return. If not set, a default limit is applied. Please refer to the Sheets editor for the default and max limit.
2454    #[serde(rename = "rowLimit")]
2455    pub row_limit: Option<i32>,
2456    /// Sort specifications in the data source table. The result of the data source table is sorted based on the sort specifications in order.
2457    #[serde(rename = "sortSpecs")]
2458    pub sort_specs: Option<Vec<SortSpec>>,
2459}
2460
2461impl common::Part for DataSourceTable {}
2462
2463/// A data validation rule.
2464///
2465/// This type is not used in any activity, and only used as *part* of another schema.
2466///
2467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2468#[serde_with::serde_as]
2469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2470pub struct DataValidationRule {
2471    /// The condition that data in the cell must match.
2472    pub condition: Option<BooleanCondition>,
2473    /// A message to show the user when adding data to the cell.
2474    #[serde(rename = "inputMessage")]
2475    pub input_message: Option<String>,
2476    /// True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown.
2477    #[serde(rename = "showCustomUi")]
2478    pub show_custom_ui: Option<bool>,
2479    /// True if invalid data should be rejected.
2480    pub strict: Option<bool>,
2481}
2482
2483impl common::Part for DataValidationRule {}
2484
2485/// Allows you to organize the date-time values in a source data column into buckets based on selected parts of their date or time values. For example, consider a pivot table showing sales transactions by date: +----------+--------------+ | Date | SUM of Sales | +----------+--------------+ | 1/1/2017 | $621.14 | | 2/3/2017 | $708.84 | | 5/8/2017 | $326.84 | ... +----------+--------------+ Applying a date-time group rule with a DateTimeRuleType of YEAR_MONTH results in the following pivot table. +--------------+--------------+ | Grouped Date | SUM of Sales | +--------------+--------------+ | 2017-Jan | $53,731.78 | | 2017-Feb | $83,475.32 | | 2017-Mar | $94,385.05 | ... +--------------+--------------+
2486///
2487/// This type is not used in any activity, and only used as *part* of another schema.
2488///
2489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2490#[serde_with::serde_as]
2491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2492pub struct DateTimeRule {
2493    /// The type of date-time grouping to apply.
2494    #[serde(rename = "type")]
2495    pub type_: Option<String>,
2496}
2497
2498impl common::Part for DateTimeRule {}
2499
2500/// Removes the banded range with the given ID from the spreadsheet.
2501///
2502/// This type is not used in any activity, and only used as *part* of another schema.
2503///
2504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2505#[serde_with::serde_as]
2506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2507pub struct DeleteBandingRequest {
2508    /// The ID of the banded range to delete.
2509    #[serde(rename = "bandedRangeId")]
2510    pub banded_range_id: Option<i32>,
2511}
2512
2513impl common::Part for DeleteBandingRequest {}
2514
2515/// Deletes a conditional format rule at the given index. All subsequent rules' indexes are decremented.
2516///
2517/// This type is not used in any activity, and only used as *part* of another schema.
2518///
2519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2520#[serde_with::serde_as]
2521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2522pub struct DeleteConditionalFormatRuleRequest {
2523    /// The zero-based index of the rule to be deleted.
2524    pub index: Option<i32>,
2525    /// The sheet the rule is being deleted from.
2526    #[serde(rename = "sheetId")]
2527    pub sheet_id: Option<i32>,
2528}
2529
2530impl common::Part for DeleteConditionalFormatRuleRequest {}
2531
2532/// The result of deleting a conditional format rule.
2533///
2534/// This type is not used in any activity, and only used as *part* of another schema.
2535///
2536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2537#[serde_with::serde_as]
2538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2539pub struct DeleteConditionalFormatRuleResponse {
2540    /// The rule that was deleted.
2541    pub rule: Option<ConditionalFormatRule>,
2542}
2543
2544impl common::Part for DeleteConditionalFormatRuleResponse {}
2545
2546/// Deletes a data source. The request also deletes the associated data source sheet, and unlinks all associated data source objects.
2547///
2548/// This type is not used in any activity, and only used as *part* of another schema.
2549///
2550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2551#[serde_with::serde_as]
2552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2553pub struct DeleteDataSourceRequest {
2554    /// The ID of the data source to delete.
2555    #[serde(rename = "dataSourceId")]
2556    pub data_source_id: Option<String>,
2557}
2558
2559impl common::Part for DeleteDataSourceRequest {}
2560
2561/// A request to delete developer metadata.
2562///
2563/// This type is not used in any activity, and only used as *part* of another schema.
2564///
2565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2566#[serde_with::serde_as]
2567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2568pub struct DeleteDeveloperMetadataRequest {
2569    /// The data filter describing the criteria used to select which developer metadata entry to delete.
2570    #[serde(rename = "dataFilter")]
2571    pub data_filter: Option<DataFilter>,
2572}
2573
2574impl common::Part for DeleteDeveloperMetadataRequest {}
2575
2576/// The response from deleting developer metadata.
2577///
2578/// This type is not used in any activity, and only used as *part* of another schema.
2579///
2580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2581#[serde_with::serde_as]
2582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2583pub struct DeleteDeveloperMetadataResponse {
2584    /// The metadata that was deleted.
2585    #[serde(rename = "deletedDeveloperMetadata")]
2586    pub deleted_developer_metadata: Option<Vec<DeveloperMetadata>>,
2587}
2588
2589impl common::Part for DeleteDeveloperMetadataResponse {}
2590
2591/// Deletes a group over the specified range by decrementing the depth of the dimensions in the range. For example, assume the sheet has a depth-1 group over B:E and a depth-2 group over C:D. Deleting a group over D:E leaves the sheet with a depth-1 group over B:D and a depth-2 group over C:C.
2592///
2593/// This type is not used in any activity, and only used as *part* of another schema.
2594///
2595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2596#[serde_with::serde_as]
2597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2598pub struct DeleteDimensionGroupRequest {
2599    /// The range of the group to be deleted.
2600    pub range: Option<DimensionRange>,
2601}
2602
2603impl common::Part for DeleteDimensionGroupRequest {}
2604
2605/// The result of deleting a group.
2606///
2607/// This type is not used in any activity, and only used as *part* of another schema.
2608///
2609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2610#[serde_with::serde_as]
2611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2612pub struct DeleteDimensionGroupResponse {
2613    /// All groups of a dimension after deleting a group from that dimension.
2614    #[serde(rename = "dimensionGroups")]
2615    pub dimension_groups: Option<Vec<DimensionGroup>>,
2616}
2617
2618impl common::Part for DeleteDimensionGroupResponse {}
2619
2620///  Deletes the dimensions from the sheet.
2621///
2622/// This type is not used in any activity, and only used as *part* of another schema.
2623///
2624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2625#[serde_with::serde_as]
2626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2627pub struct DeleteDimensionRequest {
2628    /// The dimensions to delete from the sheet.
2629    pub range: Option<DimensionRange>,
2630}
2631
2632impl common::Part for DeleteDimensionRequest {}
2633
2634/// Removes rows within this range that contain values in the specified columns that are duplicates of values in any previous row. Rows with identical values but different letter cases, formatting, or formulas are considered to be duplicates. This request also removes duplicate rows hidden from view (for example, due to a filter). When removing duplicates, the first instance of each duplicate row scanning from the top downwards is kept in the resulting range. Content outside of the specified range isn't removed, and rows considered duplicates do not have to be adjacent to each other in the range.
2635///
2636/// This type is not used in any activity, and only used as *part* of another schema.
2637///
2638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2639#[serde_with::serde_as]
2640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2641pub struct DeleteDuplicatesRequest {
2642    /// The columns in the range to analyze for duplicate values. If no columns are selected then all columns are analyzed for duplicates.
2643    #[serde(rename = "comparisonColumns")]
2644    pub comparison_columns: Option<Vec<DimensionRange>>,
2645    /// The range to remove duplicates rows from.
2646    pub range: Option<GridRange>,
2647}
2648
2649impl common::Part for DeleteDuplicatesRequest {}
2650
2651/// The result of removing duplicates in a range.
2652///
2653/// This type is not used in any activity, and only used as *part* of another schema.
2654///
2655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2656#[serde_with::serde_as]
2657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2658pub struct DeleteDuplicatesResponse {
2659    /// The number of duplicate rows removed.
2660    #[serde(rename = "duplicatesRemovedCount")]
2661    pub duplicates_removed_count: Option<i32>,
2662}
2663
2664impl common::Part for DeleteDuplicatesResponse {}
2665
2666/// Deletes the embedded object with the given ID.
2667///
2668/// This type is not used in any activity, and only used as *part* of another schema.
2669///
2670#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2671#[serde_with::serde_as]
2672#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2673pub struct DeleteEmbeddedObjectRequest {
2674    /// The ID of the embedded object to delete.
2675    #[serde(rename = "objectId")]
2676    pub object_id: Option<i32>,
2677}
2678
2679impl common::Part for DeleteEmbeddedObjectRequest {}
2680
2681/// Deletes a particular filter view.
2682///
2683/// This type is not used in any activity, and only used as *part* of another schema.
2684///
2685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2686#[serde_with::serde_as]
2687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2688pub struct DeleteFilterViewRequest {
2689    /// The ID of the filter to delete.
2690    #[serde(rename = "filterId")]
2691    pub filter_id: Option<i32>,
2692}
2693
2694impl common::Part for DeleteFilterViewRequest {}
2695
2696/// Removes the named range with the given ID from the spreadsheet.
2697///
2698/// This type is not used in any activity, and only used as *part* of another schema.
2699///
2700#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2701#[serde_with::serde_as]
2702#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2703pub struct DeleteNamedRangeRequest {
2704    /// The ID of the named range to delete.
2705    #[serde(rename = "namedRangeId")]
2706    pub named_range_id: Option<String>,
2707}
2708
2709impl common::Part for DeleteNamedRangeRequest {}
2710
2711/// Deletes the protected range with the given ID.
2712///
2713/// This type is not used in any activity, and only used as *part* of another schema.
2714///
2715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2716#[serde_with::serde_as]
2717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2718pub struct DeleteProtectedRangeRequest {
2719    /// The ID of the protected range to delete.
2720    #[serde(rename = "protectedRangeId")]
2721    pub protected_range_id: Option<i32>,
2722}
2723
2724impl common::Part for DeleteProtectedRangeRequest {}
2725
2726/// Deletes a range of cells, shifting other cells into the deleted area.
2727///
2728/// This type is not used in any activity, and only used as *part* of another schema.
2729///
2730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2731#[serde_with::serde_as]
2732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2733pub struct DeleteRangeRequest {
2734    /// The range of cells to delete.
2735    pub range: Option<GridRange>,
2736    /// The dimension from which deleted cells will be replaced with. If ROWS, existing cells will be shifted upward to replace the deleted cells. If COLUMNS, existing cells will be shifted left to replace the deleted cells.
2737    #[serde(rename = "shiftDimension")]
2738    pub shift_dimension: Option<String>,
2739}
2740
2741impl common::Part for DeleteRangeRequest {}
2742
2743/// Deletes the requested sheet.
2744///
2745/// This type is not used in any activity, and only used as *part* of another schema.
2746///
2747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2748#[serde_with::serde_as]
2749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2750pub struct DeleteSheetRequest {
2751    /// The ID of the sheet to delete. If the sheet is of DATA_SOURCE type, the associated DataSource is also deleted.
2752    #[serde(rename = "sheetId")]
2753    pub sheet_id: Option<i32>,
2754}
2755
2756impl common::Part for DeleteSheetRequest {}
2757
2758/// Removes the table with the given ID from the spreadsheet.
2759///
2760/// This type is not used in any activity, and only used as *part* of another schema.
2761///
2762#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2763#[serde_with::serde_as]
2764#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2765pub struct DeleteTableRequest {
2766    /// The ID of the table to delete.
2767    #[serde(rename = "tableId")]
2768    pub table_id: Option<String>,
2769}
2770
2771impl common::Part for DeleteTableRequest {}
2772
2773/// Developer metadata associated with a location or object in a spreadsheet. Developer metadata may be used to associate arbitrary data with various parts of a spreadsheet and will remain associated at those locations as they move around and the spreadsheet is edited. For example, if developer metadata is associated with row 5 and another row is then subsequently inserted above row 5, that original metadata will still be associated with the row it was first associated with (what is now row 6). If the associated object is deleted its metadata is deleted too.
2774///
2775/// # Activities
2776///
2777/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2778/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2779///
2780/// * [developer metadata get spreadsheets](SpreadsheetDeveloperMetadataGetCall) (response)
2781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2782#[serde_with::serde_as]
2783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2784pub struct DeveloperMetadata {
2785    /// The location where the metadata is associated.
2786    pub location: Option<DeveloperMetadataLocation>,
2787    /// The spreadsheet-scoped unique ID that identifies the metadata. IDs may be specified when metadata is created, otherwise one will be randomly generated and assigned. Must be positive.
2788    #[serde(rename = "metadataId")]
2789    pub metadata_id: Option<i32>,
2790    /// The metadata key. There may be multiple metadata in a spreadsheet with the same key. Developer metadata must always have a key specified.
2791    #[serde(rename = "metadataKey")]
2792    pub metadata_key: Option<String>,
2793    /// Data associated with the metadata's key.
2794    #[serde(rename = "metadataValue")]
2795    pub metadata_value: Option<String>,
2796    /// The metadata visibility. Developer metadata must always have a visibility specified.
2797    pub visibility: Option<String>,
2798}
2799
2800impl common::ResponseResult for DeveloperMetadata {}
2801
2802/// A location where metadata may be associated in a spreadsheet.
2803///
2804/// This type is not used in any activity, and only used as *part* of another schema.
2805///
2806#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2807#[serde_with::serde_as]
2808#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2809pub struct DeveloperMetadataLocation {
2810    /// Represents the row or column when metadata is associated with a dimension. The specified DimensionRange must represent a single row or column; it cannot be unbounded or span multiple rows or columns.
2811    #[serde(rename = "dimensionRange")]
2812    pub dimension_range: Option<DimensionRange>,
2813    /// The type of location this object represents. This field is read-only.
2814    #[serde(rename = "locationType")]
2815    pub location_type: Option<String>,
2816    /// The ID of the sheet when metadata is associated with an entire sheet.
2817    #[serde(rename = "sheetId")]
2818    pub sheet_id: Option<i32>,
2819    /// True when metadata is associated with an entire spreadsheet.
2820    pub spreadsheet: Option<bool>,
2821}
2822
2823impl common::Part for DeveloperMetadataLocation {}
2824
2825/// Selects DeveloperMetadata that matches all of the specified fields. For example, if only a metadata ID is specified this considers the DeveloperMetadata with that particular unique ID. If a metadata key is specified, this considers all developer metadata with that key. If a key, visibility, and location type are all specified, this considers all developer metadata with that key and visibility that are associated with a location of that type. In general, this selects all DeveloperMetadata that matches the intersection of all the specified fields; any field or combination of fields may be specified.
2826///
2827/// This type is not used in any activity, and only used as *part* of another schema.
2828///
2829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2830#[serde_with::serde_as]
2831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2832pub struct DeveloperMetadataLookup {
2833    /// Determines how this lookup matches the location. If this field is specified as EXACT, only developer metadata associated on the exact location specified is matched. If this field is specified to INTERSECTING, developer metadata associated on intersecting locations is also matched. If left unspecified, this field assumes a default value of INTERSECTING. If this field is specified, a metadataLocation must also be specified.
2834    #[serde(rename = "locationMatchingStrategy")]
2835    pub location_matching_strategy: Option<String>,
2836    /// Limits the selected developer metadata to those entries which are associated with locations of the specified type. For example, when this field is specified as ROW this lookup only considers developer metadata associated on rows. If the field is left unspecified, all location types are considered. This field cannot be specified as SPREADSHEET when the locationMatchingStrategy is specified as INTERSECTING or when the metadataLocation is specified as a non-spreadsheet location: spreadsheet metadata cannot intersect any other developer metadata location. This field also must be left unspecified when the locationMatchingStrategy is specified as EXACT.
2837    #[serde(rename = "locationType")]
2838    pub location_type: Option<String>,
2839    /// Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_id.
2840    #[serde(rename = "metadataId")]
2841    pub metadata_id: Option<i32>,
2842    /// Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_key.
2843    #[serde(rename = "metadataKey")]
2844    pub metadata_key: Option<String>,
2845    /// Limits the selected developer metadata to those entries associated with the specified location. This field either matches exact locations or all intersecting locations according the specified locationMatchingStrategy.
2846    #[serde(rename = "metadataLocation")]
2847    pub metadata_location: Option<DeveloperMetadataLocation>,
2848    /// Limits the selected developer metadata to that which has a matching DeveloperMetadata.metadata_value.
2849    #[serde(rename = "metadataValue")]
2850    pub metadata_value: Option<String>,
2851    /// Limits the selected developer metadata to that which has a matching DeveloperMetadata.visibility. If left unspecified, all developer metadata visible to the requesting project is considered.
2852    pub visibility: Option<String>,
2853}
2854
2855impl common::Part for DeveloperMetadataLookup {}
2856
2857/// A group over an interval of rows or columns on a sheet, which can contain or be contained within other groups. A group can be collapsed or expanded as a unit on the sheet.
2858///
2859/// This type is not used in any activity, and only used as *part* of another schema.
2860///
2861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2862#[serde_with::serde_as]
2863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2864pub struct DimensionGroup {
2865    /// This field is true if this group is collapsed. A collapsed group remains collapsed if an overlapping group at a shallower depth is expanded. A true value does not imply that all dimensions within the group are hidden, since a dimension's visibility can change independently from this group property. However, when this property is updated, all dimensions within it are set to hidden if this field is true, or set to visible if this field is false.
2866    pub collapsed: Option<bool>,
2867    /// The depth of the group, representing how many groups have a range that wholly contains the range of this group.
2868    pub depth: Option<i32>,
2869    /// The range over which this group exists.
2870    pub range: Option<DimensionRange>,
2871}
2872
2873impl common::Part for DimensionGroup {}
2874
2875/// Properties about a dimension.
2876///
2877/// This type is not used in any activity, and only used as *part* of another schema.
2878///
2879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2880#[serde_with::serde_as]
2881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2882pub struct DimensionProperties {
2883    /// Output only. If set, this is a column in a data source sheet.
2884    #[serde(rename = "dataSourceColumnReference")]
2885    pub data_source_column_reference: Option<DataSourceColumnReference>,
2886    /// The developer metadata associated with a single row or column.
2887    #[serde(rename = "developerMetadata")]
2888    pub developer_metadata: Option<Vec<DeveloperMetadata>>,
2889    /// True if this dimension is being filtered. This field is read-only.
2890    #[serde(rename = "hiddenByFilter")]
2891    pub hidden_by_filter: Option<bool>,
2892    /// True if this dimension is explicitly hidden.
2893    #[serde(rename = "hiddenByUser")]
2894    pub hidden_by_user: Option<bool>,
2895    /// The height (if a row) or width (if a column) of the dimension in pixels.
2896    #[serde(rename = "pixelSize")]
2897    pub pixel_size: Option<i32>,
2898}
2899
2900impl common::Part for DimensionProperties {}
2901
2902/// A range along a single dimension on a sheet. All indexes are zero-based. Indexes are half open: the start index is inclusive and the end index is exclusive. Missing indexes indicate the range is unbounded on that side.
2903///
2904/// This type is not used in any activity, and only used as *part* of another schema.
2905///
2906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2907#[serde_with::serde_as]
2908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2909pub struct DimensionRange {
2910    /// The dimension of the span.
2911    pub dimension: Option<String>,
2912    /// The end (exclusive) of the span, or not set if unbounded.
2913    #[serde(rename = "endIndex")]
2914    pub end_index: Option<i32>,
2915    /// The sheet this span is on.
2916    #[serde(rename = "sheetId")]
2917    pub sheet_id: Option<i32>,
2918    /// The start (inclusive) of the span, or not set if unbounded.
2919    #[serde(rename = "startIndex")]
2920    pub start_index: Option<i32>,
2921}
2922
2923impl common::Part for DimensionRange {}
2924
2925/// Duplicates a particular filter view.
2926///
2927/// This type is not used in any activity, and only used as *part* of another schema.
2928///
2929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2930#[serde_with::serde_as]
2931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2932pub struct DuplicateFilterViewRequest {
2933    /// The ID of the filter being duplicated.
2934    #[serde(rename = "filterId")]
2935    pub filter_id: Option<i32>,
2936}
2937
2938impl common::Part for DuplicateFilterViewRequest {}
2939
2940/// The result of a filter view being duplicated.
2941///
2942/// This type is not used in any activity, and only used as *part* of another schema.
2943///
2944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2945#[serde_with::serde_as]
2946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2947pub struct DuplicateFilterViewResponse {
2948    /// The newly created filter.
2949    pub filter: Option<FilterView>,
2950}
2951
2952impl common::Part for DuplicateFilterViewResponse {}
2953
2954/// Duplicates the contents of a sheet.
2955///
2956/// This type is not used in any activity, and only used as *part* of another schema.
2957///
2958#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2959#[serde_with::serde_as]
2960#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2961pub struct DuplicateSheetRequest {
2962    /// The zero-based index where the new sheet should be inserted. The index of all sheets after this are incremented.
2963    #[serde(rename = "insertSheetIndex")]
2964    pub insert_sheet_index: Option<i32>,
2965    /// If set, the ID of the new sheet. If not set, an ID is chosen. If set, the ID must not conflict with any existing sheet ID. If set, it must be non-negative.
2966    #[serde(rename = "newSheetId")]
2967    pub new_sheet_id: Option<i32>,
2968    /// The name of the new sheet. If empty, a new name is chosen for you.
2969    #[serde(rename = "newSheetName")]
2970    pub new_sheet_name: Option<String>,
2971    /// The sheet to duplicate. If the source sheet is of DATA_SOURCE type, its backing DataSource is also duplicated and associated with the new copy of the sheet. No data execution is triggered, the grid data of this sheet is also copied over but only available after the batch request completes.
2972    #[serde(rename = "sourceSheetId")]
2973    pub source_sheet_id: Option<i32>,
2974}
2975
2976impl common::Part for DuplicateSheetRequest {}
2977
2978/// The result of duplicating a sheet.
2979///
2980/// This type is not used in any activity, and only used as *part* of another schema.
2981///
2982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2983#[serde_with::serde_as]
2984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2985pub struct DuplicateSheetResponse {
2986    /// The properties of the duplicate sheet.
2987    pub properties: Option<SheetProperties>,
2988}
2989
2990impl common::Part for DuplicateSheetResponse {}
2991
2992/// The editors of a protected range.
2993///
2994/// This type is not used in any activity, and only used as *part* of another schema.
2995///
2996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2997#[serde_with::serde_as]
2998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2999pub struct Editors {
3000    /// True if anyone in the document's domain has edit access to the protected range. Domain protection is only supported on documents within a domain.
3001    #[serde(rename = "domainUsersCanEdit")]
3002    pub domain_users_can_edit: Option<bool>,
3003    /// The email addresses of groups with edit access to the protected range.
3004    pub groups: Option<Vec<String>>,
3005    /// The email addresses of users with edit access to the protected range.
3006    pub users: Option<Vec<String>>,
3007}
3008
3009impl common::Part for Editors {}
3010
3011/// A chart embedded in a sheet.
3012///
3013/// This type is not used in any activity, and only used as *part* of another schema.
3014///
3015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3016#[serde_with::serde_as]
3017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3018pub struct EmbeddedChart {
3019    /// The border of the chart.
3020    pub border: Option<EmbeddedObjectBorder>,
3021    /// The ID of the chart.
3022    #[serde(rename = "chartId")]
3023    pub chart_id: Option<i32>,
3024    /// The position of the chart.
3025    pub position: Option<EmbeddedObjectPosition>,
3026    /// The specification of the chart.
3027    pub spec: Option<ChartSpec>,
3028}
3029
3030impl common::Part for EmbeddedChart {}
3031
3032/// A border along an embedded object.
3033///
3034/// This type is not used in any activity, and only used as *part* of another schema.
3035///
3036#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3037#[serde_with::serde_as]
3038#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3039pub struct EmbeddedObjectBorder {
3040    /// The color of the border. Deprecated: Use color_style.
3041    pub color: Option<Color>,
3042    /// The color of the border. If color is also set, this field takes precedence.
3043    #[serde(rename = "colorStyle")]
3044    pub color_style: Option<ColorStyle>,
3045}
3046
3047impl common::Part for EmbeddedObjectBorder {}
3048
3049/// The position of an embedded object such as a chart.
3050///
3051/// This type is not used in any activity, and only used as *part* of another schema.
3052///
3053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3054#[serde_with::serde_as]
3055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3056pub struct EmbeddedObjectPosition {
3057    /// If true, the embedded object is put on a new sheet whose ID is chosen for you. Used only when writing.
3058    #[serde(rename = "newSheet")]
3059    pub new_sheet: Option<bool>,
3060    /// The position at which the object is overlaid on top of a grid.
3061    #[serde(rename = "overlayPosition")]
3062    pub overlay_position: Option<OverlayPosition>,
3063    /// The sheet this is on. Set only if the embedded object is on its own sheet. Must be non-negative.
3064    #[serde(rename = "sheetId")]
3065    pub sheet_id: Option<i32>,
3066}
3067
3068impl common::Part for EmbeddedObjectPosition {}
3069
3070/// An error in a cell.
3071///
3072/// This type is not used in any activity, and only used as *part* of another schema.
3073///
3074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3075#[serde_with::serde_as]
3076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3077pub struct ErrorValue {
3078    /// A message with more information about the error (in the spreadsheet's locale).
3079    pub message: Option<String>,
3080    /// The type of error.
3081    #[serde(rename = "type")]
3082    pub type_: Option<String>,
3083}
3084
3085impl common::Part for ErrorValue {}
3086
3087/// The kinds of value that a cell in a spreadsheet can have.
3088///
3089/// This type is not used in any activity, and only used as *part* of another schema.
3090///
3091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3092#[serde_with::serde_as]
3093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3094pub struct ExtendedValue {
3095    /// Represents a boolean value.
3096    #[serde(rename = "boolValue")]
3097    pub bool_value: Option<bool>,
3098    /// Represents an error. This field is read-only.
3099    #[serde(rename = "errorValue")]
3100    pub error_value: Option<ErrorValue>,
3101    /// Represents a formula.
3102    #[serde(rename = "formulaValue")]
3103    pub formula_value: Option<String>,
3104    /// Represents a double value. Note: Dates, Times and DateTimes are represented as doubles in SERIAL_NUMBER format.
3105    #[serde(rename = "numberValue")]
3106    pub number_value: Option<f64>,
3107    /// Represents a string value. Leading single quotes are not included. For example, if the user typed `'123` into the UI, this would be represented as a `stringValue` of `"123"`.
3108    #[serde(rename = "stringValue")]
3109    pub string_value: Option<String>,
3110}
3111
3112impl common::Part for ExtendedValue {}
3113
3114/// Criteria for showing/hiding rows in a filter or filter view.
3115///
3116/// This type is not used in any activity, and only used as *part* of another schema.
3117///
3118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3119#[serde_with::serde_as]
3120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3121pub struct FilterCriteria {
3122    /// A condition that must be true for values to be shown. (This does not override hidden_values -- if a value is listed there, it will still be hidden.)
3123    pub condition: Option<BooleanCondition>,
3124    /// Values that should be hidden.
3125    #[serde(rename = "hiddenValues")]
3126    pub hidden_values: Option<Vec<String>>,
3127    /// The background fill color to filter by; only cells with this fill color are shown. Mutually exclusive with visible_foreground_color. Deprecated: Use visible_background_color_style.
3128    #[serde(rename = "visibleBackgroundColor")]
3129    pub visible_background_color: Option<Color>,
3130    /// The background fill color to filter by; only cells with this fill color are shown. This field is mutually exclusive with visible_foreground_color, and must be set to an RGB-type color. If visible_background_color is also set, this field takes precedence.
3131    #[serde(rename = "visibleBackgroundColorStyle")]
3132    pub visible_background_color_style: Option<ColorStyle>,
3133    /// The foreground color to filter by; only cells with this foreground color are shown. Mutually exclusive with visible_background_color. Deprecated: Use visible_foreground_color_style.
3134    #[serde(rename = "visibleForegroundColor")]
3135    pub visible_foreground_color: Option<Color>,
3136    /// The foreground color to filter by; only cells with this foreground color are shown. This field is mutually exclusive with visible_background_color, and must be set to an RGB-type color. If visible_foreground_color is also set, this field takes precedence.
3137    #[serde(rename = "visibleForegroundColorStyle")]
3138    pub visible_foreground_color_style: Option<ColorStyle>,
3139}
3140
3141impl common::Part for FilterCriteria {}
3142
3143/// The filter criteria associated with a specific column.
3144///
3145/// This type is not used in any activity, and only used as *part* of another schema.
3146///
3147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3148#[serde_with::serde_as]
3149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3150pub struct FilterSpec {
3151    /// The zero-based column index.
3152    #[serde(rename = "columnIndex")]
3153    pub column_index: Option<i32>,
3154    /// Reference to a data source column.
3155    #[serde(rename = "dataSourceColumnReference")]
3156    pub data_source_column_reference: Option<DataSourceColumnReference>,
3157    /// The criteria for the column.
3158    #[serde(rename = "filterCriteria")]
3159    pub filter_criteria: Option<FilterCriteria>,
3160}
3161
3162impl common::Part for FilterSpec {}
3163
3164/// A filter view.
3165///
3166/// This type is not used in any activity, and only used as *part* of another schema.
3167///
3168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3169#[serde_with::serde_as]
3170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3171pub struct FilterView {
3172    /// The criteria for showing/hiding values per column. The map's key is the column index, and the value is the criteria for that column. This field is deprecated in favor of filter_specs.
3173    pub criteria: Option<HashMap<String, FilterCriteria>>,
3174    /// The filter criteria for showing/hiding values per column. Both criteria and filter_specs are populated in responses. If both fields are specified in an update request, this field takes precedence.
3175    #[serde(rename = "filterSpecs")]
3176    pub filter_specs: Option<Vec<FilterSpec>>,
3177    /// The ID of the filter view.
3178    #[serde(rename = "filterViewId")]
3179    pub filter_view_id: Option<i32>,
3180    /// The named range this filter view is backed by, if any. When writing, only one of range or named_range_id or table_id may be set.
3181    #[serde(rename = "namedRangeId")]
3182    pub named_range_id: Option<String>,
3183    /// The range this filter view covers. When writing, only one of range or named_range_id or table_id may be set.
3184    pub range: Option<GridRange>,
3185    /// The sort order per column. Later specifications are used when values are equal in the earlier specifications.
3186    #[serde(rename = "sortSpecs")]
3187    pub sort_specs: Option<Vec<SortSpec>>,
3188    /// The table this filter view is backed by, if any. When writing, only one of range or named_range_id or table_id may be set.
3189    #[serde(rename = "tableId")]
3190    pub table_id: Option<String>,
3191    /// The name of the filter view.
3192    pub title: Option<String>,
3193}
3194
3195impl common::Part for FilterView {}
3196
3197/// Finds and replaces data in cells over a range, sheet, or all sheets.
3198///
3199/// This type is not used in any activity, and only used as *part* of another schema.
3200///
3201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3202#[serde_with::serde_as]
3203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3204pub struct FindReplaceRequest {
3205    /// True to find/replace over all sheets.
3206    #[serde(rename = "allSheets")]
3207    pub all_sheets: Option<bool>,
3208    /// The value to search.
3209    pub find: Option<String>,
3210    /// True if the search should include cells with formulas. False to skip cells with formulas.
3211    #[serde(rename = "includeFormulas")]
3212    pub include_formulas: Option<bool>,
3213    /// True if the search is case sensitive.
3214    #[serde(rename = "matchCase")]
3215    pub match_case: Option<bool>,
3216    /// True if the find value should match the entire cell.
3217    #[serde(rename = "matchEntireCell")]
3218    pub match_entire_cell: Option<bool>,
3219    /// The range to find/replace over.
3220    pub range: Option<GridRange>,
3221    /// The value to use as the replacement.
3222    pub replacement: Option<String>,
3223    /// True if the find value is a regex. The regular expression and replacement should follow Java regex rules at https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html. The replacement string is allowed to refer to capturing groups. For example, if one cell has the contents `"Google Sheets"` and another has `"Google Docs"`, then searching for `"o.* (.*)"` with a replacement of `"$1 Rocks"` would change the contents of the cells to `"GSheets Rocks"` and `"GDocs Rocks"` respectively.
3224    #[serde(rename = "searchByRegex")]
3225    pub search_by_regex: Option<bool>,
3226    /// The sheet to find/replace over.
3227    #[serde(rename = "sheetId")]
3228    pub sheet_id: Option<i32>,
3229}
3230
3231impl common::Part for FindReplaceRequest {}
3232
3233/// The result of the find/replace.
3234///
3235/// This type is not used in any activity, and only used as *part* of another schema.
3236///
3237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3238#[serde_with::serde_as]
3239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3240pub struct FindReplaceResponse {
3241    /// The number of formula cells changed.
3242    #[serde(rename = "formulasChanged")]
3243    pub formulas_changed: Option<i32>,
3244    /// The number of occurrences (possibly multiple within a cell) changed. For example, if replacing `"e"` with `"o"` in `"Google Sheets"`, this would be `"3"` because `"Google Sheets"` -> `"Googlo Shoots"`.
3245    #[serde(rename = "occurrencesChanged")]
3246    pub occurrences_changed: Option<i32>,
3247    /// The number of rows changed.
3248    #[serde(rename = "rowsChanged")]
3249    pub rows_changed: Option<i32>,
3250    /// The number of sheets changed.
3251    #[serde(rename = "sheetsChanged")]
3252    pub sheets_changed: Option<i32>,
3253    /// The number of non-formula cells changed.
3254    #[serde(rename = "valuesChanged")]
3255    pub values_changed: Option<i32>,
3256}
3257
3258impl common::Part for FindReplaceResponse {}
3259
3260/// The request for retrieving a Spreadsheet.
3261///
3262/// # Activities
3263///
3264/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3265/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3266///
3267/// * [get by data filter spreadsheets](SpreadsheetGetByDataFilterCall) (request)
3268#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3269#[serde_with::serde_as]
3270#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3271pub struct GetSpreadsheetByDataFilterRequest {
3272    /// The DataFilters used to select which ranges to retrieve from the spreadsheet.
3273    #[serde(rename = "dataFilters")]
3274    pub data_filters: Option<Vec<DataFilter>>,
3275    /// True if tables should be excluded in the banded ranges. False if not set.
3276    #[serde(rename = "excludeTablesInBandedRanges")]
3277    pub exclude_tables_in_banded_ranges: Option<bool>,
3278    /// True if grid data should be returned. This parameter is ignored if a field mask was set in the request.
3279    #[serde(rename = "includeGridData")]
3280    pub include_grid_data: Option<bool>,
3281}
3282
3283impl common::RequestValue for GetSpreadsheetByDataFilterRequest {}
3284
3285/// A rule that applies a gradient color scale format, based on the interpolation points listed. The format of a cell will vary based on its contents as compared to the values of the interpolation points.
3286///
3287/// This type is not used in any activity, and only used as *part* of another schema.
3288///
3289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3290#[serde_with::serde_as]
3291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3292pub struct GradientRule {
3293    /// The final interpolation point.
3294    pub maxpoint: Option<InterpolationPoint>,
3295    /// An optional midway interpolation point.
3296    pub midpoint: Option<InterpolationPoint>,
3297    /// The starting interpolation point.
3298    pub minpoint: Option<InterpolationPoint>,
3299}
3300
3301impl common::Part for GradientRule {}
3302
3303/// A coordinate in a sheet. All indexes are zero-based.
3304///
3305/// This type is not used in any activity, and only used as *part* of another schema.
3306///
3307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3308#[serde_with::serde_as]
3309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3310pub struct GridCoordinate {
3311    /// The column index of the coordinate.
3312    #[serde(rename = "columnIndex")]
3313    pub column_index: Option<i32>,
3314    /// The row index of the coordinate.
3315    #[serde(rename = "rowIndex")]
3316    pub row_index: Option<i32>,
3317    /// The sheet this coordinate is on.
3318    #[serde(rename = "sheetId")]
3319    pub sheet_id: Option<i32>,
3320}
3321
3322impl common::Part for GridCoordinate {}
3323
3324/// Data in the grid, as well as metadata about the dimensions.
3325///
3326/// This type is not used in any activity, and only used as *part* of another schema.
3327///
3328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3329#[serde_with::serde_as]
3330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3331pub struct GridData {
3332    /// Metadata about the requested columns in the grid, starting with the column in start_column.
3333    #[serde(rename = "columnMetadata")]
3334    pub column_metadata: Option<Vec<DimensionProperties>>,
3335    /// The data in the grid, one entry per row, starting with the row in startRow. The values in RowData will correspond to columns starting at start_column.
3336    #[serde(rename = "rowData")]
3337    pub row_data: Option<Vec<RowData>>,
3338    /// Metadata about the requested rows in the grid, starting with the row in start_row.
3339    #[serde(rename = "rowMetadata")]
3340    pub row_metadata: Option<Vec<DimensionProperties>>,
3341    /// The first column this GridData refers to, zero-based.
3342    #[serde(rename = "startColumn")]
3343    pub start_column: Option<i32>,
3344    /// The first row this GridData refers to, zero-based.
3345    #[serde(rename = "startRow")]
3346    pub start_row: Option<i32>,
3347}
3348
3349impl common::Part for GridData {}
3350
3351/// Properties of a grid.
3352///
3353/// This type is not used in any activity, and only used as *part* of another schema.
3354///
3355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3356#[serde_with::serde_as]
3357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3358pub struct GridProperties {
3359    /// The number of columns in the grid.
3360    #[serde(rename = "columnCount")]
3361    pub column_count: Option<i32>,
3362    /// True if the column grouping control toggle is shown after the group.
3363    #[serde(rename = "columnGroupControlAfter")]
3364    pub column_group_control_after: Option<bool>,
3365    /// The number of columns that are frozen in the grid.
3366    #[serde(rename = "frozenColumnCount")]
3367    pub frozen_column_count: Option<i32>,
3368    /// The number of rows that are frozen in the grid.
3369    #[serde(rename = "frozenRowCount")]
3370    pub frozen_row_count: Option<i32>,
3371    /// True if the grid isn't showing gridlines in the UI.
3372    #[serde(rename = "hideGridlines")]
3373    pub hide_gridlines: Option<bool>,
3374    /// The number of rows in the grid.
3375    #[serde(rename = "rowCount")]
3376    pub row_count: Option<i32>,
3377    /// True if the row grouping control toggle is shown after the group.
3378    #[serde(rename = "rowGroupControlAfter")]
3379    pub row_group_control_after: Option<bool>,
3380}
3381
3382impl common::Part for GridProperties {}
3383
3384/// A range on a sheet. All indexes are zero-based. Indexes are half open, i.e. the start index is inclusive and the end index is exclusive -- [start_index, end_index). Missing indexes indicate the range is unbounded on that side. For example, if `"Sheet1"` is sheet ID 123456, then: `Sheet1!A1:A1 == sheet_id: 123456, start_row_index: 0, end_row_index: 1, start_column_index: 0, end_column_index: 1` `Sheet1!A3:B4 == sheet_id: 123456, start_row_index: 2, end_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1!A:B == sheet_id: 123456, start_column_index: 0, end_column_index: 2` `Sheet1!A5:B == sheet_id: 123456, start_row_index: 4, start_column_index: 0, end_column_index: 2` `Sheet1 == sheet_id: 123456` The start index must always be less than or equal to the end index. If the start index equals the end index, then the range is empty. Empty ranges are typically not meaningful and are usually rendered in the UI as `#REF!`.
3385///
3386/// This type is not used in any activity, and only used as *part* of another schema.
3387///
3388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3389#[serde_with::serde_as]
3390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3391pub struct GridRange {
3392    /// The end column (exclusive) of the range, or not set if unbounded.
3393    #[serde(rename = "endColumnIndex")]
3394    pub end_column_index: Option<i32>,
3395    /// The end row (exclusive) of the range, or not set if unbounded.
3396    #[serde(rename = "endRowIndex")]
3397    pub end_row_index: Option<i32>,
3398    /// The sheet this range is on.
3399    #[serde(rename = "sheetId")]
3400    pub sheet_id: Option<i32>,
3401    /// The start column (inclusive) of the range, or not set if unbounded.
3402    #[serde(rename = "startColumnIndex")]
3403    pub start_column_index: Option<i32>,
3404    /// The start row (inclusive) of the range, or not set if unbounded.
3405    #[serde(rename = "startRowIndex")]
3406    pub start_row_index: Option<i32>,
3407}
3408
3409impl common::Part for GridRange {}
3410
3411/// A histogram chart. A histogram chart groups data items into bins, displaying each bin as a column of stacked items. Histograms are used to display the distribution of a dataset. Each column of items represents a range into which those items fall. The number of bins can be chosen automatically or specified explicitly.
3412///
3413/// This type is not used in any activity, and only used as *part* of another schema.
3414///
3415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3416#[serde_with::serde_as]
3417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3418pub struct HistogramChartSpec {
3419    /// By default the bucket size (the range of values stacked in a single column) is chosen automatically, but it may be overridden here. E.g., A bucket size of 1.5 results in buckets from 0 - 1.5, 1.5 - 3.0, etc. Cannot be negative. This field is optional.
3420    #[serde(rename = "bucketSize")]
3421    pub bucket_size: Option<f64>,
3422    /// The position of the chart legend.
3423    #[serde(rename = "legendPosition")]
3424    pub legend_position: Option<String>,
3425    /// The outlier percentile is used to ensure that outliers do not adversely affect the calculation of bucket sizes. For example, setting an outlier percentile of 0.05 indicates that the top and bottom 5% of values when calculating buckets. The values are still included in the chart, they will be added to the first or last buckets instead of their own buckets. Must be between 0.0 and 0.5.
3426    #[serde(rename = "outlierPercentile")]
3427    pub outlier_percentile: Option<f64>,
3428    /// The series for a histogram may be either a single series of values to be bucketed or multiple series, each of the same length, containing the name of the series followed by the values to be bucketed for that series.
3429    pub series: Option<Vec<HistogramSeries>>,
3430    /// Whether horizontal divider lines should be displayed between items in each column.
3431    #[serde(rename = "showItemDividers")]
3432    pub show_item_dividers: Option<bool>,
3433}
3434
3435impl common::Part for HistogramChartSpec {}
3436
3437/// Allows you to organize the numeric values in a source data column into buckets of a constant size. All values from HistogramRule.start to HistogramRule.end are placed into groups of size HistogramRule.interval. In addition, all values below HistogramRule.start are placed in one group, and all values above HistogramRule.end are placed in another. Only HistogramRule.interval is required, though if HistogramRule.start and HistogramRule.end are both provided, HistogramRule.start must be less than HistogramRule.end. For example, a pivot table showing average purchase amount by age that has 50+ rows: +-----+-------------------+ | Age | AVERAGE of Amount | +-----+-------------------+ | 16 | $27.13 | | 17 | $5.24 | | 18 | $20.15 | ... +-----+-------------------+ could be turned into a pivot table that looks like the one below by applying a histogram group rule with a HistogramRule.start of 25, an HistogramRule.interval of 20, and an HistogramRule.end of 65. +-------------+-------------------+ | Grouped Age | AVERAGE of Amount | +-------------+-------------------+ | < 25 | $19.34 | | 25-45 | $31.43 | | 45-65 | $35.87 | | > 65 | $27.55 | +-------------+-------------------+ | Grand Total | $29.12 | +-------------+-------------------+
3438///
3439/// This type is not used in any activity, and only used as *part* of another schema.
3440///
3441#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3442#[serde_with::serde_as]
3443#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3444pub struct HistogramRule {
3445    /// The maximum value at which items are placed into buckets of constant size. Values above end are lumped into a single bucket. This field is optional.
3446    pub end: Option<f64>,
3447    /// The size of the buckets that are created. Must be positive.
3448    pub interval: Option<f64>,
3449    /// The minimum value at which items are placed into buckets of constant size. Values below start are lumped into a single bucket. This field is optional.
3450    pub start: Option<f64>,
3451}
3452
3453impl common::Part for HistogramRule {}
3454
3455/// A histogram series containing the series color and data.
3456///
3457/// This type is not used in any activity, and only used as *part* of another schema.
3458///
3459#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3460#[serde_with::serde_as]
3461#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3462pub struct HistogramSeries {
3463    /// The color of the column representing this series in each bucket. This field is optional. Deprecated: Use bar_color_style.
3464    #[serde(rename = "barColor")]
3465    pub bar_color: Option<Color>,
3466    /// The color of the column representing this series in each bucket. This field is optional. If bar_color is also set, this field takes precedence.
3467    #[serde(rename = "barColorStyle")]
3468    pub bar_color_style: Option<ColorStyle>,
3469    /// The data for this histogram series.
3470    pub data: Option<ChartData>,
3471}
3472
3473impl common::Part for HistogramSeries {}
3474
3475/// Inserts rows or columns in a sheet at a particular index.
3476///
3477/// This type is not used in any activity, and only used as *part* of another schema.
3478///
3479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3480#[serde_with::serde_as]
3481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3482pub struct InsertDimensionRequest {
3483    /// Whether dimension properties should be extended from the dimensions before or after the newly inserted dimensions. True to inherit from the dimensions before (in which case the start index must be greater than 0), and false to inherit from the dimensions after. For example, if row index 0 has red background and row index 1 has a green background, then inserting 2 rows at index 1 can inherit either the green or red background. If `inheritFromBefore` is true, the two new rows will be red (because the row before the insertion point was red), whereas if `inheritFromBefore` is false, the two new rows will be green (because the row after the insertion point was green).
3484    #[serde(rename = "inheritFromBefore")]
3485    pub inherit_from_before: Option<bool>,
3486    /// The dimensions to insert. Both the start and end indexes must be bounded.
3487    pub range: Option<DimensionRange>,
3488}
3489
3490impl common::Part for InsertDimensionRequest {}
3491
3492/// Inserts cells into a range, shifting the existing cells over or down.
3493///
3494/// This type is not used in any activity, and only used as *part* of another schema.
3495///
3496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3497#[serde_with::serde_as]
3498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3499pub struct InsertRangeRequest {
3500    /// The range to insert new cells into. The range is constrained to the current sheet boundaries.
3501    pub range: Option<GridRange>,
3502    /// The dimension which will be shifted when inserting cells. If ROWS, existing cells will be shifted down. If COLUMNS, existing cells will be shifted right.
3503    #[serde(rename = "shiftDimension")]
3504    pub shift_dimension: Option<String>,
3505}
3506
3507impl common::Part for InsertRangeRequest {}
3508
3509/// A single interpolation point on a gradient conditional format. These pin the gradient color scale according to the color, type and value chosen.
3510///
3511/// This type is not used in any activity, and only used as *part* of another schema.
3512///
3513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3514#[serde_with::serde_as]
3515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3516pub struct InterpolationPoint {
3517    /// The color this interpolation point should use. Deprecated: Use color_style.
3518    pub color: Option<Color>,
3519    /// The color this interpolation point should use. If color is also set, this field takes precedence.
3520    #[serde(rename = "colorStyle")]
3521    pub color_style: Option<ColorStyle>,
3522    /// How the value should be interpreted.
3523    #[serde(rename = "type")]
3524    pub type_: Option<String>,
3525    /// The value this interpolation point uses. May be a formula. Unused if type is MIN or MAX.
3526    pub value: Option<String>,
3527}
3528
3529impl common::Part for InterpolationPoint {}
3530
3531/// Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.
3532///
3533/// This type is not used in any activity, and only used as *part* of another schema.
3534///
3535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3536#[serde_with::serde_as]
3537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3538pub struct Interval {
3539    /// Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end.
3540    #[serde(rename = "endTime")]
3541    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3542    /// Optional. Inclusive start of the interval. If specified, a Timestamp matching this interval will have to be the same or after the start.
3543    #[serde(rename = "startTime")]
3544    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3545}
3546
3547impl common::Part for Interval {}
3548
3549/// Settings to control how circular dependencies are resolved with iterative calculation.
3550///
3551/// This type is not used in any activity, and only used as *part* of another schema.
3552///
3553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3554#[serde_with::serde_as]
3555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3556pub struct IterativeCalculationSettings {
3557    /// When iterative calculation is enabled and successive results differ by less than this threshold value, the calculation rounds stop.
3558    #[serde(rename = "convergenceThreshold")]
3559    pub convergence_threshold: Option<f64>,
3560    /// When iterative calculation is enabled, the maximum number of calculation rounds to perform.
3561    #[serde(rename = "maxIterations")]
3562    pub max_iterations: Option<i32>,
3563}
3564
3565impl common::Part for IterativeCalculationSettings {}
3566
3567/// Formatting options for key value.
3568///
3569/// This type is not used in any activity, and only used as *part* of another schema.
3570///
3571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3572#[serde_with::serde_as]
3573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3574pub struct KeyValueFormat {
3575    /// Specifies the horizontal text positioning of key value. This field is optional. If not specified, default positioning is used.
3576    pub position: Option<TextPosition>,
3577    /// Text formatting options for key value. The link field is not supported.
3578    #[serde(rename = "textFormat")]
3579    pub text_format: Option<TextFormat>,
3580}
3581
3582impl common::Part for KeyValueFormat {}
3583
3584/// Properties that describe the style of a line.
3585///
3586/// This type is not used in any activity, and only used as *part* of another schema.
3587///
3588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3589#[serde_with::serde_as]
3590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3591pub struct LineStyle {
3592    /// The dash type of the line.
3593    #[serde(rename = "type")]
3594    pub type_: Option<String>,
3595    /// The thickness of the line, in px.
3596    pub width: Option<i32>,
3597}
3598
3599impl common::Part for LineStyle {}
3600
3601/// An external or local reference.
3602///
3603/// This type is not used in any activity, and only used as *part* of another schema.
3604///
3605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3606#[serde_with::serde_as]
3607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3608pub struct Link {
3609    /// The link identifier.
3610    pub uri: Option<String>,
3611}
3612
3613impl common::Part for Link {}
3614
3615/// The specification of a Looker data source.
3616///
3617/// This type is not used in any activity, and only used as *part* of another schema.
3618///
3619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3620#[serde_with::serde_as]
3621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3622pub struct LookerDataSourceSpec {
3623    /// Name of a Looker model explore.
3624    pub explore: Option<String>,
3625    /// A Looker instance URL.
3626    #[serde(rename = "instanceUri")]
3627    pub instance_uri: Option<String>,
3628    /// Name of a Looker model.
3629    pub model: Option<String>,
3630}
3631
3632impl common::Part for LookerDataSourceSpec {}
3633
3634/// Allows you to manually organize the values in a source data column into buckets with names of your choosing. For example, a pivot table that aggregates population by state: +-------+-------------------+ | State | SUM of Population | +-------+-------------------+ | AK | 0.7 | | AL | 4.8 | | AR | 2.9 | ... +-------+-------------------+ could be turned into a pivot table that aggregates population by time zone by providing a list of groups (for example, groupName = 'Central', items = ['AL', 'AR', 'IA', ...]) to a manual group rule. Note that a similar effect could be achieved by adding a time zone column to the source data and adjusting the pivot table. +-----------+-------------------+ | Time Zone | SUM of Population | +-----------+-------------------+ | Central | 106.3 | | Eastern | 151.9 | | Mountain | 17.4 | ... +-----------+-------------------+
3635///
3636/// This type is not used in any activity, and only used as *part* of another schema.
3637///
3638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3639#[serde_with::serde_as]
3640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3641pub struct ManualRule {
3642    /// The list of group names and the corresponding items from the source data that map to each group name.
3643    pub groups: Option<Vec<ManualRuleGroup>>,
3644}
3645
3646impl common::Part for ManualRule {}
3647
3648/// A group name and a list of items from the source data that should be placed in the group with this name.
3649///
3650/// This type is not used in any activity, and only used as *part* of another schema.
3651///
3652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3653#[serde_with::serde_as]
3654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3655pub struct ManualRuleGroup {
3656    /// The group name, which must be a string. Each group in a given ManualRule must have a unique group name.
3657    #[serde(rename = "groupName")]
3658    pub group_name: Option<ExtendedValue>,
3659    /// The items in the source data that should be placed into this group. Each item may be a string, number, or boolean. Items may appear in at most one group within a given ManualRule. Items that do not appear in any group will appear on their own.
3660    pub items: Option<Vec<ExtendedValue>>,
3661}
3662
3663impl common::Part for ManualRuleGroup {}
3664
3665/// A developer metadata entry and the data filters specified in the original request that matched it.
3666///
3667/// This type is not used in any activity, and only used as *part* of another schema.
3668///
3669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3670#[serde_with::serde_as]
3671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3672pub struct MatchedDeveloperMetadata {
3673    /// All filters matching the returned developer metadata.
3674    #[serde(rename = "dataFilters")]
3675    pub data_filters: Option<Vec<DataFilter>>,
3676    /// The developer metadata matching the specified filters.
3677    #[serde(rename = "developerMetadata")]
3678    pub developer_metadata: Option<DeveloperMetadata>,
3679}
3680
3681impl common::Part for MatchedDeveloperMetadata {}
3682
3683/// A value range that was matched by one or more data filers.
3684///
3685/// This type is not used in any activity, and only used as *part* of another schema.
3686///
3687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3688#[serde_with::serde_as]
3689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3690pub struct MatchedValueRange {
3691    /// The DataFilters from the request that matched the range of values.
3692    #[serde(rename = "dataFilters")]
3693    pub data_filters: Option<Vec<DataFilter>>,
3694    /// The values matched by the DataFilter.
3695    #[serde(rename = "valueRange")]
3696    pub value_range: Option<ValueRange>,
3697}
3698
3699impl common::Part for MatchedValueRange {}
3700
3701/// Merges all cells in the range.
3702///
3703/// This type is not used in any activity, and only used as *part* of another schema.
3704///
3705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3706#[serde_with::serde_as]
3707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3708pub struct MergeCellsRequest {
3709    /// How the cells should be merged.
3710    #[serde(rename = "mergeType")]
3711    pub merge_type: Option<String>,
3712    /// The range of cells to merge.
3713    pub range: Option<GridRange>,
3714}
3715
3716impl common::Part for MergeCellsRequest {}
3717
3718/// Moves one or more rows or columns.
3719///
3720/// This type is not used in any activity, and only used as *part* of another schema.
3721///
3722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3723#[serde_with::serde_as]
3724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3725pub struct MoveDimensionRequest {
3726    /// The zero-based start index of where to move the source data to, based on the coordinates *before* the source data is removed from the grid. Existing data will be shifted down or right (depending on the dimension) to make room for the moved dimensions. The source dimensions are removed from the grid, so the the data may end up in a different index than specified. For example, given `A1..A5` of `0, 1, 2, 3, 4` and wanting to move `"1"` and `"2"` to between `"3"` and `"4"`, the source would be `ROWS [1..3)`,and the destination index would be `"4"` (the zero-based index of row 5). The end result would be `A1..A5` of `0, 3, 1, 2, 4`.
3727    #[serde(rename = "destinationIndex")]
3728    pub destination_index: Option<i32>,
3729    /// The source dimensions to move.
3730    pub source: Option<DimensionRange>,
3731}
3732
3733impl common::Part for MoveDimensionRequest {}
3734
3735/// A named range.
3736///
3737/// This type is not used in any activity, and only used as *part* of another schema.
3738///
3739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3740#[serde_with::serde_as]
3741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3742pub struct NamedRange {
3743    /// The name of the named range.
3744    pub name: Option<String>,
3745    /// The ID of the named range.
3746    #[serde(rename = "namedRangeId")]
3747    pub named_range_id: Option<String>,
3748    /// The range this represents.
3749    pub range: Option<GridRange>,
3750}
3751
3752impl common::Part for NamedRange {}
3753
3754/// The number format of a cell.
3755///
3756/// This type is not used in any activity, and only used as *part* of another schema.
3757///
3758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3759#[serde_with::serde_as]
3760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3761pub struct NumberFormat {
3762    /// Pattern string used for formatting. If not set, a default pattern based on the spreadsheet's locale will be used if necessary for the given type. See the [Date and Number Formats guide](https://developers.google.com/workspace/sheets/api/guides/formats) for more information about the supported patterns.
3763    pub pattern: Option<String>,
3764    /// The type of the number format. When writing, this field must be set.
3765    #[serde(rename = "type")]
3766    pub type_: Option<String>,
3767}
3768
3769impl common::Part for NumberFormat {}
3770
3771/// An org chart. Org charts require a unique set of labels in labels and may optionally include parent_labels and tooltips. parent_labels contain, for each node, the label identifying the parent node. tooltips contain, for each node, an optional tooltip. For example, to describe an OrgChart with Alice as the CEO, Bob as the President (reporting to Alice) and Cathy as VP of Sales (also reporting to Alice), have labels contain "Alice", "Bob", "Cathy", parent_labels contain "", "Alice", "Alice" and tooltips contain "CEO", "President", "VP Sales".
3772///
3773/// This type is not used in any activity, and only used as *part* of another schema.
3774///
3775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3776#[serde_with::serde_as]
3777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3778pub struct OrgChartSpec {
3779    /// The data containing the labels for all the nodes in the chart. Labels must be unique.
3780    pub labels: Option<ChartData>,
3781    /// The color of the org chart nodes. Deprecated: Use node_color_style.
3782    #[serde(rename = "nodeColor")]
3783    pub node_color: Option<Color>,
3784    /// The color of the org chart nodes. If node_color is also set, this field takes precedence.
3785    #[serde(rename = "nodeColorStyle")]
3786    pub node_color_style: Option<ColorStyle>,
3787    /// The size of the org chart nodes.
3788    #[serde(rename = "nodeSize")]
3789    pub node_size: Option<String>,
3790    /// The data containing the label of the parent for the corresponding node. A blank value indicates that the node has no parent and is a top-level node. This field is optional.
3791    #[serde(rename = "parentLabels")]
3792    pub parent_labels: Option<ChartData>,
3793    /// The color of the selected org chart nodes. Deprecated: Use selected_node_color_style.
3794    #[serde(rename = "selectedNodeColor")]
3795    pub selected_node_color: Option<Color>,
3796    /// The color of the selected org chart nodes. If selected_node_color is also set, this field takes precedence.
3797    #[serde(rename = "selectedNodeColorStyle")]
3798    pub selected_node_color_style: Option<ColorStyle>,
3799    /// The data containing the tooltip for the corresponding node. A blank value results in no tooltip being displayed for the node. This field is optional.
3800    pub tooltips: Option<ChartData>,
3801}
3802
3803impl common::Part for OrgChartSpec {}
3804
3805/// The location an object is overlaid on top of a grid.
3806///
3807/// This type is not used in any activity, and only used as *part* of another schema.
3808///
3809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3810#[serde_with::serde_as]
3811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3812pub struct OverlayPosition {
3813    /// The cell the object is anchored to.
3814    #[serde(rename = "anchorCell")]
3815    pub anchor_cell: Option<GridCoordinate>,
3816    /// The height of the object, in pixels. Defaults to 371.
3817    #[serde(rename = "heightPixels")]
3818    pub height_pixels: Option<i32>,
3819    /// The horizontal offset, in pixels, that the object is offset from the anchor cell.
3820    #[serde(rename = "offsetXPixels")]
3821    pub offset_x_pixels: Option<i32>,
3822    /// The vertical offset, in pixels, that the object is offset from the anchor cell.
3823    #[serde(rename = "offsetYPixels")]
3824    pub offset_y_pixels: Option<i32>,
3825    /// The width of the object, in pixels. Defaults to 600.
3826    #[serde(rename = "widthPixels")]
3827    pub width_pixels: Option<i32>,
3828}
3829
3830impl common::Part for OverlayPosition {}
3831
3832/// The amount of padding around the cell, in pixels. When updating padding, every field must be specified.
3833///
3834/// This type is not used in any activity, and only used as *part* of another schema.
3835///
3836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3837#[serde_with::serde_as]
3838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3839pub struct Padding {
3840    /// The bottom padding of the cell.
3841    pub bottom: Option<i32>,
3842    /// The left padding of the cell.
3843    pub left: Option<i32>,
3844    /// The right padding of the cell.
3845    pub right: Option<i32>,
3846    /// The top padding of the cell.
3847    pub top: Option<i32>,
3848}
3849
3850impl common::Part for Padding {}
3851
3852/// Inserts data into the spreadsheet starting at the specified coordinate.
3853///
3854/// This type is not used in any activity, and only used as *part* of another schema.
3855///
3856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3857#[serde_with::serde_as]
3858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3859pub struct PasteDataRequest {
3860    /// The coordinate at which the data should start being inserted.
3861    pub coordinate: Option<GridCoordinate>,
3862    /// The data to insert.
3863    pub data: Option<String>,
3864    /// The delimiter in the data.
3865    pub delimiter: Option<String>,
3866    /// True if the data is HTML.
3867    pub html: Option<bool>,
3868    /// How the data should be pasted.
3869    #[serde(rename = "type")]
3870    pub type_: Option<String>,
3871}
3872
3873impl common::Part for PasteDataRequest {}
3874
3875/// Properties specific to a linked person.
3876///
3877/// This type is not used in any activity, and only used as *part* of another schema.
3878///
3879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3880#[serde_with::serde_as]
3881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3882pub struct PersonProperties {
3883    /// Optional. The display format of the person chip. If not set, the default display format is used.
3884    #[serde(rename = "displayFormat")]
3885    pub display_format: Option<String>,
3886    /// Required. The email address linked to this person. This field is always present.
3887    pub email: Option<String>,
3888}
3889
3890impl common::Part for PersonProperties {}
3891
3892/// A pie chart.
3893///
3894/// This type is not used in any activity, and only used as *part* of another schema.
3895///
3896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3897#[serde_with::serde_as]
3898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3899pub struct PieChartSpec {
3900    /// The data that covers the domain of the pie chart.
3901    pub domain: Option<ChartData>,
3902    /// Where the legend of the pie chart should be drawn.
3903    #[serde(rename = "legendPosition")]
3904    pub legend_position: Option<String>,
3905    /// The size of the hole in the pie chart.
3906    #[serde(rename = "pieHole")]
3907    pub pie_hole: Option<f64>,
3908    /// The data that covers the one and only series of the pie chart.
3909    pub series: Option<ChartData>,
3910    /// True if the pie is three dimensional.
3911    #[serde(rename = "threeDimensional")]
3912    pub three_dimensional: Option<bool>,
3913}
3914
3915impl common::Part for PieChartSpec {}
3916
3917/// Criteria for showing/hiding rows in a pivot table.
3918///
3919/// This type is not used in any activity, and only used as *part* of another schema.
3920///
3921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3922#[serde_with::serde_as]
3923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3924pub struct PivotFilterCriteria {
3925    /// A condition that must be true for values to be shown. (`visibleValues` does not override this -- even if a value is listed there, it is still hidden if it does not meet the condition.) Condition values that refer to ranges in A1-notation are evaluated relative to the pivot table sheet. References are treated absolutely, so are not filled down the pivot table. For example, a condition value of `=A1` on "Pivot Table 1" is treated as `'Pivot Table 1'!$A$1`. The source data of the pivot table can be referenced by column header name. For example, if the source data has columns named "Revenue" and "Cost" and a condition is applied to the "Revenue" column with type `NUMBER_GREATER` and value `=Cost`, then only columns where "Revenue" > "Cost" are included.
3926    pub condition: Option<BooleanCondition>,
3927    /// Whether values are visible by default. If true, the visible_values are ignored, all values that meet condition (if specified) are shown. If false, values that are both in visible_values and meet condition are shown.
3928    #[serde(rename = "visibleByDefault")]
3929    pub visible_by_default: Option<bool>,
3930    /// Values that should be included. Values not listed here are excluded.
3931    #[serde(rename = "visibleValues")]
3932    pub visible_values: Option<Vec<String>>,
3933}
3934
3935impl common::Part for PivotFilterCriteria {}
3936
3937/// The pivot table filter criteria associated with a specific source column offset.
3938///
3939/// This type is not used in any activity, and only used as *part* of another schema.
3940///
3941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3942#[serde_with::serde_as]
3943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3944pub struct PivotFilterSpec {
3945    /// The zero-based column offset of the source range.
3946    #[serde(rename = "columnOffsetIndex")]
3947    pub column_offset_index: Option<i32>,
3948    /// The reference to the data source column.
3949    #[serde(rename = "dataSourceColumnReference")]
3950    pub data_source_column_reference: Option<DataSourceColumnReference>,
3951    /// The criteria for the column.
3952    #[serde(rename = "filterCriteria")]
3953    pub filter_criteria: Option<PivotFilterCriteria>,
3954}
3955
3956impl common::Part for PivotFilterSpec {}
3957
3958/// A single grouping (either row or column) in a pivot table.
3959///
3960/// This type is not used in any activity, and only used as *part* of another schema.
3961///
3962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3963#[serde_with::serde_as]
3964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3965pub struct PivotGroup {
3966    /// The reference to the data source column this grouping is based on.
3967    #[serde(rename = "dataSourceColumnReference")]
3968    pub data_source_column_reference: Option<DataSourceColumnReference>,
3969    /// The count limit on rows or columns to apply to this pivot group.
3970    #[serde(rename = "groupLimit")]
3971    pub group_limit: Option<PivotGroupLimit>,
3972    /// The group rule to apply to this row/column group.
3973    #[serde(rename = "groupRule")]
3974    pub group_rule: Option<PivotGroupRule>,
3975    /// The labels to use for the row/column groups which can be customized. For example, in the following pivot table, the row label is `Region` (which could be renamed to `State`) and the column label is `Product` (which could be renamed `Item`). Pivot tables created before December 2017 do not have header labels. If you'd like to add header labels to an existing pivot table, please delete the existing pivot table and then create a new pivot table with same parameters. +--------------+---------+-------+ | SUM of Units | Product | | | Region | Pen | Paper | +--------------+---------+-------+ | New York | 345 | 98 | | Oregon | 234 | 123 | | Tennessee | 531 | 415 | +--------------+---------+-------+ | Grand Total | 1110 | 636 | +--------------+---------+-------+
3976    pub label: Option<String>,
3977    /// True if the headings in this pivot group should be repeated. This is only valid for row groupings and is ignored by columns. By default, we minimize repetition of headings by not showing higher level headings where they are the same. For example, even though the third row below corresponds to "Q1 Mar", "Q1" is not shown because it is redundant with previous rows. Setting repeat_headings to true would cause "Q1" to be repeated for "Feb" and "Mar". +--------------+ | Q1 | Jan | | | Feb | | | Mar | +--------+-----+ | Q1 Total | +--------------+
3978    #[serde(rename = "repeatHeadings")]
3979    pub repeat_headings: Option<bool>,
3980    /// True if the pivot table should include the totals for this grouping.
3981    #[serde(rename = "showTotals")]
3982    pub show_totals: Option<bool>,
3983    /// The order the values in this group should be sorted.
3984    #[serde(rename = "sortOrder")]
3985    pub sort_order: Option<String>,
3986    /// The column offset of the source range that this grouping is based on. For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` means this group refers to column `C`, whereas the offset `1` would refer to column `D`.
3987    #[serde(rename = "sourceColumnOffset")]
3988    pub source_column_offset: Option<i32>,
3989    /// The bucket of the opposite pivot group to sort by. If not specified, sorting is alphabetical by this group's values.
3990    #[serde(rename = "valueBucket")]
3991    pub value_bucket: Option<PivotGroupSortValueBucket>,
3992    /// Metadata about values in the grouping.
3993    #[serde(rename = "valueMetadata")]
3994    pub value_metadata: Option<Vec<PivotGroupValueMetadata>>,
3995}
3996
3997impl common::Part for PivotGroup {}
3998
3999/// The count limit on rows or columns in the pivot group.
4000///
4001/// This type is not used in any activity, and only used as *part* of another schema.
4002///
4003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4004#[serde_with::serde_as]
4005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4006pub struct PivotGroupLimit {
4007    /// The order in which the group limit is applied to the pivot table. Pivot group limits are applied from lower to higher order number. Order numbers are normalized to consecutive integers from 0. For write request, to fully customize the applying orders, all pivot group limits should have this field set with an unique number. Otherwise, the order is determined by the index in the PivotTable.rows list and then the PivotTable.columns list.
4008    #[serde(rename = "applyOrder")]
4009    pub apply_order: Option<i32>,
4010    /// The count limit.
4011    #[serde(rename = "countLimit")]
4012    pub count_limit: Option<i32>,
4013}
4014
4015impl common::Part for PivotGroupLimit {}
4016
4017/// An optional setting on a PivotGroup that defines buckets for the values in the source data column rather than breaking out each individual value. Only one PivotGroup with a group rule may be added for each column in the source data, though on any given column you may add both a PivotGroup that has a rule and a PivotGroup that does not.
4018///
4019/// This type is not used in any activity, and only used as *part* of another schema.
4020///
4021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4022#[serde_with::serde_as]
4023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4024pub struct PivotGroupRule {
4025    /// A DateTimeRule.
4026    #[serde(rename = "dateTimeRule")]
4027    pub date_time_rule: Option<DateTimeRule>,
4028    /// A HistogramRule.
4029    #[serde(rename = "histogramRule")]
4030    pub histogram_rule: Option<HistogramRule>,
4031    /// A ManualRule.
4032    #[serde(rename = "manualRule")]
4033    pub manual_rule: Option<ManualRule>,
4034}
4035
4036impl common::Part for PivotGroupRule {}
4037
4038/// Information about which values in a pivot group should be used for sorting.
4039///
4040/// This type is not used in any activity, and only used as *part* of another schema.
4041///
4042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4043#[serde_with::serde_as]
4044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4045pub struct PivotGroupSortValueBucket {
4046    /// Determines the bucket from which values are chosen to sort. For example, in a pivot table with one row group & two column groups, the row group can list up to two values. The first value corresponds to a value within the first column group, and the second value corresponds to a value in the second column group. If no values are listed, this would indicate that the row should be sorted according to the "Grand Total" over the column groups. If a single value is listed, this would correspond to using the "Total" of that bucket.
4047    pub buckets: Option<Vec<ExtendedValue>>,
4048    /// The offset in the PivotTable.values list which the values in this grouping should be sorted by.
4049    #[serde(rename = "valuesIndex")]
4050    pub values_index: Option<i32>,
4051}
4052
4053impl common::Part for PivotGroupSortValueBucket {}
4054
4055/// Metadata about a value in a pivot grouping.
4056///
4057/// This type is not used in any activity, and only used as *part* of another schema.
4058///
4059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4060#[serde_with::serde_as]
4061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4062pub struct PivotGroupValueMetadata {
4063    /// True if the data corresponding to the value is collapsed.
4064    pub collapsed: Option<bool>,
4065    /// The calculated value the metadata corresponds to. (Note that formulaValue is not valid, because the values will be calculated.)
4066    pub value: Option<ExtendedValue>,
4067}
4068
4069impl common::Part for PivotGroupValueMetadata {}
4070
4071/// A pivot table.
4072///
4073/// This type is not used in any activity, and only used as *part* of another schema.
4074///
4075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4076#[serde_with::serde_as]
4077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4078pub struct PivotTable {
4079    /// Each column grouping in the pivot table.
4080    pub columns: Option<Vec<PivotGroup>>,
4081    /// An optional mapping of filters per source column offset. The filters are applied before aggregating data into the pivot table. The map's key is the column offset of the source range that you want to filter, and the value is the criteria for that column. For example, if the source was `C10:E15`, a key of `0` will have the filter for column `C`, whereas the key `1` is for column `D`. This field is deprecated in favor of filter_specs.
4082    pub criteria: Option<HashMap<String, PivotFilterCriteria>>,
4083    /// Output only. The data execution status for data source pivot tables.
4084    #[serde(rename = "dataExecutionStatus")]
4085    pub data_execution_status: Option<DataExecutionStatus>,
4086    /// The ID of the data source the pivot table is reading data from.
4087    #[serde(rename = "dataSourceId")]
4088    pub data_source_id: Option<String>,
4089    /// The filters applied to the source columns before aggregating data for the pivot table. Both criteria and filter_specs are populated in responses. If both fields are specified in an update request, this field takes precedence.
4090    #[serde(rename = "filterSpecs")]
4091    pub filter_specs: Option<Vec<PivotFilterSpec>>,
4092    /// Each row grouping in the pivot table.
4093    pub rows: Option<Vec<PivotGroup>>,
4094    /// The range the pivot table is reading data from.
4095    pub source: Option<GridRange>,
4096    /// Whether values should be listed horizontally (as columns) or vertically (as rows).
4097    #[serde(rename = "valueLayout")]
4098    pub value_layout: Option<String>,
4099    /// A list of values to include in the pivot table.
4100    pub values: Option<Vec<PivotValue>>,
4101}
4102
4103impl common::Part for PivotTable {}
4104
4105/// The definition of how a value in a pivot table should be calculated.
4106///
4107/// This type is not used in any activity, and only used as *part* of another schema.
4108///
4109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4110#[serde_with::serde_as]
4111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4112pub struct PivotValue {
4113    /// If specified, indicates that pivot values should be displayed as the result of a calculation with another pivot value. For example, if calculated_display_type is specified as PERCENT_OF_GRAND_TOTAL, all the pivot values are displayed as the percentage of the grand total. In the Sheets editor, this is referred to as "Show As" in the value section of a pivot table.
4114    #[serde(rename = "calculatedDisplayType")]
4115    pub calculated_display_type: Option<String>,
4116    /// The reference to the data source column that this value reads from.
4117    #[serde(rename = "dataSourceColumnReference")]
4118    pub data_source_column_reference: Option<DataSourceColumnReference>,
4119    /// A custom formula to calculate the value. The formula must start with an `=` character.
4120    pub formula: Option<String>,
4121    /// A name to use for the value.
4122    pub name: Option<String>,
4123    /// The column offset of the source range that this value reads from. For example, if the source was `C10:E15`, a `sourceColumnOffset` of `0` means this value refers to column `C`, whereas the offset `1` would refer to column `D`.
4124    #[serde(rename = "sourceColumnOffset")]
4125    pub source_column_offset: Option<i32>,
4126    /// A function to summarize the value. If formula is set, the only supported values are SUM and CUSTOM. If sourceColumnOffset is set, then `CUSTOM` is not supported.
4127    #[serde(rename = "summarizeFunction")]
4128    pub summarize_function: Option<String>,
4129}
4130
4131impl common::Part for PivotValue {}
4132
4133/// The style of a point on the chart.
4134///
4135/// This type is not used in any activity, and only used as *part* of another schema.
4136///
4137#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4138#[serde_with::serde_as]
4139#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4140pub struct PointStyle {
4141    /// The point shape. If empty or unspecified, a default shape is used.
4142    pub shape: Option<String>,
4143    /// The point size. If empty, a default size is used.
4144    pub size: Option<f64>,
4145}
4146
4147impl common::Part for PointStyle {}
4148
4149/// A protected range.
4150///
4151/// This type is not used in any activity, and only used as *part* of another schema.
4152///
4153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4154#[serde_with::serde_as]
4155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4156pub struct ProtectedRange {
4157    /// The description of this protected range.
4158    pub description: Option<String>,
4159    /// The users and groups with edit access to the protected range. This field is only visible to users with edit access to the protected range and the document. Editors are not supported with warning_only protection.
4160    pub editors: Option<Editors>,
4161    /// The named range this protected range is backed by, if any. When writing, only one of range or named_range_id or table_id may be set.
4162    #[serde(rename = "namedRangeId")]
4163    pub named_range_id: Option<String>,
4164    /// The ID of the protected range. This field is read-only.
4165    #[serde(rename = "protectedRangeId")]
4166    pub protected_range_id: Option<i32>,
4167    /// The range that is being protected. The range may be fully unbounded, in which case this is considered a protected sheet. When writing, only one of range or named_range_id or table_id may be set.
4168    pub range: Option<GridRange>,
4169    /// True if the user who requested this protected range can edit the protected area. This field is read-only.
4170    #[serde(rename = "requestingUserCanEdit")]
4171    pub requesting_user_can_edit: Option<bool>,
4172    /// The table this protected range is backed by, if any. When writing, only one of range or named_range_id or table_id may be set.
4173    #[serde(rename = "tableId")]
4174    pub table_id: Option<String>,
4175    /// The list of unprotected ranges within a protected sheet. Unprotected ranges are only supported on protected sheets.
4176    #[serde(rename = "unprotectedRanges")]
4177    pub unprotected_ranges: Option<Vec<GridRange>>,
4178    /// True if this protected range will show a warning when editing. Warning-based protection means that every user can edit data in the protected range, except editing will prompt a warning asking the user to confirm the edit. When writing: if this field is true, then editors are ignored. Additionally, if this field is changed from true to false and the `editors` field is not set (nor included in the field mask), then the editors will be set to all the editors in the document.
4179    #[serde(rename = "warningOnly")]
4180    pub warning_only: Option<bool>,
4181}
4182
4183impl common::Part for ProtectedRange {}
4184
4185/// Randomizes the order of the rows in a range.
4186///
4187/// This type is not used in any activity, and only used as *part* of another schema.
4188///
4189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4190#[serde_with::serde_as]
4191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4192pub struct RandomizeRangeRequest {
4193    /// The range to randomize.
4194    pub range: Option<GridRange>,
4195}
4196
4197impl common::Part for RandomizeRangeRequest {}
4198
4199/// The status of a refresh cancellation. You can send a cancel request to explicitly cancel one or multiple data source object refreshes.
4200///
4201/// This type is not used in any activity, and only used as *part* of another schema.
4202///
4203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4204#[serde_with::serde_as]
4205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4206pub struct RefreshCancellationStatus {
4207    /// The error code.
4208    #[serde(rename = "errorCode")]
4209    pub error_code: Option<String>,
4210    /// The state of a call to cancel a refresh in Sheets.
4211    pub state: Option<String>,
4212}
4213
4214impl common::Part for RefreshCancellationStatus {}
4215
4216/// The execution status of refreshing one data source object.
4217///
4218/// This type is not used in any activity, and only used as *part* of another schema.
4219///
4220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4221#[serde_with::serde_as]
4222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4223pub struct RefreshDataSourceObjectExecutionStatus {
4224    /// The data execution status.
4225    #[serde(rename = "dataExecutionStatus")]
4226    pub data_execution_status: Option<DataExecutionStatus>,
4227    /// Reference to a data source object being refreshed.
4228    pub reference: Option<DataSourceObjectReference>,
4229}
4230
4231impl common::Part for RefreshDataSourceObjectExecutionStatus {}
4232
4233/// Refreshes one or multiple data source objects in the spreadsheet by the specified references. The request requires an additional `bigquery.readonly` OAuth scope if you are refreshing a BigQuery data source. If there are multiple refresh requests referencing the same data source objects in one batch, only the last refresh request is processed, and all those requests will have the same response accordingly.
4234///
4235/// This type is not used in any activity, and only used as *part* of another schema.
4236///
4237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4238#[serde_with::serde_as]
4239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4240pub struct RefreshDataSourceRequest {
4241    /// Reference to a DataSource. If specified, refreshes all associated data source objects for the data source.
4242    #[serde(rename = "dataSourceId")]
4243    pub data_source_id: Option<String>,
4244    /// Refreshes the data source objects regardless of the current state. If not set and a referenced data source object was in error state, the refresh will fail immediately.
4245    pub force: Option<bool>,
4246    /// Refreshes all existing data source objects in the spreadsheet.
4247    #[serde(rename = "isAll")]
4248    pub is_all: Option<bool>,
4249    /// References to data source objects to refresh.
4250    pub references: Option<DataSourceObjectReferences>,
4251}
4252
4253impl common::Part for RefreshDataSourceRequest {}
4254
4255/// The response from refreshing one or multiple data source objects.
4256///
4257/// This type is not used in any activity, and only used as *part* of another schema.
4258///
4259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4260#[serde_with::serde_as]
4261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4262pub struct RefreshDataSourceResponse {
4263    /// All the refresh status for the data source object references specified in the request. If is_all is specified, the field contains only those in failure status.
4264    pub statuses: Option<Vec<RefreshDataSourceObjectExecutionStatus>>,
4265}
4266
4267impl common::Part for RefreshDataSourceResponse {}
4268
4269/// Updates all cells in the range to the values in the given Cell object. Only the fields listed in the fields field are updated; others are unchanged. If writing a cell with a formula, the formula's ranges will automatically increment for each field in the range. For example, if writing a cell with formula `=A1` into range B2:C4, B2 would be `=A1`, B3 would be `=A2`, B4 would be `=A3`, C2 would be `=B1`, C3 would be `=B2`, C4 would be `=B3`. To keep the formula's ranges static, use the `$` indicator. For example, use the formula `=$A$1` to prevent both the row and the column from incrementing.
4270///
4271/// This type is not used in any activity, and only used as *part* of another schema.
4272///
4273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4274#[serde_with::serde_as]
4275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4276pub struct RepeatCellRequest {
4277    /// The data to write.
4278    pub cell: Option<CellData>,
4279    /// The fields that should be updated. At least one field must be specified. The root `cell` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
4280    pub fields: Option<common::FieldMask>,
4281    /// The range to repeat the cell in.
4282    pub range: Option<GridRange>,
4283}
4284
4285impl common::Part for RepeatCellRequest {}
4286
4287/// A single kind of update to apply to a spreadsheet.
4288///
4289/// This type is not used in any activity, and only used as *part* of another schema.
4290///
4291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4292#[serde_with::serde_as]
4293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4294pub struct Request {
4295    /// Adds a new banded range
4296    #[serde(rename = "addBanding")]
4297    pub add_banding: Option<AddBandingRequest>,
4298    /// Adds a chart.
4299    #[serde(rename = "addChart")]
4300    pub add_chart: Option<AddChartRequest>,
4301    /// Adds a new conditional format rule.
4302    #[serde(rename = "addConditionalFormatRule")]
4303    pub add_conditional_format_rule: Option<AddConditionalFormatRuleRequest>,
4304    /// Adds a data source.
4305    #[serde(rename = "addDataSource")]
4306    pub add_data_source: Option<AddDataSourceRequest>,
4307    /// Creates a group over the specified range.
4308    #[serde(rename = "addDimensionGroup")]
4309    pub add_dimension_group: Option<AddDimensionGroupRequest>,
4310    /// Adds a filter view.
4311    #[serde(rename = "addFilterView")]
4312    pub add_filter_view: Option<AddFilterViewRequest>,
4313    /// Adds a named range.
4314    #[serde(rename = "addNamedRange")]
4315    pub add_named_range: Option<AddNamedRangeRequest>,
4316    /// Adds a protected range.
4317    #[serde(rename = "addProtectedRange")]
4318    pub add_protected_range: Option<AddProtectedRangeRequest>,
4319    /// Adds a sheet.
4320    #[serde(rename = "addSheet")]
4321    pub add_sheet: Option<AddSheetRequest>,
4322    /// Adds a slicer.
4323    #[serde(rename = "addSlicer")]
4324    pub add_slicer: Option<AddSlicerRequest>,
4325    /// Adds a table.
4326    #[serde(rename = "addTable")]
4327    pub add_table: Option<AddTableRequest>,
4328    /// Appends cells after the last row with data in a sheet.
4329    #[serde(rename = "appendCells")]
4330    pub append_cells: Option<AppendCellsRequest>,
4331    /// Appends dimensions to the end of a sheet.
4332    #[serde(rename = "appendDimension")]
4333    pub append_dimension: Option<AppendDimensionRequest>,
4334    /// Automatically fills in more data based on existing data.
4335    #[serde(rename = "autoFill")]
4336    pub auto_fill: Option<AutoFillRequest>,
4337    /// Automatically resizes one or more dimensions based on the contents of the cells in that dimension.
4338    #[serde(rename = "autoResizeDimensions")]
4339    pub auto_resize_dimensions: Option<AutoResizeDimensionsRequest>,
4340    /// Cancels refreshes of one or multiple data sources and associated dbobjects.
4341    #[serde(rename = "cancelDataSourceRefresh")]
4342    pub cancel_data_source_refresh: Option<CancelDataSourceRefreshRequest>,
4343    /// Clears the basic filter on a sheet.
4344    #[serde(rename = "clearBasicFilter")]
4345    pub clear_basic_filter: Option<ClearBasicFilterRequest>,
4346    /// Copies data from one area and pastes it to another.
4347    #[serde(rename = "copyPaste")]
4348    pub copy_paste: Option<CopyPasteRequest>,
4349    /// Creates new developer metadata
4350    #[serde(rename = "createDeveloperMetadata")]
4351    pub create_developer_metadata: Option<CreateDeveloperMetadataRequest>,
4352    /// Cuts data from one area and pastes it to another.
4353    #[serde(rename = "cutPaste")]
4354    pub cut_paste: Option<CutPasteRequest>,
4355    /// Removes a banded range
4356    #[serde(rename = "deleteBanding")]
4357    pub delete_banding: Option<DeleteBandingRequest>,
4358    /// Deletes an existing conditional format rule.
4359    #[serde(rename = "deleteConditionalFormatRule")]
4360    pub delete_conditional_format_rule: Option<DeleteConditionalFormatRuleRequest>,
4361    /// Deletes a data source.
4362    #[serde(rename = "deleteDataSource")]
4363    pub delete_data_source: Option<DeleteDataSourceRequest>,
4364    /// Deletes developer metadata
4365    #[serde(rename = "deleteDeveloperMetadata")]
4366    pub delete_developer_metadata: Option<DeleteDeveloperMetadataRequest>,
4367    /// Deletes rows or columns in a sheet.
4368    #[serde(rename = "deleteDimension")]
4369    pub delete_dimension: Option<DeleteDimensionRequest>,
4370    /// Deletes a group over the specified range.
4371    #[serde(rename = "deleteDimensionGroup")]
4372    pub delete_dimension_group: Option<DeleteDimensionGroupRequest>,
4373    /// Removes rows containing duplicate values in specified columns of a cell range.
4374    #[serde(rename = "deleteDuplicates")]
4375    pub delete_duplicates: Option<DeleteDuplicatesRequest>,
4376    /// Deletes an embedded object (e.g, chart, image) in a sheet.
4377    #[serde(rename = "deleteEmbeddedObject")]
4378    pub delete_embedded_object: Option<DeleteEmbeddedObjectRequest>,
4379    /// Deletes a filter view from a sheet.
4380    #[serde(rename = "deleteFilterView")]
4381    pub delete_filter_view: Option<DeleteFilterViewRequest>,
4382    /// Deletes a named range.
4383    #[serde(rename = "deleteNamedRange")]
4384    pub delete_named_range: Option<DeleteNamedRangeRequest>,
4385    /// Deletes a protected range.
4386    #[serde(rename = "deleteProtectedRange")]
4387    pub delete_protected_range: Option<DeleteProtectedRangeRequest>,
4388    /// Deletes a range of cells from a sheet, shifting the remaining cells.
4389    #[serde(rename = "deleteRange")]
4390    pub delete_range: Option<DeleteRangeRequest>,
4391    /// Deletes a sheet.
4392    #[serde(rename = "deleteSheet")]
4393    pub delete_sheet: Option<DeleteSheetRequest>,
4394    /// A request for deleting a table.
4395    #[serde(rename = "deleteTable")]
4396    pub delete_table: Option<DeleteTableRequest>,
4397    /// Duplicates a filter view.
4398    #[serde(rename = "duplicateFilterView")]
4399    pub duplicate_filter_view: Option<DuplicateFilterViewRequest>,
4400    /// Duplicates a sheet.
4401    #[serde(rename = "duplicateSheet")]
4402    pub duplicate_sheet: Option<DuplicateSheetRequest>,
4403    /// Finds and replaces occurrences of some text with other text.
4404    #[serde(rename = "findReplace")]
4405    pub find_replace: Option<FindReplaceRequest>,
4406    /// Inserts new rows or columns in a sheet.
4407    #[serde(rename = "insertDimension")]
4408    pub insert_dimension: Option<InsertDimensionRequest>,
4409    /// Inserts new cells in a sheet, shifting the existing cells.
4410    #[serde(rename = "insertRange")]
4411    pub insert_range: Option<InsertRangeRequest>,
4412    /// Merges cells together.
4413    #[serde(rename = "mergeCells")]
4414    pub merge_cells: Option<MergeCellsRequest>,
4415    /// Moves rows or columns to another location in a sheet.
4416    #[serde(rename = "moveDimension")]
4417    pub move_dimension: Option<MoveDimensionRequest>,
4418    /// Pastes data (HTML or delimited) into a sheet.
4419    #[serde(rename = "pasteData")]
4420    pub paste_data: Option<PasteDataRequest>,
4421    /// Randomizes the order of the rows in a range.
4422    #[serde(rename = "randomizeRange")]
4423    pub randomize_range: Option<RandomizeRangeRequest>,
4424    /// Refreshes one or multiple data sources and associated dbobjects.
4425    #[serde(rename = "refreshDataSource")]
4426    pub refresh_data_source: Option<RefreshDataSourceRequest>,
4427    /// Repeats a single cell across a range.
4428    #[serde(rename = "repeatCell")]
4429    pub repeat_cell: Option<RepeatCellRequest>,
4430    /// Sets the basic filter on a sheet.
4431    #[serde(rename = "setBasicFilter")]
4432    pub set_basic_filter: Option<SetBasicFilterRequest>,
4433    /// Sets data validation for one or more cells.
4434    #[serde(rename = "setDataValidation")]
4435    pub set_data_validation: Option<SetDataValidationRequest>,
4436    /// Sorts data in a range.
4437    #[serde(rename = "sortRange")]
4438    pub sort_range: Option<SortRangeRequest>,
4439    /// Converts a column of text into many columns of text.
4440    #[serde(rename = "textToColumns")]
4441    pub text_to_columns: Option<TextToColumnsRequest>,
4442    /// Trims cells of whitespace (such as spaces, tabs, or new lines).
4443    #[serde(rename = "trimWhitespace")]
4444    pub trim_whitespace: Option<TrimWhitespaceRequest>,
4445    /// Unmerges merged cells.
4446    #[serde(rename = "unmergeCells")]
4447    pub unmerge_cells: Option<UnmergeCellsRequest>,
4448    /// Updates a banded range
4449    #[serde(rename = "updateBanding")]
4450    pub update_banding: Option<UpdateBandingRequest>,
4451    /// Updates the borders in a range of cells.
4452    #[serde(rename = "updateBorders")]
4453    pub update_borders: Option<UpdateBordersRequest>,
4454    /// Updates many cells at once.
4455    #[serde(rename = "updateCells")]
4456    pub update_cells: Option<UpdateCellsRequest>,
4457    /// Updates a chart's specifications.
4458    #[serde(rename = "updateChartSpec")]
4459    pub update_chart_spec: Option<UpdateChartSpecRequest>,
4460    /// Updates an existing conditional format rule.
4461    #[serde(rename = "updateConditionalFormatRule")]
4462    pub update_conditional_format_rule: Option<UpdateConditionalFormatRuleRequest>,
4463    /// Updates a data source.
4464    #[serde(rename = "updateDataSource")]
4465    pub update_data_source: Option<UpdateDataSourceRequest>,
4466    /// Updates an existing developer metadata entry
4467    #[serde(rename = "updateDeveloperMetadata")]
4468    pub update_developer_metadata: Option<UpdateDeveloperMetadataRequest>,
4469    /// Updates the state of the specified group.
4470    #[serde(rename = "updateDimensionGroup")]
4471    pub update_dimension_group: Option<UpdateDimensionGroupRequest>,
4472    /// Updates dimensions' properties.
4473    #[serde(rename = "updateDimensionProperties")]
4474    pub update_dimension_properties: Option<UpdateDimensionPropertiesRequest>,
4475    /// Updates an embedded object's border.
4476    #[serde(rename = "updateEmbeddedObjectBorder")]
4477    pub update_embedded_object_border: Option<UpdateEmbeddedObjectBorderRequest>,
4478    /// Updates an embedded object's (e.g. chart, image) position.
4479    #[serde(rename = "updateEmbeddedObjectPosition")]
4480    pub update_embedded_object_position: Option<UpdateEmbeddedObjectPositionRequest>,
4481    /// Updates the properties of a filter view.
4482    #[serde(rename = "updateFilterView")]
4483    pub update_filter_view: Option<UpdateFilterViewRequest>,
4484    /// Updates a named range.
4485    #[serde(rename = "updateNamedRange")]
4486    pub update_named_range: Option<UpdateNamedRangeRequest>,
4487    /// Updates a protected range.
4488    #[serde(rename = "updateProtectedRange")]
4489    pub update_protected_range: Option<UpdateProtectedRangeRequest>,
4490    /// Updates a sheet's properties.
4491    #[serde(rename = "updateSheetProperties")]
4492    pub update_sheet_properties: Option<UpdateSheetPropertiesRequest>,
4493    /// Updates a slicer's specifications.
4494    #[serde(rename = "updateSlicerSpec")]
4495    pub update_slicer_spec: Option<UpdateSlicerSpecRequest>,
4496    /// Updates the spreadsheet's properties.
4497    #[serde(rename = "updateSpreadsheetProperties")]
4498    pub update_spreadsheet_properties: Option<UpdateSpreadsheetPropertiesRequest>,
4499    /// Updates a table.
4500    #[serde(rename = "updateTable")]
4501    pub update_table: Option<UpdateTableRequest>,
4502}
4503
4504impl common::Part for Request {}
4505
4506/// A single response from an update.
4507///
4508/// This type is not used in any activity, and only used as *part* of another schema.
4509///
4510#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4511#[serde_with::serde_as]
4512#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4513pub struct Response {
4514    /// A reply from adding a banded range.
4515    #[serde(rename = "addBanding")]
4516    pub add_banding: Option<AddBandingResponse>,
4517    /// A reply from adding a chart.
4518    #[serde(rename = "addChart")]
4519    pub add_chart: Option<AddChartResponse>,
4520    /// A reply from adding a data source.
4521    #[serde(rename = "addDataSource")]
4522    pub add_data_source: Option<AddDataSourceResponse>,
4523    /// A reply from adding a dimension group.
4524    #[serde(rename = "addDimensionGroup")]
4525    pub add_dimension_group: Option<AddDimensionGroupResponse>,
4526    /// A reply from adding a filter view.
4527    #[serde(rename = "addFilterView")]
4528    pub add_filter_view: Option<AddFilterViewResponse>,
4529    /// A reply from adding a named range.
4530    #[serde(rename = "addNamedRange")]
4531    pub add_named_range: Option<AddNamedRangeResponse>,
4532    /// A reply from adding a protected range.
4533    #[serde(rename = "addProtectedRange")]
4534    pub add_protected_range: Option<AddProtectedRangeResponse>,
4535    /// A reply from adding a sheet.
4536    #[serde(rename = "addSheet")]
4537    pub add_sheet: Option<AddSheetResponse>,
4538    /// A reply from adding a slicer.
4539    #[serde(rename = "addSlicer")]
4540    pub add_slicer: Option<AddSlicerResponse>,
4541    /// A reply from adding a table.
4542    #[serde(rename = "addTable")]
4543    pub add_table: Option<AddTableResponse>,
4544    /// A reply from cancelling data source object refreshes.
4545    #[serde(rename = "cancelDataSourceRefresh")]
4546    pub cancel_data_source_refresh: Option<CancelDataSourceRefreshResponse>,
4547    /// A reply from creating a developer metadata entry.
4548    #[serde(rename = "createDeveloperMetadata")]
4549    pub create_developer_metadata: Option<CreateDeveloperMetadataResponse>,
4550    /// A reply from deleting a conditional format rule.
4551    #[serde(rename = "deleteConditionalFormatRule")]
4552    pub delete_conditional_format_rule: Option<DeleteConditionalFormatRuleResponse>,
4553    /// A reply from deleting a developer metadata entry.
4554    #[serde(rename = "deleteDeveloperMetadata")]
4555    pub delete_developer_metadata: Option<DeleteDeveloperMetadataResponse>,
4556    /// A reply from deleting a dimension group.
4557    #[serde(rename = "deleteDimensionGroup")]
4558    pub delete_dimension_group: Option<DeleteDimensionGroupResponse>,
4559    /// A reply from removing rows containing duplicate values.
4560    #[serde(rename = "deleteDuplicates")]
4561    pub delete_duplicates: Option<DeleteDuplicatesResponse>,
4562    /// A reply from duplicating a filter view.
4563    #[serde(rename = "duplicateFilterView")]
4564    pub duplicate_filter_view: Option<DuplicateFilterViewResponse>,
4565    /// A reply from duplicating a sheet.
4566    #[serde(rename = "duplicateSheet")]
4567    pub duplicate_sheet: Option<DuplicateSheetResponse>,
4568    /// A reply from doing a find/replace.
4569    #[serde(rename = "findReplace")]
4570    pub find_replace: Option<FindReplaceResponse>,
4571    /// A reply from refreshing data source objects.
4572    #[serde(rename = "refreshDataSource")]
4573    pub refresh_data_source: Option<RefreshDataSourceResponse>,
4574    /// A reply from trimming whitespace.
4575    #[serde(rename = "trimWhitespace")]
4576    pub trim_whitespace: Option<TrimWhitespaceResponse>,
4577    /// A reply from updating a conditional format rule.
4578    #[serde(rename = "updateConditionalFormatRule")]
4579    pub update_conditional_format_rule: Option<UpdateConditionalFormatRuleResponse>,
4580    /// A reply from updating a data source.
4581    #[serde(rename = "updateDataSource")]
4582    pub update_data_source: Option<UpdateDataSourceResponse>,
4583    /// A reply from updating a developer metadata entry.
4584    #[serde(rename = "updateDeveloperMetadata")]
4585    pub update_developer_metadata: Option<UpdateDeveloperMetadataResponse>,
4586    /// A reply from updating an embedded object's position.
4587    #[serde(rename = "updateEmbeddedObjectPosition")]
4588    pub update_embedded_object_position: Option<UpdateEmbeddedObjectPositionResponse>,
4589}
4590
4591impl common::Part for Response {}
4592
4593/// Properties of a link to a Google resource (such as a file in Drive, a YouTube video, a Maps address, or a Calendar event). Only Drive files can be written as chips. All other rich link types are read only. URIs cannot exceed 2000 bytes when writing. NOTE: Writing Drive file chips requires at least one of the `drive.file`, `drive.readonly`, or `drive` OAuth scopes.
4594///
4595/// This type is not used in any activity, and only used as *part* of another schema.
4596///
4597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4598#[serde_with::serde_as]
4599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4600pub struct RichLinkProperties {
4601    /// Output only. The [MIME type](https://developers.google.com/drive/api/v3/mime-types) of the link, if there's one (for example, when it's a file in Drive).
4602    #[serde(rename = "mimeType")]
4603    pub mime_type: Option<String>,
4604    /// Required. The URI to the link. This is always present.
4605    pub uri: Option<String>,
4606}
4607
4608impl common::Part for RichLinkProperties {}
4609
4610/// Data about each cell in a row.
4611///
4612/// This type is not used in any activity, and only used as *part* of another schema.
4613///
4614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4615#[serde_with::serde_as]
4616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4617pub struct RowData {
4618    /// The values in the row, one per column.
4619    pub values: Option<Vec<CellData>>,
4620}
4621
4622impl common::Part for RowData {}
4623
4624/// A scorecard chart. Scorecard charts are used to highlight key performance indicators, known as KPIs, on the spreadsheet. A scorecard chart can represent things like total sales, average cost, or a top selling item. You can specify a single data value, or aggregate over a range of data. Percentage or absolute difference from a baseline value can be highlighted, like changes over time.
4625///
4626/// This type is not used in any activity, and only used as *part* of another schema.
4627///
4628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4629#[serde_with::serde_as]
4630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4631pub struct ScorecardChartSpec {
4632    /// The aggregation type for key and baseline chart data in scorecard chart. This field is not supported for data source charts. Use the ChartData.aggregateType field of the key_value_data or baseline_value_data instead for data source charts. This field is optional.
4633    #[serde(rename = "aggregateType")]
4634    pub aggregate_type: Option<String>,
4635    /// The data for scorecard baseline value. This field is optional.
4636    #[serde(rename = "baselineValueData")]
4637    pub baseline_value_data: Option<ChartData>,
4638    /// Formatting options for baseline value. This field is needed only if baseline_value_data is specified.
4639    #[serde(rename = "baselineValueFormat")]
4640    pub baseline_value_format: Option<BaselineValueFormat>,
4641    /// Custom formatting options for numeric key/baseline values in scorecard chart. This field is used only when number_format_source is set to CUSTOM. This field is optional.
4642    #[serde(rename = "customFormatOptions")]
4643    pub custom_format_options: Option<ChartCustomNumberFormatOptions>,
4644    /// The data for scorecard key value.
4645    #[serde(rename = "keyValueData")]
4646    pub key_value_data: Option<ChartData>,
4647    /// Formatting options for key value.
4648    #[serde(rename = "keyValueFormat")]
4649    pub key_value_format: Option<KeyValueFormat>,
4650    /// The number format source used in the scorecard chart. This field is optional.
4651    #[serde(rename = "numberFormatSource")]
4652    pub number_format_source: Option<String>,
4653    /// Value to scale scorecard key and baseline value. For example, a factor of 10 can be used to divide all values in the chart by 10. This field is optional.
4654    #[serde(rename = "scaleFactor")]
4655    pub scale_factor: Option<f64>,
4656}
4657
4658impl common::Part for ScorecardChartSpec {}
4659
4660/// A request to retrieve all developer metadata matching the set of specified criteria.
4661///
4662/// # Activities
4663///
4664/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4665/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4666///
4667/// * [developer metadata search spreadsheets](SpreadsheetDeveloperMetadataSearchCall) (request)
4668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4669#[serde_with::serde_as]
4670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4671pub struct SearchDeveloperMetadataRequest {
4672    /// The data filters describing the criteria used to determine which DeveloperMetadata entries to return. DeveloperMetadata matching any of the specified filters are included in the response.
4673    #[serde(rename = "dataFilters")]
4674    pub data_filters: Option<Vec<DataFilter>>,
4675}
4676
4677impl common::RequestValue for SearchDeveloperMetadataRequest {}
4678
4679/// A reply to a developer metadata search request.
4680///
4681/// # Activities
4682///
4683/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4684/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4685///
4686/// * [developer metadata search spreadsheets](SpreadsheetDeveloperMetadataSearchCall) (response)
4687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4688#[serde_with::serde_as]
4689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4690pub struct SearchDeveloperMetadataResponse {
4691    /// The metadata matching the criteria of the search request.
4692    #[serde(rename = "matchedDeveloperMetadata")]
4693    pub matched_developer_metadata: Option<Vec<MatchedDeveloperMetadata>>,
4694}
4695
4696impl common::ResponseResult for SearchDeveloperMetadataResponse {}
4697
4698/// Sets the basic filter associated with a sheet.
4699///
4700/// This type is not used in any activity, and only used as *part* of another schema.
4701///
4702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4703#[serde_with::serde_as]
4704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4705pub struct SetBasicFilterRequest {
4706    /// The filter to set.
4707    pub filter: Option<BasicFilter>,
4708}
4709
4710impl common::Part for SetBasicFilterRequest {}
4711
4712/// Sets a data validation rule to every cell in the range. To clear validation in a range, call this with no rule specified.
4713///
4714/// This type is not used in any activity, and only used as *part* of another schema.
4715///
4716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4717#[serde_with::serde_as]
4718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4719pub struct SetDataValidationRequest {
4720    /// Optional. If true, the data validation rule will be applied to the filtered rows as well.
4721    #[serde(rename = "filteredRowsIncluded")]
4722    pub filtered_rows_included: Option<bool>,
4723    /// The range the data validation rule should apply to.
4724    pub range: Option<GridRange>,
4725    /// The data validation rule to set on each cell in the range, or empty to clear the data validation in the range.
4726    pub rule: Option<DataValidationRule>,
4727}
4728
4729impl common::Part for SetDataValidationRequest {}
4730
4731/// A sheet in a spreadsheet.
4732///
4733/// This type is not used in any activity, and only used as *part* of another schema.
4734///
4735#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4736#[serde_with::serde_as]
4737#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4738pub struct Sheet {
4739    /// The banded (alternating colors) ranges on this sheet.
4740    #[serde(rename = "bandedRanges")]
4741    pub banded_ranges: Option<Vec<BandedRange>>,
4742    /// The filter on this sheet, if any.
4743    #[serde(rename = "basicFilter")]
4744    pub basic_filter: Option<BasicFilter>,
4745    /// The specifications of every chart on this sheet.
4746    pub charts: Option<Vec<EmbeddedChart>>,
4747    /// All column groups on this sheet, ordered by increasing range start index, then by group depth.
4748    #[serde(rename = "columnGroups")]
4749    pub column_groups: Option<Vec<DimensionGroup>>,
4750    /// The conditional format rules in this sheet.
4751    #[serde(rename = "conditionalFormats")]
4752    pub conditional_formats: Option<Vec<ConditionalFormatRule>>,
4753    /// Data in the grid, if this is a grid sheet. The number of GridData objects returned is dependent on the number of ranges requested on this sheet. For example, if this is representing `Sheet1`, and the spreadsheet was requested with ranges `Sheet1!A1:C10` and `Sheet1!D15:E20`, then the first GridData will have a startRow/startColumn of `0`, while the second one will have `startRow 14` (zero-based row 15), and `startColumn 3` (zero-based column D). For a DATA_SOURCE sheet, you can not request a specific range, the GridData contains all the values.
4754    pub data: Option<Vec<GridData>>,
4755    /// The developer metadata associated with a sheet.
4756    #[serde(rename = "developerMetadata")]
4757    pub developer_metadata: Option<Vec<DeveloperMetadata>>,
4758    /// The filter views in this sheet.
4759    #[serde(rename = "filterViews")]
4760    pub filter_views: Option<Vec<FilterView>>,
4761    /// The ranges that are merged together.
4762    pub merges: Option<Vec<GridRange>>,
4763    /// The properties of the sheet.
4764    pub properties: Option<SheetProperties>,
4765    /// The protected ranges in this sheet.
4766    #[serde(rename = "protectedRanges")]
4767    pub protected_ranges: Option<Vec<ProtectedRange>>,
4768    /// All row groups on this sheet, ordered by increasing range start index, then by group depth.
4769    #[serde(rename = "rowGroups")]
4770    pub row_groups: Option<Vec<DimensionGroup>>,
4771    /// The slicers on this sheet.
4772    pub slicers: Option<Vec<Slicer>>,
4773    /// The tables on this sheet.
4774    pub tables: Option<Vec<Table>>,
4775}
4776
4777impl common::Part for Sheet {}
4778
4779/// Properties of a sheet.
4780///
4781/// # Activities
4782///
4783/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4784/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4785///
4786/// * [sheets copy to spreadsheets](SpreadsheetSheetCopyToCall) (response)
4787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4788#[serde_with::serde_as]
4789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4790pub struct SheetProperties {
4791    /// Output only. If present, the field contains DATA_SOURCE sheet specific properties.
4792    #[serde(rename = "dataSourceSheetProperties")]
4793    pub data_source_sheet_properties: Option<DataSourceSheetProperties>,
4794    /// Additional properties of the sheet if this sheet is a grid. (If the sheet is an object sheet, containing a chart or image, then this field will be absent.) When writing it is an error to set any grid properties on non-grid sheets. If this sheet is a DATA_SOURCE sheet, this field is output only but contains the properties that reflect how a data source sheet is rendered in the UI, e.g. row_count.
4795    #[serde(rename = "gridProperties")]
4796    pub grid_properties: Option<GridProperties>,
4797    /// True if the sheet is hidden in the UI, false if it's visible.
4798    pub hidden: Option<bool>,
4799    /// The index of the sheet within the spreadsheet. When adding or updating sheet properties, if this field is excluded then the sheet is added or moved to the end of the sheet list. When updating sheet indices or inserting sheets, movement is considered in "before the move" indexes. For example, if there were three sheets (S1, S2, S3) in order to move S1 ahead of S2 the index would have to be set to 2. A sheet index update request is ignored if the requested index is identical to the sheets current index or if the requested new index is equal to the current sheet index + 1.
4800    pub index: Option<i32>,
4801    /// True if the sheet is an RTL sheet instead of an LTR sheet.
4802    #[serde(rename = "rightToLeft")]
4803    pub right_to_left: Option<bool>,
4804    /// The ID of the sheet. Must be non-negative. This field cannot be changed once set.
4805    #[serde(rename = "sheetId")]
4806    pub sheet_id: Option<i32>,
4807    /// The type of sheet. Defaults to GRID. This field cannot be changed once set.
4808    #[serde(rename = "sheetType")]
4809    pub sheet_type: Option<String>,
4810    /// The color of the tab in the UI. Deprecated: Use tab_color_style.
4811    #[serde(rename = "tabColor")]
4812    pub tab_color: Option<Color>,
4813    /// The color of the tab in the UI. If tab_color is also set, this field takes precedence.
4814    #[serde(rename = "tabColorStyle")]
4815    pub tab_color_style: Option<ColorStyle>,
4816    /// The name of the sheet.
4817    pub title: Option<String>,
4818}
4819
4820impl common::ResponseResult for SheetProperties {}
4821
4822/// A slicer in a sheet.
4823///
4824/// This type is not used in any activity, and only used as *part* of another schema.
4825///
4826#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4827#[serde_with::serde_as]
4828#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4829pub struct Slicer {
4830    /// The position of the slicer. Note that slicer can be positioned only on existing sheet. Also, width and height of slicer can be automatically adjusted to keep it within permitted limits.
4831    pub position: Option<EmbeddedObjectPosition>,
4832    /// The ID of the slicer.
4833    #[serde(rename = "slicerId")]
4834    pub slicer_id: Option<i32>,
4835    /// The specification of the slicer.
4836    pub spec: Option<SlicerSpec>,
4837}
4838
4839impl common::Part for Slicer {}
4840
4841/// The specifications of a slicer.
4842///
4843/// This type is not used in any activity, and only used as *part* of another schema.
4844///
4845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4846#[serde_with::serde_as]
4847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4848pub struct SlicerSpec {
4849    /// True if the filter should apply to pivot tables. If not set, default to `True`.
4850    #[serde(rename = "applyToPivotTables")]
4851    pub apply_to_pivot_tables: Option<bool>,
4852    /// The background color of the slicer. Deprecated: Use background_color_style.
4853    #[serde(rename = "backgroundColor")]
4854    pub background_color: Option<Color>,
4855    /// The background color of the slicer. If background_color is also set, this field takes precedence.
4856    #[serde(rename = "backgroundColorStyle")]
4857    pub background_color_style: Option<ColorStyle>,
4858    /// The zero-based column index in the data table on which the filter is applied to.
4859    #[serde(rename = "columnIndex")]
4860    pub column_index: Option<i32>,
4861    /// The data range of the slicer.
4862    #[serde(rename = "dataRange")]
4863    pub data_range: Option<GridRange>,
4864    /// The filtering criteria of the slicer.
4865    #[serde(rename = "filterCriteria")]
4866    pub filter_criteria: Option<FilterCriteria>,
4867    /// The horizontal alignment of title in the slicer. If unspecified, defaults to `LEFT`
4868    #[serde(rename = "horizontalAlignment")]
4869    pub horizontal_alignment: Option<String>,
4870    /// The text format of title in the slicer. The link field is not supported.
4871    #[serde(rename = "textFormat")]
4872    pub text_format: Option<TextFormat>,
4873    /// The title of the slicer.
4874    pub title: Option<String>,
4875}
4876
4877impl common::Part for SlicerSpec {}
4878
4879/// Sorts data in rows based on a sort order per column.
4880///
4881/// This type is not used in any activity, and only used as *part* of another schema.
4882///
4883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4884#[serde_with::serde_as]
4885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4886pub struct SortRangeRequest {
4887    /// The range to sort.
4888    pub range: Option<GridRange>,
4889    /// The sort order per column. Later specifications are used when values are equal in the earlier specifications.
4890    #[serde(rename = "sortSpecs")]
4891    pub sort_specs: Option<Vec<SortSpec>>,
4892}
4893
4894impl common::Part for SortRangeRequest {}
4895
4896/// A sort order associated with a specific column or row.
4897///
4898/// This type is not used in any activity, and only used as *part* of another schema.
4899///
4900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4901#[serde_with::serde_as]
4902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4903pub struct SortSpec {
4904    /// The background fill color to sort by; cells with this fill color are sorted to the top. Mutually exclusive with foreground_color. Deprecated: Use background_color_style.
4905    #[serde(rename = "backgroundColor")]
4906    pub background_color: Option<Color>,
4907    /// The background fill color to sort by; cells with this fill color are sorted to the top. Mutually exclusive with foreground_color, and must be an RGB-type color. If background_color is also set, this field takes precedence.
4908    #[serde(rename = "backgroundColorStyle")]
4909    pub background_color_style: Option<ColorStyle>,
4910    /// Reference to a data source column.
4911    #[serde(rename = "dataSourceColumnReference")]
4912    pub data_source_column_reference: Option<DataSourceColumnReference>,
4913    /// The dimension the sort should be applied to.
4914    #[serde(rename = "dimensionIndex")]
4915    pub dimension_index: Option<i32>,
4916    /// The foreground color to sort by; cells with this foreground color are sorted to the top. Mutually exclusive with background_color. Deprecated: Use foreground_color_style.
4917    #[serde(rename = "foregroundColor")]
4918    pub foreground_color: Option<Color>,
4919    /// The foreground color to sort by; cells with this foreground color are sorted to the top. Mutually exclusive with background_color, and must be an RGB-type color. If foreground_color is also set, this field takes precedence.
4920    #[serde(rename = "foregroundColorStyle")]
4921    pub foreground_color_style: Option<ColorStyle>,
4922    /// The order data should be sorted.
4923    #[serde(rename = "sortOrder")]
4924    pub sort_order: Option<String>,
4925}
4926
4927impl common::Part for SortSpec {}
4928
4929/// A combination of a source range and how to extend that source.
4930///
4931/// This type is not used in any activity, and only used as *part* of another schema.
4932///
4933#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4934#[serde_with::serde_as]
4935#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4936pub struct SourceAndDestination {
4937    /// The dimension that data should be filled into.
4938    pub dimension: Option<String>,
4939    /// The number of rows or columns that data should be filled into. Positive numbers expand beyond the last row or last column of the source. Negative numbers expand before the first row or first column of the source.
4940    #[serde(rename = "fillLength")]
4941    pub fill_length: Option<i32>,
4942    /// The location of the data to use as the source of the autofill.
4943    pub source: Option<GridRange>,
4944}
4945
4946impl common::Part for SourceAndDestination {}
4947
4948/// Resource that represents a spreadsheet.
4949///
4950/// # Activities
4951///
4952/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4953/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4954///
4955/// * [developer metadata get spreadsheets](SpreadsheetDeveloperMetadataGetCall) (none)
4956/// * [developer metadata search spreadsheets](SpreadsheetDeveloperMetadataSearchCall) (none)
4957/// * [sheets copy to spreadsheets](SpreadsheetSheetCopyToCall) (none)
4958/// * [values append spreadsheets](SpreadsheetValueAppendCall) (none)
4959/// * [values batch clear spreadsheets](SpreadsheetValueBatchClearCall) (none)
4960/// * [values batch clear by data filter spreadsheets](SpreadsheetValueBatchClearByDataFilterCall) (none)
4961/// * [values batch get spreadsheets](SpreadsheetValueBatchGetCall) (none)
4962/// * [values batch get by data filter spreadsheets](SpreadsheetValueBatchGetByDataFilterCall) (none)
4963/// * [values batch update spreadsheets](SpreadsheetValueBatchUpdateCall) (none)
4964/// * [values batch update by data filter spreadsheets](SpreadsheetValueBatchUpdateByDataFilterCall) (none)
4965/// * [values clear spreadsheets](SpreadsheetValueClearCall) (none)
4966/// * [values get spreadsheets](SpreadsheetValueGetCall) (none)
4967/// * [values update spreadsheets](SpreadsheetValueUpdateCall) (none)
4968/// * [batch update spreadsheets](SpreadsheetBatchUpdateCall) (none)
4969/// * [create spreadsheets](SpreadsheetCreateCall) (request|response)
4970/// * [get spreadsheets](SpreadsheetGetCall) (response)
4971/// * [get by data filter spreadsheets](SpreadsheetGetByDataFilterCall) (response)
4972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4973#[serde_with::serde_as]
4974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4975pub struct Spreadsheet {
4976    /// Output only. A list of data source refresh schedules.
4977    #[serde(rename = "dataSourceSchedules")]
4978    pub data_source_schedules: Option<Vec<DataSourceRefreshSchedule>>,
4979    /// A list of external data sources connected with the spreadsheet.
4980    #[serde(rename = "dataSources")]
4981    pub data_sources: Option<Vec<DataSource>>,
4982    /// The developer metadata associated with a spreadsheet.
4983    #[serde(rename = "developerMetadata")]
4984    pub developer_metadata: Option<Vec<DeveloperMetadata>>,
4985    /// The named ranges defined in a spreadsheet.
4986    #[serde(rename = "namedRanges")]
4987    pub named_ranges: Option<Vec<NamedRange>>,
4988    /// Overall properties of a spreadsheet.
4989    pub properties: Option<SpreadsheetProperties>,
4990    /// The sheets that are part of a spreadsheet.
4991    pub sheets: Option<Vec<Sheet>>,
4992    /// The ID of the spreadsheet. This field is read-only.
4993    #[serde(rename = "spreadsheetId")]
4994    pub spreadsheet_id: Option<String>,
4995    /// The url of the spreadsheet. This field is read-only.
4996    #[serde(rename = "spreadsheetUrl")]
4997    pub spreadsheet_url: Option<String>,
4998}
4999
5000impl common::RequestValue for Spreadsheet {}
5001impl common::Resource for Spreadsheet {}
5002impl common::ResponseResult for Spreadsheet {}
5003
5004/// Properties of a spreadsheet.
5005///
5006/// This type is not used in any activity, and only used as *part* of another schema.
5007///
5008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5009#[serde_with::serde_as]
5010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5011pub struct SpreadsheetProperties {
5012    /// The amount of time to wait before volatile functions are recalculated.
5013    #[serde(rename = "autoRecalc")]
5014    pub auto_recalc: Option<String>,
5015    /// The default format of all cells in the spreadsheet. CellData.effectiveFormat will not be set if the cell's format is equal to this default format. This field is read-only.
5016    #[serde(rename = "defaultFormat")]
5017    pub default_format: Option<CellFormat>,
5018    /// Whether to allow external URL access for image and import functions. Read only when true. When false, you can set to true. This value will be bypassed and always return true if the admin has enabled the [allowlisting feature](https://support.google.com/a?p=url_allowlist).
5019    #[serde(rename = "importFunctionsExternalUrlAccessAllowed")]
5020    pub import_functions_external_url_access_allowed: Option<bool>,
5021    /// Determines whether and how circular references are resolved with iterative calculation. Absence of this field means that circular references result in calculation errors.
5022    #[serde(rename = "iterativeCalculationSettings")]
5023    pub iterative_calculation_settings: Option<IterativeCalculationSettings>,
5024    /// The locale of the spreadsheet in one of the following formats: * an ISO 639-1 language code such as `en` * an ISO 639-2 language code such as `fil`, if no 639-1 code exists * a combination of the ISO language code and country code, such as `en_US` Note: when updating this field, not all locales/languages are supported.
5025    pub locale: Option<String>,
5026    /// Theme applied to the spreadsheet.
5027    #[serde(rename = "spreadsheetTheme")]
5028    pub spreadsheet_theme: Option<SpreadsheetTheme>,
5029    /// The time zone of the spreadsheet, in CLDR format such as `America/New_York`. If the time zone isn't recognized, this may be a custom time zone such as `GMT-07:00`.
5030    #[serde(rename = "timeZone")]
5031    pub time_zone: Option<String>,
5032    /// The title of the spreadsheet.
5033    pub title: Option<String>,
5034}
5035
5036impl common::Part for SpreadsheetProperties {}
5037
5038/// Represents spreadsheet theme
5039///
5040/// This type is not used in any activity, and only used as *part* of another schema.
5041///
5042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5043#[serde_with::serde_as]
5044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5045pub struct SpreadsheetTheme {
5046    /// Name of the primary font family.
5047    #[serde(rename = "primaryFontFamily")]
5048    pub primary_font_family: Option<String>,
5049    /// The spreadsheet theme color pairs. To update you must provide all theme color pairs.
5050    #[serde(rename = "themeColors")]
5051    pub theme_colors: Option<Vec<ThemeColorPair>>,
5052}
5053
5054impl common::Part for SpreadsheetTheme {}
5055
5056/// A table.
5057///
5058/// This type is not used in any activity, and only used as *part* of another schema.
5059///
5060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5061#[serde_with::serde_as]
5062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5063pub struct Table {
5064    /// The table column properties.
5065    #[serde(rename = "columnProperties")]
5066    pub column_properties: Option<Vec<TableColumnProperties>>,
5067    /// The table name. This is unique to all tables in the same spreadsheet.
5068    pub name: Option<String>,
5069    /// The table range.
5070    pub range: Option<GridRange>,
5071    /// The table rows properties.
5072    #[serde(rename = "rowsProperties")]
5073    pub rows_properties: Option<TableRowsProperties>,
5074    /// The id of the table.
5075    #[serde(rename = "tableId")]
5076    pub table_id: Option<String>,
5077}
5078
5079impl common::Part for Table {}
5080
5081/// A data validation rule for a column in a table.
5082///
5083/// This type is not used in any activity, and only used as *part* of another schema.
5084///
5085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5086#[serde_with::serde_as]
5087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5088pub struct TableColumnDataValidationRule {
5089    /// The condition that data in the cell must match. Valid only if the [BooleanCondition.type] is ONE_OF_LIST.
5090    pub condition: Option<BooleanCondition>,
5091}
5092
5093impl common::Part for TableColumnDataValidationRule {}
5094
5095/// The table column.
5096///
5097/// This type is not used in any activity, and only used as *part* of another schema.
5098///
5099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5100#[serde_with::serde_as]
5101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5102pub struct TableColumnProperties {
5103    /// The 0-based column index. This index is relative to its position in the table and is not necessarily the same as the column index in the sheet.
5104    #[serde(rename = "columnIndex")]
5105    pub column_index: Option<i32>,
5106    /// The column name.
5107    #[serde(rename = "columnName")]
5108    pub column_name: Option<String>,
5109    /// The column type.
5110    #[serde(rename = "columnType")]
5111    pub column_type: Option<String>,
5112    /// The column data validation rule. Only set for dropdown column type.
5113    #[serde(rename = "dataValidationRule")]
5114    pub data_validation_rule: Option<TableColumnDataValidationRule>,
5115}
5116
5117impl common::Part for TableColumnProperties {}
5118
5119/// The table row properties.
5120///
5121/// This type is not used in any activity, and only used as *part* of another schema.
5122///
5123#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5124#[serde_with::serde_as]
5125#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5126pub struct TableRowsProperties {
5127    /// The first color that is alternating. If this field is set, the first banded row is filled with the specified color. Otherwise, the first banded row is filled with a default color.
5128    #[serde(rename = "firstBandColorStyle")]
5129    pub first_band_color_style: Option<ColorStyle>,
5130    /// The color of the last row. If this field is not set a footer is not added, the last row is filled with either first_band_color_style or second_band_color_style, depending on the color of the previous row. If updating an existing table without a footer to have a footer, the range will be expanded by 1 row. If updating an existing table with a footer and removing a footer, the range will be shrunk by 1 row.
5131    #[serde(rename = "footerColorStyle")]
5132    pub footer_color_style: Option<ColorStyle>,
5133    /// The color of the header row. If this field is set, the header row is filled with the specified color. Otherwise, the header row is filled with a default color.
5134    #[serde(rename = "headerColorStyle")]
5135    pub header_color_style: Option<ColorStyle>,
5136    /// The second color that is alternating. If this field is set, the second banded row is filled with the specified color. Otherwise, the second banded row is filled with a default color.
5137    #[serde(rename = "secondBandColorStyle")]
5138    pub second_band_color_style: Option<ColorStyle>,
5139}
5140
5141impl common::Part for TableRowsProperties {}
5142
5143/// The format of a run of text in a cell. Absent values indicate that the field isn't specified.
5144///
5145/// This type is not used in any activity, and only used as *part* of another schema.
5146///
5147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5148#[serde_with::serde_as]
5149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5150pub struct TextFormat {
5151    /// True if the text is bold.
5152    pub bold: Option<bool>,
5153    /// The font family.
5154    #[serde(rename = "fontFamily")]
5155    pub font_family: Option<String>,
5156    /// The size of the font.
5157    #[serde(rename = "fontSize")]
5158    pub font_size: Option<i32>,
5159    /// The foreground color of the text. Deprecated: Use foreground_color_style.
5160    #[serde(rename = "foregroundColor")]
5161    pub foreground_color: Option<Color>,
5162    /// The foreground color of the text. If foreground_color is also set, this field takes precedence.
5163    #[serde(rename = "foregroundColorStyle")]
5164    pub foreground_color_style: Option<ColorStyle>,
5165    /// True if the text is italicized.
5166    pub italic: Option<bool>,
5167    /// The link destination of the text, if any. Setting the link field in a TextFormatRun will clear the cell's existing links or a cell-level link set in the same request. When a link is set, the text foreground color will be set to the default link color and the text will be underlined. If these fields are modified in the same request, those values will be used instead of the link defaults.
5168    pub link: Option<Link>,
5169    /// True if the text has a strikethrough.
5170    pub strikethrough: Option<bool>,
5171    /// True if the text is underlined.
5172    pub underline: Option<bool>,
5173}
5174
5175impl common::Part for TextFormat {}
5176
5177/// A run of a text format. The format of this run continues until the start index of the next run. When updating, all fields must be set.
5178///
5179/// This type is not used in any activity, and only used as *part* of another schema.
5180///
5181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5182#[serde_with::serde_as]
5183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5184pub struct TextFormatRun {
5185    /// The format of this run. Absent values inherit the cell's format.
5186    pub format: Option<TextFormat>,
5187    /// The zero-based character index where this run starts, in UTF-16 code units.
5188    #[serde(rename = "startIndex")]
5189    pub start_index: Option<i32>,
5190}
5191
5192impl common::Part for TextFormatRun {}
5193
5194/// Position settings for text.
5195///
5196/// This type is not used in any activity, and only used as *part* of another schema.
5197///
5198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5199#[serde_with::serde_as]
5200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5201pub struct TextPosition {
5202    /// Horizontal alignment setting for the piece of text.
5203    #[serde(rename = "horizontalAlignment")]
5204    pub horizontal_alignment: Option<String>,
5205}
5206
5207impl common::Part for TextPosition {}
5208
5209/// The rotation applied to text in a cell.
5210///
5211/// This type is not used in any activity, and only used as *part* of another schema.
5212///
5213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5214#[serde_with::serde_as]
5215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5216pub struct TextRotation {
5217    /// The angle between the standard orientation and the desired orientation. Measured in degrees. Valid values are between -90 and 90. Positive angles are angled upwards, negative are angled downwards. Note: For LTR text direction positive angles are in the counterclockwise direction, whereas for RTL they are in the clockwise direction
5218    pub angle: Option<i32>,
5219    /// If true, text reads top to bottom, but the orientation of individual characters is unchanged. For example: | V | | e | | r | | t | | i | | c | | a | | l |
5220    pub vertical: Option<bool>,
5221}
5222
5223impl common::Part for TextRotation {}
5224
5225/// Splits a column of text into multiple columns, based on a delimiter in each cell.
5226///
5227/// This type is not used in any activity, and only used as *part* of another schema.
5228///
5229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5230#[serde_with::serde_as]
5231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5232pub struct TextToColumnsRequest {
5233    /// The delimiter to use. Used only if delimiterType is CUSTOM.
5234    pub delimiter: Option<String>,
5235    /// The delimiter type to use.
5236    #[serde(rename = "delimiterType")]
5237    pub delimiter_type: Option<String>,
5238    /// The source data range. This must span exactly one column.
5239    pub source: Option<GridRange>,
5240}
5241
5242impl common::Part for TextToColumnsRequest {}
5243
5244/// A pair mapping a spreadsheet theme color type to the concrete color it represents.
5245///
5246/// This type is not used in any activity, and only used as *part* of another schema.
5247///
5248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5249#[serde_with::serde_as]
5250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5251pub struct ThemeColorPair {
5252    /// The concrete color corresponding to the theme color type.
5253    pub color: Option<ColorStyle>,
5254    /// The type of the spreadsheet theme color.
5255    #[serde(rename = "colorType")]
5256    pub color_type: Option<String>,
5257}
5258
5259impl common::Part for ThemeColorPair {}
5260
5261/// Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
5262///
5263/// This type is not used in any activity, and only used as *part* of another schema.
5264///
5265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5266#[serde_with::serde_as]
5267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5268pub struct TimeOfDay {
5269    /// Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
5270    pub hours: Option<i32>,
5271    /// Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
5272    pub minutes: Option<i32>,
5273    /// Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
5274    pub nanos: Option<i32>,
5275    /// Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
5276    pub seconds: Option<i32>,
5277}
5278
5279impl common::Part for TimeOfDay {}
5280
5281/// A color scale for a treemap chart.
5282///
5283/// This type is not used in any activity, and only used as *part* of another schema.
5284///
5285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5286#[serde_with::serde_as]
5287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5288pub struct TreemapChartColorScale {
5289    /// The background color for cells with a color value greater than or equal to maxValue. Defaults to #109618 if not specified. Deprecated: Use max_value_color_style.
5290    #[serde(rename = "maxValueColor")]
5291    pub max_value_color: Option<Color>,
5292    /// The background color for cells with a color value greater than or equal to maxValue. Defaults to #109618 if not specified. If max_value_color is also set, this field takes precedence.
5293    #[serde(rename = "maxValueColorStyle")]
5294    pub max_value_color_style: Option<ColorStyle>,
5295    /// The background color for cells with a color value at the midpoint between minValue and maxValue. Defaults to #efe6dc if not specified. Deprecated: Use mid_value_color_style.
5296    #[serde(rename = "midValueColor")]
5297    pub mid_value_color: Option<Color>,
5298    /// The background color for cells with a color value at the midpoint between minValue and maxValue. Defaults to #efe6dc if not specified. If mid_value_color is also set, this field takes precedence.
5299    #[serde(rename = "midValueColorStyle")]
5300    pub mid_value_color_style: Option<ColorStyle>,
5301    /// The background color for cells with a color value less than or equal to minValue. Defaults to #dc3912 if not specified. Deprecated: Use min_value_color_style.
5302    #[serde(rename = "minValueColor")]
5303    pub min_value_color: Option<Color>,
5304    /// The background color for cells with a color value less than or equal to minValue. Defaults to #dc3912 if not specified. If min_value_color is also set, this field takes precedence.
5305    #[serde(rename = "minValueColorStyle")]
5306    pub min_value_color_style: Option<ColorStyle>,
5307    /// The background color for cells that have no color data associated with them. Defaults to #000000 if not specified. Deprecated: Use no_data_color_style.
5308    #[serde(rename = "noDataColor")]
5309    pub no_data_color: Option<Color>,
5310    /// The background color for cells that have no color data associated with them. Defaults to #000000 if not specified. If no_data_color is also set, this field takes precedence.
5311    #[serde(rename = "noDataColorStyle")]
5312    pub no_data_color_style: Option<ColorStyle>,
5313}
5314
5315impl common::Part for TreemapChartColorScale {}
5316
5317/// A Treemap chart.
5318///
5319/// This type is not used in any activity, and only used as *part* of another schema.
5320///
5321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5322#[serde_with::serde_as]
5323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5324pub struct TreemapChartSpec {
5325    /// The data that determines the background color of each treemap data cell. This field is optional. If not specified, size_data is used to determine background colors. If specified, the data is expected to be numeric. color_scale will determine how the values in this data map to data cell background colors.
5326    #[serde(rename = "colorData")]
5327    pub color_data: Option<ChartData>,
5328    /// The color scale for data cells in the treemap chart. Data cells are assigned colors based on their color values. These color values come from color_data, or from size_data if color_data is not specified. Cells with color values less than or equal to min_value will have minValueColor as their background color. Cells with color values greater than or equal to max_value will have maxValueColor as their background color. Cells with color values between min_value and max_value will have background colors on a gradient between minValueColor and maxValueColor, the midpoint of the gradient being midValueColor. Cells with missing or non-numeric color values will have noDataColor as their background color.
5329    #[serde(rename = "colorScale")]
5330    pub color_scale: Option<TreemapChartColorScale>,
5331    /// The background color for header cells. Deprecated: Use header_color_style.
5332    #[serde(rename = "headerColor")]
5333    pub header_color: Option<Color>,
5334    /// The background color for header cells. If header_color is also set, this field takes precedence.
5335    #[serde(rename = "headerColorStyle")]
5336    pub header_color_style: Option<ColorStyle>,
5337    /// True to hide tooltips.
5338    #[serde(rename = "hideTooltips")]
5339    pub hide_tooltips: Option<bool>,
5340    /// The number of additional data levels beyond the labeled levels to be shown on the treemap chart. These levels are not interactive and are shown without their labels. Defaults to 0 if not specified.
5341    #[serde(rename = "hintedLevels")]
5342    pub hinted_levels: Option<i32>,
5343    /// The data that contains the treemap cell labels.
5344    pub labels: Option<ChartData>,
5345    /// The number of data levels to show on the treemap chart. These levels are interactive and are shown with their labels. Defaults to 2 if not specified.
5346    pub levels: Option<i32>,
5347    /// The maximum possible data value. Cells with values greater than this will have the same color as cells with this value. If not specified, defaults to the actual maximum value from color_data, or the maximum value from size_data if color_data is not specified.
5348    #[serde(rename = "maxValue")]
5349    pub max_value: Option<f64>,
5350    /// The minimum possible data value. Cells with values less than this will have the same color as cells with this value. If not specified, defaults to the actual minimum value from color_data, or the minimum value from size_data if color_data is not specified.
5351    #[serde(rename = "minValue")]
5352    pub min_value: Option<f64>,
5353    /// The data the contains the treemap cells' parent labels.
5354    #[serde(rename = "parentLabels")]
5355    pub parent_labels: Option<ChartData>,
5356    /// The data that determines the size of each treemap data cell. This data is expected to be numeric. The cells corresponding to non-numeric or missing data will not be rendered. If color_data is not specified, this data is used to determine data cell background colors as well.
5357    #[serde(rename = "sizeData")]
5358    pub size_data: Option<ChartData>,
5359    /// The text format for all labels on the chart. The link field is not supported.
5360    #[serde(rename = "textFormat")]
5361    pub text_format: Option<TextFormat>,
5362}
5363
5364impl common::Part for TreemapChartSpec {}
5365
5366/// Trims the whitespace (such as spaces, tabs, or new lines) in every cell in the specified range. This request removes all whitespace from the start and end of each cell's text, and reduces any subsequence of remaining whitespace characters to a single space. If the resulting trimmed text starts with a '+' or '=' character, the text remains as a string value and isn't interpreted as a formula.
5367///
5368/// This type is not used in any activity, and only used as *part* of another schema.
5369///
5370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5371#[serde_with::serde_as]
5372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5373pub struct TrimWhitespaceRequest {
5374    /// The range whose cells to trim.
5375    pub range: Option<GridRange>,
5376}
5377
5378impl common::Part for TrimWhitespaceRequest {}
5379
5380/// The result of trimming whitespace in cells.
5381///
5382/// This type is not used in any activity, and only used as *part* of another schema.
5383///
5384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5385#[serde_with::serde_as]
5386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5387pub struct TrimWhitespaceResponse {
5388    /// The number of cells that were trimmed of whitespace.
5389    #[serde(rename = "cellsChangedCount")]
5390    pub cells_changed_count: Option<i32>,
5391}
5392
5393impl common::Part for TrimWhitespaceResponse {}
5394
5395/// Unmerges cells in the given range.
5396///
5397/// This type is not used in any activity, and only used as *part* of another schema.
5398///
5399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5400#[serde_with::serde_as]
5401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5402pub struct UnmergeCellsRequest {
5403    /// The range within which all cells should be unmerged. If the range spans multiple merges, all will be unmerged. The range must not partially span any merge.
5404    pub range: Option<GridRange>,
5405}
5406
5407impl common::Part for UnmergeCellsRequest {}
5408
5409/// Updates properties of the supplied banded range.
5410///
5411/// This type is not used in any activity, and only used as *part* of another schema.
5412///
5413#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5414#[serde_with::serde_as]
5415#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5416pub struct UpdateBandingRequest {
5417    /// The banded range to update with the new properties.
5418    #[serde(rename = "bandedRange")]
5419    pub banded_range: Option<BandedRange>,
5420    /// The fields that should be updated. At least one field must be specified. The root `bandedRange` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5421    pub fields: Option<common::FieldMask>,
5422}
5423
5424impl common::Part for UpdateBandingRequest {}
5425
5426/// Updates the borders of a range. If a field is not set in the request, that means the border remains as-is. For example, with two subsequent UpdateBordersRequest: 1. range: A1:A5 `{ top: RED, bottom: WHITE }` 2. range: A1:A5 `{ left: BLUE }` That would result in A1:A5 having a borders of `{ top: RED, bottom: WHITE, left: BLUE }`. If you want to clear a border, explicitly set the style to NONE.
5427///
5428/// This type is not used in any activity, and only used as *part* of another schema.
5429///
5430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5431#[serde_with::serde_as]
5432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5433pub struct UpdateBordersRequest {
5434    /// The border to put at the bottom of the range.
5435    pub bottom: Option<Border>,
5436    /// The horizontal border to put within the range.
5437    #[serde(rename = "innerHorizontal")]
5438    pub inner_horizontal: Option<Border>,
5439    /// The vertical border to put within the range.
5440    #[serde(rename = "innerVertical")]
5441    pub inner_vertical: Option<Border>,
5442    /// The border to put at the left of the range.
5443    pub left: Option<Border>,
5444    /// The range whose borders should be updated.
5445    pub range: Option<GridRange>,
5446    /// The border to put at the right of the range.
5447    pub right: Option<Border>,
5448    /// The border to put at the top of the range.
5449    pub top: Option<Border>,
5450}
5451
5452impl common::Part for UpdateBordersRequest {}
5453
5454/// Updates all cells in a range with new data.
5455///
5456/// This type is not used in any activity, and only used as *part* of another schema.
5457///
5458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5459#[serde_with::serde_as]
5460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5461pub struct UpdateCellsRequest {
5462    /// The fields of CellData that should be updated. At least one field must be specified. The root is the CellData; 'row.values.' should not be specified. A single `"*"` can be used as short-hand for listing every field.
5463    pub fields: Option<common::FieldMask>,
5464    /// The range to write data to. If the data in rows does not cover the entire requested range, the fields matching those set in fields will be cleared.
5465    pub range: Option<GridRange>,
5466    /// The data to write.
5467    pub rows: Option<Vec<RowData>>,
5468    /// The coordinate to start writing data at. Any number of rows and columns (including a different number of columns per row) may be written.
5469    pub start: Option<GridCoordinate>,
5470}
5471
5472impl common::Part for UpdateCellsRequest {}
5473
5474/// Updates a chart's specifications. (This does not move or resize a chart. To move or resize a chart, use UpdateEmbeddedObjectPositionRequest.)
5475///
5476/// This type is not used in any activity, and only used as *part* of another schema.
5477///
5478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5479#[serde_with::serde_as]
5480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5481pub struct UpdateChartSpecRequest {
5482    /// The ID of the chart to update.
5483    #[serde(rename = "chartId")]
5484    pub chart_id: Option<i32>,
5485    /// The specification to apply to the chart.
5486    pub spec: Option<ChartSpec>,
5487}
5488
5489impl common::Part for UpdateChartSpecRequest {}
5490
5491/// Updates a conditional format rule at the given index, or moves a conditional format rule to another index.
5492///
5493/// This type is not used in any activity, and only used as *part* of another schema.
5494///
5495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5496#[serde_with::serde_as]
5497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5498pub struct UpdateConditionalFormatRuleRequest {
5499    /// The zero-based index of the rule that should be replaced or moved.
5500    pub index: Option<i32>,
5501    /// The zero-based new index the rule should end up at.
5502    #[serde(rename = "newIndex")]
5503    pub new_index: Option<i32>,
5504    /// The rule that should replace the rule at the given index.
5505    pub rule: Option<ConditionalFormatRule>,
5506    /// The sheet of the rule to move. Required if new_index is set, unused otherwise.
5507    #[serde(rename = "sheetId")]
5508    pub sheet_id: Option<i32>,
5509}
5510
5511impl common::Part for UpdateConditionalFormatRuleRequest {}
5512
5513/// The result of updating a conditional format rule.
5514///
5515/// This type is not used in any activity, and only used as *part* of another schema.
5516///
5517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5518#[serde_with::serde_as]
5519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5520pub struct UpdateConditionalFormatRuleResponse {
5521    /// The index of the new rule.
5522    #[serde(rename = "newIndex")]
5523    pub new_index: Option<i32>,
5524    /// The new rule that replaced the old rule (if replacing), or the rule that was moved (if moved)
5525    #[serde(rename = "newRule")]
5526    pub new_rule: Option<ConditionalFormatRule>,
5527    /// The old index of the rule. Not set if a rule was replaced (because it is the same as new_index).
5528    #[serde(rename = "oldIndex")]
5529    pub old_index: Option<i32>,
5530    /// The old (deleted) rule. Not set if a rule was moved (because it is the same as new_rule).
5531    #[serde(rename = "oldRule")]
5532    pub old_rule: Option<ConditionalFormatRule>,
5533}
5534
5535impl common::Part for UpdateConditionalFormatRuleResponse {}
5536
5537/// Updates a data source. After the data source is updated successfully, an execution is triggered to refresh the associated DATA_SOURCE sheet to read data from the updated data source. The request requires an additional `bigquery.readonly` OAuth scope if you are updating a BigQuery data source.
5538///
5539/// This type is not used in any activity, and only used as *part* of another schema.
5540///
5541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5542#[serde_with::serde_as]
5543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5544pub struct UpdateDataSourceRequest {
5545    /// The data source to update.
5546    #[serde(rename = "dataSource")]
5547    pub data_source: Option<DataSource>,
5548    /// The fields that should be updated. At least one field must be specified. The root `dataSource` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5549    pub fields: Option<common::FieldMask>,
5550}
5551
5552impl common::Part for UpdateDataSourceRequest {}
5553
5554/// The response from updating data source.
5555///
5556/// This type is not used in any activity, and only used as *part* of another schema.
5557///
5558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5559#[serde_with::serde_as]
5560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5561pub struct UpdateDataSourceResponse {
5562    /// The data execution status.
5563    #[serde(rename = "dataExecutionStatus")]
5564    pub data_execution_status: Option<DataExecutionStatus>,
5565    /// The updated data source.
5566    #[serde(rename = "dataSource")]
5567    pub data_source: Option<DataSource>,
5568}
5569
5570impl common::Part for UpdateDataSourceResponse {}
5571
5572/// A request to update properties of developer metadata. Updates the properties of the developer metadata selected by the filters to the values provided in the DeveloperMetadata resource. Callers must specify the properties they wish to update in the fields parameter, as well as specify at least one DataFilter matching the metadata they wish to update.
5573///
5574/// This type is not used in any activity, and only used as *part* of another schema.
5575///
5576#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5577#[serde_with::serde_as]
5578#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5579pub struct UpdateDeveloperMetadataRequest {
5580    /// The filters matching the developer metadata entries to update.
5581    #[serde(rename = "dataFilters")]
5582    pub data_filters: Option<Vec<DataFilter>>,
5583    /// The value that all metadata matched by the data filters will be updated to.
5584    #[serde(rename = "developerMetadata")]
5585    pub developer_metadata: Option<DeveloperMetadata>,
5586    /// The fields that should be updated. At least one field must be specified. The root `developerMetadata` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5587    pub fields: Option<common::FieldMask>,
5588}
5589
5590impl common::Part for UpdateDeveloperMetadataRequest {}
5591
5592/// The response from updating developer metadata.
5593///
5594/// This type is not used in any activity, and only used as *part* of another schema.
5595///
5596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5597#[serde_with::serde_as]
5598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5599pub struct UpdateDeveloperMetadataResponse {
5600    /// The updated developer metadata.
5601    #[serde(rename = "developerMetadata")]
5602    pub developer_metadata: Option<Vec<DeveloperMetadata>>,
5603}
5604
5605impl common::Part for UpdateDeveloperMetadataResponse {}
5606
5607/// Updates the state of the specified group.
5608///
5609/// This type is not used in any activity, and only used as *part* of another schema.
5610///
5611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5612#[serde_with::serde_as]
5613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5614pub struct UpdateDimensionGroupRequest {
5615    /// The group whose state should be updated. The range and depth of the group should specify a valid group on the sheet, and all other fields updated.
5616    #[serde(rename = "dimensionGroup")]
5617    pub dimension_group: Option<DimensionGroup>,
5618    /// The fields that should be updated. At least one field must be specified. The root `dimensionGroup` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5619    pub fields: Option<common::FieldMask>,
5620}
5621
5622impl common::Part for UpdateDimensionGroupRequest {}
5623
5624/// Updates properties of dimensions within the specified range.
5625///
5626/// This type is not used in any activity, and only used as *part* of another schema.
5627///
5628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5629#[serde_with::serde_as]
5630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5631pub struct UpdateDimensionPropertiesRequest {
5632    /// The columns on a data source sheet to update.
5633    #[serde(rename = "dataSourceSheetRange")]
5634    pub data_source_sheet_range: Option<DataSourceSheetDimensionRange>,
5635    /// The fields that should be updated. At least one field must be specified. The root `properties` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5636    pub fields: Option<common::FieldMask>,
5637    /// Properties to update.
5638    pub properties: Option<DimensionProperties>,
5639    /// The rows or columns to update.
5640    pub range: Option<DimensionRange>,
5641}
5642
5643impl common::Part for UpdateDimensionPropertiesRequest {}
5644
5645/// Updates an embedded object's border property.
5646///
5647/// This type is not used in any activity, and only used as *part* of another schema.
5648///
5649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5650#[serde_with::serde_as]
5651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5652pub struct UpdateEmbeddedObjectBorderRequest {
5653    /// The border that applies to the embedded object.
5654    pub border: Option<EmbeddedObjectBorder>,
5655    /// The fields that should be updated. At least one field must be specified. The root `border` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5656    pub fields: Option<common::FieldMask>,
5657    /// The ID of the embedded object to update.
5658    #[serde(rename = "objectId")]
5659    pub object_id: Option<i32>,
5660}
5661
5662impl common::Part for UpdateEmbeddedObjectBorderRequest {}
5663
5664/// Update an embedded object's position (such as a moving or resizing a chart or image).
5665///
5666/// This type is not used in any activity, and only used as *part* of another schema.
5667///
5668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5669#[serde_with::serde_as]
5670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5671pub struct UpdateEmbeddedObjectPositionRequest {
5672    /// The fields of OverlayPosition that should be updated when setting a new position. Used only if newPosition.overlayPosition is set, in which case at least one field must be specified. The root `newPosition.overlayPosition` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5673    pub fields: Option<common::FieldMask>,
5674    /// An explicit position to move the embedded object to. If newPosition.sheetId is set, a new sheet with that ID will be created. If newPosition.newSheet is set to true, a new sheet will be created with an ID that will be chosen for you.
5675    #[serde(rename = "newPosition")]
5676    pub new_position: Option<EmbeddedObjectPosition>,
5677    /// The ID of the object to moved.
5678    #[serde(rename = "objectId")]
5679    pub object_id: Option<i32>,
5680}
5681
5682impl common::Part for UpdateEmbeddedObjectPositionRequest {}
5683
5684/// The result of updating an embedded object's position.
5685///
5686/// This type is not used in any activity, and only used as *part* of another schema.
5687///
5688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5689#[serde_with::serde_as]
5690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5691pub struct UpdateEmbeddedObjectPositionResponse {
5692    /// The new position of the embedded object.
5693    pub position: Option<EmbeddedObjectPosition>,
5694}
5695
5696impl common::Part for UpdateEmbeddedObjectPositionResponse {}
5697
5698/// Updates properties of the filter view.
5699///
5700/// This type is not used in any activity, and only used as *part* of another schema.
5701///
5702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5703#[serde_with::serde_as]
5704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5705pub struct UpdateFilterViewRequest {
5706    /// The fields that should be updated. At least one field must be specified. The root `filter` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5707    pub fields: Option<common::FieldMask>,
5708    /// The new properties of the filter view.
5709    pub filter: Option<FilterView>,
5710}
5711
5712impl common::Part for UpdateFilterViewRequest {}
5713
5714/// Updates properties of the named range with the specified namedRangeId.
5715///
5716/// This type is not used in any activity, and only used as *part* of another schema.
5717///
5718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5719#[serde_with::serde_as]
5720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5721pub struct UpdateNamedRangeRequest {
5722    /// The fields that should be updated. At least one field must be specified. The root `namedRange` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5723    pub fields: Option<common::FieldMask>,
5724    /// The named range to update with the new properties.
5725    #[serde(rename = "namedRange")]
5726    pub named_range: Option<NamedRange>,
5727}
5728
5729impl common::Part for UpdateNamedRangeRequest {}
5730
5731/// Updates an existing protected range with the specified protectedRangeId.
5732///
5733/// This type is not used in any activity, and only used as *part* of another schema.
5734///
5735#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5736#[serde_with::serde_as]
5737#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5738pub struct UpdateProtectedRangeRequest {
5739    /// The fields that should be updated. At least one field must be specified. The root `protectedRange` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5740    pub fields: Option<common::FieldMask>,
5741    /// The protected range to update with the new properties.
5742    #[serde(rename = "protectedRange")]
5743    pub protected_range: Option<ProtectedRange>,
5744}
5745
5746impl common::Part for UpdateProtectedRangeRequest {}
5747
5748/// Updates properties of the sheet with the specified sheetId.
5749///
5750/// This type is not used in any activity, and only used as *part* of another schema.
5751///
5752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5753#[serde_with::serde_as]
5754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5755pub struct UpdateSheetPropertiesRequest {
5756    /// The fields that should be updated. At least one field must be specified. The root `properties` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5757    pub fields: Option<common::FieldMask>,
5758    /// The properties to update.
5759    pub properties: Option<SheetProperties>,
5760}
5761
5762impl common::Part for UpdateSheetPropertiesRequest {}
5763
5764/// Updates a slicer's specifications. (This does not move or resize a slicer. To move or resize a slicer use UpdateEmbeddedObjectPositionRequest.
5765///
5766/// This type is not used in any activity, and only used as *part* of another schema.
5767///
5768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5769#[serde_with::serde_as]
5770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5771pub struct UpdateSlicerSpecRequest {
5772    /// The fields that should be updated. At least one field must be specified. The root `SlicerSpec` is implied and should not be specified. A single "*"` can be used as short-hand for listing every field.
5773    pub fields: Option<common::FieldMask>,
5774    /// The id of the slicer to update.
5775    #[serde(rename = "slicerId")]
5776    pub slicer_id: Option<i32>,
5777    /// The specification to apply to the slicer.
5778    pub spec: Option<SlicerSpec>,
5779}
5780
5781impl common::Part for UpdateSlicerSpecRequest {}
5782
5783/// Updates properties of a spreadsheet.
5784///
5785/// This type is not used in any activity, and only used as *part* of another schema.
5786///
5787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5788#[serde_with::serde_as]
5789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5790pub struct UpdateSpreadsheetPropertiesRequest {
5791    /// The fields that should be updated. At least one field must be specified. The root 'properties' is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5792    pub fields: Option<common::FieldMask>,
5793    /// The properties to update.
5794    pub properties: Option<SpreadsheetProperties>,
5795}
5796
5797impl common::Part for UpdateSpreadsheetPropertiesRequest {}
5798
5799/// Updates a table in the spreadsheet.
5800///
5801/// This type is not used in any activity, and only used as *part* of another schema.
5802///
5803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5804#[serde_with::serde_as]
5805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5806pub struct UpdateTableRequest {
5807    /// Required. The fields that should be updated. At least one field must be specified. The root `table` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field.
5808    pub fields: Option<common::FieldMask>,
5809    /// Required. The table to update.
5810    pub table: Option<Table>,
5811}
5812
5813impl common::Part for UpdateTableRequest {}
5814
5815/// The response when updating a range of values by a data filter in a spreadsheet.
5816///
5817/// This type is not used in any activity, and only used as *part* of another schema.
5818///
5819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5820#[serde_with::serde_as]
5821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5822pub struct UpdateValuesByDataFilterResponse {
5823    /// The data filter that selected the range that was updated.
5824    #[serde(rename = "dataFilter")]
5825    pub data_filter: Option<DataFilter>,
5826    /// The number of cells updated.
5827    #[serde(rename = "updatedCells")]
5828    pub updated_cells: Option<i32>,
5829    /// The number of columns where at least one cell in the column was updated.
5830    #[serde(rename = "updatedColumns")]
5831    pub updated_columns: Option<i32>,
5832    /// The values of the cells in the range matched by the dataFilter after all updates were applied. This is only included if the request's `includeValuesInResponse` field was `true`.
5833    #[serde(rename = "updatedData")]
5834    pub updated_data: Option<ValueRange>,
5835    /// The range (in [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell)) that updates were applied to.
5836    #[serde(rename = "updatedRange")]
5837    pub updated_range: Option<String>,
5838    /// The number of rows where at least one cell in the row was updated.
5839    #[serde(rename = "updatedRows")]
5840    pub updated_rows: Option<i32>,
5841}
5842
5843impl common::Part for UpdateValuesByDataFilterResponse {}
5844
5845/// The response when updating a range of values in a spreadsheet.
5846///
5847/// # Activities
5848///
5849/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5850/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5851///
5852/// * [values update spreadsheets](SpreadsheetValueUpdateCall) (response)
5853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5854#[serde_with::serde_as]
5855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5856pub struct UpdateValuesResponse {
5857    /// The spreadsheet the updates were applied to.
5858    #[serde(rename = "spreadsheetId")]
5859    pub spreadsheet_id: Option<String>,
5860    /// The number of cells updated.
5861    #[serde(rename = "updatedCells")]
5862    pub updated_cells: Option<i32>,
5863    /// The number of columns where at least one cell in the column was updated.
5864    #[serde(rename = "updatedColumns")]
5865    pub updated_columns: Option<i32>,
5866    /// The values of the cells after updates were applied. This is only included if the request's `includeValuesInResponse` field was `true`.
5867    #[serde(rename = "updatedData")]
5868    pub updated_data: Option<ValueRange>,
5869    /// The range (in A1 notation) that updates were applied to.
5870    #[serde(rename = "updatedRange")]
5871    pub updated_range: Option<String>,
5872    /// The number of rows where at least one cell in the row was updated.
5873    #[serde(rename = "updatedRows")]
5874    pub updated_rows: Option<i32>,
5875}
5876
5877impl common::ResponseResult for UpdateValuesResponse {}
5878
5879/// Data within a range of the spreadsheet.
5880///
5881/// # Activities
5882///
5883/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5884/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5885///
5886/// * [values append spreadsheets](SpreadsheetValueAppendCall) (request)
5887/// * [values get spreadsheets](SpreadsheetValueGetCall) (response)
5888/// * [values update spreadsheets](SpreadsheetValueUpdateCall) (request)
5889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5890#[serde_with::serde_as]
5891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5892pub struct ValueRange {
5893    /// The major dimension of the values. For output, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, then requesting `range=A1:B2,majorDimension=ROWS` will return `[[1,2],[3,4]]`, whereas requesting `range=A1:B2,majorDimension=COLUMNS` will return `[[1,3],[2,4]]`. For input, with `range=A1:B2,majorDimension=ROWS` then `[[1,2],[3,4]]` will set `A1=1,B1=2,A2=3,B2=4`. With `range=A1:B2,majorDimension=COLUMNS` then `[[1,2],[3,4]]` will set `A1=1,B1=3,A2=2,B2=4`. When writing, if this field is not set, it defaults to ROWS.
5894    #[serde(rename = "majorDimension")]
5895    pub major_dimension: Option<String>,
5896    /// The range the values cover, in [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). For output, this range indicates the entire requested range, even though the values will exclude trailing rows and columns. When appending values, this field represents the range to search for a table, after which values will be appended.
5897    pub range: Option<String>,
5898    /// The data that was read or to be written. This is an array of arrays, the outer array representing all the data and each inner array representing a major dimension. Each item in the inner array corresponds with one cell. For output, empty trailing rows and columns will not be included. For input, supported value types are: bool, string, and double. Null values will be skipped. To set a cell to an empty value, set the string value to an empty string.
5899    pub values: Option<Vec<Vec<serde_json::Value>>>,
5900}
5901
5902impl common::RequestValue for ValueRange {}
5903impl common::ResponseResult for ValueRange {}
5904
5905/// Styles for a waterfall chart column.
5906///
5907/// This type is not used in any activity, and only used as *part* of another schema.
5908///
5909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5910#[serde_with::serde_as]
5911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5912pub struct WaterfallChartColumnStyle {
5913    /// The color of the column. Deprecated: Use color_style.
5914    pub color: Option<Color>,
5915    /// The color of the column. If color is also set, this field takes precedence.
5916    #[serde(rename = "colorStyle")]
5917    pub color_style: Option<ColorStyle>,
5918    /// The label of the column's legend.
5919    pub label: Option<String>,
5920}
5921
5922impl common::Part for WaterfallChartColumnStyle {}
5923
5924/// A custom subtotal column for a waterfall chart series.
5925///
5926/// This type is not used in any activity, and only used as *part* of another schema.
5927///
5928#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5929#[serde_with::serde_as]
5930#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5931pub struct WaterfallChartCustomSubtotal {
5932    /// True if the data point at subtotal_index is the subtotal. If false, the subtotal will be computed and appear after the data point.
5933    #[serde(rename = "dataIsSubtotal")]
5934    pub data_is_subtotal: Option<bool>,
5935    /// A label for the subtotal column.
5936    pub label: Option<String>,
5937    /// The zero-based index of a data point within the series. If data_is_subtotal is true, the data point at this index is the subtotal. Otherwise, the subtotal appears after the data point with this index. A series can have multiple subtotals at arbitrary indices, but subtotals do not affect the indices of the data points. For example, if a series has three data points, their indices will always be 0, 1, and 2, regardless of how many subtotals exist on the series or what data points they are associated with.
5938    #[serde(rename = "subtotalIndex")]
5939    pub subtotal_index: Option<i32>,
5940}
5941
5942impl common::Part for WaterfallChartCustomSubtotal {}
5943
5944/// The domain of a waterfall chart.
5945///
5946/// This type is not used in any activity, and only used as *part* of another schema.
5947///
5948#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5949#[serde_with::serde_as]
5950#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5951pub struct WaterfallChartDomain {
5952    /// The data of the WaterfallChartDomain.
5953    pub data: Option<ChartData>,
5954    /// True to reverse the order of the domain values (horizontal axis).
5955    pub reversed: Option<bool>,
5956}
5957
5958impl common::Part for WaterfallChartDomain {}
5959
5960/// A single series of data for a waterfall chart.
5961///
5962/// This type is not used in any activity, and only used as *part* of another schema.
5963///
5964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5965#[serde_with::serde_as]
5966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5967pub struct WaterfallChartSeries {
5968    /// Custom subtotal columns appearing in this series. The order in which subtotals are defined is not significant. Only one subtotal may be defined for each data point.
5969    #[serde(rename = "customSubtotals")]
5970    pub custom_subtotals: Option<Vec<WaterfallChartCustomSubtotal>>,
5971    /// The data being visualized in this series.
5972    pub data: Option<ChartData>,
5973    /// Information about the data labels for this series.
5974    #[serde(rename = "dataLabel")]
5975    pub data_label: Option<DataLabel>,
5976    /// True to hide the subtotal column from the end of the series. By default, a subtotal column will appear at the end of each series. Setting this field to true will hide that subtotal column for this series.
5977    #[serde(rename = "hideTrailingSubtotal")]
5978    pub hide_trailing_subtotal: Option<bool>,
5979    /// Styles for all columns in this series with negative values.
5980    #[serde(rename = "negativeColumnsStyle")]
5981    pub negative_columns_style: Option<WaterfallChartColumnStyle>,
5982    /// Styles for all columns in this series with positive values.
5983    #[serde(rename = "positiveColumnsStyle")]
5984    pub positive_columns_style: Option<WaterfallChartColumnStyle>,
5985    /// Styles for all subtotal columns in this series.
5986    #[serde(rename = "subtotalColumnsStyle")]
5987    pub subtotal_columns_style: Option<WaterfallChartColumnStyle>,
5988}
5989
5990impl common::Part for WaterfallChartSeries {}
5991
5992/// A waterfall chart.
5993///
5994/// This type is not used in any activity, and only used as *part* of another schema.
5995///
5996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5997#[serde_with::serde_as]
5998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5999pub struct WaterfallChartSpec {
6000    /// The line style for the connector lines.
6001    #[serde(rename = "connectorLineStyle")]
6002    pub connector_line_style: Option<LineStyle>,
6003    /// The domain data (horizontal axis) for the waterfall chart.
6004    pub domain: Option<WaterfallChartDomain>,
6005    /// True to interpret the first value as a total.
6006    #[serde(rename = "firstValueIsTotal")]
6007    pub first_value_is_total: Option<bool>,
6008    /// True to hide connector lines between columns.
6009    #[serde(rename = "hideConnectorLines")]
6010    pub hide_connector_lines: Option<bool>,
6011    /// The data this waterfall chart is visualizing.
6012    pub series: Option<Vec<WaterfallChartSeries>>,
6013    /// The stacked type.
6014    #[serde(rename = "stackedType")]
6015    pub stacked_type: Option<String>,
6016    /// Controls whether to display additional data labels on stacked charts which sum the total value of all stacked values at each value along the domain axis. stacked_type must be STACKED and neither CUSTOM nor placement can be set on the total_data_label.
6017    #[serde(rename = "totalDataLabel")]
6018    pub total_data_label: Option<DataLabel>,
6019}
6020
6021impl common::Part for WaterfallChartSpec {}
6022
6023// ###################
6024// MethodBuilders ###
6025// #################
6026
6027/// A builder providing access to all methods supported on *spreadsheet* resources.
6028/// It is not used directly, but through the [`Sheets`] hub.
6029///
6030/// # Example
6031///
6032/// Instantiate a resource builder
6033///
6034/// ```test_harness,no_run
6035/// extern crate hyper;
6036/// extern crate hyper_rustls;
6037/// extern crate google_sheets4 as sheets4;
6038///
6039/// # async fn dox() {
6040/// use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6041///
6042/// let secret: yup_oauth2::ApplicationSecret = Default::default();
6043/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
6044///     .with_native_roots()
6045///     .unwrap()
6046///     .https_only()
6047///     .enable_http2()
6048///     .build();
6049///
6050/// let executor = hyper_util::rt::TokioExecutor::new();
6051/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6052///     secret,
6053///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6054///     yup_oauth2::client::CustomHyperClientBuilder::from(
6055///         hyper_util::client::legacy::Client::builder(executor).build(connector),
6056///     ),
6057/// ).build().await.unwrap();
6058///
6059/// let client = hyper_util::client::legacy::Client::builder(
6060///     hyper_util::rt::TokioExecutor::new()
6061/// )
6062/// .build(
6063///     hyper_rustls::HttpsConnectorBuilder::new()
6064///         .with_native_roots()
6065///         .unwrap()
6066///         .https_or_http()
6067///         .enable_http2()
6068///         .build()
6069/// );
6070/// let mut hub = Sheets::new(client, auth);
6071/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
6072/// // like `batch_update(...)`, `create(...)`, `developer_metadata_get(...)`, `developer_metadata_search(...)`, `get(...)`, `get_by_data_filter(...)`, `sheets_copy_to(...)`, `values_append(...)`, `values_batch_clear(...)`, `values_batch_clear_by_data_filter(...)`, `values_batch_get(...)`, `values_batch_get_by_data_filter(...)`, `values_batch_update(...)`, `values_batch_update_by_data_filter(...)`, `values_clear(...)`, `values_get(...)` and `values_update(...)`
6073/// // to build up your call.
6074/// let rb = hub.spreadsheets();
6075/// # }
6076/// ```
6077pub struct SpreadsheetMethods<'a, C>
6078where
6079    C: 'a,
6080{
6081    hub: &'a Sheets<C>,
6082}
6083
6084impl<'a, C> common::MethodsBuilder for SpreadsheetMethods<'a, C> {}
6085
6086impl<'a, C> SpreadsheetMethods<'a, C> {
6087    /// Create a builder to help you perform the following task:
6088    ///
6089    /// Returns the developer metadata with the specified ID. The caller must specify the spreadsheet ID and the developer metadata's unique metadataId.
6090    ///
6091    /// # Arguments
6092    ///
6093    /// * `spreadsheetId` - The ID of the spreadsheet to retrieve metadata from.
6094    /// * `metadataId` - The ID of the developer metadata to retrieve.
6095    pub fn developer_metadata_get(
6096        &self,
6097        spreadsheet_id: &str,
6098        metadata_id: i32,
6099    ) -> SpreadsheetDeveloperMetadataGetCall<'a, C> {
6100        SpreadsheetDeveloperMetadataGetCall {
6101            hub: self.hub,
6102            _spreadsheet_id: spreadsheet_id.to_string(),
6103            _metadata_id: metadata_id,
6104            _delegate: Default::default(),
6105            _additional_params: Default::default(),
6106            _scopes: Default::default(),
6107        }
6108    }
6109
6110    /// Create a builder to help you perform the following task:
6111    ///
6112    /// Returns all developer metadata matching the specified DataFilter. If the provided DataFilter represents a DeveloperMetadataLookup object, this will return all DeveloperMetadata entries selected by it. If the DataFilter represents a location in a spreadsheet, this will return all developer metadata associated with locations intersecting that region.
6113    ///
6114    /// # Arguments
6115    ///
6116    /// * `request` - No description provided.
6117    /// * `spreadsheetId` - The ID of the spreadsheet to retrieve metadata from.
6118    pub fn developer_metadata_search(
6119        &self,
6120        request: SearchDeveloperMetadataRequest,
6121        spreadsheet_id: &str,
6122    ) -> SpreadsheetDeveloperMetadataSearchCall<'a, C> {
6123        SpreadsheetDeveloperMetadataSearchCall {
6124            hub: self.hub,
6125            _request: request,
6126            _spreadsheet_id: spreadsheet_id.to_string(),
6127            _delegate: Default::default(),
6128            _additional_params: Default::default(),
6129            _scopes: Default::default(),
6130        }
6131    }
6132
6133    /// Create a builder to help you perform the following task:
6134    ///
6135    /// Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.
6136    ///
6137    /// # Arguments
6138    ///
6139    /// * `request` - No description provided.
6140    /// * `spreadsheetId` - The ID of the spreadsheet containing the sheet to copy.
6141    /// * `sheetId` - The ID of the sheet to copy.
6142    pub fn sheets_copy_to(
6143        &self,
6144        request: CopySheetToAnotherSpreadsheetRequest,
6145        spreadsheet_id: &str,
6146        sheet_id: i32,
6147    ) -> SpreadsheetSheetCopyToCall<'a, C> {
6148        SpreadsheetSheetCopyToCall {
6149            hub: self.hub,
6150            _request: request,
6151            _spreadsheet_id: spreadsheet_id.to_string(),
6152            _sheet_id: sheet_id,
6153            _delegate: Default::default(),
6154            _additional_params: Default::default(),
6155            _scopes: Default::default(),
6156        }
6157    }
6158
6159    /// Create a builder to help you perform the following task:
6160    ///
6161    /// Appends values to a spreadsheet. The input range is used to search for existing data and find a "table" within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the [guide](https://developers.google.com/workspace/sheets/api/guides/values#appending_values) and [sample code](https://developers.google.com/workspace/sheets/api/samples/writing#append_values) for specific details of how tables are detected and data is appended. The caller must specify the spreadsheet ID, range, and a valueInputOption. The `valueInputOption` only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to.
6162    ///
6163    /// # Arguments
6164    ///
6165    /// * `request` - No description provided.
6166    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6167    /// * `range` - The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of a range to search for a logical table of data. Values are appended after the last row of the table.
6168    pub fn values_append(
6169        &self,
6170        request: ValueRange,
6171        spreadsheet_id: &str,
6172        range: &str,
6173    ) -> SpreadsheetValueAppendCall<'a, C> {
6174        SpreadsheetValueAppendCall {
6175            hub: self.hub,
6176            _request: request,
6177            _spreadsheet_id: spreadsheet_id.to_string(),
6178            _range: range.to_string(),
6179            _value_input_option: Default::default(),
6180            _response_value_render_option: Default::default(),
6181            _response_date_time_render_option: Default::default(),
6182            _insert_data_option: Default::default(),
6183            _include_values_in_response: Default::default(),
6184            _delegate: Default::default(),
6185            _additional_params: Default::default(),
6186            _scopes: Default::default(),
6187        }
6188    }
6189
6190    /// Create a builder to help you perform the following task:
6191    ///
6192    /// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges. Only values are cleared -- all other properties of the cell (such as formatting and data validation) are kept.
6193    ///
6194    /// # Arguments
6195    ///
6196    /// * `request` - No description provided.
6197    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6198    pub fn values_batch_clear(
6199        &self,
6200        request: BatchClearValuesRequest,
6201        spreadsheet_id: &str,
6202    ) -> SpreadsheetValueBatchClearCall<'a, C> {
6203        SpreadsheetValueBatchClearCall {
6204            hub: self.hub,
6205            _request: request,
6206            _spreadsheet_id: spreadsheet_id.to_string(),
6207            _delegate: Default::default(),
6208            _additional_params: Default::default(),
6209            _scopes: Default::default(),
6210        }
6211    }
6212
6213    /// Create a builder to help you perform the following task:
6214    ///
6215    /// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
6216    ///
6217    /// # Arguments
6218    ///
6219    /// * `request` - No description provided.
6220    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6221    pub fn values_batch_clear_by_data_filter(
6222        &self,
6223        request: BatchClearValuesByDataFilterRequest,
6224        spreadsheet_id: &str,
6225    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C> {
6226        SpreadsheetValueBatchClearByDataFilterCall {
6227            hub: self.hub,
6228            _request: request,
6229            _spreadsheet_id: spreadsheet_id.to_string(),
6230            _delegate: Default::default(),
6231            _additional_params: Default::default(),
6232            _scopes: Default::default(),
6233        }
6234    }
6235
6236    /// Create a builder to help you perform the following task:
6237    ///
6238    /// Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.
6239    ///
6240    /// # Arguments
6241    ///
6242    /// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
6243    pub fn values_batch_get(&self, spreadsheet_id: &str) -> SpreadsheetValueBatchGetCall<'a, C> {
6244        SpreadsheetValueBatchGetCall {
6245            hub: self.hub,
6246            _spreadsheet_id: spreadsheet_id.to_string(),
6247            _value_render_option: Default::default(),
6248            _ranges: Default::default(),
6249            _major_dimension: Default::default(),
6250            _date_time_render_option: Default::default(),
6251            _delegate: Default::default(),
6252            _additional_params: Default::default(),
6253            _scopes: Default::default(),
6254        }
6255    }
6256
6257    /// Create a builder to help you perform the following task:
6258    ///
6259    /// Returns one or more ranges of values that match the specified data filters. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges that match any of the data filters in the request will be returned.
6260    ///
6261    /// # Arguments
6262    ///
6263    /// * `request` - No description provided.
6264    /// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
6265    pub fn values_batch_get_by_data_filter(
6266        &self,
6267        request: BatchGetValuesByDataFilterRequest,
6268        spreadsheet_id: &str,
6269    ) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C> {
6270        SpreadsheetValueBatchGetByDataFilterCall {
6271            hub: self.hub,
6272            _request: request,
6273            _spreadsheet_id: spreadsheet_id.to_string(),
6274            _delegate: Default::default(),
6275            _additional_params: Default::default(),
6276            _scopes: Default::default(),
6277        }
6278    }
6279
6280    /// Create a builder to help you perform the following task:
6281    ///
6282    /// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
6283    ///
6284    /// # Arguments
6285    ///
6286    /// * `request` - No description provided.
6287    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6288    pub fn values_batch_update(
6289        &self,
6290        request: BatchUpdateValuesRequest,
6291        spreadsheet_id: &str,
6292    ) -> SpreadsheetValueBatchUpdateCall<'a, C> {
6293        SpreadsheetValueBatchUpdateCall {
6294            hub: self.hub,
6295            _request: request,
6296            _spreadsheet_id: spreadsheet_id.to_string(),
6297            _delegate: Default::default(),
6298            _additional_params: Default::default(),
6299            _scopes: Default::default(),
6300        }
6301    }
6302
6303    /// Create a builder to help you perform the following task:
6304    ///
6305    /// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more DataFilterValueRanges.
6306    ///
6307    /// # Arguments
6308    ///
6309    /// * `request` - No description provided.
6310    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6311    pub fn values_batch_update_by_data_filter(
6312        &self,
6313        request: BatchUpdateValuesByDataFilterRequest,
6314        spreadsheet_id: &str,
6315    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {
6316        SpreadsheetValueBatchUpdateByDataFilterCall {
6317            hub: self.hub,
6318            _request: request,
6319            _spreadsheet_id: spreadsheet_id.to_string(),
6320            _delegate: Default::default(),
6321            _additional_params: Default::default(),
6322            _scopes: Default::default(),
6323        }
6324    }
6325
6326    /// Create a builder to help you perform the following task:
6327    ///
6328    /// Clears values from a spreadsheet. The caller must specify the spreadsheet ID and range. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
6329    ///
6330    /// # Arguments
6331    ///
6332    /// * `request` - No description provided.
6333    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6334    /// * `range` - The [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to clear.
6335    pub fn values_clear(
6336        &self,
6337        request: ClearValuesRequest,
6338        spreadsheet_id: &str,
6339        range: &str,
6340    ) -> SpreadsheetValueClearCall<'a, C> {
6341        SpreadsheetValueClearCall {
6342            hub: self.hub,
6343            _request: request,
6344            _spreadsheet_id: spreadsheet_id.to_string(),
6345            _range: range.to_string(),
6346            _delegate: Default::default(),
6347            _additional_params: Default::default(),
6348            _scopes: Default::default(),
6349        }
6350    }
6351
6352    /// Create a builder to help you perform the following task:
6353    ///
6354    /// Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.
6355    ///
6356    /// # Arguments
6357    ///
6358    /// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
6359    /// * `range` - The [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the range to retrieve values from.
6360    pub fn values_get(&self, spreadsheet_id: &str, range: &str) -> SpreadsheetValueGetCall<'a, C> {
6361        SpreadsheetValueGetCall {
6362            hub: self.hub,
6363            _spreadsheet_id: spreadsheet_id.to_string(),
6364            _range: range.to_string(),
6365            _value_render_option: Default::default(),
6366            _major_dimension: Default::default(),
6367            _date_time_render_option: Default::default(),
6368            _delegate: Default::default(),
6369            _additional_params: Default::default(),
6370            _scopes: Default::default(),
6371        }
6372    }
6373
6374    /// Create a builder to help you perform the following task:
6375    ///
6376    /// Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.
6377    ///
6378    /// # Arguments
6379    ///
6380    /// * `request` - No description provided.
6381    /// * `spreadsheetId` - The ID of the spreadsheet to update.
6382    /// * `range` - The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to update.
6383    pub fn values_update(
6384        &self,
6385        request: ValueRange,
6386        spreadsheet_id: &str,
6387        range: &str,
6388    ) -> SpreadsheetValueUpdateCall<'a, C> {
6389        SpreadsheetValueUpdateCall {
6390            hub: self.hub,
6391            _request: request,
6392            _spreadsheet_id: spreadsheet_id.to_string(),
6393            _range: range.to_string(),
6394            _value_input_option: Default::default(),
6395            _response_value_render_option: Default::default(),
6396            _response_date_time_render_option: Default::default(),
6397            _include_values_in_response: Default::default(),
6398            _delegate: Default::default(),
6399            _additional_params: Default::default(),
6400            _scopes: Default::default(),
6401        }
6402    }
6403
6404    /// Create a builder to help you perform the following task:
6405    ///
6406    /// Applies one or more updates to the spreadsheet. Each request is validated before being applied. If any request is not valid then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply, then the response will have 2 empty replies, the actual reply, and another empty reply, in that order. Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect exactly your changes after this completes, however it is guaranteed that the updates in the request will be applied together atomically. Your changes may be altered with respect to collaborator changes. If there are no collaborators, the spreadsheet should reflect your changes.
6407    ///
6408    /// # Arguments
6409    ///
6410    /// * `request` - No description provided.
6411    /// * `spreadsheetId` - The spreadsheet to apply the updates to.
6412    pub fn batch_update(
6413        &self,
6414        request: BatchUpdateSpreadsheetRequest,
6415        spreadsheet_id: &str,
6416    ) -> SpreadsheetBatchUpdateCall<'a, C> {
6417        SpreadsheetBatchUpdateCall {
6418            hub: self.hub,
6419            _request: request,
6420            _spreadsheet_id: spreadsheet_id.to_string(),
6421            _delegate: Default::default(),
6422            _additional_params: Default::default(),
6423            _scopes: Default::default(),
6424        }
6425    }
6426
6427    /// Create a builder to help you perform the following task:
6428    ///
6429    /// Creates a spreadsheet, returning the newly created spreadsheet.
6430    ///
6431    /// # Arguments
6432    ///
6433    /// * `request` - No description provided.
6434    pub fn create(&self, request: Spreadsheet) -> SpreadsheetCreateCall<'a, C> {
6435        SpreadsheetCreateCall {
6436            hub: self.hub,
6437            _request: request,
6438            _delegate: Default::default(),
6439            _additional_params: Default::default(),
6440            _scopes: Default::default(),
6441        }
6442    }
6443
6444    /// Create a builder to help you perform the following task:
6445    ///
6446    /// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. By default, data within grids is not returned. You can include grid data in one of 2 ways: * Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData URL parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want. To retrieve only subsets of spreadsheet data, use the ranges URL parameter. Ranges are specified using [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). You can define a single cell (for example, `A1`) or multiple cells (for example, `A1:D5`). You can also get cells from other sheets within the same spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.
6447    ///
6448    /// # Arguments
6449    ///
6450    /// * `spreadsheetId` - The spreadsheet to request.
6451    pub fn get(&self, spreadsheet_id: &str) -> SpreadsheetGetCall<'a, C> {
6452        SpreadsheetGetCall {
6453            hub: self.hub,
6454            _spreadsheet_id: spreadsheet_id.to_string(),
6455            _ranges: Default::default(),
6456            _include_grid_data: Default::default(),
6457            _exclude_tables_in_banded_ranges: Default::default(),
6458            _delegate: Default::default(),
6459            _additional_params: Default::default(),
6460            _scopes: Default::default(),
6461        }
6462    }
6463
6464    /// Create a builder to help you perform the following task:
6465    ///
6466    /// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters returns the portions of the spreadsheet that intersect ranges matched by any of the filters. By default, data within grids is not returned. You can include grid data one of 2 ways: * Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.
6467    ///
6468    /// # Arguments
6469    ///
6470    /// * `request` - No description provided.
6471    /// * `spreadsheetId` - The spreadsheet to request.
6472    pub fn get_by_data_filter(
6473        &self,
6474        request: GetSpreadsheetByDataFilterRequest,
6475        spreadsheet_id: &str,
6476    ) -> SpreadsheetGetByDataFilterCall<'a, C> {
6477        SpreadsheetGetByDataFilterCall {
6478            hub: self.hub,
6479            _request: request,
6480            _spreadsheet_id: spreadsheet_id.to_string(),
6481            _delegate: Default::default(),
6482            _additional_params: Default::default(),
6483            _scopes: Default::default(),
6484        }
6485    }
6486}
6487
6488// ###################
6489// CallBuilders   ###
6490// #################
6491
6492/// Returns the developer metadata with the specified ID. The caller must specify the spreadsheet ID and the developer metadata's unique metadataId.
6493///
6494/// A builder for the *developerMetadata.get* method supported by a *spreadsheet* resource.
6495/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
6496///
6497/// # Example
6498///
6499/// Instantiate a resource method builder
6500///
6501/// ```test_harness,no_run
6502/// # extern crate hyper;
6503/// # extern crate hyper_rustls;
6504/// # extern crate google_sheets4 as sheets4;
6505/// # async fn dox() {
6506/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6507///
6508/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6509/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6510/// #     .with_native_roots()
6511/// #     .unwrap()
6512/// #     .https_only()
6513/// #     .enable_http2()
6514/// #     .build();
6515///
6516/// # let executor = hyper_util::rt::TokioExecutor::new();
6517/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6518/// #     secret,
6519/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6520/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6521/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6522/// #     ),
6523/// # ).build().await.unwrap();
6524///
6525/// # let client = hyper_util::client::legacy::Client::builder(
6526/// #     hyper_util::rt::TokioExecutor::new()
6527/// # )
6528/// # .build(
6529/// #     hyper_rustls::HttpsConnectorBuilder::new()
6530/// #         .with_native_roots()
6531/// #         .unwrap()
6532/// #         .https_or_http()
6533/// #         .enable_http2()
6534/// #         .build()
6535/// # );
6536/// # let mut hub = Sheets::new(client, auth);
6537/// // You can configure optional parameters by calling the respective setters at will, and
6538/// // execute the final call using `doit()`.
6539/// // Values shown here are possibly random and not representative !
6540/// let result = hub.spreadsheets().developer_metadata_get("spreadsheetId", -50)
6541///              .doit().await;
6542/// # }
6543/// ```
6544pub struct SpreadsheetDeveloperMetadataGetCall<'a, C>
6545where
6546    C: 'a,
6547{
6548    hub: &'a Sheets<C>,
6549    _spreadsheet_id: String,
6550    _metadata_id: i32,
6551    _delegate: Option<&'a mut dyn common::Delegate>,
6552    _additional_params: HashMap<String, String>,
6553    _scopes: BTreeSet<String>,
6554}
6555
6556impl<'a, C> common::CallBuilder for SpreadsheetDeveloperMetadataGetCall<'a, C> {}
6557
6558impl<'a, C> SpreadsheetDeveloperMetadataGetCall<'a, C>
6559where
6560    C: common::Connector,
6561{
6562    /// Perform the operation you have build so far.
6563    pub async fn doit(mut self) -> common::Result<(common::Response, DeveloperMetadata)> {
6564        use std::borrow::Cow;
6565        use std::io::{Read, Seek};
6566
6567        use common::{url::Params, ToParts};
6568        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6569
6570        let mut dd = common::DefaultDelegate;
6571        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6572        dlg.begin(common::MethodInfo {
6573            id: "sheets.spreadsheets.developerMetadata.get",
6574            http_method: hyper::Method::GET,
6575        });
6576
6577        for &field in ["alt", "spreadsheetId", "metadataId"].iter() {
6578            if self._additional_params.contains_key(field) {
6579                dlg.finished(false);
6580                return Err(common::Error::FieldClash(field));
6581            }
6582        }
6583
6584        let mut params = Params::with_capacity(4 + self._additional_params.len());
6585        params.push("spreadsheetId", self._spreadsheet_id);
6586        params.push("metadataId", self._metadata_id.to_string());
6587
6588        params.extend(self._additional_params.iter());
6589
6590        params.push("alt", "json");
6591        let mut url = self.hub._base_url.clone()
6592            + "v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId}";
6593        if self._scopes.is_empty() {
6594            self._scopes.insert(Scope::Drive.as_ref().to_string());
6595        }
6596
6597        #[allow(clippy::single_element_loop)]
6598        for &(find_this, param_name) in [
6599            ("{spreadsheetId}", "spreadsheetId"),
6600            ("{metadataId}", "metadataId"),
6601        ]
6602        .iter()
6603        {
6604            url = params.uri_replacement(url, param_name, find_this, false);
6605        }
6606        {
6607            let to_remove = ["metadataId", "spreadsheetId"];
6608            params.remove_params(&to_remove);
6609        }
6610
6611        let url = params.parse_with_url(&url);
6612
6613        loop {
6614            let token = match self
6615                .hub
6616                .auth
6617                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6618                .await
6619            {
6620                Ok(token) => token,
6621                Err(e) => match dlg.token(e) {
6622                    Ok(token) => token,
6623                    Err(e) => {
6624                        dlg.finished(false);
6625                        return Err(common::Error::MissingToken(e));
6626                    }
6627                },
6628            };
6629            let mut req_result = {
6630                let client = &self.hub.client;
6631                dlg.pre_request();
6632                let mut req_builder = hyper::Request::builder()
6633                    .method(hyper::Method::GET)
6634                    .uri(url.as_str())
6635                    .header(USER_AGENT, self.hub._user_agent.clone());
6636
6637                if let Some(token) = token.as_ref() {
6638                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6639                }
6640
6641                let request = req_builder
6642                    .header(CONTENT_LENGTH, 0_u64)
6643                    .body(common::to_body::<String>(None));
6644
6645                client.request(request.unwrap()).await
6646            };
6647
6648            match req_result {
6649                Err(err) => {
6650                    if let common::Retry::After(d) = dlg.http_error(&err) {
6651                        sleep(d).await;
6652                        continue;
6653                    }
6654                    dlg.finished(false);
6655                    return Err(common::Error::HttpError(err));
6656                }
6657                Ok(res) => {
6658                    let (mut parts, body) = res.into_parts();
6659                    let mut body = common::Body::new(body);
6660                    if !parts.status.is_success() {
6661                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6662                        let error = serde_json::from_str(&common::to_string(&bytes));
6663                        let response = common::to_response(parts, bytes.into());
6664
6665                        if let common::Retry::After(d) =
6666                            dlg.http_failure(&response, error.as_ref().ok())
6667                        {
6668                            sleep(d).await;
6669                            continue;
6670                        }
6671
6672                        dlg.finished(false);
6673
6674                        return Err(match error {
6675                            Ok(value) => common::Error::BadRequest(value),
6676                            _ => common::Error::Failure(response),
6677                        });
6678                    }
6679                    let response = {
6680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6681                        let encoded = common::to_string(&bytes);
6682                        match serde_json::from_str(&encoded) {
6683                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6684                            Err(error) => {
6685                                dlg.response_json_decode_error(&encoded, &error);
6686                                return Err(common::Error::JsonDecodeError(
6687                                    encoded.to_string(),
6688                                    error,
6689                                ));
6690                            }
6691                        }
6692                    };
6693
6694                    dlg.finished(true);
6695                    return Ok(response);
6696                }
6697            }
6698        }
6699    }
6700
6701    /// The ID of the spreadsheet to retrieve metadata from.
6702    ///
6703    /// Sets the *spreadsheet id* path property to the given value.
6704    ///
6705    /// Even though the property as already been set when instantiating this call,
6706    /// we provide this method for API completeness.
6707    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetDeveloperMetadataGetCall<'a, C> {
6708        self._spreadsheet_id = new_value.to_string();
6709        self
6710    }
6711    /// The ID of the developer metadata to retrieve.
6712    ///
6713    /// Sets the *metadata id* path property to the given value.
6714    ///
6715    /// Even though the property as already been set when instantiating this call,
6716    /// we provide this method for API completeness.
6717    pub fn metadata_id(mut self, new_value: i32) -> SpreadsheetDeveloperMetadataGetCall<'a, C> {
6718        self._metadata_id = new_value;
6719        self
6720    }
6721    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6722    /// while executing the actual API request.
6723    ///
6724    /// ````text
6725    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6726    /// ````
6727    ///
6728    /// Sets the *delegate* property to the given value.
6729    pub fn delegate(
6730        mut self,
6731        new_value: &'a mut dyn common::Delegate,
6732    ) -> SpreadsheetDeveloperMetadataGetCall<'a, C> {
6733        self._delegate = Some(new_value);
6734        self
6735    }
6736
6737    /// Set any additional parameter of the query string used in the request.
6738    /// It should be used to set parameters which are not yet available through their own
6739    /// setters.
6740    ///
6741    /// Please note that this method must not be used to set any of the known parameters
6742    /// which have their own setter method. If done anyway, the request will fail.
6743    ///
6744    /// # Additional Parameters
6745    ///
6746    /// * *$.xgafv* (query-string) - V1 error format.
6747    /// * *access_token* (query-string) - OAuth access token.
6748    /// * *alt* (query-string) - Data format for response.
6749    /// * *callback* (query-string) - JSONP
6750    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6751    /// * *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.
6752    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6753    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6754    /// * *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.
6755    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6756    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6757    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetDeveloperMetadataGetCall<'a, C>
6758    where
6759        T: AsRef<str>,
6760    {
6761        self._additional_params
6762            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6763        self
6764    }
6765
6766    /// Identifies the authorization scope for the method you are building.
6767    ///
6768    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6769    /// [`Scope::Drive`].
6770    ///
6771    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6772    /// tokens for more than one scope.
6773    ///
6774    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6775    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6776    /// sufficient, a read-write scope will do as well.
6777    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetDeveloperMetadataGetCall<'a, C>
6778    where
6779        St: AsRef<str>,
6780    {
6781        self._scopes.insert(String::from(scope.as_ref()));
6782        self
6783    }
6784    /// Identifies the authorization scope(s) for the method you are building.
6785    ///
6786    /// See [`Self::add_scope()`] for details.
6787    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetDeveloperMetadataGetCall<'a, C>
6788    where
6789        I: IntoIterator<Item = St>,
6790        St: AsRef<str>,
6791    {
6792        self._scopes
6793            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6794        self
6795    }
6796
6797    /// Removes all scopes, and no default scope will be used either.
6798    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6799    /// for details).
6800    pub fn clear_scopes(mut self) -> SpreadsheetDeveloperMetadataGetCall<'a, C> {
6801        self._scopes.clear();
6802        self
6803    }
6804}
6805
6806/// Returns all developer metadata matching the specified DataFilter. If the provided DataFilter represents a DeveloperMetadataLookup object, this will return all DeveloperMetadata entries selected by it. If the DataFilter represents a location in a spreadsheet, this will return all developer metadata associated with locations intersecting that region.
6807///
6808/// A builder for the *developerMetadata.search* method supported by a *spreadsheet* resource.
6809/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
6810///
6811/// # Example
6812///
6813/// Instantiate a resource method builder
6814///
6815/// ```test_harness,no_run
6816/// # extern crate hyper;
6817/// # extern crate hyper_rustls;
6818/// # extern crate google_sheets4 as sheets4;
6819/// use sheets4::api::SearchDeveloperMetadataRequest;
6820/// # async fn dox() {
6821/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6822///
6823/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6824/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6825/// #     .with_native_roots()
6826/// #     .unwrap()
6827/// #     .https_only()
6828/// #     .enable_http2()
6829/// #     .build();
6830///
6831/// # let executor = hyper_util::rt::TokioExecutor::new();
6832/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6833/// #     secret,
6834/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6835/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6836/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6837/// #     ),
6838/// # ).build().await.unwrap();
6839///
6840/// # let client = hyper_util::client::legacy::Client::builder(
6841/// #     hyper_util::rt::TokioExecutor::new()
6842/// # )
6843/// # .build(
6844/// #     hyper_rustls::HttpsConnectorBuilder::new()
6845/// #         .with_native_roots()
6846/// #         .unwrap()
6847/// #         .https_or_http()
6848/// #         .enable_http2()
6849/// #         .build()
6850/// # );
6851/// # let mut hub = Sheets::new(client, auth);
6852/// // As the method needs a request, you would usually fill it with the desired information
6853/// // into the respective structure. Some of the parts shown here might not be applicable !
6854/// // Values shown here are possibly random and not representative !
6855/// let mut req = SearchDeveloperMetadataRequest::default();
6856///
6857/// // You can configure optional parameters by calling the respective setters at will, and
6858/// // execute the final call using `doit()`.
6859/// // Values shown here are possibly random and not representative !
6860/// let result = hub.spreadsheets().developer_metadata_search(req, "spreadsheetId")
6861///              .doit().await;
6862/// # }
6863/// ```
6864pub struct SpreadsheetDeveloperMetadataSearchCall<'a, C>
6865where
6866    C: 'a,
6867{
6868    hub: &'a Sheets<C>,
6869    _request: SearchDeveloperMetadataRequest,
6870    _spreadsheet_id: String,
6871    _delegate: Option<&'a mut dyn common::Delegate>,
6872    _additional_params: HashMap<String, String>,
6873    _scopes: BTreeSet<String>,
6874}
6875
6876impl<'a, C> common::CallBuilder for SpreadsheetDeveloperMetadataSearchCall<'a, C> {}
6877
6878impl<'a, C> SpreadsheetDeveloperMetadataSearchCall<'a, C>
6879where
6880    C: common::Connector,
6881{
6882    /// Perform the operation you have build so far.
6883    pub async fn doit(
6884        mut self,
6885    ) -> common::Result<(common::Response, SearchDeveloperMetadataResponse)> {
6886        use std::borrow::Cow;
6887        use std::io::{Read, Seek};
6888
6889        use common::{url::Params, ToParts};
6890        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6891
6892        let mut dd = common::DefaultDelegate;
6893        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6894        dlg.begin(common::MethodInfo {
6895            id: "sheets.spreadsheets.developerMetadata.search",
6896            http_method: hyper::Method::POST,
6897        });
6898
6899        for &field in ["alt", "spreadsheetId"].iter() {
6900            if self._additional_params.contains_key(field) {
6901                dlg.finished(false);
6902                return Err(common::Error::FieldClash(field));
6903            }
6904        }
6905
6906        let mut params = Params::with_capacity(4 + self._additional_params.len());
6907        params.push("spreadsheetId", self._spreadsheet_id);
6908
6909        params.extend(self._additional_params.iter());
6910
6911        params.push("alt", "json");
6912        let mut url =
6913            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/developerMetadata:search";
6914        if self._scopes.is_empty() {
6915            self._scopes.insert(Scope::Drive.as_ref().to_string());
6916        }
6917
6918        #[allow(clippy::single_element_loop)]
6919        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
6920            url = params.uri_replacement(url, param_name, find_this, false);
6921        }
6922        {
6923            let to_remove = ["spreadsheetId"];
6924            params.remove_params(&to_remove);
6925        }
6926
6927        let url = params.parse_with_url(&url);
6928
6929        let mut json_mime_type = mime::APPLICATION_JSON;
6930        let mut request_value_reader = {
6931            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6932            common::remove_json_null_values(&mut value);
6933            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6934            serde_json::to_writer(&mut dst, &value).unwrap();
6935            dst
6936        };
6937        let request_size = request_value_reader
6938            .seek(std::io::SeekFrom::End(0))
6939            .unwrap();
6940        request_value_reader
6941            .seek(std::io::SeekFrom::Start(0))
6942            .unwrap();
6943
6944        loop {
6945            let token = match self
6946                .hub
6947                .auth
6948                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6949                .await
6950            {
6951                Ok(token) => token,
6952                Err(e) => match dlg.token(e) {
6953                    Ok(token) => token,
6954                    Err(e) => {
6955                        dlg.finished(false);
6956                        return Err(common::Error::MissingToken(e));
6957                    }
6958                },
6959            };
6960            request_value_reader
6961                .seek(std::io::SeekFrom::Start(0))
6962                .unwrap();
6963            let mut req_result = {
6964                let client = &self.hub.client;
6965                dlg.pre_request();
6966                let mut req_builder = hyper::Request::builder()
6967                    .method(hyper::Method::POST)
6968                    .uri(url.as_str())
6969                    .header(USER_AGENT, self.hub._user_agent.clone());
6970
6971                if let Some(token) = token.as_ref() {
6972                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6973                }
6974
6975                let request = req_builder
6976                    .header(CONTENT_TYPE, json_mime_type.to_string())
6977                    .header(CONTENT_LENGTH, request_size as u64)
6978                    .body(common::to_body(
6979                        request_value_reader.get_ref().clone().into(),
6980                    ));
6981
6982                client.request(request.unwrap()).await
6983            };
6984
6985            match req_result {
6986                Err(err) => {
6987                    if let common::Retry::After(d) = dlg.http_error(&err) {
6988                        sleep(d).await;
6989                        continue;
6990                    }
6991                    dlg.finished(false);
6992                    return Err(common::Error::HttpError(err));
6993                }
6994                Ok(res) => {
6995                    let (mut parts, body) = res.into_parts();
6996                    let mut body = common::Body::new(body);
6997                    if !parts.status.is_success() {
6998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6999                        let error = serde_json::from_str(&common::to_string(&bytes));
7000                        let response = common::to_response(parts, bytes.into());
7001
7002                        if let common::Retry::After(d) =
7003                            dlg.http_failure(&response, error.as_ref().ok())
7004                        {
7005                            sleep(d).await;
7006                            continue;
7007                        }
7008
7009                        dlg.finished(false);
7010
7011                        return Err(match error {
7012                            Ok(value) => common::Error::BadRequest(value),
7013                            _ => common::Error::Failure(response),
7014                        });
7015                    }
7016                    let response = {
7017                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7018                        let encoded = common::to_string(&bytes);
7019                        match serde_json::from_str(&encoded) {
7020                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7021                            Err(error) => {
7022                                dlg.response_json_decode_error(&encoded, &error);
7023                                return Err(common::Error::JsonDecodeError(
7024                                    encoded.to_string(),
7025                                    error,
7026                                ));
7027                            }
7028                        }
7029                    };
7030
7031                    dlg.finished(true);
7032                    return Ok(response);
7033                }
7034            }
7035        }
7036    }
7037
7038    ///
7039    /// Sets the *request* property to the given value.
7040    ///
7041    /// Even though the property as already been set when instantiating this call,
7042    /// we provide this method for API completeness.
7043    pub fn request(
7044        mut self,
7045        new_value: SearchDeveloperMetadataRequest,
7046    ) -> SpreadsheetDeveloperMetadataSearchCall<'a, C> {
7047        self._request = new_value;
7048        self
7049    }
7050    /// The ID of the spreadsheet to retrieve metadata from.
7051    ///
7052    /// Sets the *spreadsheet id* path property to the given value.
7053    ///
7054    /// Even though the property as already been set when instantiating this call,
7055    /// we provide this method for API completeness.
7056    pub fn spreadsheet_id(
7057        mut self,
7058        new_value: &str,
7059    ) -> SpreadsheetDeveloperMetadataSearchCall<'a, C> {
7060        self._spreadsheet_id = new_value.to_string();
7061        self
7062    }
7063    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7064    /// while executing the actual API request.
7065    ///
7066    /// ````text
7067    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7068    /// ````
7069    ///
7070    /// Sets the *delegate* property to the given value.
7071    pub fn delegate(
7072        mut self,
7073        new_value: &'a mut dyn common::Delegate,
7074    ) -> SpreadsheetDeveloperMetadataSearchCall<'a, C> {
7075        self._delegate = Some(new_value);
7076        self
7077    }
7078
7079    /// Set any additional parameter of the query string used in the request.
7080    /// It should be used to set parameters which are not yet available through their own
7081    /// setters.
7082    ///
7083    /// Please note that this method must not be used to set any of the known parameters
7084    /// which have their own setter method. If done anyway, the request will fail.
7085    ///
7086    /// # Additional Parameters
7087    ///
7088    /// * *$.xgafv* (query-string) - V1 error format.
7089    /// * *access_token* (query-string) - OAuth access token.
7090    /// * *alt* (query-string) - Data format for response.
7091    /// * *callback* (query-string) - JSONP
7092    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7093    /// * *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.
7094    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7095    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7096    /// * *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.
7097    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7098    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7099    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetDeveloperMetadataSearchCall<'a, C>
7100    where
7101        T: AsRef<str>,
7102    {
7103        self._additional_params
7104            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7105        self
7106    }
7107
7108    /// Identifies the authorization scope for the method you are building.
7109    ///
7110    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7111    /// [`Scope::Drive`].
7112    ///
7113    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7114    /// tokens for more than one scope.
7115    ///
7116    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7117    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7118    /// sufficient, a read-write scope will do as well.
7119    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetDeveloperMetadataSearchCall<'a, C>
7120    where
7121        St: AsRef<str>,
7122    {
7123        self._scopes.insert(String::from(scope.as_ref()));
7124        self
7125    }
7126    /// Identifies the authorization scope(s) for the method you are building.
7127    ///
7128    /// See [`Self::add_scope()`] for details.
7129    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetDeveloperMetadataSearchCall<'a, C>
7130    where
7131        I: IntoIterator<Item = St>,
7132        St: AsRef<str>,
7133    {
7134        self._scopes
7135            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7136        self
7137    }
7138
7139    /// Removes all scopes, and no default scope will be used either.
7140    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7141    /// for details).
7142    pub fn clear_scopes(mut self) -> SpreadsheetDeveloperMetadataSearchCall<'a, C> {
7143        self._scopes.clear();
7144        self
7145    }
7146}
7147
7148/// Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.
7149///
7150/// A builder for the *sheets.copyTo* method supported by a *spreadsheet* resource.
7151/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
7152///
7153/// # Example
7154///
7155/// Instantiate a resource method builder
7156///
7157/// ```test_harness,no_run
7158/// # extern crate hyper;
7159/// # extern crate hyper_rustls;
7160/// # extern crate google_sheets4 as sheets4;
7161/// use sheets4::api::CopySheetToAnotherSpreadsheetRequest;
7162/// # async fn dox() {
7163/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7164///
7165/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7166/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7167/// #     .with_native_roots()
7168/// #     .unwrap()
7169/// #     .https_only()
7170/// #     .enable_http2()
7171/// #     .build();
7172///
7173/// # let executor = hyper_util::rt::TokioExecutor::new();
7174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7175/// #     secret,
7176/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7177/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7178/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7179/// #     ),
7180/// # ).build().await.unwrap();
7181///
7182/// # let client = hyper_util::client::legacy::Client::builder(
7183/// #     hyper_util::rt::TokioExecutor::new()
7184/// # )
7185/// # .build(
7186/// #     hyper_rustls::HttpsConnectorBuilder::new()
7187/// #         .with_native_roots()
7188/// #         .unwrap()
7189/// #         .https_or_http()
7190/// #         .enable_http2()
7191/// #         .build()
7192/// # );
7193/// # let mut hub = Sheets::new(client, auth);
7194/// // As the method needs a request, you would usually fill it with the desired information
7195/// // into the respective structure. Some of the parts shown here might not be applicable !
7196/// // Values shown here are possibly random and not representative !
7197/// let mut req = CopySheetToAnotherSpreadsheetRequest::default();
7198///
7199/// // You can configure optional parameters by calling the respective setters at will, and
7200/// // execute the final call using `doit()`.
7201/// // Values shown here are possibly random and not representative !
7202/// let result = hub.spreadsheets().sheets_copy_to(req, "spreadsheetId", -12)
7203///              .doit().await;
7204/// # }
7205/// ```
7206pub struct SpreadsheetSheetCopyToCall<'a, C>
7207where
7208    C: 'a,
7209{
7210    hub: &'a Sheets<C>,
7211    _request: CopySheetToAnotherSpreadsheetRequest,
7212    _spreadsheet_id: String,
7213    _sheet_id: i32,
7214    _delegate: Option<&'a mut dyn common::Delegate>,
7215    _additional_params: HashMap<String, String>,
7216    _scopes: BTreeSet<String>,
7217}
7218
7219impl<'a, C> common::CallBuilder for SpreadsheetSheetCopyToCall<'a, C> {}
7220
7221impl<'a, C> SpreadsheetSheetCopyToCall<'a, C>
7222where
7223    C: common::Connector,
7224{
7225    /// Perform the operation you have build so far.
7226    pub async fn doit(mut self) -> common::Result<(common::Response, SheetProperties)> {
7227        use std::borrow::Cow;
7228        use std::io::{Read, Seek};
7229
7230        use common::{url::Params, ToParts};
7231        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7232
7233        let mut dd = common::DefaultDelegate;
7234        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7235        dlg.begin(common::MethodInfo {
7236            id: "sheets.spreadsheets.sheets.copyTo",
7237            http_method: hyper::Method::POST,
7238        });
7239
7240        for &field in ["alt", "spreadsheetId", "sheetId"].iter() {
7241            if self._additional_params.contains_key(field) {
7242                dlg.finished(false);
7243                return Err(common::Error::FieldClash(field));
7244            }
7245        }
7246
7247        let mut params = Params::with_capacity(5 + self._additional_params.len());
7248        params.push("spreadsheetId", self._spreadsheet_id);
7249        params.push("sheetId", self._sheet_id.to_string());
7250
7251        params.extend(self._additional_params.iter());
7252
7253        params.push("alt", "json");
7254        let mut url =
7255            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo";
7256        if self._scopes.is_empty() {
7257            self._scopes.insert(Scope::Drive.as_ref().to_string());
7258        }
7259
7260        #[allow(clippy::single_element_loop)]
7261        for &(find_this, param_name) in [
7262            ("{spreadsheetId}", "spreadsheetId"),
7263            ("{sheetId}", "sheetId"),
7264        ]
7265        .iter()
7266        {
7267            url = params.uri_replacement(url, param_name, find_this, false);
7268        }
7269        {
7270            let to_remove = ["sheetId", "spreadsheetId"];
7271            params.remove_params(&to_remove);
7272        }
7273
7274        let url = params.parse_with_url(&url);
7275
7276        let mut json_mime_type = mime::APPLICATION_JSON;
7277        let mut request_value_reader = {
7278            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7279            common::remove_json_null_values(&mut value);
7280            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7281            serde_json::to_writer(&mut dst, &value).unwrap();
7282            dst
7283        };
7284        let request_size = request_value_reader
7285            .seek(std::io::SeekFrom::End(0))
7286            .unwrap();
7287        request_value_reader
7288            .seek(std::io::SeekFrom::Start(0))
7289            .unwrap();
7290
7291        loop {
7292            let token = match self
7293                .hub
7294                .auth
7295                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7296                .await
7297            {
7298                Ok(token) => token,
7299                Err(e) => match dlg.token(e) {
7300                    Ok(token) => token,
7301                    Err(e) => {
7302                        dlg.finished(false);
7303                        return Err(common::Error::MissingToken(e));
7304                    }
7305                },
7306            };
7307            request_value_reader
7308                .seek(std::io::SeekFrom::Start(0))
7309                .unwrap();
7310            let mut req_result = {
7311                let client = &self.hub.client;
7312                dlg.pre_request();
7313                let mut req_builder = hyper::Request::builder()
7314                    .method(hyper::Method::POST)
7315                    .uri(url.as_str())
7316                    .header(USER_AGENT, self.hub._user_agent.clone());
7317
7318                if let Some(token) = token.as_ref() {
7319                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7320                }
7321
7322                let request = req_builder
7323                    .header(CONTENT_TYPE, json_mime_type.to_string())
7324                    .header(CONTENT_LENGTH, request_size as u64)
7325                    .body(common::to_body(
7326                        request_value_reader.get_ref().clone().into(),
7327                    ));
7328
7329                client.request(request.unwrap()).await
7330            };
7331
7332            match req_result {
7333                Err(err) => {
7334                    if let common::Retry::After(d) = dlg.http_error(&err) {
7335                        sleep(d).await;
7336                        continue;
7337                    }
7338                    dlg.finished(false);
7339                    return Err(common::Error::HttpError(err));
7340                }
7341                Ok(res) => {
7342                    let (mut parts, body) = res.into_parts();
7343                    let mut body = common::Body::new(body);
7344                    if !parts.status.is_success() {
7345                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7346                        let error = serde_json::from_str(&common::to_string(&bytes));
7347                        let response = common::to_response(parts, bytes.into());
7348
7349                        if let common::Retry::After(d) =
7350                            dlg.http_failure(&response, error.as_ref().ok())
7351                        {
7352                            sleep(d).await;
7353                            continue;
7354                        }
7355
7356                        dlg.finished(false);
7357
7358                        return Err(match error {
7359                            Ok(value) => common::Error::BadRequest(value),
7360                            _ => common::Error::Failure(response),
7361                        });
7362                    }
7363                    let response = {
7364                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7365                        let encoded = common::to_string(&bytes);
7366                        match serde_json::from_str(&encoded) {
7367                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7368                            Err(error) => {
7369                                dlg.response_json_decode_error(&encoded, &error);
7370                                return Err(common::Error::JsonDecodeError(
7371                                    encoded.to_string(),
7372                                    error,
7373                                ));
7374                            }
7375                        }
7376                    };
7377
7378                    dlg.finished(true);
7379                    return Ok(response);
7380                }
7381            }
7382        }
7383    }
7384
7385    ///
7386    /// Sets the *request* property to the given value.
7387    ///
7388    /// Even though the property as already been set when instantiating this call,
7389    /// we provide this method for API completeness.
7390    pub fn request(
7391        mut self,
7392        new_value: CopySheetToAnotherSpreadsheetRequest,
7393    ) -> SpreadsheetSheetCopyToCall<'a, C> {
7394        self._request = new_value;
7395        self
7396    }
7397    /// The ID of the spreadsheet containing the sheet to copy.
7398    ///
7399    /// Sets the *spreadsheet id* path property to the given value.
7400    ///
7401    /// Even though the property as already been set when instantiating this call,
7402    /// we provide this method for API completeness.
7403    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetSheetCopyToCall<'a, C> {
7404        self._spreadsheet_id = new_value.to_string();
7405        self
7406    }
7407    /// The ID of the sheet to copy.
7408    ///
7409    /// Sets the *sheet id* path property to the given value.
7410    ///
7411    /// Even though the property as already been set when instantiating this call,
7412    /// we provide this method for API completeness.
7413    pub fn sheet_id(mut self, new_value: i32) -> SpreadsheetSheetCopyToCall<'a, C> {
7414        self._sheet_id = new_value;
7415        self
7416    }
7417    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7418    /// while executing the actual API request.
7419    ///
7420    /// ````text
7421    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7422    /// ````
7423    ///
7424    /// Sets the *delegate* property to the given value.
7425    pub fn delegate(
7426        mut self,
7427        new_value: &'a mut dyn common::Delegate,
7428    ) -> SpreadsheetSheetCopyToCall<'a, C> {
7429        self._delegate = Some(new_value);
7430        self
7431    }
7432
7433    /// Set any additional parameter of the query string used in the request.
7434    /// It should be used to set parameters which are not yet available through their own
7435    /// setters.
7436    ///
7437    /// Please note that this method must not be used to set any of the known parameters
7438    /// which have their own setter method. If done anyway, the request will fail.
7439    ///
7440    /// # Additional Parameters
7441    ///
7442    /// * *$.xgafv* (query-string) - V1 error format.
7443    /// * *access_token* (query-string) - OAuth access token.
7444    /// * *alt* (query-string) - Data format for response.
7445    /// * *callback* (query-string) - JSONP
7446    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7447    /// * *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.
7448    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7449    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7450    /// * *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.
7451    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7452    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7453    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetSheetCopyToCall<'a, C>
7454    where
7455        T: AsRef<str>,
7456    {
7457        self._additional_params
7458            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7459        self
7460    }
7461
7462    /// Identifies the authorization scope for the method you are building.
7463    ///
7464    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7465    /// [`Scope::Drive`].
7466    ///
7467    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7468    /// tokens for more than one scope.
7469    ///
7470    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7471    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7472    /// sufficient, a read-write scope will do as well.
7473    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetSheetCopyToCall<'a, C>
7474    where
7475        St: AsRef<str>,
7476    {
7477        self._scopes.insert(String::from(scope.as_ref()));
7478        self
7479    }
7480    /// Identifies the authorization scope(s) for the method you are building.
7481    ///
7482    /// See [`Self::add_scope()`] for details.
7483    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetSheetCopyToCall<'a, C>
7484    where
7485        I: IntoIterator<Item = St>,
7486        St: AsRef<str>,
7487    {
7488        self._scopes
7489            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7490        self
7491    }
7492
7493    /// Removes all scopes, and no default scope will be used either.
7494    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7495    /// for details).
7496    pub fn clear_scopes(mut self) -> SpreadsheetSheetCopyToCall<'a, C> {
7497        self._scopes.clear();
7498        self
7499    }
7500}
7501
7502/// Appends values to a spreadsheet. The input range is used to search for existing data and find a "table" within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the [guide](https://developers.google.com/workspace/sheets/api/guides/values#appending_values) and [sample code](https://developers.google.com/workspace/sheets/api/samples/writing#append_values) for specific details of how tables are detected and data is appended. The caller must specify the spreadsheet ID, range, and a valueInputOption. The `valueInputOption` only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to.
7503///
7504/// A builder for the *values.append* method supported by a *spreadsheet* resource.
7505/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
7506///
7507/// # Example
7508///
7509/// Instantiate a resource method builder
7510///
7511/// ```test_harness,no_run
7512/// # extern crate hyper;
7513/// # extern crate hyper_rustls;
7514/// # extern crate google_sheets4 as sheets4;
7515/// use sheets4::api::ValueRange;
7516/// # async fn dox() {
7517/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7518///
7519/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7520/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7521/// #     .with_native_roots()
7522/// #     .unwrap()
7523/// #     .https_only()
7524/// #     .enable_http2()
7525/// #     .build();
7526///
7527/// # let executor = hyper_util::rt::TokioExecutor::new();
7528/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7529/// #     secret,
7530/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7531/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7532/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7533/// #     ),
7534/// # ).build().await.unwrap();
7535///
7536/// # let client = hyper_util::client::legacy::Client::builder(
7537/// #     hyper_util::rt::TokioExecutor::new()
7538/// # )
7539/// # .build(
7540/// #     hyper_rustls::HttpsConnectorBuilder::new()
7541/// #         .with_native_roots()
7542/// #         .unwrap()
7543/// #         .https_or_http()
7544/// #         .enable_http2()
7545/// #         .build()
7546/// # );
7547/// # let mut hub = Sheets::new(client, auth);
7548/// // As the method needs a request, you would usually fill it with the desired information
7549/// // into the respective structure. Some of the parts shown here might not be applicable !
7550/// // Values shown here are possibly random and not representative !
7551/// let mut req = ValueRange::default();
7552///
7553/// // You can configure optional parameters by calling the respective setters at will, and
7554/// // execute the final call using `doit()`.
7555/// // Values shown here are possibly random and not representative !
7556/// let result = hub.spreadsheets().values_append(req, "spreadsheetId", "range")
7557///              .value_input_option("ipsum")
7558///              .response_value_render_option("ipsum")
7559///              .response_date_time_render_option("est")
7560///              .insert_data_option("gubergren")
7561///              .include_values_in_response(false)
7562///              .doit().await;
7563/// # }
7564/// ```
7565pub struct SpreadsheetValueAppendCall<'a, C>
7566where
7567    C: 'a,
7568{
7569    hub: &'a Sheets<C>,
7570    _request: ValueRange,
7571    _spreadsheet_id: String,
7572    _range: String,
7573    _value_input_option: Option<String>,
7574    _response_value_render_option: Option<String>,
7575    _response_date_time_render_option: Option<String>,
7576    _insert_data_option: Option<String>,
7577    _include_values_in_response: Option<bool>,
7578    _delegate: Option<&'a mut dyn common::Delegate>,
7579    _additional_params: HashMap<String, String>,
7580    _scopes: BTreeSet<String>,
7581}
7582
7583impl<'a, C> common::CallBuilder for SpreadsheetValueAppendCall<'a, C> {}
7584
7585impl<'a, C> SpreadsheetValueAppendCall<'a, C>
7586where
7587    C: common::Connector,
7588{
7589    /// Perform the operation you have build so far.
7590    pub async fn doit(mut self) -> common::Result<(common::Response, AppendValuesResponse)> {
7591        use std::borrow::Cow;
7592        use std::io::{Read, Seek};
7593
7594        use common::{url::Params, ToParts};
7595        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7596
7597        let mut dd = common::DefaultDelegate;
7598        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7599        dlg.begin(common::MethodInfo {
7600            id: "sheets.spreadsheets.values.append",
7601            http_method: hyper::Method::POST,
7602        });
7603
7604        for &field in [
7605            "alt",
7606            "spreadsheetId",
7607            "range",
7608            "valueInputOption",
7609            "responseValueRenderOption",
7610            "responseDateTimeRenderOption",
7611            "insertDataOption",
7612            "includeValuesInResponse",
7613        ]
7614        .iter()
7615        {
7616            if self._additional_params.contains_key(field) {
7617                dlg.finished(false);
7618                return Err(common::Error::FieldClash(field));
7619            }
7620        }
7621
7622        let mut params = Params::with_capacity(10 + self._additional_params.len());
7623        params.push("spreadsheetId", self._spreadsheet_id);
7624        params.push("range", self._range);
7625        if let Some(value) = self._value_input_option.as_ref() {
7626            params.push("valueInputOption", value);
7627        }
7628        if let Some(value) = self._response_value_render_option.as_ref() {
7629            params.push("responseValueRenderOption", value);
7630        }
7631        if let Some(value) = self._response_date_time_render_option.as_ref() {
7632            params.push("responseDateTimeRenderOption", value);
7633        }
7634        if let Some(value) = self._insert_data_option.as_ref() {
7635            params.push("insertDataOption", value);
7636        }
7637        if let Some(value) = self._include_values_in_response.as_ref() {
7638            params.push("includeValuesInResponse", value.to_string());
7639        }
7640
7641        params.extend(self._additional_params.iter());
7642
7643        params.push("alt", "json");
7644        let mut url =
7645            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values/{range}:append";
7646        if self._scopes.is_empty() {
7647            self._scopes.insert(Scope::Drive.as_ref().to_string());
7648        }
7649
7650        #[allow(clippy::single_element_loop)]
7651        for &(find_this, param_name) in
7652            [("{spreadsheetId}", "spreadsheetId"), ("{range}", "range")].iter()
7653        {
7654            url = params.uri_replacement(url, param_name, find_this, false);
7655        }
7656        {
7657            let to_remove = ["range", "spreadsheetId"];
7658            params.remove_params(&to_remove);
7659        }
7660
7661        let url = params.parse_with_url(&url);
7662
7663        let mut json_mime_type = mime::APPLICATION_JSON;
7664        let mut request_value_reader = {
7665            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7666            common::remove_json_null_values(&mut value);
7667            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7668            serde_json::to_writer(&mut dst, &value).unwrap();
7669            dst
7670        };
7671        let request_size = request_value_reader
7672            .seek(std::io::SeekFrom::End(0))
7673            .unwrap();
7674        request_value_reader
7675            .seek(std::io::SeekFrom::Start(0))
7676            .unwrap();
7677
7678        loop {
7679            let token = match self
7680                .hub
7681                .auth
7682                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7683                .await
7684            {
7685                Ok(token) => token,
7686                Err(e) => match dlg.token(e) {
7687                    Ok(token) => token,
7688                    Err(e) => {
7689                        dlg.finished(false);
7690                        return Err(common::Error::MissingToken(e));
7691                    }
7692                },
7693            };
7694            request_value_reader
7695                .seek(std::io::SeekFrom::Start(0))
7696                .unwrap();
7697            let mut req_result = {
7698                let client = &self.hub.client;
7699                dlg.pre_request();
7700                let mut req_builder = hyper::Request::builder()
7701                    .method(hyper::Method::POST)
7702                    .uri(url.as_str())
7703                    .header(USER_AGENT, self.hub._user_agent.clone());
7704
7705                if let Some(token) = token.as_ref() {
7706                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7707                }
7708
7709                let request = req_builder
7710                    .header(CONTENT_TYPE, json_mime_type.to_string())
7711                    .header(CONTENT_LENGTH, request_size as u64)
7712                    .body(common::to_body(
7713                        request_value_reader.get_ref().clone().into(),
7714                    ));
7715
7716                client.request(request.unwrap()).await
7717            };
7718
7719            match req_result {
7720                Err(err) => {
7721                    if let common::Retry::After(d) = dlg.http_error(&err) {
7722                        sleep(d).await;
7723                        continue;
7724                    }
7725                    dlg.finished(false);
7726                    return Err(common::Error::HttpError(err));
7727                }
7728                Ok(res) => {
7729                    let (mut parts, body) = res.into_parts();
7730                    let mut body = common::Body::new(body);
7731                    if !parts.status.is_success() {
7732                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7733                        let error = serde_json::from_str(&common::to_string(&bytes));
7734                        let response = common::to_response(parts, bytes.into());
7735
7736                        if let common::Retry::After(d) =
7737                            dlg.http_failure(&response, error.as_ref().ok())
7738                        {
7739                            sleep(d).await;
7740                            continue;
7741                        }
7742
7743                        dlg.finished(false);
7744
7745                        return Err(match error {
7746                            Ok(value) => common::Error::BadRequest(value),
7747                            _ => common::Error::Failure(response),
7748                        });
7749                    }
7750                    let response = {
7751                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7752                        let encoded = common::to_string(&bytes);
7753                        match serde_json::from_str(&encoded) {
7754                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7755                            Err(error) => {
7756                                dlg.response_json_decode_error(&encoded, &error);
7757                                return Err(common::Error::JsonDecodeError(
7758                                    encoded.to_string(),
7759                                    error,
7760                                ));
7761                            }
7762                        }
7763                    };
7764
7765                    dlg.finished(true);
7766                    return Ok(response);
7767                }
7768            }
7769        }
7770    }
7771
7772    ///
7773    /// Sets the *request* property to the given value.
7774    ///
7775    /// Even though the property as already been set when instantiating this call,
7776    /// we provide this method for API completeness.
7777    pub fn request(mut self, new_value: ValueRange) -> SpreadsheetValueAppendCall<'a, C> {
7778        self._request = new_value;
7779        self
7780    }
7781    /// The ID of the spreadsheet to update.
7782    ///
7783    /// Sets the *spreadsheet id* path property to the given value.
7784    ///
7785    /// Even though the property as already been set when instantiating this call,
7786    /// we provide this method for API completeness.
7787    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueAppendCall<'a, C> {
7788        self._spreadsheet_id = new_value.to_string();
7789        self
7790    }
7791    /// The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of a range to search for a logical table of data. Values are appended after the last row of the table.
7792    ///
7793    /// Sets the *range* path property to the given value.
7794    ///
7795    /// Even though the property as already been set when instantiating this call,
7796    /// we provide this method for API completeness.
7797    pub fn range(mut self, new_value: &str) -> SpreadsheetValueAppendCall<'a, C> {
7798        self._range = new_value.to_string();
7799        self
7800    }
7801    /// How the input data should be interpreted.
7802    ///
7803    /// Sets the *value input option* query property to the given value.
7804    pub fn value_input_option(mut self, new_value: &str) -> SpreadsheetValueAppendCall<'a, C> {
7805        self._value_input_option = Some(new_value.to_string());
7806        self
7807    }
7808    /// Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
7809    ///
7810    /// Sets the *response value render option* query property to the given value.
7811    pub fn response_value_render_option(
7812        mut self,
7813        new_value: &str,
7814    ) -> SpreadsheetValueAppendCall<'a, C> {
7815        self._response_value_render_option = Some(new_value.to_string());
7816        self
7817    }
7818    /// Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
7819    ///
7820    /// Sets the *response date time render option* query property to the given value.
7821    pub fn response_date_time_render_option(
7822        mut self,
7823        new_value: &str,
7824    ) -> SpreadsheetValueAppendCall<'a, C> {
7825        self._response_date_time_render_option = Some(new_value.to_string());
7826        self
7827    }
7828    /// How the input data should be inserted.
7829    ///
7830    /// Sets the *insert data option* query property to the given value.
7831    pub fn insert_data_option(mut self, new_value: &str) -> SpreadsheetValueAppendCall<'a, C> {
7832        self._insert_data_option = Some(new_value.to_string());
7833        self
7834    }
7835    /// Determines if the update response should include the values of the cells that were appended. By default, responses do not include the updated values.
7836    ///
7837    /// Sets the *include values in response* query property to the given value.
7838    pub fn include_values_in_response(
7839        mut self,
7840        new_value: bool,
7841    ) -> SpreadsheetValueAppendCall<'a, C> {
7842        self._include_values_in_response = Some(new_value);
7843        self
7844    }
7845    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7846    /// while executing the actual API request.
7847    ///
7848    /// ````text
7849    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7850    /// ````
7851    ///
7852    /// Sets the *delegate* property to the given value.
7853    pub fn delegate(
7854        mut self,
7855        new_value: &'a mut dyn common::Delegate,
7856    ) -> SpreadsheetValueAppendCall<'a, C> {
7857        self._delegate = Some(new_value);
7858        self
7859    }
7860
7861    /// Set any additional parameter of the query string used in the request.
7862    /// It should be used to set parameters which are not yet available through their own
7863    /// setters.
7864    ///
7865    /// Please note that this method must not be used to set any of the known parameters
7866    /// which have their own setter method. If done anyway, the request will fail.
7867    ///
7868    /// # Additional Parameters
7869    ///
7870    /// * *$.xgafv* (query-string) - V1 error format.
7871    /// * *access_token* (query-string) - OAuth access token.
7872    /// * *alt* (query-string) - Data format for response.
7873    /// * *callback* (query-string) - JSONP
7874    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7875    /// * *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.
7876    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7877    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7878    /// * *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.
7879    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7880    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7881    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueAppendCall<'a, C>
7882    where
7883        T: AsRef<str>,
7884    {
7885        self._additional_params
7886            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7887        self
7888    }
7889
7890    /// Identifies the authorization scope for the method you are building.
7891    ///
7892    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7893    /// [`Scope::Drive`].
7894    ///
7895    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7896    /// tokens for more than one scope.
7897    ///
7898    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7899    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7900    /// sufficient, a read-write scope will do as well.
7901    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueAppendCall<'a, C>
7902    where
7903        St: AsRef<str>,
7904    {
7905        self._scopes.insert(String::from(scope.as_ref()));
7906        self
7907    }
7908    /// Identifies the authorization scope(s) for the method you are building.
7909    ///
7910    /// See [`Self::add_scope()`] for details.
7911    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueAppendCall<'a, C>
7912    where
7913        I: IntoIterator<Item = St>,
7914        St: AsRef<str>,
7915    {
7916        self._scopes
7917            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7918        self
7919    }
7920
7921    /// Removes all scopes, and no default scope will be used either.
7922    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7923    /// for details).
7924    pub fn clear_scopes(mut self) -> SpreadsheetValueAppendCall<'a, C> {
7925        self._scopes.clear();
7926        self
7927    }
7928}
7929
7930/// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges. Only values are cleared -- all other properties of the cell (such as formatting and data validation) are kept.
7931///
7932/// A builder for the *values.batchClear* method supported by a *spreadsheet* resource.
7933/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
7934///
7935/// # Example
7936///
7937/// Instantiate a resource method builder
7938///
7939/// ```test_harness,no_run
7940/// # extern crate hyper;
7941/// # extern crate hyper_rustls;
7942/// # extern crate google_sheets4 as sheets4;
7943/// use sheets4::api::BatchClearValuesRequest;
7944/// # async fn dox() {
7945/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7946///
7947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7948/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7949/// #     .with_native_roots()
7950/// #     .unwrap()
7951/// #     .https_only()
7952/// #     .enable_http2()
7953/// #     .build();
7954///
7955/// # let executor = hyper_util::rt::TokioExecutor::new();
7956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7957/// #     secret,
7958/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7959/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7960/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7961/// #     ),
7962/// # ).build().await.unwrap();
7963///
7964/// # let client = hyper_util::client::legacy::Client::builder(
7965/// #     hyper_util::rt::TokioExecutor::new()
7966/// # )
7967/// # .build(
7968/// #     hyper_rustls::HttpsConnectorBuilder::new()
7969/// #         .with_native_roots()
7970/// #         .unwrap()
7971/// #         .https_or_http()
7972/// #         .enable_http2()
7973/// #         .build()
7974/// # );
7975/// # let mut hub = Sheets::new(client, auth);
7976/// // As the method needs a request, you would usually fill it with the desired information
7977/// // into the respective structure. Some of the parts shown here might not be applicable !
7978/// // Values shown here are possibly random and not representative !
7979/// let mut req = BatchClearValuesRequest::default();
7980///
7981/// // You can configure optional parameters by calling the respective setters at will, and
7982/// // execute the final call using `doit()`.
7983/// // Values shown here are possibly random and not representative !
7984/// let result = hub.spreadsheets().values_batch_clear(req, "spreadsheetId")
7985///              .doit().await;
7986/// # }
7987/// ```
7988pub struct SpreadsheetValueBatchClearCall<'a, C>
7989where
7990    C: 'a,
7991{
7992    hub: &'a Sheets<C>,
7993    _request: BatchClearValuesRequest,
7994    _spreadsheet_id: String,
7995    _delegate: Option<&'a mut dyn common::Delegate>,
7996    _additional_params: HashMap<String, String>,
7997    _scopes: BTreeSet<String>,
7998}
7999
8000impl<'a, C> common::CallBuilder for SpreadsheetValueBatchClearCall<'a, C> {}
8001
8002impl<'a, C> SpreadsheetValueBatchClearCall<'a, C>
8003where
8004    C: common::Connector,
8005{
8006    /// Perform the operation you have build so far.
8007    pub async fn doit(mut self) -> common::Result<(common::Response, BatchClearValuesResponse)> {
8008        use std::borrow::Cow;
8009        use std::io::{Read, Seek};
8010
8011        use common::{url::Params, ToParts};
8012        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8013
8014        let mut dd = common::DefaultDelegate;
8015        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8016        dlg.begin(common::MethodInfo {
8017            id: "sheets.spreadsheets.values.batchClear",
8018            http_method: hyper::Method::POST,
8019        });
8020
8021        for &field in ["alt", "spreadsheetId"].iter() {
8022            if self._additional_params.contains_key(field) {
8023                dlg.finished(false);
8024                return Err(common::Error::FieldClash(field));
8025            }
8026        }
8027
8028        let mut params = Params::with_capacity(4 + self._additional_params.len());
8029        params.push("spreadsheetId", self._spreadsheet_id);
8030
8031        params.extend(self._additional_params.iter());
8032
8033        params.push("alt", "json");
8034        let mut url =
8035            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values:batchClear";
8036        if self._scopes.is_empty() {
8037            self._scopes.insert(Scope::Drive.as_ref().to_string());
8038        }
8039
8040        #[allow(clippy::single_element_loop)]
8041        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
8042            url = params.uri_replacement(url, param_name, find_this, false);
8043        }
8044        {
8045            let to_remove = ["spreadsheetId"];
8046            params.remove_params(&to_remove);
8047        }
8048
8049        let url = params.parse_with_url(&url);
8050
8051        let mut json_mime_type = mime::APPLICATION_JSON;
8052        let mut request_value_reader = {
8053            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8054            common::remove_json_null_values(&mut value);
8055            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8056            serde_json::to_writer(&mut dst, &value).unwrap();
8057            dst
8058        };
8059        let request_size = request_value_reader
8060            .seek(std::io::SeekFrom::End(0))
8061            .unwrap();
8062        request_value_reader
8063            .seek(std::io::SeekFrom::Start(0))
8064            .unwrap();
8065
8066        loop {
8067            let token = match self
8068                .hub
8069                .auth
8070                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8071                .await
8072            {
8073                Ok(token) => token,
8074                Err(e) => match dlg.token(e) {
8075                    Ok(token) => token,
8076                    Err(e) => {
8077                        dlg.finished(false);
8078                        return Err(common::Error::MissingToken(e));
8079                    }
8080                },
8081            };
8082            request_value_reader
8083                .seek(std::io::SeekFrom::Start(0))
8084                .unwrap();
8085            let mut req_result = {
8086                let client = &self.hub.client;
8087                dlg.pre_request();
8088                let mut req_builder = hyper::Request::builder()
8089                    .method(hyper::Method::POST)
8090                    .uri(url.as_str())
8091                    .header(USER_AGENT, self.hub._user_agent.clone());
8092
8093                if let Some(token) = token.as_ref() {
8094                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8095                }
8096
8097                let request = req_builder
8098                    .header(CONTENT_TYPE, json_mime_type.to_string())
8099                    .header(CONTENT_LENGTH, request_size as u64)
8100                    .body(common::to_body(
8101                        request_value_reader.get_ref().clone().into(),
8102                    ));
8103
8104                client.request(request.unwrap()).await
8105            };
8106
8107            match req_result {
8108                Err(err) => {
8109                    if let common::Retry::After(d) = dlg.http_error(&err) {
8110                        sleep(d).await;
8111                        continue;
8112                    }
8113                    dlg.finished(false);
8114                    return Err(common::Error::HttpError(err));
8115                }
8116                Ok(res) => {
8117                    let (mut parts, body) = res.into_parts();
8118                    let mut body = common::Body::new(body);
8119                    if !parts.status.is_success() {
8120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8121                        let error = serde_json::from_str(&common::to_string(&bytes));
8122                        let response = common::to_response(parts, bytes.into());
8123
8124                        if let common::Retry::After(d) =
8125                            dlg.http_failure(&response, error.as_ref().ok())
8126                        {
8127                            sleep(d).await;
8128                            continue;
8129                        }
8130
8131                        dlg.finished(false);
8132
8133                        return Err(match error {
8134                            Ok(value) => common::Error::BadRequest(value),
8135                            _ => common::Error::Failure(response),
8136                        });
8137                    }
8138                    let response = {
8139                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8140                        let encoded = common::to_string(&bytes);
8141                        match serde_json::from_str(&encoded) {
8142                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8143                            Err(error) => {
8144                                dlg.response_json_decode_error(&encoded, &error);
8145                                return Err(common::Error::JsonDecodeError(
8146                                    encoded.to_string(),
8147                                    error,
8148                                ));
8149                            }
8150                        }
8151                    };
8152
8153                    dlg.finished(true);
8154                    return Ok(response);
8155                }
8156            }
8157        }
8158    }
8159
8160    ///
8161    /// Sets the *request* property to the given value.
8162    ///
8163    /// Even though the property as already been set when instantiating this call,
8164    /// we provide this method for API completeness.
8165    pub fn request(
8166        mut self,
8167        new_value: BatchClearValuesRequest,
8168    ) -> SpreadsheetValueBatchClearCall<'a, C> {
8169        self._request = new_value;
8170        self
8171    }
8172    /// The ID of the spreadsheet to update.
8173    ///
8174    /// Sets the *spreadsheet id* path property to the given value.
8175    ///
8176    /// Even though the property as already been set when instantiating this call,
8177    /// we provide this method for API completeness.
8178    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueBatchClearCall<'a, C> {
8179        self._spreadsheet_id = new_value.to_string();
8180        self
8181    }
8182    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8183    /// while executing the actual API request.
8184    ///
8185    /// ````text
8186    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8187    /// ````
8188    ///
8189    /// Sets the *delegate* property to the given value.
8190    pub fn delegate(
8191        mut self,
8192        new_value: &'a mut dyn common::Delegate,
8193    ) -> SpreadsheetValueBatchClearCall<'a, C> {
8194        self._delegate = Some(new_value);
8195        self
8196    }
8197
8198    /// Set any additional parameter of the query string used in the request.
8199    /// It should be used to set parameters which are not yet available through their own
8200    /// setters.
8201    ///
8202    /// Please note that this method must not be used to set any of the known parameters
8203    /// which have their own setter method. If done anyway, the request will fail.
8204    ///
8205    /// # Additional Parameters
8206    ///
8207    /// * *$.xgafv* (query-string) - V1 error format.
8208    /// * *access_token* (query-string) - OAuth access token.
8209    /// * *alt* (query-string) - Data format for response.
8210    /// * *callback* (query-string) - JSONP
8211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8212    /// * *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.
8213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8215    /// * *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.
8216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8218    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueBatchClearCall<'a, C>
8219    where
8220        T: AsRef<str>,
8221    {
8222        self._additional_params
8223            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8224        self
8225    }
8226
8227    /// Identifies the authorization scope for the method you are building.
8228    ///
8229    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8230    /// [`Scope::Drive`].
8231    ///
8232    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8233    /// tokens for more than one scope.
8234    ///
8235    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8236    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8237    /// sufficient, a read-write scope will do as well.
8238    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchClearCall<'a, C>
8239    where
8240        St: AsRef<str>,
8241    {
8242        self._scopes.insert(String::from(scope.as_ref()));
8243        self
8244    }
8245    /// Identifies the authorization scope(s) for the method you are building.
8246    ///
8247    /// See [`Self::add_scope()`] for details.
8248    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueBatchClearCall<'a, C>
8249    where
8250        I: IntoIterator<Item = St>,
8251        St: AsRef<str>,
8252    {
8253        self._scopes
8254            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8255        self
8256    }
8257
8258    /// Removes all scopes, and no default scope will be used either.
8259    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8260    /// for details).
8261    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchClearCall<'a, C> {
8262        self._scopes.clear();
8263        self
8264    }
8265}
8266
8267/// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
8268///
8269/// A builder for the *values.batchClearByDataFilter* method supported by a *spreadsheet* resource.
8270/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
8271///
8272/// # Example
8273///
8274/// Instantiate a resource method builder
8275///
8276/// ```test_harness,no_run
8277/// # extern crate hyper;
8278/// # extern crate hyper_rustls;
8279/// # extern crate google_sheets4 as sheets4;
8280/// use sheets4::api::BatchClearValuesByDataFilterRequest;
8281/// # async fn dox() {
8282/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8283///
8284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8285/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8286/// #     .with_native_roots()
8287/// #     .unwrap()
8288/// #     .https_only()
8289/// #     .enable_http2()
8290/// #     .build();
8291///
8292/// # let executor = hyper_util::rt::TokioExecutor::new();
8293/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8294/// #     secret,
8295/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8296/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8297/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8298/// #     ),
8299/// # ).build().await.unwrap();
8300///
8301/// # let client = hyper_util::client::legacy::Client::builder(
8302/// #     hyper_util::rt::TokioExecutor::new()
8303/// # )
8304/// # .build(
8305/// #     hyper_rustls::HttpsConnectorBuilder::new()
8306/// #         .with_native_roots()
8307/// #         .unwrap()
8308/// #         .https_or_http()
8309/// #         .enable_http2()
8310/// #         .build()
8311/// # );
8312/// # let mut hub = Sheets::new(client, auth);
8313/// // As the method needs a request, you would usually fill it with the desired information
8314/// // into the respective structure. Some of the parts shown here might not be applicable !
8315/// // Values shown here are possibly random and not representative !
8316/// let mut req = BatchClearValuesByDataFilterRequest::default();
8317///
8318/// // You can configure optional parameters by calling the respective setters at will, and
8319/// // execute the final call using `doit()`.
8320/// // Values shown here are possibly random and not representative !
8321/// let result = hub.spreadsheets().values_batch_clear_by_data_filter(req, "spreadsheetId")
8322///              .doit().await;
8323/// # }
8324/// ```
8325pub struct SpreadsheetValueBatchClearByDataFilterCall<'a, C>
8326where
8327    C: 'a,
8328{
8329    hub: &'a Sheets<C>,
8330    _request: BatchClearValuesByDataFilterRequest,
8331    _spreadsheet_id: String,
8332    _delegate: Option<&'a mut dyn common::Delegate>,
8333    _additional_params: HashMap<String, String>,
8334    _scopes: BTreeSet<String>,
8335}
8336
8337impl<'a, C> common::CallBuilder for SpreadsheetValueBatchClearByDataFilterCall<'a, C> {}
8338
8339impl<'a, C> SpreadsheetValueBatchClearByDataFilterCall<'a, C>
8340where
8341    C: common::Connector,
8342{
8343    /// Perform the operation you have build so far.
8344    pub async fn doit(
8345        mut self,
8346    ) -> common::Result<(common::Response, BatchClearValuesByDataFilterResponse)> {
8347        use std::borrow::Cow;
8348        use std::io::{Read, Seek};
8349
8350        use common::{url::Params, ToParts};
8351        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8352
8353        let mut dd = common::DefaultDelegate;
8354        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8355        dlg.begin(common::MethodInfo {
8356            id: "sheets.spreadsheets.values.batchClearByDataFilter",
8357            http_method: hyper::Method::POST,
8358        });
8359
8360        for &field in ["alt", "spreadsheetId"].iter() {
8361            if self._additional_params.contains_key(field) {
8362                dlg.finished(false);
8363                return Err(common::Error::FieldClash(field));
8364            }
8365        }
8366
8367        let mut params = Params::with_capacity(4 + self._additional_params.len());
8368        params.push("spreadsheetId", self._spreadsheet_id);
8369
8370        params.extend(self._additional_params.iter());
8371
8372        params.push("alt", "json");
8373        let mut url = self.hub._base_url.clone()
8374            + "v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter";
8375        if self._scopes.is_empty() {
8376            self._scopes.insert(Scope::Drive.as_ref().to_string());
8377        }
8378
8379        #[allow(clippy::single_element_loop)]
8380        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
8381            url = params.uri_replacement(url, param_name, find_this, false);
8382        }
8383        {
8384            let to_remove = ["spreadsheetId"];
8385            params.remove_params(&to_remove);
8386        }
8387
8388        let url = params.parse_with_url(&url);
8389
8390        let mut json_mime_type = mime::APPLICATION_JSON;
8391        let mut request_value_reader = {
8392            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8393            common::remove_json_null_values(&mut value);
8394            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8395            serde_json::to_writer(&mut dst, &value).unwrap();
8396            dst
8397        };
8398        let request_size = request_value_reader
8399            .seek(std::io::SeekFrom::End(0))
8400            .unwrap();
8401        request_value_reader
8402            .seek(std::io::SeekFrom::Start(0))
8403            .unwrap();
8404
8405        loop {
8406            let token = match self
8407                .hub
8408                .auth
8409                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8410                .await
8411            {
8412                Ok(token) => token,
8413                Err(e) => match dlg.token(e) {
8414                    Ok(token) => token,
8415                    Err(e) => {
8416                        dlg.finished(false);
8417                        return Err(common::Error::MissingToken(e));
8418                    }
8419                },
8420            };
8421            request_value_reader
8422                .seek(std::io::SeekFrom::Start(0))
8423                .unwrap();
8424            let mut req_result = {
8425                let client = &self.hub.client;
8426                dlg.pre_request();
8427                let mut req_builder = hyper::Request::builder()
8428                    .method(hyper::Method::POST)
8429                    .uri(url.as_str())
8430                    .header(USER_AGENT, self.hub._user_agent.clone());
8431
8432                if let Some(token) = token.as_ref() {
8433                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8434                }
8435
8436                let request = req_builder
8437                    .header(CONTENT_TYPE, json_mime_type.to_string())
8438                    .header(CONTENT_LENGTH, request_size as u64)
8439                    .body(common::to_body(
8440                        request_value_reader.get_ref().clone().into(),
8441                    ));
8442
8443                client.request(request.unwrap()).await
8444            };
8445
8446            match req_result {
8447                Err(err) => {
8448                    if let common::Retry::After(d) = dlg.http_error(&err) {
8449                        sleep(d).await;
8450                        continue;
8451                    }
8452                    dlg.finished(false);
8453                    return Err(common::Error::HttpError(err));
8454                }
8455                Ok(res) => {
8456                    let (mut parts, body) = res.into_parts();
8457                    let mut body = common::Body::new(body);
8458                    if !parts.status.is_success() {
8459                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8460                        let error = serde_json::from_str(&common::to_string(&bytes));
8461                        let response = common::to_response(parts, bytes.into());
8462
8463                        if let common::Retry::After(d) =
8464                            dlg.http_failure(&response, error.as_ref().ok())
8465                        {
8466                            sleep(d).await;
8467                            continue;
8468                        }
8469
8470                        dlg.finished(false);
8471
8472                        return Err(match error {
8473                            Ok(value) => common::Error::BadRequest(value),
8474                            _ => common::Error::Failure(response),
8475                        });
8476                    }
8477                    let response = {
8478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8479                        let encoded = common::to_string(&bytes);
8480                        match serde_json::from_str(&encoded) {
8481                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8482                            Err(error) => {
8483                                dlg.response_json_decode_error(&encoded, &error);
8484                                return Err(common::Error::JsonDecodeError(
8485                                    encoded.to_string(),
8486                                    error,
8487                                ));
8488                            }
8489                        }
8490                    };
8491
8492                    dlg.finished(true);
8493                    return Ok(response);
8494                }
8495            }
8496        }
8497    }
8498
8499    ///
8500    /// Sets the *request* property to the given value.
8501    ///
8502    /// Even though the property as already been set when instantiating this call,
8503    /// we provide this method for API completeness.
8504    pub fn request(
8505        mut self,
8506        new_value: BatchClearValuesByDataFilterRequest,
8507    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C> {
8508        self._request = new_value;
8509        self
8510    }
8511    /// The ID of the spreadsheet to update.
8512    ///
8513    /// Sets the *spreadsheet id* path property to the given value.
8514    ///
8515    /// Even though the property as already been set when instantiating this call,
8516    /// we provide this method for API completeness.
8517    pub fn spreadsheet_id(
8518        mut self,
8519        new_value: &str,
8520    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C> {
8521        self._spreadsheet_id = new_value.to_string();
8522        self
8523    }
8524    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8525    /// while executing the actual API request.
8526    ///
8527    /// ````text
8528    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8529    /// ````
8530    ///
8531    /// Sets the *delegate* property to the given value.
8532    pub fn delegate(
8533        mut self,
8534        new_value: &'a mut dyn common::Delegate,
8535    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C> {
8536        self._delegate = Some(new_value);
8537        self
8538    }
8539
8540    /// Set any additional parameter of the query string used in the request.
8541    /// It should be used to set parameters which are not yet available through their own
8542    /// setters.
8543    ///
8544    /// Please note that this method must not be used to set any of the known parameters
8545    /// which have their own setter method. If done anyway, the request will fail.
8546    ///
8547    /// # Additional Parameters
8548    ///
8549    /// * *$.xgafv* (query-string) - V1 error format.
8550    /// * *access_token* (query-string) - OAuth access token.
8551    /// * *alt* (query-string) - Data format for response.
8552    /// * *callback* (query-string) - JSONP
8553    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8554    /// * *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.
8555    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8556    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8557    /// * *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.
8558    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8559    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8560    pub fn param<T>(
8561        mut self,
8562        name: T,
8563        value: T,
8564    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C>
8565    where
8566        T: AsRef<str>,
8567    {
8568        self._additional_params
8569            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8570        self
8571    }
8572
8573    /// Identifies the authorization scope for the method you are building.
8574    ///
8575    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8576    /// [`Scope::Drive`].
8577    ///
8578    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8579    /// tokens for more than one scope.
8580    ///
8581    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8582    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8583    /// sufficient, a read-write scope will do as well.
8584    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C>
8585    where
8586        St: AsRef<str>,
8587    {
8588        self._scopes.insert(String::from(scope.as_ref()));
8589        self
8590    }
8591    /// Identifies the authorization scope(s) for the method you are building.
8592    ///
8593    /// See [`Self::add_scope()`] for details.
8594    pub fn add_scopes<I, St>(
8595        mut self,
8596        scopes: I,
8597    ) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C>
8598    where
8599        I: IntoIterator<Item = St>,
8600        St: AsRef<str>,
8601    {
8602        self._scopes
8603            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8604        self
8605    }
8606
8607    /// Removes all scopes, and no default scope will be used either.
8608    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8609    /// for details).
8610    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchClearByDataFilterCall<'a, C> {
8611        self._scopes.clear();
8612        self
8613    }
8614}
8615
8616/// Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.
8617///
8618/// A builder for the *values.batchGet* method supported by a *spreadsheet* resource.
8619/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
8620///
8621/// # Example
8622///
8623/// Instantiate a resource method builder
8624///
8625/// ```test_harness,no_run
8626/// # extern crate hyper;
8627/// # extern crate hyper_rustls;
8628/// # extern crate google_sheets4 as sheets4;
8629/// # async fn dox() {
8630/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8631///
8632/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8633/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8634/// #     .with_native_roots()
8635/// #     .unwrap()
8636/// #     .https_only()
8637/// #     .enable_http2()
8638/// #     .build();
8639///
8640/// # let executor = hyper_util::rt::TokioExecutor::new();
8641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8642/// #     secret,
8643/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8644/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8645/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8646/// #     ),
8647/// # ).build().await.unwrap();
8648///
8649/// # let client = hyper_util::client::legacy::Client::builder(
8650/// #     hyper_util::rt::TokioExecutor::new()
8651/// # )
8652/// # .build(
8653/// #     hyper_rustls::HttpsConnectorBuilder::new()
8654/// #         .with_native_roots()
8655/// #         .unwrap()
8656/// #         .https_or_http()
8657/// #         .enable_http2()
8658/// #         .build()
8659/// # );
8660/// # let mut hub = Sheets::new(client, auth);
8661/// // You can configure optional parameters by calling the respective setters at will, and
8662/// // execute the final call using `doit()`.
8663/// // Values shown here are possibly random and not representative !
8664/// let result = hub.spreadsheets().values_batch_get("spreadsheetId")
8665///              .value_render_option("sed")
8666///              .add_ranges("duo")
8667///              .major_dimension("sed")
8668///              .date_time_render_option("no")
8669///              .doit().await;
8670/// # }
8671/// ```
8672pub struct SpreadsheetValueBatchGetCall<'a, C>
8673where
8674    C: 'a,
8675{
8676    hub: &'a Sheets<C>,
8677    _spreadsheet_id: String,
8678    _value_render_option: Option<String>,
8679    _ranges: Vec<String>,
8680    _major_dimension: Option<String>,
8681    _date_time_render_option: Option<String>,
8682    _delegate: Option<&'a mut dyn common::Delegate>,
8683    _additional_params: HashMap<String, String>,
8684    _scopes: BTreeSet<String>,
8685}
8686
8687impl<'a, C> common::CallBuilder for SpreadsheetValueBatchGetCall<'a, C> {}
8688
8689impl<'a, C> SpreadsheetValueBatchGetCall<'a, C>
8690where
8691    C: common::Connector,
8692{
8693    /// Perform the operation you have build so far.
8694    pub async fn doit(mut self) -> common::Result<(common::Response, BatchGetValuesResponse)> {
8695        use std::borrow::Cow;
8696        use std::io::{Read, Seek};
8697
8698        use common::{url::Params, ToParts};
8699        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8700
8701        let mut dd = common::DefaultDelegate;
8702        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8703        dlg.begin(common::MethodInfo {
8704            id: "sheets.spreadsheets.values.batchGet",
8705            http_method: hyper::Method::GET,
8706        });
8707
8708        for &field in [
8709            "alt",
8710            "spreadsheetId",
8711            "valueRenderOption",
8712            "ranges",
8713            "majorDimension",
8714            "dateTimeRenderOption",
8715        ]
8716        .iter()
8717        {
8718            if self._additional_params.contains_key(field) {
8719                dlg.finished(false);
8720                return Err(common::Error::FieldClash(field));
8721            }
8722        }
8723
8724        let mut params = Params::with_capacity(7 + self._additional_params.len());
8725        params.push("spreadsheetId", self._spreadsheet_id);
8726        if let Some(value) = self._value_render_option.as_ref() {
8727            params.push("valueRenderOption", value);
8728        }
8729        if !self._ranges.is_empty() {
8730            for f in self._ranges.iter() {
8731                params.push("ranges", f);
8732            }
8733        }
8734        if let Some(value) = self._major_dimension.as_ref() {
8735            params.push("majorDimension", value);
8736        }
8737        if let Some(value) = self._date_time_render_option.as_ref() {
8738            params.push("dateTimeRenderOption", value);
8739        }
8740
8741        params.extend(self._additional_params.iter());
8742
8743        params.push("alt", "json");
8744        let mut url =
8745            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values:batchGet";
8746        if self._scopes.is_empty() {
8747            self._scopes
8748                .insert(Scope::DriveReadonly.as_ref().to_string());
8749        }
8750
8751        #[allow(clippy::single_element_loop)]
8752        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
8753            url = params.uri_replacement(url, param_name, find_this, false);
8754        }
8755        {
8756            let to_remove = ["spreadsheetId"];
8757            params.remove_params(&to_remove);
8758        }
8759
8760        let url = params.parse_with_url(&url);
8761
8762        loop {
8763            let token = match self
8764                .hub
8765                .auth
8766                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8767                .await
8768            {
8769                Ok(token) => token,
8770                Err(e) => match dlg.token(e) {
8771                    Ok(token) => token,
8772                    Err(e) => {
8773                        dlg.finished(false);
8774                        return Err(common::Error::MissingToken(e));
8775                    }
8776                },
8777            };
8778            let mut req_result = {
8779                let client = &self.hub.client;
8780                dlg.pre_request();
8781                let mut req_builder = hyper::Request::builder()
8782                    .method(hyper::Method::GET)
8783                    .uri(url.as_str())
8784                    .header(USER_AGENT, self.hub._user_agent.clone());
8785
8786                if let Some(token) = token.as_ref() {
8787                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8788                }
8789
8790                let request = req_builder
8791                    .header(CONTENT_LENGTH, 0_u64)
8792                    .body(common::to_body::<String>(None));
8793
8794                client.request(request.unwrap()).await
8795            };
8796
8797            match req_result {
8798                Err(err) => {
8799                    if let common::Retry::After(d) = dlg.http_error(&err) {
8800                        sleep(d).await;
8801                        continue;
8802                    }
8803                    dlg.finished(false);
8804                    return Err(common::Error::HttpError(err));
8805                }
8806                Ok(res) => {
8807                    let (mut parts, body) = res.into_parts();
8808                    let mut body = common::Body::new(body);
8809                    if !parts.status.is_success() {
8810                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8811                        let error = serde_json::from_str(&common::to_string(&bytes));
8812                        let response = common::to_response(parts, bytes.into());
8813
8814                        if let common::Retry::After(d) =
8815                            dlg.http_failure(&response, error.as_ref().ok())
8816                        {
8817                            sleep(d).await;
8818                            continue;
8819                        }
8820
8821                        dlg.finished(false);
8822
8823                        return Err(match error {
8824                            Ok(value) => common::Error::BadRequest(value),
8825                            _ => common::Error::Failure(response),
8826                        });
8827                    }
8828                    let response = {
8829                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8830                        let encoded = common::to_string(&bytes);
8831                        match serde_json::from_str(&encoded) {
8832                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8833                            Err(error) => {
8834                                dlg.response_json_decode_error(&encoded, &error);
8835                                return Err(common::Error::JsonDecodeError(
8836                                    encoded.to_string(),
8837                                    error,
8838                                ));
8839                            }
8840                        }
8841                    };
8842
8843                    dlg.finished(true);
8844                    return Ok(response);
8845                }
8846            }
8847        }
8848    }
8849
8850    /// The ID of the spreadsheet to retrieve data from.
8851    ///
8852    /// Sets the *spreadsheet id* path property to the given value.
8853    ///
8854    /// Even though the property as already been set when instantiating this call,
8855    /// we provide this method for API completeness.
8856    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueBatchGetCall<'a, C> {
8857        self._spreadsheet_id = new_value.to_string();
8858        self
8859    }
8860    /// How values should be represented in the output. The default render option is ValueRenderOption.FORMATTED_VALUE.
8861    ///
8862    /// Sets the *value render option* query property to the given value.
8863    pub fn value_render_option(mut self, new_value: &str) -> SpreadsheetValueBatchGetCall<'a, C> {
8864        self._value_render_option = Some(new_value.to_string());
8865        self
8866    }
8867    /// The [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the range to retrieve values from.
8868    ///
8869    /// Append the given value to the *ranges* query property.
8870    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8871    pub fn add_ranges(mut self, new_value: &str) -> SpreadsheetValueBatchGetCall<'a, C> {
8872        self._ranges.push(new_value.to_string());
8873        self
8874    }
8875    /// The major dimension that results should use. For example, if the spreadsheet data is: `A1=1,B1=2,A2=3,B2=4`, then requesting `ranges=["A1:B2"],majorDimension=ROWS` returns `[[1,2],[3,4]]`, whereas requesting `ranges=["A1:B2"],majorDimension=COLUMNS` returns `[[1,3],[2,4]]`.
8876    ///
8877    /// Sets the *major dimension* query property to the given value.
8878    pub fn major_dimension(mut self, new_value: &str) -> SpreadsheetValueBatchGetCall<'a, C> {
8879        self._major_dimension = Some(new_value.to_string());
8880        self
8881    }
8882    /// How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
8883    ///
8884    /// Sets the *date time render option* query property to the given value.
8885    pub fn date_time_render_option(
8886        mut self,
8887        new_value: &str,
8888    ) -> SpreadsheetValueBatchGetCall<'a, C> {
8889        self._date_time_render_option = Some(new_value.to_string());
8890        self
8891    }
8892    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8893    /// while executing the actual API request.
8894    ///
8895    /// ````text
8896    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8897    /// ````
8898    ///
8899    /// Sets the *delegate* property to the given value.
8900    pub fn delegate(
8901        mut self,
8902        new_value: &'a mut dyn common::Delegate,
8903    ) -> SpreadsheetValueBatchGetCall<'a, C> {
8904        self._delegate = Some(new_value);
8905        self
8906    }
8907
8908    /// Set any additional parameter of the query string used in the request.
8909    /// It should be used to set parameters which are not yet available through their own
8910    /// setters.
8911    ///
8912    /// Please note that this method must not be used to set any of the known parameters
8913    /// which have their own setter method. If done anyway, the request will fail.
8914    ///
8915    /// # Additional Parameters
8916    ///
8917    /// * *$.xgafv* (query-string) - V1 error format.
8918    /// * *access_token* (query-string) - OAuth access token.
8919    /// * *alt* (query-string) - Data format for response.
8920    /// * *callback* (query-string) - JSONP
8921    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8922    /// * *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.
8923    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8924    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8925    /// * *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.
8926    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8927    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8928    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueBatchGetCall<'a, C>
8929    where
8930        T: AsRef<str>,
8931    {
8932        self._additional_params
8933            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8934        self
8935    }
8936
8937    /// Identifies the authorization scope for the method you are building.
8938    ///
8939    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8940    /// [`Scope::DriveReadonly`].
8941    ///
8942    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8943    /// tokens for more than one scope.
8944    ///
8945    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8946    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8947    /// sufficient, a read-write scope will do as well.
8948    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchGetCall<'a, C>
8949    where
8950        St: AsRef<str>,
8951    {
8952        self._scopes.insert(String::from(scope.as_ref()));
8953        self
8954    }
8955    /// Identifies the authorization scope(s) for the method you are building.
8956    ///
8957    /// See [`Self::add_scope()`] for details.
8958    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueBatchGetCall<'a, C>
8959    where
8960        I: IntoIterator<Item = St>,
8961        St: AsRef<str>,
8962    {
8963        self._scopes
8964            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8965        self
8966    }
8967
8968    /// Removes all scopes, and no default scope will be used either.
8969    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8970    /// for details).
8971    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchGetCall<'a, C> {
8972        self._scopes.clear();
8973        self
8974    }
8975}
8976
8977/// Returns one or more ranges of values that match the specified data filters. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges that match any of the data filters in the request will be returned.
8978///
8979/// A builder for the *values.batchGetByDataFilter* method supported by a *spreadsheet* resource.
8980/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
8981///
8982/// # Example
8983///
8984/// Instantiate a resource method builder
8985///
8986/// ```test_harness,no_run
8987/// # extern crate hyper;
8988/// # extern crate hyper_rustls;
8989/// # extern crate google_sheets4 as sheets4;
8990/// use sheets4::api::BatchGetValuesByDataFilterRequest;
8991/// # async fn dox() {
8992/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8993///
8994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8996/// #     .with_native_roots()
8997/// #     .unwrap()
8998/// #     .https_only()
8999/// #     .enable_http2()
9000/// #     .build();
9001///
9002/// # let executor = hyper_util::rt::TokioExecutor::new();
9003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9004/// #     secret,
9005/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9006/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9007/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9008/// #     ),
9009/// # ).build().await.unwrap();
9010///
9011/// # let client = hyper_util::client::legacy::Client::builder(
9012/// #     hyper_util::rt::TokioExecutor::new()
9013/// # )
9014/// # .build(
9015/// #     hyper_rustls::HttpsConnectorBuilder::new()
9016/// #         .with_native_roots()
9017/// #         .unwrap()
9018/// #         .https_or_http()
9019/// #         .enable_http2()
9020/// #         .build()
9021/// # );
9022/// # let mut hub = Sheets::new(client, auth);
9023/// // As the method needs a request, you would usually fill it with the desired information
9024/// // into the respective structure. Some of the parts shown here might not be applicable !
9025/// // Values shown here are possibly random and not representative !
9026/// let mut req = BatchGetValuesByDataFilterRequest::default();
9027///
9028/// // You can configure optional parameters by calling the respective setters at will, and
9029/// // execute the final call using `doit()`.
9030/// // Values shown here are possibly random and not representative !
9031/// let result = hub.spreadsheets().values_batch_get_by_data_filter(req, "spreadsheetId")
9032///              .doit().await;
9033/// # }
9034/// ```
9035pub struct SpreadsheetValueBatchGetByDataFilterCall<'a, C>
9036where
9037    C: 'a,
9038{
9039    hub: &'a Sheets<C>,
9040    _request: BatchGetValuesByDataFilterRequest,
9041    _spreadsheet_id: String,
9042    _delegate: Option<&'a mut dyn common::Delegate>,
9043    _additional_params: HashMap<String, String>,
9044    _scopes: BTreeSet<String>,
9045}
9046
9047impl<'a, C> common::CallBuilder for SpreadsheetValueBatchGetByDataFilterCall<'a, C> {}
9048
9049impl<'a, C> SpreadsheetValueBatchGetByDataFilterCall<'a, C>
9050where
9051    C: common::Connector,
9052{
9053    /// Perform the operation you have build so far.
9054    pub async fn doit(
9055        mut self,
9056    ) -> common::Result<(common::Response, BatchGetValuesByDataFilterResponse)> {
9057        use std::borrow::Cow;
9058        use std::io::{Read, Seek};
9059
9060        use common::{url::Params, ToParts};
9061        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9062
9063        let mut dd = common::DefaultDelegate;
9064        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9065        dlg.begin(common::MethodInfo {
9066            id: "sheets.spreadsheets.values.batchGetByDataFilter",
9067            http_method: hyper::Method::POST,
9068        });
9069
9070        for &field in ["alt", "spreadsheetId"].iter() {
9071            if self._additional_params.contains_key(field) {
9072                dlg.finished(false);
9073                return Err(common::Error::FieldClash(field));
9074            }
9075        }
9076
9077        let mut params = Params::with_capacity(4 + self._additional_params.len());
9078        params.push("spreadsheetId", self._spreadsheet_id);
9079
9080        params.extend(self._additional_params.iter());
9081
9082        params.push("alt", "json");
9083        let mut url = self.hub._base_url.clone()
9084            + "v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter";
9085        if self._scopes.is_empty() {
9086            self._scopes.insert(Scope::Drive.as_ref().to_string());
9087        }
9088
9089        #[allow(clippy::single_element_loop)]
9090        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
9091            url = params.uri_replacement(url, param_name, find_this, false);
9092        }
9093        {
9094            let to_remove = ["spreadsheetId"];
9095            params.remove_params(&to_remove);
9096        }
9097
9098        let url = params.parse_with_url(&url);
9099
9100        let mut json_mime_type = mime::APPLICATION_JSON;
9101        let mut request_value_reader = {
9102            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9103            common::remove_json_null_values(&mut value);
9104            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9105            serde_json::to_writer(&mut dst, &value).unwrap();
9106            dst
9107        };
9108        let request_size = request_value_reader
9109            .seek(std::io::SeekFrom::End(0))
9110            .unwrap();
9111        request_value_reader
9112            .seek(std::io::SeekFrom::Start(0))
9113            .unwrap();
9114
9115        loop {
9116            let token = match self
9117                .hub
9118                .auth
9119                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9120                .await
9121            {
9122                Ok(token) => token,
9123                Err(e) => match dlg.token(e) {
9124                    Ok(token) => token,
9125                    Err(e) => {
9126                        dlg.finished(false);
9127                        return Err(common::Error::MissingToken(e));
9128                    }
9129                },
9130            };
9131            request_value_reader
9132                .seek(std::io::SeekFrom::Start(0))
9133                .unwrap();
9134            let mut req_result = {
9135                let client = &self.hub.client;
9136                dlg.pre_request();
9137                let mut req_builder = hyper::Request::builder()
9138                    .method(hyper::Method::POST)
9139                    .uri(url.as_str())
9140                    .header(USER_AGENT, self.hub._user_agent.clone());
9141
9142                if let Some(token) = token.as_ref() {
9143                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9144                }
9145
9146                let request = req_builder
9147                    .header(CONTENT_TYPE, json_mime_type.to_string())
9148                    .header(CONTENT_LENGTH, request_size as u64)
9149                    .body(common::to_body(
9150                        request_value_reader.get_ref().clone().into(),
9151                    ));
9152
9153                client.request(request.unwrap()).await
9154            };
9155
9156            match req_result {
9157                Err(err) => {
9158                    if let common::Retry::After(d) = dlg.http_error(&err) {
9159                        sleep(d).await;
9160                        continue;
9161                    }
9162                    dlg.finished(false);
9163                    return Err(common::Error::HttpError(err));
9164                }
9165                Ok(res) => {
9166                    let (mut parts, body) = res.into_parts();
9167                    let mut body = common::Body::new(body);
9168                    if !parts.status.is_success() {
9169                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9170                        let error = serde_json::from_str(&common::to_string(&bytes));
9171                        let response = common::to_response(parts, bytes.into());
9172
9173                        if let common::Retry::After(d) =
9174                            dlg.http_failure(&response, error.as_ref().ok())
9175                        {
9176                            sleep(d).await;
9177                            continue;
9178                        }
9179
9180                        dlg.finished(false);
9181
9182                        return Err(match error {
9183                            Ok(value) => common::Error::BadRequest(value),
9184                            _ => common::Error::Failure(response),
9185                        });
9186                    }
9187                    let response = {
9188                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9189                        let encoded = common::to_string(&bytes);
9190                        match serde_json::from_str(&encoded) {
9191                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9192                            Err(error) => {
9193                                dlg.response_json_decode_error(&encoded, &error);
9194                                return Err(common::Error::JsonDecodeError(
9195                                    encoded.to_string(),
9196                                    error,
9197                                ));
9198                            }
9199                        }
9200                    };
9201
9202                    dlg.finished(true);
9203                    return Ok(response);
9204                }
9205            }
9206        }
9207    }
9208
9209    ///
9210    /// Sets the *request* property to the given value.
9211    ///
9212    /// Even though the property as already been set when instantiating this call,
9213    /// we provide this method for API completeness.
9214    pub fn request(
9215        mut self,
9216        new_value: BatchGetValuesByDataFilterRequest,
9217    ) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C> {
9218        self._request = new_value;
9219        self
9220    }
9221    /// The ID of the spreadsheet to retrieve data from.
9222    ///
9223    /// Sets the *spreadsheet id* path property to the given value.
9224    ///
9225    /// Even though the property as already been set when instantiating this call,
9226    /// we provide this method for API completeness.
9227    pub fn spreadsheet_id(
9228        mut self,
9229        new_value: &str,
9230    ) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C> {
9231        self._spreadsheet_id = new_value.to_string();
9232        self
9233    }
9234    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9235    /// while executing the actual API request.
9236    ///
9237    /// ````text
9238    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9239    /// ````
9240    ///
9241    /// Sets the *delegate* property to the given value.
9242    pub fn delegate(
9243        mut self,
9244        new_value: &'a mut dyn common::Delegate,
9245    ) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C> {
9246        self._delegate = Some(new_value);
9247        self
9248    }
9249
9250    /// Set any additional parameter of the query string used in the request.
9251    /// It should be used to set parameters which are not yet available through their own
9252    /// setters.
9253    ///
9254    /// Please note that this method must not be used to set any of the known parameters
9255    /// which have their own setter method. If done anyway, the request will fail.
9256    ///
9257    /// # Additional Parameters
9258    ///
9259    /// * *$.xgafv* (query-string) - V1 error format.
9260    /// * *access_token* (query-string) - OAuth access token.
9261    /// * *alt* (query-string) - Data format for response.
9262    /// * *callback* (query-string) - JSONP
9263    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9264    /// * *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.
9265    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9266    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9267    /// * *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.
9268    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9269    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9270    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C>
9271    where
9272        T: AsRef<str>,
9273    {
9274        self._additional_params
9275            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9276        self
9277    }
9278
9279    /// Identifies the authorization scope for the method you are building.
9280    ///
9281    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9282    /// [`Scope::Drive`].
9283    ///
9284    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9285    /// tokens for more than one scope.
9286    ///
9287    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9288    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9289    /// sufficient, a read-write scope will do as well.
9290    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C>
9291    where
9292        St: AsRef<str>,
9293    {
9294        self._scopes.insert(String::from(scope.as_ref()));
9295        self
9296    }
9297    /// Identifies the authorization scope(s) for the method you are building.
9298    ///
9299    /// See [`Self::add_scope()`] for details.
9300    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C>
9301    where
9302        I: IntoIterator<Item = St>,
9303        St: AsRef<str>,
9304    {
9305        self._scopes
9306            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9307        self
9308    }
9309
9310    /// Removes all scopes, and no default scope will be used either.
9311    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9312    /// for details).
9313    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchGetByDataFilterCall<'a, C> {
9314        self._scopes.clear();
9315        self
9316    }
9317}
9318
9319/// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
9320///
9321/// A builder for the *values.batchUpdate* method supported by a *spreadsheet* resource.
9322/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
9323///
9324/// # Example
9325///
9326/// Instantiate a resource method builder
9327///
9328/// ```test_harness,no_run
9329/// # extern crate hyper;
9330/// # extern crate hyper_rustls;
9331/// # extern crate google_sheets4 as sheets4;
9332/// use sheets4::api::BatchUpdateValuesRequest;
9333/// # async fn dox() {
9334/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9335///
9336/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9337/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9338/// #     .with_native_roots()
9339/// #     .unwrap()
9340/// #     .https_only()
9341/// #     .enable_http2()
9342/// #     .build();
9343///
9344/// # let executor = hyper_util::rt::TokioExecutor::new();
9345/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9346/// #     secret,
9347/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9348/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9349/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9350/// #     ),
9351/// # ).build().await.unwrap();
9352///
9353/// # let client = hyper_util::client::legacy::Client::builder(
9354/// #     hyper_util::rt::TokioExecutor::new()
9355/// # )
9356/// # .build(
9357/// #     hyper_rustls::HttpsConnectorBuilder::new()
9358/// #         .with_native_roots()
9359/// #         .unwrap()
9360/// #         .https_or_http()
9361/// #         .enable_http2()
9362/// #         .build()
9363/// # );
9364/// # let mut hub = Sheets::new(client, auth);
9365/// // As the method needs a request, you would usually fill it with the desired information
9366/// // into the respective structure. Some of the parts shown here might not be applicable !
9367/// // Values shown here are possibly random and not representative !
9368/// let mut req = BatchUpdateValuesRequest::default();
9369///
9370/// // You can configure optional parameters by calling the respective setters at will, and
9371/// // execute the final call using `doit()`.
9372/// // Values shown here are possibly random and not representative !
9373/// let result = hub.spreadsheets().values_batch_update(req, "spreadsheetId")
9374///              .doit().await;
9375/// # }
9376/// ```
9377pub struct SpreadsheetValueBatchUpdateCall<'a, C>
9378where
9379    C: 'a,
9380{
9381    hub: &'a Sheets<C>,
9382    _request: BatchUpdateValuesRequest,
9383    _spreadsheet_id: String,
9384    _delegate: Option<&'a mut dyn common::Delegate>,
9385    _additional_params: HashMap<String, String>,
9386    _scopes: BTreeSet<String>,
9387}
9388
9389impl<'a, C> common::CallBuilder for SpreadsheetValueBatchUpdateCall<'a, C> {}
9390
9391impl<'a, C> SpreadsheetValueBatchUpdateCall<'a, C>
9392where
9393    C: common::Connector,
9394{
9395    /// Perform the operation you have build so far.
9396    pub async fn doit(mut self) -> common::Result<(common::Response, BatchUpdateValuesResponse)> {
9397        use std::borrow::Cow;
9398        use std::io::{Read, Seek};
9399
9400        use common::{url::Params, ToParts};
9401        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9402
9403        let mut dd = common::DefaultDelegate;
9404        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9405        dlg.begin(common::MethodInfo {
9406            id: "sheets.spreadsheets.values.batchUpdate",
9407            http_method: hyper::Method::POST,
9408        });
9409
9410        for &field in ["alt", "spreadsheetId"].iter() {
9411            if self._additional_params.contains_key(field) {
9412                dlg.finished(false);
9413                return Err(common::Error::FieldClash(field));
9414            }
9415        }
9416
9417        let mut params = Params::with_capacity(4 + self._additional_params.len());
9418        params.push("spreadsheetId", self._spreadsheet_id);
9419
9420        params.extend(self._additional_params.iter());
9421
9422        params.push("alt", "json");
9423        let mut url =
9424            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values:batchUpdate";
9425        if self._scopes.is_empty() {
9426            self._scopes.insert(Scope::Drive.as_ref().to_string());
9427        }
9428
9429        #[allow(clippy::single_element_loop)]
9430        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
9431            url = params.uri_replacement(url, param_name, find_this, false);
9432        }
9433        {
9434            let to_remove = ["spreadsheetId"];
9435            params.remove_params(&to_remove);
9436        }
9437
9438        let url = params.parse_with_url(&url);
9439
9440        let mut json_mime_type = mime::APPLICATION_JSON;
9441        let mut request_value_reader = {
9442            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9443            common::remove_json_null_values(&mut value);
9444            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9445            serde_json::to_writer(&mut dst, &value).unwrap();
9446            dst
9447        };
9448        let request_size = request_value_reader
9449            .seek(std::io::SeekFrom::End(0))
9450            .unwrap();
9451        request_value_reader
9452            .seek(std::io::SeekFrom::Start(0))
9453            .unwrap();
9454
9455        loop {
9456            let token = match self
9457                .hub
9458                .auth
9459                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9460                .await
9461            {
9462                Ok(token) => token,
9463                Err(e) => match dlg.token(e) {
9464                    Ok(token) => token,
9465                    Err(e) => {
9466                        dlg.finished(false);
9467                        return Err(common::Error::MissingToken(e));
9468                    }
9469                },
9470            };
9471            request_value_reader
9472                .seek(std::io::SeekFrom::Start(0))
9473                .unwrap();
9474            let mut req_result = {
9475                let client = &self.hub.client;
9476                dlg.pre_request();
9477                let mut req_builder = hyper::Request::builder()
9478                    .method(hyper::Method::POST)
9479                    .uri(url.as_str())
9480                    .header(USER_AGENT, self.hub._user_agent.clone());
9481
9482                if let Some(token) = token.as_ref() {
9483                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9484                }
9485
9486                let request = req_builder
9487                    .header(CONTENT_TYPE, json_mime_type.to_string())
9488                    .header(CONTENT_LENGTH, request_size as u64)
9489                    .body(common::to_body(
9490                        request_value_reader.get_ref().clone().into(),
9491                    ));
9492
9493                client.request(request.unwrap()).await
9494            };
9495
9496            match req_result {
9497                Err(err) => {
9498                    if let common::Retry::After(d) = dlg.http_error(&err) {
9499                        sleep(d).await;
9500                        continue;
9501                    }
9502                    dlg.finished(false);
9503                    return Err(common::Error::HttpError(err));
9504                }
9505                Ok(res) => {
9506                    let (mut parts, body) = res.into_parts();
9507                    let mut body = common::Body::new(body);
9508                    if !parts.status.is_success() {
9509                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9510                        let error = serde_json::from_str(&common::to_string(&bytes));
9511                        let response = common::to_response(parts, bytes.into());
9512
9513                        if let common::Retry::After(d) =
9514                            dlg.http_failure(&response, error.as_ref().ok())
9515                        {
9516                            sleep(d).await;
9517                            continue;
9518                        }
9519
9520                        dlg.finished(false);
9521
9522                        return Err(match error {
9523                            Ok(value) => common::Error::BadRequest(value),
9524                            _ => common::Error::Failure(response),
9525                        });
9526                    }
9527                    let response = {
9528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9529                        let encoded = common::to_string(&bytes);
9530                        match serde_json::from_str(&encoded) {
9531                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9532                            Err(error) => {
9533                                dlg.response_json_decode_error(&encoded, &error);
9534                                return Err(common::Error::JsonDecodeError(
9535                                    encoded.to_string(),
9536                                    error,
9537                                ));
9538                            }
9539                        }
9540                    };
9541
9542                    dlg.finished(true);
9543                    return Ok(response);
9544                }
9545            }
9546        }
9547    }
9548
9549    ///
9550    /// Sets the *request* property to the given value.
9551    ///
9552    /// Even though the property as already been set when instantiating this call,
9553    /// we provide this method for API completeness.
9554    pub fn request(
9555        mut self,
9556        new_value: BatchUpdateValuesRequest,
9557    ) -> SpreadsheetValueBatchUpdateCall<'a, C> {
9558        self._request = new_value;
9559        self
9560    }
9561    /// The ID of the spreadsheet to update.
9562    ///
9563    /// Sets the *spreadsheet id* path property to the given value.
9564    ///
9565    /// Even though the property as already been set when instantiating this call,
9566    /// we provide this method for API completeness.
9567    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueBatchUpdateCall<'a, C> {
9568        self._spreadsheet_id = new_value.to_string();
9569        self
9570    }
9571    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9572    /// while executing the actual API request.
9573    ///
9574    /// ````text
9575    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9576    /// ````
9577    ///
9578    /// Sets the *delegate* property to the given value.
9579    pub fn delegate(
9580        mut self,
9581        new_value: &'a mut dyn common::Delegate,
9582    ) -> SpreadsheetValueBatchUpdateCall<'a, C> {
9583        self._delegate = Some(new_value);
9584        self
9585    }
9586
9587    /// Set any additional parameter of the query string used in the request.
9588    /// It should be used to set parameters which are not yet available through their own
9589    /// setters.
9590    ///
9591    /// Please note that this method must not be used to set any of the known parameters
9592    /// which have their own setter method. If done anyway, the request will fail.
9593    ///
9594    /// # Additional Parameters
9595    ///
9596    /// * *$.xgafv* (query-string) - V1 error format.
9597    /// * *access_token* (query-string) - OAuth access token.
9598    /// * *alt* (query-string) - Data format for response.
9599    /// * *callback* (query-string) - JSONP
9600    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9601    /// * *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.
9602    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9603    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9604    /// * *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.
9605    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9606    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9607    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueBatchUpdateCall<'a, C>
9608    where
9609        T: AsRef<str>,
9610    {
9611        self._additional_params
9612            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9613        self
9614    }
9615
9616    /// Identifies the authorization scope for the method you are building.
9617    ///
9618    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9619    /// [`Scope::Drive`].
9620    ///
9621    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9622    /// tokens for more than one scope.
9623    ///
9624    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9625    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9626    /// sufficient, a read-write scope will do as well.
9627    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchUpdateCall<'a, C>
9628    where
9629        St: AsRef<str>,
9630    {
9631        self._scopes.insert(String::from(scope.as_ref()));
9632        self
9633    }
9634    /// Identifies the authorization scope(s) for the method you are building.
9635    ///
9636    /// See [`Self::add_scope()`] for details.
9637    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueBatchUpdateCall<'a, C>
9638    where
9639        I: IntoIterator<Item = St>,
9640        St: AsRef<str>,
9641    {
9642        self._scopes
9643            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9644        self
9645    }
9646
9647    /// Removes all scopes, and no default scope will be used either.
9648    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9649    /// for details).
9650    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchUpdateCall<'a, C> {
9651        self._scopes.clear();
9652        self
9653    }
9654}
9655
9656/// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more DataFilterValueRanges.
9657///
9658/// A builder for the *values.batchUpdateByDataFilter* method supported by a *spreadsheet* resource.
9659/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
9660///
9661/// # Example
9662///
9663/// Instantiate a resource method builder
9664///
9665/// ```test_harness,no_run
9666/// # extern crate hyper;
9667/// # extern crate hyper_rustls;
9668/// # extern crate google_sheets4 as sheets4;
9669/// use sheets4::api::BatchUpdateValuesByDataFilterRequest;
9670/// # async fn dox() {
9671/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9672///
9673/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9674/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9675/// #     .with_native_roots()
9676/// #     .unwrap()
9677/// #     .https_only()
9678/// #     .enable_http2()
9679/// #     .build();
9680///
9681/// # let executor = hyper_util::rt::TokioExecutor::new();
9682/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9683/// #     secret,
9684/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9685/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9686/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9687/// #     ),
9688/// # ).build().await.unwrap();
9689///
9690/// # let client = hyper_util::client::legacy::Client::builder(
9691/// #     hyper_util::rt::TokioExecutor::new()
9692/// # )
9693/// # .build(
9694/// #     hyper_rustls::HttpsConnectorBuilder::new()
9695/// #         .with_native_roots()
9696/// #         .unwrap()
9697/// #         .https_or_http()
9698/// #         .enable_http2()
9699/// #         .build()
9700/// # );
9701/// # let mut hub = Sheets::new(client, auth);
9702/// // As the method needs a request, you would usually fill it with the desired information
9703/// // into the respective structure. Some of the parts shown here might not be applicable !
9704/// // Values shown here are possibly random and not representative !
9705/// let mut req = BatchUpdateValuesByDataFilterRequest::default();
9706///
9707/// // You can configure optional parameters by calling the respective setters at will, and
9708/// // execute the final call using `doit()`.
9709/// // Values shown here are possibly random and not representative !
9710/// let result = hub.spreadsheets().values_batch_update_by_data_filter(req, "spreadsheetId")
9711///              .doit().await;
9712/// # }
9713/// ```
9714pub struct SpreadsheetValueBatchUpdateByDataFilterCall<'a, C>
9715where
9716    C: 'a,
9717{
9718    hub: &'a Sheets<C>,
9719    _request: BatchUpdateValuesByDataFilterRequest,
9720    _spreadsheet_id: String,
9721    _delegate: Option<&'a mut dyn common::Delegate>,
9722    _additional_params: HashMap<String, String>,
9723    _scopes: BTreeSet<String>,
9724}
9725
9726impl<'a, C> common::CallBuilder for SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {}
9727
9728impl<'a, C> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C>
9729where
9730    C: common::Connector,
9731{
9732    /// Perform the operation you have build so far.
9733    pub async fn doit(
9734        mut self,
9735    ) -> common::Result<(common::Response, BatchUpdateValuesByDataFilterResponse)> {
9736        use std::borrow::Cow;
9737        use std::io::{Read, Seek};
9738
9739        use common::{url::Params, ToParts};
9740        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9741
9742        let mut dd = common::DefaultDelegate;
9743        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9744        dlg.begin(common::MethodInfo {
9745            id: "sheets.spreadsheets.values.batchUpdateByDataFilter",
9746            http_method: hyper::Method::POST,
9747        });
9748
9749        for &field in ["alt", "spreadsheetId"].iter() {
9750            if self._additional_params.contains_key(field) {
9751                dlg.finished(false);
9752                return Err(common::Error::FieldClash(field));
9753            }
9754        }
9755
9756        let mut params = Params::with_capacity(4 + self._additional_params.len());
9757        params.push("spreadsheetId", self._spreadsheet_id);
9758
9759        params.extend(self._additional_params.iter());
9760
9761        params.push("alt", "json");
9762        let mut url = self.hub._base_url.clone()
9763            + "v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter";
9764        if self._scopes.is_empty() {
9765            self._scopes.insert(Scope::Drive.as_ref().to_string());
9766        }
9767
9768        #[allow(clippy::single_element_loop)]
9769        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
9770            url = params.uri_replacement(url, param_name, find_this, false);
9771        }
9772        {
9773            let to_remove = ["spreadsheetId"];
9774            params.remove_params(&to_remove);
9775        }
9776
9777        let url = params.parse_with_url(&url);
9778
9779        let mut json_mime_type = mime::APPLICATION_JSON;
9780        let mut request_value_reader = {
9781            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9782            common::remove_json_null_values(&mut value);
9783            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9784            serde_json::to_writer(&mut dst, &value).unwrap();
9785            dst
9786        };
9787        let request_size = request_value_reader
9788            .seek(std::io::SeekFrom::End(0))
9789            .unwrap();
9790        request_value_reader
9791            .seek(std::io::SeekFrom::Start(0))
9792            .unwrap();
9793
9794        loop {
9795            let token = match self
9796                .hub
9797                .auth
9798                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9799                .await
9800            {
9801                Ok(token) => token,
9802                Err(e) => match dlg.token(e) {
9803                    Ok(token) => token,
9804                    Err(e) => {
9805                        dlg.finished(false);
9806                        return Err(common::Error::MissingToken(e));
9807                    }
9808                },
9809            };
9810            request_value_reader
9811                .seek(std::io::SeekFrom::Start(0))
9812                .unwrap();
9813            let mut req_result = {
9814                let client = &self.hub.client;
9815                dlg.pre_request();
9816                let mut req_builder = hyper::Request::builder()
9817                    .method(hyper::Method::POST)
9818                    .uri(url.as_str())
9819                    .header(USER_AGENT, self.hub._user_agent.clone());
9820
9821                if let Some(token) = token.as_ref() {
9822                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9823                }
9824
9825                let request = req_builder
9826                    .header(CONTENT_TYPE, json_mime_type.to_string())
9827                    .header(CONTENT_LENGTH, request_size as u64)
9828                    .body(common::to_body(
9829                        request_value_reader.get_ref().clone().into(),
9830                    ));
9831
9832                client.request(request.unwrap()).await
9833            };
9834
9835            match req_result {
9836                Err(err) => {
9837                    if let common::Retry::After(d) = dlg.http_error(&err) {
9838                        sleep(d).await;
9839                        continue;
9840                    }
9841                    dlg.finished(false);
9842                    return Err(common::Error::HttpError(err));
9843                }
9844                Ok(res) => {
9845                    let (mut parts, body) = res.into_parts();
9846                    let mut body = common::Body::new(body);
9847                    if !parts.status.is_success() {
9848                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9849                        let error = serde_json::from_str(&common::to_string(&bytes));
9850                        let response = common::to_response(parts, bytes.into());
9851
9852                        if let common::Retry::After(d) =
9853                            dlg.http_failure(&response, error.as_ref().ok())
9854                        {
9855                            sleep(d).await;
9856                            continue;
9857                        }
9858
9859                        dlg.finished(false);
9860
9861                        return Err(match error {
9862                            Ok(value) => common::Error::BadRequest(value),
9863                            _ => common::Error::Failure(response),
9864                        });
9865                    }
9866                    let response = {
9867                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9868                        let encoded = common::to_string(&bytes);
9869                        match serde_json::from_str(&encoded) {
9870                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9871                            Err(error) => {
9872                                dlg.response_json_decode_error(&encoded, &error);
9873                                return Err(common::Error::JsonDecodeError(
9874                                    encoded.to_string(),
9875                                    error,
9876                                ));
9877                            }
9878                        }
9879                    };
9880
9881                    dlg.finished(true);
9882                    return Ok(response);
9883                }
9884            }
9885        }
9886    }
9887
9888    ///
9889    /// Sets the *request* property to the given value.
9890    ///
9891    /// Even though the property as already been set when instantiating this call,
9892    /// we provide this method for API completeness.
9893    pub fn request(
9894        mut self,
9895        new_value: BatchUpdateValuesByDataFilterRequest,
9896    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {
9897        self._request = new_value;
9898        self
9899    }
9900    /// The ID of the spreadsheet to update.
9901    ///
9902    /// Sets the *spreadsheet id* path property to the given value.
9903    ///
9904    /// Even though the property as already been set when instantiating this call,
9905    /// we provide this method for API completeness.
9906    pub fn spreadsheet_id(
9907        mut self,
9908        new_value: &str,
9909    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {
9910        self._spreadsheet_id = new_value.to_string();
9911        self
9912    }
9913    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9914    /// while executing the actual API request.
9915    ///
9916    /// ````text
9917    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9918    /// ````
9919    ///
9920    /// Sets the *delegate* property to the given value.
9921    pub fn delegate(
9922        mut self,
9923        new_value: &'a mut dyn common::Delegate,
9924    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {
9925        self._delegate = Some(new_value);
9926        self
9927    }
9928
9929    /// Set any additional parameter of the query string used in the request.
9930    /// It should be used to set parameters which are not yet available through their own
9931    /// setters.
9932    ///
9933    /// Please note that this method must not be used to set any of the known parameters
9934    /// which have their own setter method. If done anyway, the request will fail.
9935    ///
9936    /// # Additional Parameters
9937    ///
9938    /// * *$.xgafv* (query-string) - V1 error format.
9939    /// * *access_token* (query-string) - OAuth access token.
9940    /// * *alt* (query-string) - Data format for response.
9941    /// * *callback* (query-string) - JSONP
9942    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9943    /// * *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.
9944    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9945    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9946    /// * *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.
9947    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9948    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9949    pub fn param<T>(
9950        mut self,
9951        name: T,
9952        value: T,
9953    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C>
9954    where
9955        T: AsRef<str>,
9956    {
9957        self._additional_params
9958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9959        self
9960    }
9961
9962    /// Identifies the authorization scope for the method you are building.
9963    ///
9964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9965    /// [`Scope::Drive`].
9966    ///
9967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9968    /// tokens for more than one scope.
9969    ///
9970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9972    /// sufficient, a read-write scope will do as well.
9973    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C>
9974    where
9975        St: AsRef<str>,
9976    {
9977        self._scopes.insert(String::from(scope.as_ref()));
9978        self
9979    }
9980    /// Identifies the authorization scope(s) for the method you are building.
9981    ///
9982    /// See [`Self::add_scope()`] for details.
9983    pub fn add_scopes<I, St>(
9984        mut self,
9985        scopes: I,
9986    ) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C>
9987    where
9988        I: IntoIterator<Item = St>,
9989        St: AsRef<str>,
9990    {
9991        self._scopes
9992            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9993        self
9994    }
9995
9996    /// Removes all scopes, and no default scope will be used either.
9997    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9998    /// for details).
9999    pub fn clear_scopes(mut self) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, C> {
10000        self._scopes.clear();
10001        self
10002    }
10003}
10004
10005/// Clears values from a spreadsheet. The caller must specify the spreadsheet ID and range. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
10006///
10007/// A builder for the *values.clear* method supported by a *spreadsheet* resource.
10008/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
10009///
10010/// # Example
10011///
10012/// Instantiate a resource method builder
10013///
10014/// ```test_harness,no_run
10015/// # extern crate hyper;
10016/// # extern crate hyper_rustls;
10017/// # extern crate google_sheets4 as sheets4;
10018/// use sheets4::api::ClearValuesRequest;
10019/// # async fn dox() {
10020/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10021///
10022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10023/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10024/// #     .with_native_roots()
10025/// #     .unwrap()
10026/// #     .https_only()
10027/// #     .enable_http2()
10028/// #     .build();
10029///
10030/// # let executor = hyper_util::rt::TokioExecutor::new();
10031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10032/// #     secret,
10033/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10034/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10035/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10036/// #     ),
10037/// # ).build().await.unwrap();
10038///
10039/// # let client = hyper_util::client::legacy::Client::builder(
10040/// #     hyper_util::rt::TokioExecutor::new()
10041/// # )
10042/// # .build(
10043/// #     hyper_rustls::HttpsConnectorBuilder::new()
10044/// #         .with_native_roots()
10045/// #         .unwrap()
10046/// #         .https_or_http()
10047/// #         .enable_http2()
10048/// #         .build()
10049/// # );
10050/// # let mut hub = Sheets::new(client, auth);
10051/// // As the method needs a request, you would usually fill it with the desired information
10052/// // into the respective structure. Some of the parts shown here might not be applicable !
10053/// // Values shown here are possibly random and not representative !
10054/// let mut req = ClearValuesRequest::default();
10055///
10056/// // You can configure optional parameters by calling the respective setters at will, and
10057/// // execute the final call using `doit()`.
10058/// // Values shown here are possibly random and not representative !
10059/// let result = hub.spreadsheets().values_clear(req, "spreadsheetId", "range")
10060///              .doit().await;
10061/// # }
10062/// ```
10063pub struct SpreadsheetValueClearCall<'a, C>
10064where
10065    C: 'a,
10066{
10067    hub: &'a Sheets<C>,
10068    _request: ClearValuesRequest,
10069    _spreadsheet_id: String,
10070    _range: String,
10071    _delegate: Option<&'a mut dyn common::Delegate>,
10072    _additional_params: HashMap<String, String>,
10073    _scopes: BTreeSet<String>,
10074}
10075
10076impl<'a, C> common::CallBuilder for SpreadsheetValueClearCall<'a, C> {}
10077
10078impl<'a, C> SpreadsheetValueClearCall<'a, C>
10079where
10080    C: common::Connector,
10081{
10082    /// Perform the operation you have build so far.
10083    pub async fn doit(mut self) -> common::Result<(common::Response, ClearValuesResponse)> {
10084        use std::borrow::Cow;
10085        use std::io::{Read, Seek};
10086
10087        use common::{url::Params, ToParts};
10088        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10089
10090        let mut dd = common::DefaultDelegate;
10091        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10092        dlg.begin(common::MethodInfo {
10093            id: "sheets.spreadsheets.values.clear",
10094            http_method: hyper::Method::POST,
10095        });
10096
10097        for &field in ["alt", "spreadsheetId", "range"].iter() {
10098            if self._additional_params.contains_key(field) {
10099                dlg.finished(false);
10100                return Err(common::Error::FieldClash(field));
10101            }
10102        }
10103
10104        let mut params = Params::with_capacity(5 + self._additional_params.len());
10105        params.push("spreadsheetId", self._spreadsheet_id);
10106        params.push("range", self._range);
10107
10108        params.extend(self._additional_params.iter());
10109
10110        params.push("alt", "json");
10111        let mut url =
10112            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values/{range}:clear";
10113        if self._scopes.is_empty() {
10114            self._scopes.insert(Scope::Drive.as_ref().to_string());
10115        }
10116
10117        #[allow(clippy::single_element_loop)]
10118        for &(find_this, param_name) in
10119            [("{spreadsheetId}", "spreadsheetId"), ("{range}", "range")].iter()
10120        {
10121            url = params.uri_replacement(url, param_name, find_this, false);
10122        }
10123        {
10124            let to_remove = ["range", "spreadsheetId"];
10125            params.remove_params(&to_remove);
10126        }
10127
10128        let url = params.parse_with_url(&url);
10129
10130        let mut json_mime_type = mime::APPLICATION_JSON;
10131        let mut request_value_reader = {
10132            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10133            common::remove_json_null_values(&mut value);
10134            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10135            serde_json::to_writer(&mut dst, &value).unwrap();
10136            dst
10137        };
10138        let request_size = request_value_reader
10139            .seek(std::io::SeekFrom::End(0))
10140            .unwrap();
10141        request_value_reader
10142            .seek(std::io::SeekFrom::Start(0))
10143            .unwrap();
10144
10145        loop {
10146            let token = match self
10147                .hub
10148                .auth
10149                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10150                .await
10151            {
10152                Ok(token) => token,
10153                Err(e) => match dlg.token(e) {
10154                    Ok(token) => token,
10155                    Err(e) => {
10156                        dlg.finished(false);
10157                        return Err(common::Error::MissingToken(e));
10158                    }
10159                },
10160            };
10161            request_value_reader
10162                .seek(std::io::SeekFrom::Start(0))
10163                .unwrap();
10164            let mut req_result = {
10165                let client = &self.hub.client;
10166                dlg.pre_request();
10167                let mut req_builder = hyper::Request::builder()
10168                    .method(hyper::Method::POST)
10169                    .uri(url.as_str())
10170                    .header(USER_AGENT, self.hub._user_agent.clone());
10171
10172                if let Some(token) = token.as_ref() {
10173                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10174                }
10175
10176                let request = req_builder
10177                    .header(CONTENT_TYPE, json_mime_type.to_string())
10178                    .header(CONTENT_LENGTH, request_size as u64)
10179                    .body(common::to_body(
10180                        request_value_reader.get_ref().clone().into(),
10181                    ));
10182
10183                client.request(request.unwrap()).await
10184            };
10185
10186            match req_result {
10187                Err(err) => {
10188                    if let common::Retry::After(d) = dlg.http_error(&err) {
10189                        sleep(d).await;
10190                        continue;
10191                    }
10192                    dlg.finished(false);
10193                    return Err(common::Error::HttpError(err));
10194                }
10195                Ok(res) => {
10196                    let (mut parts, body) = res.into_parts();
10197                    let mut body = common::Body::new(body);
10198                    if !parts.status.is_success() {
10199                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10200                        let error = serde_json::from_str(&common::to_string(&bytes));
10201                        let response = common::to_response(parts, bytes.into());
10202
10203                        if let common::Retry::After(d) =
10204                            dlg.http_failure(&response, error.as_ref().ok())
10205                        {
10206                            sleep(d).await;
10207                            continue;
10208                        }
10209
10210                        dlg.finished(false);
10211
10212                        return Err(match error {
10213                            Ok(value) => common::Error::BadRequest(value),
10214                            _ => common::Error::Failure(response),
10215                        });
10216                    }
10217                    let response = {
10218                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10219                        let encoded = common::to_string(&bytes);
10220                        match serde_json::from_str(&encoded) {
10221                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10222                            Err(error) => {
10223                                dlg.response_json_decode_error(&encoded, &error);
10224                                return Err(common::Error::JsonDecodeError(
10225                                    encoded.to_string(),
10226                                    error,
10227                                ));
10228                            }
10229                        }
10230                    };
10231
10232                    dlg.finished(true);
10233                    return Ok(response);
10234                }
10235            }
10236        }
10237    }
10238
10239    ///
10240    /// Sets the *request* property to the given value.
10241    ///
10242    /// Even though the property as already been set when instantiating this call,
10243    /// we provide this method for API completeness.
10244    pub fn request(mut self, new_value: ClearValuesRequest) -> SpreadsheetValueClearCall<'a, C> {
10245        self._request = new_value;
10246        self
10247    }
10248    /// The ID of the spreadsheet to update.
10249    ///
10250    /// Sets the *spreadsheet id* path property to the given value.
10251    ///
10252    /// Even though the property as already been set when instantiating this call,
10253    /// we provide this method for API completeness.
10254    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueClearCall<'a, C> {
10255        self._spreadsheet_id = new_value.to_string();
10256        self
10257    }
10258    /// The [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to clear.
10259    ///
10260    /// Sets the *range* path property to the given value.
10261    ///
10262    /// Even though the property as already been set when instantiating this call,
10263    /// we provide this method for API completeness.
10264    pub fn range(mut self, new_value: &str) -> SpreadsheetValueClearCall<'a, C> {
10265        self._range = new_value.to_string();
10266        self
10267    }
10268    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10269    /// while executing the actual API request.
10270    ///
10271    /// ````text
10272    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10273    /// ````
10274    ///
10275    /// Sets the *delegate* property to the given value.
10276    pub fn delegate(
10277        mut self,
10278        new_value: &'a mut dyn common::Delegate,
10279    ) -> SpreadsheetValueClearCall<'a, C> {
10280        self._delegate = Some(new_value);
10281        self
10282    }
10283
10284    /// Set any additional parameter of the query string used in the request.
10285    /// It should be used to set parameters which are not yet available through their own
10286    /// setters.
10287    ///
10288    /// Please note that this method must not be used to set any of the known parameters
10289    /// which have their own setter method. If done anyway, the request will fail.
10290    ///
10291    /// # Additional Parameters
10292    ///
10293    /// * *$.xgafv* (query-string) - V1 error format.
10294    /// * *access_token* (query-string) - OAuth access token.
10295    /// * *alt* (query-string) - Data format for response.
10296    /// * *callback* (query-string) - JSONP
10297    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10298    /// * *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.
10299    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10300    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10301    /// * *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.
10302    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10303    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10304    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueClearCall<'a, C>
10305    where
10306        T: AsRef<str>,
10307    {
10308        self._additional_params
10309            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10310        self
10311    }
10312
10313    /// Identifies the authorization scope for the method you are building.
10314    ///
10315    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10316    /// [`Scope::Drive`].
10317    ///
10318    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10319    /// tokens for more than one scope.
10320    ///
10321    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10322    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10323    /// sufficient, a read-write scope will do as well.
10324    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueClearCall<'a, C>
10325    where
10326        St: AsRef<str>,
10327    {
10328        self._scopes.insert(String::from(scope.as_ref()));
10329        self
10330    }
10331    /// Identifies the authorization scope(s) for the method you are building.
10332    ///
10333    /// See [`Self::add_scope()`] for details.
10334    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueClearCall<'a, C>
10335    where
10336        I: IntoIterator<Item = St>,
10337        St: AsRef<str>,
10338    {
10339        self._scopes
10340            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10341        self
10342    }
10343
10344    /// Removes all scopes, and no default scope will be used either.
10345    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10346    /// for details).
10347    pub fn clear_scopes(mut self) -> SpreadsheetValueClearCall<'a, C> {
10348        self._scopes.clear();
10349        self
10350    }
10351}
10352
10353/// Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.
10354///
10355/// A builder for the *values.get* method supported by a *spreadsheet* resource.
10356/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
10357///
10358/// # Example
10359///
10360/// Instantiate a resource method builder
10361///
10362/// ```test_harness,no_run
10363/// # extern crate hyper;
10364/// # extern crate hyper_rustls;
10365/// # extern crate google_sheets4 as sheets4;
10366/// # async fn dox() {
10367/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10368///
10369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10370/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10371/// #     .with_native_roots()
10372/// #     .unwrap()
10373/// #     .https_only()
10374/// #     .enable_http2()
10375/// #     .build();
10376///
10377/// # let executor = hyper_util::rt::TokioExecutor::new();
10378/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10379/// #     secret,
10380/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10381/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10382/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10383/// #     ),
10384/// # ).build().await.unwrap();
10385///
10386/// # let client = hyper_util::client::legacy::Client::builder(
10387/// #     hyper_util::rt::TokioExecutor::new()
10388/// # )
10389/// # .build(
10390/// #     hyper_rustls::HttpsConnectorBuilder::new()
10391/// #         .with_native_roots()
10392/// #         .unwrap()
10393/// #         .https_or_http()
10394/// #         .enable_http2()
10395/// #         .build()
10396/// # );
10397/// # let mut hub = Sheets::new(client, auth);
10398/// // You can configure optional parameters by calling the respective setters at will, and
10399/// // execute the final call using `doit()`.
10400/// // Values shown here are possibly random and not representative !
10401/// let result = hub.spreadsheets().values_get("spreadsheetId", "range")
10402///              .value_render_option("erat")
10403///              .major_dimension("sed")
10404///              .date_time_render_option("duo")
10405///              .doit().await;
10406/// # }
10407/// ```
10408pub struct SpreadsheetValueGetCall<'a, C>
10409where
10410    C: 'a,
10411{
10412    hub: &'a Sheets<C>,
10413    _spreadsheet_id: String,
10414    _range: String,
10415    _value_render_option: Option<String>,
10416    _major_dimension: Option<String>,
10417    _date_time_render_option: Option<String>,
10418    _delegate: Option<&'a mut dyn common::Delegate>,
10419    _additional_params: HashMap<String, String>,
10420    _scopes: BTreeSet<String>,
10421}
10422
10423impl<'a, C> common::CallBuilder for SpreadsheetValueGetCall<'a, C> {}
10424
10425impl<'a, C> SpreadsheetValueGetCall<'a, C>
10426where
10427    C: common::Connector,
10428{
10429    /// Perform the operation you have build so far.
10430    pub async fn doit(mut self) -> common::Result<(common::Response, ValueRange)> {
10431        use std::borrow::Cow;
10432        use std::io::{Read, Seek};
10433
10434        use common::{url::Params, ToParts};
10435        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10436
10437        let mut dd = common::DefaultDelegate;
10438        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10439        dlg.begin(common::MethodInfo {
10440            id: "sheets.spreadsheets.values.get",
10441            http_method: hyper::Method::GET,
10442        });
10443
10444        for &field in [
10445            "alt",
10446            "spreadsheetId",
10447            "range",
10448            "valueRenderOption",
10449            "majorDimension",
10450            "dateTimeRenderOption",
10451        ]
10452        .iter()
10453        {
10454            if self._additional_params.contains_key(field) {
10455                dlg.finished(false);
10456                return Err(common::Error::FieldClash(field));
10457            }
10458        }
10459
10460        let mut params = Params::with_capacity(7 + self._additional_params.len());
10461        params.push("spreadsheetId", self._spreadsheet_id);
10462        params.push("range", self._range);
10463        if let Some(value) = self._value_render_option.as_ref() {
10464            params.push("valueRenderOption", value);
10465        }
10466        if let Some(value) = self._major_dimension.as_ref() {
10467            params.push("majorDimension", value);
10468        }
10469        if let Some(value) = self._date_time_render_option.as_ref() {
10470            params.push("dateTimeRenderOption", value);
10471        }
10472
10473        params.extend(self._additional_params.iter());
10474
10475        params.push("alt", "json");
10476        let mut url = self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values/{range}";
10477        if self._scopes.is_empty() {
10478            self._scopes
10479                .insert(Scope::DriveReadonly.as_ref().to_string());
10480        }
10481
10482        #[allow(clippy::single_element_loop)]
10483        for &(find_this, param_name) in
10484            [("{spreadsheetId}", "spreadsheetId"), ("{range}", "range")].iter()
10485        {
10486            url = params.uri_replacement(url, param_name, find_this, false);
10487        }
10488        {
10489            let to_remove = ["range", "spreadsheetId"];
10490            params.remove_params(&to_remove);
10491        }
10492
10493        let url = params.parse_with_url(&url);
10494
10495        loop {
10496            let token = match self
10497                .hub
10498                .auth
10499                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10500                .await
10501            {
10502                Ok(token) => token,
10503                Err(e) => match dlg.token(e) {
10504                    Ok(token) => token,
10505                    Err(e) => {
10506                        dlg.finished(false);
10507                        return Err(common::Error::MissingToken(e));
10508                    }
10509                },
10510            };
10511            let mut req_result = {
10512                let client = &self.hub.client;
10513                dlg.pre_request();
10514                let mut req_builder = hyper::Request::builder()
10515                    .method(hyper::Method::GET)
10516                    .uri(url.as_str())
10517                    .header(USER_AGENT, self.hub._user_agent.clone());
10518
10519                if let Some(token) = token.as_ref() {
10520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10521                }
10522
10523                let request = req_builder
10524                    .header(CONTENT_LENGTH, 0_u64)
10525                    .body(common::to_body::<String>(None));
10526
10527                client.request(request.unwrap()).await
10528            };
10529
10530            match req_result {
10531                Err(err) => {
10532                    if let common::Retry::After(d) = dlg.http_error(&err) {
10533                        sleep(d).await;
10534                        continue;
10535                    }
10536                    dlg.finished(false);
10537                    return Err(common::Error::HttpError(err));
10538                }
10539                Ok(res) => {
10540                    let (mut parts, body) = res.into_parts();
10541                    let mut body = common::Body::new(body);
10542                    if !parts.status.is_success() {
10543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10544                        let error = serde_json::from_str(&common::to_string(&bytes));
10545                        let response = common::to_response(parts, bytes.into());
10546
10547                        if let common::Retry::After(d) =
10548                            dlg.http_failure(&response, error.as_ref().ok())
10549                        {
10550                            sleep(d).await;
10551                            continue;
10552                        }
10553
10554                        dlg.finished(false);
10555
10556                        return Err(match error {
10557                            Ok(value) => common::Error::BadRequest(value),
10558                            _ => common::Error::Failure(response),
10559                        });
10560                    }
10561                    let response = {
10562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10563                        let encoded = common::to_string(&bytes);
10564                        match serde_json::from_str(&encoded) {
10565                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10566                            Err(error) => {
10567                                dlg.response_json_decode_error(&encoded, &error);
10568                                return Err(common::Error::JsonDecodeError(
10569                                    encoded.to_string(),
10570                                    error,
10571                                ));
10572                            }
10573                        }
10574                    };
10575
10576                    dlg.finished(true);
10577                    return Ok(response);
10578                }
10579            }
10580        }
10581    }
10582
10583    /// The ID of the spreadsheet to retrieve data from.
10584    ///
10585    /// Sets the *spreadsheet id* path property to the given value.
10586    ///
10587    /// Even though the property as already been set when instantiating this call,
10588    /// we provide this method for API completeness.
10589    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueGetCall<'a, C> {
10590        self._spreadsheet_id = new_value.to_string();
10591        self
10592    }
10593    /// The [A1 notation or R1C1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the range to retrieve values from.
10594    ///
10595    /// Sets the *range* path property to the given value.
10596    ///
10597    /// Even though the property as already been set when instantiating this call,
10598    /// we provide this method for API completeness.
10599    pub fn range(mut self, new_value: &str) -> SpreadsheetValueGetCall<'a, C> {
10600        self._range = new_value.to_string();
10601        self
10602    }
10603    /// How values should be represented in the output. The default render option is FORMATTED_VALUE.
10604    ///
10605    /// Sets the *value render option* query property to the given value.
10606    pub fn value_render_option(mut self, new_value: &str) -> SpreadsheetValueGetCall<'a, C> {
10607        self._value_render_option = Some(new_value.to_string());
10608        self
10609    }
10610    /// The major dimension that results should use. For example, if the spreadsheet data in Sheet1 is: `A1=1,B1=2,A2=3,B2=4`, then requesting `range=Sheet1!A1:B2?majorDimension=ROWS` returns `[[1,2],[3,4]]`, whereas requesting `range=Sheet1!A1:B2?majorDimension=COLUMNS` returns `[[1,3],[2,4]]`.
10611    ///
10612    /// Sets the *major dimension* query property to the given value.
10613    pub fn major_dimension(mut self, new_value: &str) -> SpreadsheetValueGetCall<'a, C> {
10614        self._major_dimension = Some(new_value.to_string());
10615        self
10616    }
10617    /// How dates, times, and durations should be represented in the output. This is ignored if value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
10618    ///
10619    /// Sets the *date time render option* query property to the given value.
10620    pub fn date_time_render_option(mut self, new_value: &str) -> SpreadsheetValueGetCall<'a, C> {
10621        self._date_time_render_option = Some(new_value.to_string());
10622        self
10623    }
10624    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10625    /// while executing the actual API request.
10626    ///
10627    /// ````text
10628    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10629    /// ````
10630    ///
10631    /// Sets the *delegate* property to the given value.
10632    pub fn delegate(
10633        mut self,
10634        new_value: &'a mut dyn common::Delegate,
10635    ) -> SpreadsheetValueGetCall<'a, C> {
10636        self._delegate = Some(new_value);
10637        self
10638    }
10639
10640    /// Set any additional parameter of the query string used in the request.
10641    /// It should be used to set parameters which are not yet available through their own
10642    /// setters.
10643    ///
10644    /// Please note that this method must not be used to set any of the known parameters
10645    /// which have their own setter method. If done anyway, the request will fail.
10646    ///
10647    /// # Additional Parameters
10648    ///
10649    /// * *$.xgafv* (query-string) - V1 error format.
10650    /// * *access_token* (query-string) - OAuth access token.
10651    /// * *alt* (query-string) - Data format for response.
10652    /// * *callback* (query-string) - JSONP
10653    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10654    /// * *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.
10655    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10656    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10657    /// * *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.
10658    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10659    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10660    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueGetCall<'a, C>
10661    where
10662        T: AsRef<str>,
10663    {
10664        self._additional_params
10665            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10666        self
10667    }
10668
10669    /// Identifies the authorization scope for the method you are building.
10670    ///
10671    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10672    /// [`Scope::DriveReadonly`].
10673    ///
10674    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10675    /// tokens for more than one scope.
10676    ///
10677    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10678    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10679    /// sufficient, a read-write scope will do as well.
10680    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueGetCall<'a, C>
10681    where
10682        St: AsRef<str>,
10683    {
10684        self._scopes.insert(String::from(scope.as_ref()));
10685        self
10686    }
10687    /// Identifies the authorization scope(s) for the method you are building.
10688    ///
10689    /// See [`Self::add_scope()`] for details.
10690    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueGetCall<'a, C>
10691    where
10692        I: IntoIterator<Item = St>,
10693        St: AsRef<str>,
10694    {
10695        self._scopes
10696            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10697        self
10698    }
10699
10700    /// Removes all scopes, and no default scope will be used either.
10701    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10702    /// for details).
10703    pub fn clear_scopes(mut self) -> SpreadsheetValueGetCall<'a, C> {
10704        self._scopes.clear();
10705        self
10706    }
10707}
10708
10709/// Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.
10710///
10711/// A builder for the *values.update* method supported by a *spreadsheet* resource.
10712/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
10713///
10714/// # Example
10715///
10716/// Instantiate a resource method builder
10717///
10718/// ```test_harness,no_run
10719/// # extern crate hyper;
10720/// # extern crate hyper_rustls;
10721/// # extern crate google_sheets4 as sheets4;
10722/// use sheets4::api::ValueRange;
10723/// # async fn dox() {
10724/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10725///
10726/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10727/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10728/// #     .with_native_roots()
10729/// #     .unwrap()
10730/// #     .https_only()
10731/// #     .enable_http2()
10732/// #     .build();
10733///
10734/// # let executor = hyper_util::rt::TokioExecutor::new();
10735/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10736/// #     secret,
10737/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10738/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10739/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10740/// #     ),
10741/// # ).build().await.unwrap();
10742///
10743/// # let client = hyper_util::client::legacy::Client::builder(
10744/// #     hyper_util::rt::TokioExecutor::new()
10745/// # )
10746/// # .build(
10747/// #     hyper_rustls::HttpsConnectorBuilder::new()
10748/// #         .with_native_roots()
10749/// #         .unwrap()
10750/// #         .https_or_http()
10751/// #         .enable_http2()
10752/// #         .build()
10753/// # );
10754/// # let mut hub = Sheets::new(client, auth);
10755/// // As the method needs a request, you would usually fill it with the desired information
10756/// // into the respective structure. Some of the parts shown here might not be applicable !
10757/// // Values shown here are possibly random and not representative !
10758/// let mut req = ValueRange::default();
10759///
10760/// // You can configure optional parameters by calling the respective setters at will, and
10761/// // execute the final call using `doit()`.
10762/// // Values shown here are possibly random and not representative !
10763/// let result = hub.spreadsheets().values_update(req, "spreadsheetId", "range")
10764///              .value_input_option("voluptua.")
10765///              .response_value_render_option("amet.")
10766///              .response_date_time_render_option("consetetur")
10767///              .include_values_in_response(false)
10768///              .doit().await;
10769/// # }
10770/// ```
10771pub struct SpreadsheetValueUpdateCall<'a, C>
10772where
10773    C: 'a,
10774{
10775    hub: &'a Sheets<C>,
10776    _request: ValueRange,
10777    _spreadsheet_id: String,
10778    _range: String,
10779    _value_input_option: Option<String>,
10780    _response_value_render_option: Option<String>,
10781    _response_date_time_render_option: Option<String>,
10782    _include_values_in_response: Option<bool>,
10783    _delegate: Option<&'a mut dyn common::Delegate>,
10784    _additional_params: HashMap<String, String>,
10785    _scopes: BTreeSet<String>,
10786}
10787
10788impl<'a, C> common::CallBuilder for SpreadsheetValueUpdateCall<'a, C> {}
10789
10790impl<'a, C> SpreadsheetValueUpdateCall<'a, C>
10791where
10792    C: common::Connector,
10793{
10794    /// Perform the operation you have build so far.
10795    pub async fn doit(mut self) -> common::Result<(common::Response, UpdateValuesResponse)> {
10796        use std::borrow::Cow;
10797        use std::io::{Read, Seek};
10798
10799        use common::{url::Params, ToParts};
10800        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10801
10802        let mut dd = common::DefaultDelegate;
10803        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10804        dlg.begin(common::MethodInfo {
10805            id: "sheets.spreadsheets.values.update",
10806            http_method: hyper::Method::PUT,
10807        });
10808
10809        for &field in [
10810            "alt",
10811            "spreadsheetId",
10812            "range",
10813            "valueInputOption",
10814            "responseValueRenderOption",
10815            "responseDateTimeRenderOption",
10816            "includeValuesInResponse",
10817        ]
10818        .iter()
10819        {
10820            if self._additional_params.contains_key(field) {
10821                dlg.finished(false);
10822                return Err(common::Error::FieldClash(field));
10823            }
10824        }
10825
10826        let mut params = Params::with_capacity(9 + self._additional_params.len());
10827        params.push("spreadsheetId", self._spreadsheet_id);
10828        params.push("range", self._range);
10829        if let Some(value) = self._value_input_option.as_ref() {
10830            params.push("valueInputOption", value);
10831        }
10832        if let Some(value) = self._response_value_render_option.as_ref() {
10833            params.push("responseValueRenderOption", value);
10834        }
10835        if let Some(value) = self._response_date_time_render_option.as_ref() {
10836            params.push("responseDateTimeRenderOption", value);
10837        }
10838        if let Some(value) = self._include_values_in_response.as_ref() {
10839            params.push("includeValuesInResponse", value.to_string());
10840        }
10841
10842        params.extend(self._additional_params.iter());
10843
10844        params.push("alt", "json");
10845        let mut url = self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}/values/{range}";
10846        if self._scopes.is_empty() {
10847            self._scopes.insert(Scope::Drive.as_ref().to_string());
10848        }
10849
10850        #[allow(clippy::single_element_loop)]
10851        for &(find_this, param_name) in
10852            [("{spreadsheetId}", "spreadsheetId"), ("{range}", "range")].iter()
10853        {
10854            url = params.uri_replacement(url, param_name, find_this, false);
10855        }
10856        {
10857            let to_remove = ["range", "spreadsheetId"];
10858            params.remove_params(&to_remove);
10859        }
10860
10861        let url = params.parse_with_url(&url);
10862
10863        let mut json_mime_type = mime::APPLICATION_JSON;
10864        let mut request_value_reader = {
10865            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10866            common::remove_json_null_values(&mut value);
10867            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10868            serde_json::to_writer(&mut dst, &value).unwrap();
10869            dst
10870        };
10871        let request_size = request_value_reader
10872            .seek(std::io::SeekFrom::End(0))
10873            .unwrap();
10874        request_value_reader
10875            .seek(std::io::SeekFrom::Start(0))
10876            .unwrap();
10877
10878        loop {
10879            let token = match self
10880                .hub
10881                .auth
10882                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10883                .await
10884            {
10885                Ok(token) => token,
10886                Err(e) => match dlg.token(e) {
10887                    Ok(token) => token,
10888                    Err(e) => {
10889                        dlg.finished(false);
10890                        return Err(common::Error::MissingToken(e));
10891                    }
10892                },
10893            };
10894            request_value_reader
10895                .seek(std::io::SeekFrom::Start(0))
10896                .unwrap();
10897            let mut req_result = {
10898                let client = &self.hub.client;
10899                dlg.pre_request();
10900                let mut req_builder = hyper::Request::builder()
10901                    .method(hyper::Method::PUT)
10902                    .uri(url.as_str())
10903                    .header(USER_AGENT, self.hub._user_agent.clone());
10904
10905                if let Some(token) = token.as_ref() {
10906                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10907                }
10908
10909                let request = req_builder
10910                    .header(CONTENT_TYPE, json_mime_type.to_string())
10911                    .header(CONTENT_LENGTH, request_size as u64)
10912                    .body(common::to_body(
10913                        request_value_reader.get_ref().clone().into(),
10914                    ));
10915
10916                client.request(request.unwrap()).await
10917            };
10918
10919            match req_result {
10920                Err(err) => {
10921                    if let common::Retry::After(d) = dlg.http_error(&err) {
10922                        sleep(d).await;
10923                        continue;
10924                    }
10925                    dlg.finished(false);
10926                    return Err(common::Error::HttpError(err));
10927                }
10928                Ok(res) => {
10929                    let (mut parts, body) = res.into_parts();
10930                    let mut body = common::Body::new(body);
10931                    if !parts.status.is_success() {
10932                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10933                        let error = serde_json::from_str(&common::to_string(&bytes));
10934                        let response = common::to_response(parts, bytes.into());
10935
10936                        if let common::Retry::After(d) =
10937                            dlg.http_failure(&response, error.as_ref().ok())
10938                        {
10939                            sleep(d).await;
10940                            continue;
10941                        }
10942
10943                        dlg.finished(false);
10944
10945                        return Err(match error {
10946                            Ok(value) => common::Error::BadRequest(value),
10947                            _ => common::Error::Failure(response),
10948                        });
10949                    }
10950                    let response = {
10951                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10952                        let encoded = common::to_string(&bytes);
10953                        match serde_json::from_str(&encoded) {
10954                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10955                            Err(error) => {
10956                                dlg.response_json_decode_error(&encoded, &error);
10957                                return Err(common::Error::JsonDecodeError(
10958                                    encoded.to_string(),
10959                                    error,
10960                                ));
10961                            }
10962                        }
10963                    };
10964
10965                    dlg.finished(true);
10966                    return Ok(response);
10967                }
10968            }
10969        }
10970    }
10971
10972    ///
10973    /// Sets the *request* property to the given value.
10974    ///
10975    /// Even though the property as already been set when instantiating this call,
10976    /// we provide this method for API completeness.
10977    pub fn request(mut self, new_value: ValueRange) -> SpreadsheetValueUpdateCall<'a, C> {
10978        self._request = new_value;
10979        self
10980    }
10981    /// The ID of the spreadsheet to update.
10982    ///
10983    /// Sets the *spreadsheet id* path property to the given value.
10984    ///
10985    /// Even though the property as already been set when instantiating this call,
10986    /// we provide this method for API completeness.
10987    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetValueUpdateCall<'a, C> {
10988        self._spreadsheet_id = new_value.to_string();
10989        self
10990    }
10991    /// The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of the values to update.
10992    ///
10993    /// Sets the *range* path property to the given value.
10994    ///
10995    /// Even though the property as already been set when instantiating this call,
10996    /// we provide this method for API completeness.
10997    pub fn range(mut self, new_value: &str) -> SpreadsheetValueUpdateCall<'a, C> {
10998        self._range = new_value.to_string();
10999        self
11000    }
11001    /// How the input data should be interpreted.
11002    ///
11003    /// Sets the *value input option* query property to the given value.
11004    pub fn value_input_option(mut self, new_value: &str) -> SpreadsheetValueUpdateCall<'a, C> {
11005        self._value_input_option = Some(new_value.to_string());
11006        self
11007    }
11008    /// Determines how values in the response should be rendered. The default render option is FORMATTED_VALUE.
11009    ///
11010    /// Sets the *response value render option* query property to the given value.
11011    pub fn response_value_render_option(
11012        mut self,
11013        new_value: &str,
11014    ) -> SpreadsheetValueUpdateCall<'a, C> {
11015        self._response_value_render_option = Some(new_value.to_string());
11016        self
11017    }
11018    /// Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is SERIAL_NUMBER.
11019    ///
11020    /// Sets the *response date time render option* query property to the given value.
11021    pub fn response_date_time_render_option(
11022        mut self,
11023        new_value: &str,
11024    ) -> SpreadsheetValueUpdateCall<'a, C> {
11025        self._response_date_time_render_option = Some(new_value.to_string());
11026        self
11027    }
11028    /// Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns).
11029    ///
11030    /// Sets the *include values in response* query property to the given value.
11031    pub fn include_values_in_response(
11032        mut self,
11033        new_value: bool,
11034    ) -> SpreadsheetValueUpdateCall<'a, C> {
11035        self._include_values_in_response = Some(new_value);
11036        self
11037    }
11038    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11039    /// while executing the actual API request.
11040    ///
11041    /// ````text
11042    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11043    /// ````
11044    ///
11045    /// Sets the *delegate* property to the given value.
11046    pub fn delegate(
11047        mut self,
11048        new_value: &'a mut dyn common::Delegate,
11049    ) -> SpreadsheetValueUpdateCall<'a, C> {
11050        self._delegate = Some(new_value);
11051        self
11052    }
11053
11054    /// Set any additional parameter of the query string used in the request.
11055    /// It should be used to set parameters which are not yet available through their own
11056    /// setters.
11057    ///
11058    /// Please note that this method must not be used to set any of the known parameters
11059    /// which have their own setter method. If done anyway, the request will fail.
11060    ///
11061    /// # Additional Parameters
11062    ///
11063    /// * *$.xgafv* (query-string) - V1 error format.
11064    /// * *access_token* (query-string) - OAuth access token.
11065    /// * *alt* (query-string) - Data format for response.
11066    /// * *callback* (query-string) - JSONP
11067    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11068    /// * *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.
11069    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11070    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11071    /// * *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.
11072    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11073    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11074    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetValueUpdateCall<'a, C>
11075    where
11076        T: AsRef<str>,
11077    {
11078        self._additional_params
11079            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11080        self
11081    }
11082
11083    /// Identifies the authorization scope for the method you are building.
11084    ///
11085    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11086    /// [`Scope::Drive`].
11087    ///
11088    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11089    /// tokens for more than one scope.
11090    ///
11091    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11092    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11093    /// sufficient, a read-write scope will do as well.
11094    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetValueUpdateCall<'a, C>
11095    where
11096        St: AsRef<str>,
11097    {
11098        self._scopes.insert(String::from(scope.as_ref()));
11099        self
11100    }
11101    /// Identifies the authorization scope(s) for the method you are building.
11102    ///
11103    /// See [`Self::add_scope()`] for details.
11104    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetValueUpdateCall<'a, C>
11105    where
11106        I: IntoIterator<Item = St>,
11107        St: AsRef<str>,
11108    {
11109        self._scopes
11110            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11111        self
11112    }
11113
11114    /// Removes all scopes, and no default scope will be used either.
11115    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11116    /// for details).
11117    pub fn clear_scopes(mut self) -> SpreadsheetValueUpdateCall<'a, C> {
11118        self._scopes.clear();
11119        self
11120    }
11121}
11122
11123/// Applies one or more updates to the spreadsheet. Each request is validated before being applied. If any request is not valid then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply, then the response will have 2 empty replies, the actual reply, and another empty reply, in that order. Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect exactly your changes after this completes, however it is guaranteed that the updates in the request will be applied together atomically. Your changes may be altered with respect to collaborator changes. If there are no collaborators, the spreadsheet should reflect your changes.
11124///
11125/// A builder for the *batchUpdate* method supported by a *spreadsheet* resource.
11126/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
11127///
11128/// # Example
11129///
11130/// Instantiate a resource method builder
11131///
11132/// ```test_harness,no_run
11133/// # extern crate hyper;
11134/// # extern crate hyper_rustls;
11135/// # extern crate google_sheets4 as sheets4;
11136/// use sheets4::api::BatchUpdateSpreadsheetRequest;
11137/// # async fn dox() {
11138/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11139///
11140/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11141/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11142/// #     .with_native_roots()
11143/// #     .unwrap()
11144/// #     .https_only()
11145/// #     .enable_http2()
11146/// #     .build();
11147///
11148/// # let executor = hyper_util::rt::TokioExecutor::new();
11149/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11150/// #     secret,
11151/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11152/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11153/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11154/// #     ),
11155/// # ).build().await.unwrap();
11156///
11157/// # let client = hyper_util::client::legacy::Client::builder(
11158/// #     hyper_util::rt::TokioExecutor::new()
11159/// # )
11160/// # .build(
11161/// #     hyper_rustls::HttpsConnectorBuilder::new()
11162/// #         .with_native_roots()
11163/// #         .unwrap()
11164/// #         .https_or_http()
11165/// #         .enable_http2()
11166/// #         .build()
11167/// # );
11168/// # let mut hub = Sheets::new(client, auth);
11169/// // As the method needs a request, you would usually fill it with the desired information
11170/// // into the respective structure. Some of the parts shown here might not be applicable !
11171/// // Values shown here are possibly random and not representative !
11172/// let mut req = BatchUpdateSpreadsheetRequest::default();
11173///
11174/// // You can configure optional parameters by calling the respective setters at will, and
11175/// // execute the final call using `doit()`.
11176/// // Values shown here are possibly random and not representative !
11177/// let result = hub.spreadsheets().batch_update(req, "spreadsheetId")
11178///              .doit().await;
11179/// # }
11180/// ```
11181pub struct SpreadsheetBatchUpdateCall<'a, C>
11182where
11183    C: 'a,
11184{
11185    hub: &'a Sheets<C>,
11186    _request: BatchUpdateSpreadsheetRequest,
11187    _spreadsheet_id: String,
11188    _delegate: Option<&'a mut dyn common::Delegate>,
11189    _additional_params: HashMap<String, String>,
11190    _scopes: BTreeSet<String>,
11191}
11192
11193impl<'a, C> common::CallBuilder for SpreadsheetBatchUpdateCall<'a, C> {}
11194
11195impl<'a, C> SpreadsheetBatchUpdateCall<'a, C>
11196where
11197    C: common::Connector,
11198{
11199    /// Perform the operation you have build so far.
11200    pub async fn doit(
11201        mut self,
11202    ) -> common::Result<(common::Response, BatchUpdateSpreadsheetResponse)> {
11203        use std::borrow::Cow;
11204        use std::io::{Read, Seek};
11205
11206        use common::{url::Params, ToParts};
11207        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11208
11209        let mut dd = common::DefaultDelegate;
11210        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11211        dlg.begin(common::MethodInfo {
11212            id: "sheets.spreadsheets.batchUpdate",
11213            http_method: hyper::Method::POST,
11214        });
11215
11216        for &field in ["alt", "spreadsheetId"].iter() {
11217            if self._additional_params.contains_key(field) {
11218                dlg.finished(false);
11219                return Err(common::Error::FieldClash(field));
11220            }
11221        }
11222
11223        let mut params = Params::with_capacity(4 + self._additional_params.len());
11224        params.push("spreadsheetId", self._spreadsheet_id);
11225
11226        params.extend(self._additional_params.iter());
11227
11228        params.push("alt", "json");
11229        let mut url = self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}:batchUpdate";
11230        if self._scopes.is_empty() {
11231            self._scopes.insert(Scope::Drive.as_ref().to_string());
11232        }
11233
11234        #[allow(clippy::single_element_loop)]
11235        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
11236            url = params.uri_replacement(url, param_name, find_this, false);
11237        }
11238        {
11239            let to_remove = ["spreadsheetId"];
11240            params.remove_params(&to_remove);
11241        }
11242
11243        let url = params.parse_with_url(&url);
11244
11245        let mut json_mime_type = mime::APPLICATION_JSON;
11246        let mut request_value_reader = {
11247            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11248            common::remove_json_null_values(&mut value);
11249            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11250            serde_json::to_writer(&mut dst, &value).unwrap();
11251            dst
11252        };
11253        let request_size = request_value_reader
11254            .seek(std::io::SeekFrom::End(0))
11255            .unwrap();
11256        request_value_reader
11257            .seek(std::io::SeekFrom::Start(0))
11258            .unwrap();
11259
11260        loop {
11261            let token = match self
11262                .hub
11263                .auth
11264                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11265                .await
11266            {
11267                Ok(token) => token,
11268                Err(e) => match dlg.token(e) {
11269                    Ok(token) => token,
11270                    Err(e) => {
11271                        dlg.finished(false);
11272                        return Err(common::Error::MissingToken(e));
11273                    }
11274                },
11275            };
11276            request_value_reader
11277                .seek(std::io::SeekFrom::Start(0))
11278                .unwrap();
11279            let mut req_result = {
11280                let client = &self.hub.client;
11281                dlg.pre_request();
11282                let mut req_builder = hyper::Request::builder()
11283                    .method(hyper::Method::POST)
11284                    .uri(url.as_str())
11285                    .header(USER_AGENT, self.hub._user_agent.clone());
11286
11287                if let Some(token) = token.as_ref() {
11288                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11289                }
11290
11291                let request = req_builder
11292                    .header(CONTENT_TYPE, json_mime_type.to_string())
11293                    .header(CONTENT_LENGTH, request_size as u64)
11294                    .body(common::to_body(
11295                        request_value_reader.get_ref().clone().into(),
11296                    ));
11297
11298                client.request(request.unwrap()).await
11299            };
11300
11301            match req_result {
11302                Err(err) => {
11303                    if let common::Retry::After(d) = dlg.http_error(&err) {
11304                        sleep(d).await;
11305                        continue;
11306                    }
11307                    dlg.finished(false);
11308                    return Err(common::Error::HttpError(err));
11309                }
11310                Ok(res) => {
11311                    let (mut parts, body) = res.into_parts();
11312                    let mut body = common::Body::new(body);
11313                    if !parts.status.is_success() {
11314                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11315                        let error = serde_json::from_str(&common::to_string(&bytes));
11316                        let response = common::to_response(parts, bytes.into());
11317
11318                        if let common::Retry::After(d) =
11319                            dlg.http_failure(&response, error.as_ref().ok())
11320                        {
11321                            sleep(d).await;
11322                            continue;
11323                        }
11324
11325                        dlg.finished(false);
11326
11327                        return Err(match error {
11328                            Ok(value) => common::Error::BadRequest(value),
11329                            _ => common::Error::Failure(response),
11330                        });
11331                    }
11332                    let response = {
11333                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11334                        let encoded = common::to_string(&bytes);
11335                        match serde_json::from_str(&encoded) {
11336                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11337                            Err(error) => {
11338                                dlg.response_json_decode_error(&encoded, &error);
11339                                return Err(common::Error::JsonDecodeError(
11340                                    encoded.to_string(),
11341                                    error,
11342                                ));
11343                            }
11344                        }
11345                    };
11346
11347                    dlg.finished(true);
11348                    return Ok(response);
11349                }
11350            }
11351        }
11352    }
11353
11354    ///
11355    /// Sets the *request* property to the given value.
11356    ///
11357    /// Even though the property as already been set when instantiating this call,
11358    /// we provide this method for API completeness.
11359    pub fn request(
11360        mut self,
11361        new_value: BatchUpdateSpreadsheetRequest,
11362    ) -> SpreadsheetBatchUpdateCall<'a, C> {
11363        self._request = new_value;
11364        self
11365    }
11366    /// The spreadsheet to apply the updates to.
11367    ///
11368    /// Sets the *spreadsheet id* path property to the given value.
11369    ///
11370    /// Even though the property as already been set when instantiating this call,
11371    /// we provide this method for API completeness.
11372    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetBatchUpdateCall<'a, C> {
11373        self._spreadsheet_id = new_value.to_string();
11374        self
11375    }
11376    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11377    /// while executing the actual API request.
11378    ///
11379    /// ````text
11380    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11381    /// ````
11382    ///
11383    /// Sets the *delegate* property to the given value.
11384    pub fn delegate(
11385        mut self,
11386        new_value: &'a mut dyn common::Delegate,
11387    ) -> SpreadsheetBatchUpdateCall<'a, C> {
11388        self._delegate = Some(new_value);
11389        self
11390    }
11391
11392    /// Set any additional parameter of the query string used in the request.
11393    /// It should be used to set parameters which are not yet available through their own
11394    /// setters.
11395    ///
11396    /// Please note that this method must not be used to set any of the known parameters
11397    /// which have their own setter method. If done anyway, the request will fail.
11398    ///
11399    /// # Additional Parameters
11400    ///
11401    /// * *$.xgafv* (query-string) - V1 error format.
11402    /// * *access_token* (query-string) - OAuth access token.
11403    /// * *alt* (query-string) - Data format for response.
11404    /// * *callback* (query-string) - JSONP
11405    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11406    /// * *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.
11407    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11408    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11409    /// * *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.
11410    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11411    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11412    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetBatchUpdateCall<'a, C>
11413    where
11414        T: AsRef<str>,
11415    {
11416        self._additional_params
11417            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11418        self
11419    }
11420
11421    /// Identifies the authorization scope for the method you are building.
11422    ///
11423    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11424    /// [`Scope::Drive`].
11425    ///
11426    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11427    /// tokens for more than one scope.
11428    ///
11429    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11430    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11431    /// sufficient, a read-write scope will do as well.
11432    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetBatchUpdateCall<'a, C>
11433    where
11434        St: AsRef<str>,
11435    {
11436        self._scopes.insert(String::from(scope.as_ref()));
11437        self
11438    }
11439    /// Identifies the authorization scope(s) for the method you are building.
11440    ///
11441    /// See [`Self::add_scope()`] for details.
11442    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetBatchUpdateCall<'a, C>
11443    where
11444        I: IntoIterator<Item = St>,
11445        St: AsRef<str>,
11446    {
11447        self._scopes
11448            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11449        self
11450    }
11451
11452    /// Removes all scopes, and no default scope will be used either.
11453    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11454    /// for details).
11455    pub fn clear_scopes(mut self) -> SpreadsheetBatchUpdateCall<'a, C> {
11456        self._scopes.clear();
11457        self
11458    }
11459}
11460
11461/// Creates a spreadsheet, returning the newly created spreadsheet.
11462///
11463/// A builder for the *create* method supported by a *spreadsheet* resource.
11464/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
11465///
11466/// # Example
11467///
11468/// Instantiate a resource method builder
11469///
11470/// ```test_harness,no_run
11471/// # extern crate hyper;
11472/// # extern crate hyper_rustls;
11473/// # extern crate google_sheets4 as sheets4;
11474/// use sheets4::api::Spreadsheet;
11475/// # async fn dox() {
11476/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11477///
11478/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11479/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11480/// #     .with_native_roots()
11481/// #     .unwrap()
11482/// #     .https_only()
11483/// #     .enable_http2()
11484/// #     .build();
11485///
11486/// # let executor = hyper_util::rt::TokioExecutor::new();
11487/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11488/// #     secret,
11489/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11490/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11491/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11492/// #     ),
11493/// # ).build().await.unwrap();
11494///
11495/// # let client = hyper_util::client::legacy::Client::builder(
11496/// #     hyper_util::rt::TokioExecutor::new()
11497/// # )
11498/// # .build(
11499/// #     hyper_rustls::HttpsConnectorBuilder::new()
11500/// #         .with_native_roots()
11501/// #         .unwrap()
11502/// #         .https_or_http()
11503/// #         .enable_http2()
11504/// #         .build()
11505/// # );
11506/// # let mut hub = Sheets::new(client, auth);
11507/// // As the method needs a request, you would usually fill it with the desired information
11508/// // into the respective structure. Some of the parts shown here might not be applicable !
11509/// // Values shown here are possibly random and not representative !
11510/// let mut req = Spreadsheet::default();
11511///
11512/// // You can configure optional parameters by calling the respective setters at will, and
11513/// // execute the final call using `doit()`.
11514/// // Values shown here are possibly random and not representative !
11515/// let result = hub.spreadsheets().create(req)
11516///              .doit().await;
11517/// # }
11518/// ```
11519pub struct SpreadsheetCreateCall<'a, C>
11520where
11521    C: 'a,
11522{
11523    hub: &'a Sheets<C>,
11524    _request: Spreadsheet,
11525    _delegate: Option<&'a mut dyn common::Delegate>,
11526    _additional_params: HashMap<String, String>,
11527    _scopes: BTreeSet<String>,
11528}
11529
11530impl<'a, C> common::CallBuilder for SpreadsheetCreateCall<'a, C> {}
11531
11532impl<'a, C> SpreadsheetCreateCall<'a, C>
11533where
11534    C: common::Connector,
11535{
11536    /// Perform the operation you have build so far.
11537    pub async fn doit(mut self) -> common::Result<(common::Response, Spreadsheet)> {
11538        use std::borrow::Cow;
11539        use std::io::{Read, Seek};
11540
11541        use common::{url::Params, ToParts};
11542        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11543
11544        let mut dd = common::DefaultDelegate;
11545        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11546        dlg.begin(common::MethodInfo {
11547            id: "sheets.spreadsheets.create",
11548            http_method: hyper::Method::POST,
11549        });
11550
11551        for &field in ["alt"].iter() {
11552            if self._additional_params.contains_key(field) {
11553                dlg.finished(false);
11554                return Err(common::Error::FieldClash(field));
11555            }
11556        }
11557
11558        let mut params = Params::with_capacity(3 + self._additional_params.len());
11559
11560        params.extend(self._additional_params.iter());
11561
11562        params.push("alt", "json");
11563        let mut url = self.hub._base_url.clone() + "v4/spreadsheets";
11564        if self._scopes.is_empty() {
11565            self._scopes.insert(Scope::Drive.as_ref().to_string());
11566        }
11567
11568        let url = params.parse_with_url(&url);
11569
11570        let mut json_mime_type = mime::APPLICATION_JSON;
11571        let mut request_value_reader = {
11572            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11573            common::remove_json_null_values(&mut value);
11574            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11575            serde_json::to_writer(&mut dst, &value).unwrap();
11576            dst
11577        };
11578        let request_size = request_value_reader
11579            .seek(std::io::SeekFrom::End(0))
11580            .unwrap();
11581        request_value_reader
11582            .seek(std::io::SeekFrom::Start(0))
11583            .unwrap();
11584
11585        loop {
11586            let token = match self
11587                .hub
11588                .auth
11589                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11590                .await
11591            {
11592                Ok(token) => token,
11593                Err(e) => match dlg.token(e) {
11594                    Ok(token) => token,
11595                    Err(e) => {
11596                        dlg.finished(false);
11597                        return Err(common::Error::MissingToken(e));
11598                    }
11599                },
11600            };
11601            request_value_reader
11602                .seek(std::io::SeekFrom::Start(0))
11603                .unwrap();
11604            let mut req_result = {
11605                let client = &self.hub.client;
11606                dlg.pre_request();
11607                let mut req_builder = hyper::Request::builder()
11608                    .method(hyper::Method::POST)
11609                    .uri(url.as_str())
11610                    .header(USER_AGENT, self.hub._user_agent.clone());
11611
11612                if let Some(token) = token.as_ref() {
11613                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11614                }
11615
11616                let request = req_builder
11617                    .header(CONTENT_TYPE, json_mime_type.to_string())
11618                    .header(CONTENT_LENGTH, request_size as u64)
11619                    .body(common::to_body(
11620                        request_value_reader.get_ref().clone().into(),
11621                    ));
11622
11623                client.request(request.unwrap()).await
11624            };
11625
11626            match req_result {
11627                Err(err) => {
11628                    if let common::Retry::After(d) = dlg.http_error(&err) {
11629                        sleep(d).await;
11630                        continue;
11631                    }
11632                    dlg.finished(false);
11633                    return Err(common::Error::HttpError(err));
11634                }
11635                Ok(res) => {
11636                    let (mut parts, body) = res.into_parts();
11637                    let mut body = common::Body::new(body);
11638                    if !parts.status.is_success() {
11639                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11640                        let error = serde_json::from_str(&common::to_string(&bytes));
11641                        let response = common::to_response(parts, bytes.into());
11642
11643                        if let common::Retry::After(d) =
11644                            dlg.http_failure(&response, error.as_ref().ok())
11645                        {
11646                            sleep(d).await;
11647                            continue;
11648                        }
11649
11650                        dlg.finished(false);
11651
11652                        return Err(match error {
11653                            Ok(value) => common::Error::BadRequest(value),
11654                            _ => common::Error::Failure(response),
11655                        });
11656                    }
11657                    let response = {
11658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11659                        let encoded = common::to_string(&bytes);
11660                        match serde_json::from_str(&encoded) {
11661                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11662                            Err(error) => {
11663                                dlg.response_json_decode_error(&encoded, &error);
11664                                return Err(common::Error::JsonDecodeError(
11665                                    encoded.to_string(),
11666                                    error,
11667                                ));
11668                            }
11669                        }
11670                    };
11671
11672                    dlg.finished(true);
11673                    return Ok(response);
11674                }
11675            }
11676        }
11677    }
11678
11679    ///
11680    /// Sets the *request* property to the given value.
11681    ///
11682    /// Even though the property as already been set when instantiating this call,
11683    /// we provide this method for API completeness.
11684    pub fn request(mut self, new_value: Spreadsheet) -> SpreadsheetCreateCall<'a, C> {
11685        self._request = new_value;
11686        self
11687    }
11688    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11689    /// while executing the actual API request.
11690    ///
11691    /// ````text
11692    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11693    /// ````
11694    ///
11695    /// Sets the *delegate* property to the given value.
11696    pub fn delegate(
11697        mut self,
11698        new_value: &'a mut dyn common::Delegate,
11699    ) -> SpreadsheetCreateCall<'a, C> {
11700        self._delegate = Some(new_value);
11701        self
11702    }
11703
11704    /// Set any additional parameter of the query string used in the request.
11705    /// It should be used to set parameters which are not yet available through their own
11706    /// setters.
11707    ///
11708    /// Please note that this method must not be used to set any of the known parameters
11709    /// which have their own setter method. If done anyway, the request will fail.
11710    ///
11711    /// # Additional Parameters
11712    ///
11713    /// * *$.xgafv* (query-string) - V1 error format.
11714    /// * *access_token* (query-string) - OAuth access token.
11715    /// * *alt* (query-string) - Data format for response.
11716    /// * *callback* (query-string) - JSONP
11717    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11718    /// * *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.
11719    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11720    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11721    /// * *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.
11722    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11723    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11724    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetCreateCall<'a, C>
11725    where
11726        T: AsRef<str>,
11727    {
11728        self._additional_params
11729            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11730        self
11731    }
11732
11733    /// Identifies the authorization scope for the method you are building.
11734    ///
11735    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11736    /// [`Scope::Drive`].
11737    ///
11738    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11739    /// tokens for more than one scope.
11740    ///
11741    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11742    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11743    /// sufficient, a read-write scope will do as well.
11744    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetCreateCall<'a, C>
11745    where
11746        St: AsRef<str>,
11747    {
11748        self._scopes.insert(String::from(scope.as_ref()));
11749        self
11750    }
11751    /// Identifies the authorization scope(s) for the method you are building.
11752    ///
11753    /// See [`Self::add_scope()`] for details.
11754    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetCreateCall<'a, C>
11755    where
11756        I: IntoIterator<Item = St>,
11757        St: AsRef<str>,
11758    {
11759        self._scopes
11760            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11761        self
11762    }
11763
11764    /// Removes all scopes, and no default scope will be used either.
11765    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11766    /// for details).
11767    pub fn clear_scopes(mut self) -> SpreadsheetCreateCall<'a, C> {
11768        self._scopes.clear();
11769        self
11770    }
11771}
11772
11773/// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. By default, data within grids is not returned. You can include grid data in one of 2 ways: * Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData URL parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want. To retrieve only subsets of spreadsheet data, use the ranges URL parameter. Ranges are specified using [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). You can define a single cell (for example, `A1`) or multiple cells (for example, `A1:D5`). You can also get cells from other sheets within the same spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.
11774///
11775/// A builder for the *get* method supported by a *spreadsheet* resource.
11776/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
11777///
11778/// # Example
11779///
11780/// Instantiate a resource method builder
11781///
11782/// ```test_harness,no_run
11783/// # extern crate hyper;
11784/// # extern crate hyper_rustls;
11785/// # extern crate google_sheets4 as sheets4;
11786/// # async fn dox() {
11787/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11788///
11789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11791/// #     .with_native_roots()
11792/// #     .unwrap()
11793/// #     .https_only()
11794/// #     .enable_http2()
11795/// #     .build();
11796///
11797/// # let executor = hyper_util::rt::TokioExecutor::new();
11798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11799/// #     secret,
11800/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11801/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11802/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11803/// #     ),
11804/// # ).build().await.unwrap();
11805///
11806/// # let client = hyper_util::client::legacy::Client::builder(
11807/// #     hyper_util::rt::TokioExecutor::new()
11808/// # )
11809/// # .build(
11810/// #     hyper_rustls::HttpsConnectorBuilder::new()
11811/// #         .with_native_roots()
11812/// #         .unwrap()
11813/// #         .https_or_http()
11814/// #         .enable_http2()
11815/// #         .build()
11816/// # );
11817/// # let mut hub = Sheets::new(client, auth);
11818/// // You can configure optional parameters by calling the respective setters at will, and
11819/// // execute the final call using `doit()`.
11820/// // Values shown here are possibly random and not representative !
11821/// let result = hub.spreadsheets().get("spreadsheetId")
11822///              .add_ranges("et")
11823///              .include_grid_data(false)
11824///              .exclude_tables_in_banded_ranges(false)
11825///              .doit().await;
11826/// # }
11827/// ```
11828pub struct SpreadsheetGetCall<'a, C>
11829where
11830    C: 'a,
11831{
11832    hub: &'a Sheets<C>,
11833    _spreadsheet_id: String,
11834    _ranges: Vec<String>,
11835    _include_grid_data: Option<bool>,
11836    _exclude_tables_in_banded_ranges: Option<bool>,
11837    _delegate: Option<&'a mut dyn common::Delegate>,
11838    _additional_params: HashMap<String, String>,
11839    _scopes: BTreeSet<String>,
11840}
11841
11842impl<'a, C> common::CallBuilder for SpreadsheetGetCall<'a, C> {}
11843
11844impl<'a, C> SpreadsheetGetCall<'a, C>
11845where
11846    C: common::Connector,
11847{
11848    /// Perform the operation you have build so far.
11849    pub async fn doit(mut self) -> common::Result<(common::Response, Spreadsheet)> {
11850        use std::borrow::Cow;
11851        use std::io::{Read, Seek};
11852
11853        use common::{url::Params, ToParts};
11854        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11855
11856        let mut dd = common::DefaultDelegate;
11857        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11858        dlg.begin(common::MethodInfo {
11859            id: "sheets.spreadsheets.get",
11860            http_method: hyper::Method::GET,
11861        });
11862
11863        for &field in [
11864            "alt",
11865            "spreadsheetId",
11866            "ranges",
11867            "includeGridData",
11868            "excludeTablesInBandedRanges",
11869        ]
11870        .iter()
11871        {
11872            if self._additional_params.contains_key(field) {
11873                dlg.finished(false);
11874                return Err(common::Error::FieldClash(field));
11875            }
11876        }
11877
11878        let mut params = Params::with_capacity(6 + self._additional_params.len());
11879        params.push("spreadsheetId", self._spreadsheet_id);
11880        if !self._ranges.is_empty() {
11881            for f in self._ranges.iter() {
11882                params.push("ranges", f);
11883            }
11884        }
11885        if let Some(value) = self._include_grid_data.as_ref() {
11886            params.push("includeGridData", value.to_string());
11887        }
11888        if let Some(value) = self._exclude_tables_in_banded_ranges.as_ref() {
11889            params.push("excludeTablesInBandedRanges", value.to_string());
11890        }
11891
11892        params.extend(self._additional_params.iter());
11893
11894        params.push("alt", "json");
11895        let mut url = self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}";
11896        if self._scopes.is_empty() {
11897            self._scopes
11898                .insert(Scope::DriveReadonly.as_ref().to_string());
11899        }
11900
11901        #[allow(clippy::single_element_loop)]
11902        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
11903            url = params.uri_replacement(url, param_name, find_this, false);
11904        }
11905        {
11906            let to_remove = ["spreadsheetId"];
11907            params.remove_params(&to_remove);
11908        }
11909
11910        let url = params.parse_with_url(&url);
11911
11912        loop {
11913            let token = match self
11914                .hub
11915                .auth
11916                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11917                .await
11918            {
11919                Ok(token) => token,
11920                Err(e) => match dlg.token(e) {
11921                    Ok(token) => token,
11922                    Err(e) => {
11923                        dlg.finished(false);
11924                        return Err(common::Error::MissingToken(e));
11925                    }
11926                },
11927            };
11928            let mut req_result = {
11929                let client = &self.hub.client;
11930                dlg.pre_request();
11931                let mut req_builder = hyper::Request::builder()
11932                    .method(hyper::Method::GET)
11933                    .uri(url.as_str())
11934                    .header(USER_AGENT, self.hub._user_agent.clone());
11935
11936                if let Some(token) = token.as_ref() {
11937                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11938                }
11939
11940                let request = req_builder
11941                    .header(CONTENT_LENGTH, 0_u64)
11942                    .body(common::to_body::<String>(None));
11943
11944                client.request(request.unwrap()).await
11945            };
11946
11947            match req_result {
11948                Err(err) => {
11949                    if let common::Retry::After(d) = dlg.http_error(&err) {
11950                        sleep(d).await;
11951                        continue;
11952                    }
11953                    dlg.finished(false);
11954                    return Err(common::Error::HttpError(err));
11955                }
11956                Ok(res) => {
11957                    let (mut parts, body) = res.into_parts();
11958                    let mut body = common::Body::new(body);
11959                    if !parts.status.is_success() {
11960                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11961                        let error = serde_json::from_str(&common::to_string(&bytes));
11962                        let response = common::to_response(parts, bytes.into());
11963
11964                        if let common::Retry::After(d) =
11965                            dlg.http_failure(&response, error.as_ref().ok())
11966                        {
11967                            sleep(d).await;
11968                            continue;
11969                        }
11970
11971                        dlg.finished(false);
11972
11973                        return Err(match error {
11974                            Ok(value) => common::Error::BadRequest(value),
11975                            _ => common::Error::Failure(response),
11976                        });
11977                    }
11978                    let response = {
11979                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11980                        let encoded = common::to_string(&bytes);
11981                        match serde_json::from_str(&encoded) {
11982                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11983                            Err(error) => {
11984                                dlg.response_json_decode_error(&encoded, &error);
11985                                return Err(common::Error::JsonDecodeError(
11986                                    encoded.to_string(),
11987                                    error,
11988                                ));
11989                            }
11990                        }
11991                    };
11992
11993                    dlg.finished(true);
11994                    return Ok(response);
11995                }
11996            }
11997        }
11998    }
11999
12000    /// The spreadsheet to request.
12001    ///
12002    /// Sets the *spreadsheet id* path property to the given value.
12003    ///
12004    /// Even though the property as already been set when instantiating this call,
12005    /// we provide this method for API completeness.
12006    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetGetCall<'a, C> {
12007        self._spreadsheet_id = new_value.to_string();
12008        self
12009    }
12010    /// The ranges to retrieve from the spreadsheet.
12011    ///
12012    /// Append the given value to the *ranges* query property.
12013    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
12014    pub fn add_ranges(mut self, new_value: &str) -> SpreadsheetGetCall<'a, C> {
12015        self._ranges.push(new_value.to_string());
12016        self
12017    }
12018    /// True if grid data should be returned. This parameter is ignored if a field mask was set in the request.
12019    ///
12020    /// Sets the *include grid data* query property to the given value.
12021    pub fn include_grid_data(mut self, new_value: bool) -> SpreadsheetGetCall<'a, C> {
12022        self._include_grid_data = Some(new_value);
12023        self
12024    }
12025    /// True if tables should be excluded in the banded ranges. False if not set.
12026    ///
12027    /// Sets the *exclude tables in banded ranges* query property to the given value.
12028    pub fn exclude_tables_in_banded_ranges(mut self, new_value: bool) -> SpreadsheetGetCall<'a, C> {
12029        self._exclude_tables_in_banded_ranges = Some(new_value);
12030        self
12031    }
12032    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12033    /// while executing the actual API request.
12034    ///
12035    /// ````text
12036    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12037    /// ````
12038    ///
12039    /// Sets the *delegate* property to the given value.
12040    pub fn delegate(
12041        mut self,
12042        new_value: &'a mut dyn common::Delegate,
12043    ) -> SpreadsheetGetCall<'a, C> {
12044        self._delegate = Some(new_value);
12045        self
12046    }
12047
12048    /// Set any additional parameter of the query string used in the request.
12049    /// It should be used to set parameters which are not yet available through their own
12050    /// setters.
12051    ///
12052    /// Please note that this method must not be used to set any of the known parameters
12053    /// which have their own setter method. If done anyway, the request will fail.
12054    ///
12055    /// # Additional Parameters
12056    ///
12057    /// * *$.xgafv* (query-string) - V1 error format.
12058    /// * *access_token* (query-string) - OAuth access token.
12059    /// * *alt* (query-string) - Data format for response.
12060    /// * *callback* (query-string) - JSONP
12061    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12062    /// * *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.
12063    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12064    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12065    /// * *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.
12066    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12067    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12068    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetGetCall<'a, C>
12069    where
12070        T: AsRef<str>,
12071    {
12072        self._additional_params
12073            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12074        self
12075    }
12076
12077    /// Identifies the authorization scope for the method you are building.
12078    ///
12079    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12080    /// [`Scope::DriveReadonly`].
12081    ///
12082    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12083    /// tokens for more than one scope.
12084    ///
12085    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12086    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12087    /// sufficient, a read-write scope will do as well.
12088    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetGetCall<'a, C>
12089    where
12090        St: AsRef<str>,
12091    {
12092        self._scopes.insert(String::from(scope.as_ref()));
12093        self
12094    }
12095    /// Identifies the authorization scope(s) for the method you are building.
12096    ///
12097    /// See [`Self::add_scope()`] for details.
12098    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetGetCall<'a, C>
12099    where
12100        I: IntoIterator<Item = St>,
12101        St: AsRef<str>,
12102    {
12103        self._scopes
12104            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12105        self
12106    }
12107
12108    /// Removes all scopes, and no default scope will be used either.
12109    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12110    /// for details).
12111    pub fn clear_scopes(mut self) -> SpreadsheetGetCall<'a, C> {
12112        self._scopes.clear();
12113        self
12114    }
12115}
12116
12117/// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters returns the portions of the spreadsheet that intersect ranges matched by any of the filters. By default, data within grids is not returned. You can include grid data one of 2 ways: * Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.
12118///
12119/// A builder for the *getByDataFilter* method supported by a *spreadsheet* resource.
12120/// It is not used directly, but through a [`SpreadsheetMethods`] instance.
12121///
12122/// # Example
12123///
12124/// Instantiate a resource method builder
12125///
12126/// ```test_harness,no_run
12127/// # extern crate hyper;
12128/// # extern crate hyper_rustls;
12129/// # extern crate google_sheets4 as sheets4;
12130/// use sheets4::api::GetSpreadsheetByDataFilterRequest;
12131/// # async fn dox() {
12132/// # use sheets4::{Sheets, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12133///
12134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12135/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12136/// #     .with_native_roots()
12137/// #     .unwrap()
12138/// #     .https_only()
12139/// #     .enable_http2()
12140/// #     .build();
12141///
12142/// # let executor = hyper_util::rt::TokioExecutor::new();
12143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12144/// #     secret,
12145/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12146/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12147/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12148/// #     ),
12149/// # ).build().await.unwrap();
12150///
12151/// # let client = hyper_util::client::legacy::Client::builder(
12152/// #     hyper_util::rt::TokioExecutor::new()
12153/// # )
12154/// # .build(
12155/// #     hyper_rustls::HttpsConnectorBuilder::new()
12156/// #         .with_native_roots()
12157/// #         .unwrap()
12158/// #         .https_or_http()
12159/// #         .enable_http2()
12160/// #         .build()
12161/// # );
12162/// # let mut hub = Sheets::new(client, auth);
12163/// // As the method needs a request, you would usually fill it with the desired information
12164/// // into the respective structure. Some of the parts shown here might not be applicable !
12165/// // Values shown here are possibly random and not representative !
12166/// let mut req = GetSpreadsheetByDataFilterRequest::default();
12167///
12168/// // You can configure optional parameters by calling the respective setters at will, and
12169/// // execute the final call using `doit()`.
12170/// // Values shown here are possibly random and not representative !
12171/// let result = hub.spreadsheets().get_by_data_filter(req, "spreadsheetId")
12172///              .doit().await;
12173/// # }
12174/// ```
12175pub struct SpreadsheetGetByDataFilterCall<'a, C>
12176where
12177    C: 'a,
12178{
12179    hub: &'a Sheets<C>,
12180    _request: GetSpreadsheetByDataFilterRequest,
12181    _spreadsheet_id: String,
12182    _delegate: Option<&'a mut dyn common::Delegate>,
12183    _additional_params: HashMap<String, String>,
12184    _scopes: BTreeSet<String>,
12185}
12186
12187impl<'a, C> common::CallBuilder for SpreadsheetGetByDataFilterCall<'a, C> {}
12188
12189impl<'a, C> SpreadsheetGetByDataFilterCall<'a, C>
12190where
12191    C: common::Connector,
12192{
12193    /// Perform the operation you have build so far.
12194    pub async fn doit(mut self) -> common::Result<(common::Response, Spreadsheet)> {
12195        use std::borrow::Cow;
12196        use std::io::{Read, Seek};
12197
12198        use common::{url::Params, ToParts};
12199        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12200
12201        let mut dd = common::DefaultDelegate;
12202        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12203        dlg.begin(common::MethodInfo {
12204            id: "sheets.spreadsheets.getByDataFilter",
12205            http_method: hyper::Method::POST,
12206        });
12207
12208        for &field in ["alt", "spreadsheetId"].iter() {
12209            if self._additional_params.contains_key(field) {
12210                dlg.finished(false);
12211                return Err(common::Error::FieldClash(field));
12212            }
12213        }
12214
12215        let mut params = Params::with_capacity(4 + self._additional_params.len());
12216        params.push("spreadsheetId", self._spreadsheet_id);
12217
12218        params.extend(self._additional_params.iter());
12219
12220        params.push("alt", "json");
12221        let mut url =
12222            self.hub._base_url.clone() + "v4/spreadsheets/{spreadsheetId}:getByDataFilter";
12223        if self._scopes.is_empty() {
12224            self._scopes.insert(Scope::Drive.as_ref().to_string());
12225        }
12226
12227        #[allow(clippy::single_element_loop)]
12228        for &(find_this, param_name) in [("{spreadsheetId}", "spreadsheetId")].iter() {
12229            url = params.uri_replacement(url, param_name, find_this, false);
12230        }
12231        {
12232            let to_remove = ["spreadsheetId"];
12233            params.remove_params(&to_remove);
12234        }
12235
12236        let url = params.parse_with_url(&url);
12237
12238        let mut json_mime_type = mime::APPLICATION_JSON;
12239        let mut request_value_reader = {
12240            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12241            common::remove_json_null_values(&mut value);
12242            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12243            serde_json::to_writer(&mut dst, &value).unwrap();
12244            dst
12245        };
12246        let request_size = request_value_reader
12247            .seek(std::io::SeekFrom::End(0))
12248            .unwrap();
12249        request_value_reader
12250            .seek(std::io::SeekFrom::Start(0))
12251            .unwrap();
12252
12253        loop {
12254            let token = match self
12255                .hub
12256                .auth
12257                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12258                .await
12259            {
12260                Ok(token) => token,
12261                Err(e) => match dlg.token(e) {
12262                    Ok(token) => token,
12263                    Err(e) => {
12264                        dlg.finished(false);
12265                        return Err(common::Error::MissingToken(e));
12266                    }
12267                },
12268            };
12269            request_value_reader
12270                .seek(std::io::SeekFrom::Start(0))
12271                .unwrap();
12272            let mut req_result = {
12273                let client = &self.hub.client;
12274                dlg.pre_request();
12275                let mut req_builder = hyper::Request::builder()
12276                    .method(hyper::Method::POST)
12277                    .uri(url.as_str())
12278                    .header(USER_AGENT, self.hub._user_agent.clone());
12279
12280                if let Some(token) = token.as_ref() {
12281                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12282                }
12283
12284                let request = req_builder
12285                    .header(CONTENT_TYPE, json_mime_type.to_string())
12286                    .header(CONTENT_LENGTH, request_size as u64)
12287                    .body(common::to_body(
12288                        request_value_reader.get_ref().clone().into(),
12289                    ));
12290
12291                client.request(request.unwrap()).await
12292            };
12293
12294            match req_result {
12295                Err(err) => {
12296                    if let common::Retry::After(d) = dlg.http_error(&err) {
12297                        sleep(d).await;
12298                        continue;
12299                    }
12300                    dlg.finished(false);
12301                    return Err(common::Error::HttpError(err));
12302                }
12303                Ok(res) => {
12304                    let (mut parts, body) = res.into_parts();
12305                    let mut body = common::Body::new(body);
12306                    if !parts.status.is_success() {
12307                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12308                        let error = serde_json::from_str(&common::to_string(&bytes));
12309                        let response = common::to_response(parts, bytes.into());
12310
12311                        if let common::Retry::After(d) =
12312                            dlg.http_failure(&response, error.as_ref().ok())
12313                        {
12314                            sleep(d).await;
12315                            continue;
12316                        }
12317
12318                        dlg.finished(false);
12319
12320                        return Err(match error {
12321                            Ok(value) => common::Error::BadRequest(value),
12322                            _ => common::Error::Failure(response),
12323                        });
12324                    }
12325                    let response = {
12326                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12327                        let encoded = common::to_string(&bytes);
12328                        match serde_json::from_str(&encoded) {
12329                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12330                            Err(error) => {
12331                                dlg.response_json_decode_error(&encoded, &error);
12332                                return Err(common::Error::JsonDecodeError(
12333                                    encoded.to_string(),
12334                                    error,
12335                                ));
12336                            }
12337                        }
12338                    };
12339
12340                    dlg.finished(true);
12341                    return Ok(response);
12342                }
12343            }
12344        }
12345    }
12346
12347    ///
12348    /// Sets the *request* property to the given value.
12349    ///
12350    /// Even though the property as already been set when instantiating this call,
12351    /// we provide this method for API completeness.
12352    pub fn request(
12353        mut self,
12354        new_value: GetSpreadsheetByDataFilterRequest,
12355    ) -> SpreadsheetGetByDataFilterCall<'a, C> {
12356        self._request = new_value;
12357        self
12358    }
12359    /// The spreadsheet to request.
12360    ///
12361    /// Sets the *spreadsheet id* path property to the given value.
12362    ///
12363    /// Even though the property as already been set when instantiating this call,
12364    /// we provide this method for API completeness.
12365    pub fn spreadsheet_id(mut self, new_value: &str) -> SpreadsheetGetByDataFilterCall<'a, C> {
12366        self._spreadsheet_id = new_value.to_string();
12367        self
12368    }
12369    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12370    /// while executing the actual API request.
12371    ///
12372    /// ````text
12373    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12374    /// ````
12375    ///
12376    /// Sets the *delegate* property to the given value.
12377    pub fn delegate(
12378        mut self,
12379        new_value: &'a mut dyn common::Delegate,
12380    ) -> SpreadsheetGetByDataFilterCall<'a, C> {
12381        self._delegate = Some(new_value);
12382        self
12383    }
12384
12385    /// Set any additional parameter of the query string used in the request.
12386    /// It should be used to set parameters which are not yet available through their own
12387    /// setters.
12388    ///
12389    /// Please note that this method must not be used to set any of the known parameters
12390    /// which have their own setter method. If done anyway, the request will fail.
12391    ///
12392    /// # Additional Parameters
12393    ///
12394    /// * *$.xgafv* (query-string) - V1 error format.
12395    /// * *access_token* (query-string) - OAuth access token.
12396    /// * *alt* (query-string) - Data format for response.
12397    /// * *callback* (query-string) - JSONP
12398    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12399    /// * *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.
12400    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12401    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12402    /// * *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.
12403    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12404    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12405    pub fn param<T>(mut self, name: T, value: T) -> SpreadsheetGetByDataFilterCall<'a, C>
12406    where
12407        T: AsRef<str>,
12408    {
12409        self._additional_params
12410            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12411        self
12412    }
12413
12414    /// Identifies the authorization scope for the method you are building.
12415    ///
12416    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12417    /// [`Scope::Drive`].
12418    ///
12419    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12420    /// tokens for more than one scope.
12421    ///
12422    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12423    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12424    /// sufficient, a read-write scope will do as well.
12425    pub fn add_scope<St>(mut self, scope: St) -> SpreadsheetGetByDataFilterCall<'a, C>
12426    where
12427        St: AsRef<str>,
12428    {
12429        self._scopes.insert(String::from(scope.as_ref()));
12430        self
12431    }
12432    /// Identifies the authorization scope(s) for the method you are building.
12433    ///
12434    /// See [`Self::add_scope()`] for details.
12435    pub fn add_scopes<I, St>(mut self, scopes: I) -> SpreadsheetGetByDataFilterCall<'a, C>
12436    where
12437        I: IntoIterator<Item = St>,
12438        St: AsRef<str>,
12439    {
12440        self._scopes
12441            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12442        self
12443    }
12444
12445    /// Removes all scopes, and no default scope will be used either.
12446    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12447    /// for details).
12448    pub fn clear_scopes(mut self) -> SpreadsheetGetByDataFilterCall<'a, C> {
12449        self._scopes.clear();
12450        self
12451    }
12452}