google_analyticsdata1_beta/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// View and manage your Google Analytics data
17 Analytic,
18
19 /// See and download your Google Analytics data
20 AnalyticReadonly,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::Analytic => "https://www.googleapis.com/auth/analytics",
27 Scope::AnalyticReadonly => "https://www.googleapis.com/auth/analytics.readonly",
28 }
29 }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34 fn default() -> Scope {
35 Scope::AnalyticReadonly
36 }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all AnalyticsData related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_analyticsdata1_beta as analyticsdata1_beta;
53/// use analyticsdata1_beta::api::AudienceExport;
54/// use analyticsdata1_beta::{Result, Error};
55/// # async fn dox() {
56/// use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57///
58/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
59/// // `client_secret`, among other things.
60/// let secret: yup_oauth2::ApplicationSecret = Default::default();
61/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
62/// // unless you replace `None` with the desired Flow.
63/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
64/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
65/// // retrieve them from storage.
66/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
67/// secret,
68/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
69/// ).build().await.unwrap();
70///
71/// let client = hyper_util::client::legacy::Client::builder(
72/// hyper_util::rt::TokioExecutor::new()
73/// )
74/// .build(
75/// hyper_rustls::HttpsConnectorBuilder::new()
76/// .with_native_roots()
77/// .unwrap()
78/// .https_or_http()
79/// .enable_http1()
80/// .build()
81/// );
82/// let mut hub = AnalyticsData::new(client, auth);
83/// // As the method needs a request, you would usually fill it with the desired information
84/// // into the respective structure. Some of the parts shown here might not be applicable !
85/// // Values shown here are possibly random and not representative !
86/// let mut req = AudienceExport::default();
87///
88/// // You can configure optional parameters by calling the respective setters at will, and
89/// // execute the final call using `doit()`.
90/// // Values shown here are possibly random and not representative !
91/// let result = hub.properties().audience_exports_create(req, "parent")
92/// .doit().await;
93///
94/// match result {
95/// Err(e) => match e {
96/// // The Error enum provides details about what exactly happened.
97/// // You can also just use its `Debug`, `Display` or `Error` traits
98/// Error::HttpError(_)
99/// |Error::Io(_)
100/// |Error::MissingAPIKey
101/// |Error::MissingToken(_)
102/// |Error::Cancelled
103/// |Error::UploadSizeLimitExceeded(_, _)
104/// |Error::Failure(_)
105/// |Error::BadRequest(_)
106/// |Error::FieldClash(_)
107/// |Error::JsonDecodeError(_, _) => println!("{}", e),
108/// },
109/// Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct AnalyticsData<C> {
115 pub client: common::Client<C>,
116 pub auth: Box<dyn common::GetToken>,
117 _user_agent: String,
118 _base_url: String,
119 _root_url: String,
120}
121
122impl<C> common::Hub for AnalyticsData<C> {}
123
124impl<'a, C> AnalyticsData<C> {
125 pub fn new<A: 'static + common::GetToken>(
126 client: common::Client<C>,
127 auth: A,
128 ) -> AnalyticsData<C> {
129 AnalyticsData {
130 client,
131 auth: Box::new(auth),
132 _user_agent: "google-api-rust-client/6.0.0".to_string(),
133 _base_url: "https://analyticsdata.googleapis.com/".to_string(),
134 _root_url: "https://analyticsdata.googleapis.com/".to_string(),
135 }
136 }
137
138 pub fn properties(&'a self) -> PropertyMethods<'a, C> {
139 PropertyMethods { hub: self }
140 }
141
142 /// Set the user-agent header field to use in all requests to the server.
143 /// It defaults to `google-api-rust-client/6.0.0`.
144 ///
145 /// Returns the previously set user-agent.
146 pub fn user_agent(&mut self, agent_name: String) -> String {
147 std::mem::replace(&mut self._user_agent, agent_name)
148 }
149
150 /// Set the base url to use in all requests to the server.
151 /// It defaults to `https://analyticsdata.googleapis.com/`.
152 ///
153 /// Returns the previously set base url.
154 pub fn base_url(&mut self, new_base_url: String) -> String {
155 std::mem::replace(&mut self._base_url, new_base_url)
156 }
157
158 /// Set the root url to use in all requests to the server.
159 /// It defaults to `https://analyticsdata.googleapis.com/`.
160 ///
161 /// Returns the previously set root url.
162 pub fn root_url(&mut self, new_root_url: String) -> String {
163 std::mem::replace(&mut self._root_url, new_root_url)
164 }
165}
166
167// ############
168// SCHEMAS ###
169// ##########
170/// A metric actively restricted in creating the report.
171///
172/// This type is not used in any activity, and only used as *part* of another schema.
173///
174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
175#[serde_with::serde_as]
176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
177pub struct ActiveMetricRestriction {
178 /// The name of the restricted metric.
179 #[serde(rename = "metricName")]
180 pub metric_name: Option<String>,
181 /// The reason for this metric's restriction.
182 #[serde(rename = "restrictedMetricTypes")]
183 pub restricted_metric_types: Option<Vec<String>>,
184}
185
186impl common::Part for ActiveMetricRestriction {}
187
188/// An audience export is a list of users in an audience at the time of the list’s creation. One audience may have multiple audience exports created for different days.
189///
190/// # Activities
191///
192/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
193/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
194///
195/// * [audience exports create properties](PropertyAudienceExportCreateCall) (request)
196/// * [audience exports get properties](PropertyAudienceExportGetCall) (response)
197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
198#[serde_with::serde_as]
199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
200pub struct AudienceExport {
201 /// Required. The audience resource name. This resource name identifies the audience being listed and is shared between the Analytics Data & Admin APIs. Format: `properties/{property}/audiences/{audience}`
202 pub audience: Option<String>,
203 /// Output only. The descriptive display name for this audience. For example, "Purchasers".
204 #[serde(rename = "audienceDisplayName")]
205 pub audience_display_name: Option<String>,
206 /// Output only. The time when CreateAudienceExport was called and the AudienceExport began the `CREATING` state.
207 #[serde(rename = "beginCreatingTime")]
208 pub begin_creating_time: Option<chrono::DateTime<chrono::offset::Utc>>,
209 /// Output only. The total quota tokens charged during creation of the AudienceExport. Because this token count is based on activity from the `CREATING` state, this tokens charged will be fixed once an AudienceExport enters the `ACTIVE` or `FAILED` states.
210 #[serde(rename = "creationQuotaTokensCharged")]
211 pub creation_quota_tokens_charged: Option<i32>,
212 /// Required. The dimensions requested and displayed in the query response.
213 pub dimensions: Option<Vec<V1betaAudienceDimension>>,
214 /// Output only. Error message is populated when an audience export fails during creation. A common reason for such a failure is quota exhaustion.
215 #[serde(rename = "errorMessage")]
216 pub error_message: Option<String>,
217 /// Output only. Identifier. The audience export resource name assigned during creation. This resource name identifies this `AudienceExport`. Format: `properties/{property}/audienceExports/{audience_export}`
218 pub name: Option<String>,
219 /// Output only. The percentage completed for this audience export ranging between 0 to 100.
220 #[serde(rename = "percentageCompleted")]
221 pub percentage_completed: Option<f64>,
222 /// Output only. The total number of rows in the AudienceExport result.
223 #[serde(rename = "rowCount")]
224 pub row_count: Option<i32>,
225 /// Output only. The current state for this AudienceExport.
226 pub state: Option<String>,
227}
228
229impl common::RequestValue for AudienceExport {}
230impl common::ResponseResult for AudienceExport {}
231
232/// The batch request containing multiple pivot report requests.
233///
234/// # Activities
235///
236/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
237/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
238///
239/// * [batch run pivot reports properties](PropertyBatchRunPivotReportCall) (request)
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct BatchRunPivotReportsRequest {
244 /// Individual requests. Each request has a separate pivot report response. Each batch request is allowed up to 5 requests.
245 pub requests: Option<Vec<RunPivotReportRequest>>,
246}
247
248impl common::RequestValue for BatchRunPivotReportsRequest {}
249
250/// The batch response containing multiple pivot reports.
251///
252/// # Activities
253///
254/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
255/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
256///
257/// * [batch run pivot reports properties](PropertyBatchRunPivotReportCall) (response)
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct BatchRunPivotReportsResponse {
262 /// Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#batchRunPivotReports". Useful to distinguish between response types in JSON.
263 pub kind: Option<String>,
264 /// Individual responses. Each response has a separate pivot report request.
265 #[serde(rename = "pivotReports")]
266 pub pivot_reports: Option<Vec<RunPivotReportResponse>>,
267}
268
269impl common::ResponseResult for BatchRunPivotReportsResponse {}
270
271/// The batch request containing multiple report requests.
272///
273/// # Activities
274///
275/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
276/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
277///
278/// * [batch run reports properties](PropertyBatchRunReportCall) (request)
279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
280#[serde_with::serde_as]
281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
282pub struct BatchRunReportsRequest {
283 /// Individual requests. Each request has a separate report response. Each batch request is allowed up to 5 requests.
284 pub requests: Option<Vec<RunReportRequest>>,
285}
286
287impl common::RequestValue for BatchRunReportsRequest {}
288
289/// The batch response containing multiple reports.
290///
291/// # Activities
292///
293/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
294/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
295///
296/// * [batch run reports properties](PropertyBatchRunReportCall) (response)
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct BatchRunReportsResponse {
301 /// Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#batchRunReports". Useful to distinguish between response types in JSON.
302 pub kind: Option<String>,
303 /// Individual responses. Each response has a separate report request.
304 pub reports: Option<Vec<RunReportResponse>>,
305}
306
307impl common::ResponseResult for BatchRunReportsResponse {}
308
309/// To express that the result needs to be between two numbers (inclusive).
310///
311/// This type is not used in any activity, and only used as *part* of another schema.
312///
313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
314#[serde_with::serde_as]
315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
316pub struct BetweenFilter {
317 /// Begins with this number.
318 #[serde(rename = "fromValue")]
319 pub from_value: Option<NumericValue>,
320 /// Ends with this number.
321 #[serde(rename = "toValue")]
322 pub to_value: Option<NumericValue>,
323}
324
325impl common::Part for BetweenFilter {}
326
327/// Used to convert a dimension value to a single case.
328///
329/// This type is not used in any activity, and only used as *part* of another schema.
330///
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct CaseExpression {
335 /// Name of a dimension. The name must refer back to a name in dimensions field of the request.
336 #[serde(rename = "dimensionName")]
337 pub dimension_name: Option<String>,
338}
339
340impl common::Part for CaseExpression {}
341
342/// The request for compatibility information for a report’s dimensions and metrics. Check compatibility provides a preview of the compatibility of a report; fields shared with the `runReport` request should be the same values as in your `runReport` request.
343///
344/// # Activities
345///
346/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
347/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
348///
349/// * [check compatibility properties](PropertyCheckCompatibilityCall) (request)
350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
351#[serde_with::serde_as]
352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
353pub struct CheckCompatibilityRequest {
354 /// Filters the dimensions and metrics in the response to just this compatibility. Commonly used as `”compatibilityFilter”: “COMPATIBLE”` to only return compatible dimensions & metrics.
355 #[serde(rename = "compatibilityFilter")]
356 pub compatibility_filter: Option<String>,
357 /// The filter clause of dimensions. `dimensionFilter` should be the same value as in your `runReport` request.
358 #[serde(rename = "dimensionFilter")]
359 pub dimension_filter: Option<FilterExpression>,
360 /// The dimensions in this report. `dimensions` should be the same value as in your `runReport` request.
361 pub dimensions: Option<Vec<Dimension>>,
362 /// The filter clause of metrics. `metricFilter` should be the same value as in your `runReport` request
363 #[serde(rename = "metricFilter")]
364 pub metric_filter: Option<FilterExpression>,
365 /// The metrics in this report. `metrics` should be the same value as in your `runReport` request.
366 pub metrics: Option<Vec<Metric>>,
367}
368
369impl common::RequestValue for CheckCompatibilityRequest {}
370
371/// The compatibility response with the compatibility of each dimension & metric.
372///
373/// # Activities
374///
375/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
376/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
377///
378/// * [check compatibility properties](PropertyCheckCompatibilityCall) (response)
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct CheckCompatibilityResponse {
383 /// The compatibility of each dimension.
384 #[serde(rename = "dimensionCompatibilities")]
385 pub dimension_compatibilities: Option<Vec<DimensionCompatibility>>,
386 /// The compatibility of each metric.
387 #[serde(rename = "metricCompatibilities")]
388 pub metric_compatibilities: Option<Vec<MetricCompatibility>>,
389}
390
391impl common::ResponseResult for CheckCompatibilityResponse {}
392
393/// Defines a cohort selection criteria. A cohort is a group of users who share a common characteristic. For example, users with the same `firstSessionDate` belong to the same cohort.
394///
395/// This type is not used in any activity, and only used as *part* of another schema.
396///
397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
398#[serde_with::serde_as]
399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
400pub struct Cohort {
401 /// The cohort selects users whose first touch date is between start date and end date defined in the `dateRange`. This `dateRange` does not specify the full date range of event data that is present in a cohort report. In a cohort report, this `dateRange` is extended by the granularity and offset present in the `cohortsRange`; event data for the extended reporting date range is present in a cohort report. In a cohort request, this `dateRange` is required and the `dateRanges` in the `RunReportRequest` or `RunPivotReportRequest` must be unspecified. This `dateRange` should generally be aligned with the cohort's granularity. If `CohortsRange` uses daily granularity, this `dateRange` can be a single day. If `CohortsRange` uses weekly granularity, this `dateRange` can be aligned to a week boundary, starting at Sunday and ending Saturday. If `CohortsRange` uses monthly granularity, this `dateRange` can be aligned to a month, starting at the first and ending on the last day of the month.
402 #[serde(rename = "dateRange")]
403 pub date_range: Option<DateRange>,
404 /// Dimension used by the cohort. Required and only supports `firstSessionDate`.
405 pub dimension: Option<String>,
406 /// Assigns a name to this cohort. The dimension `cohort` is valued to this name in a report response. If set, cannot begin with `cohort_` or `RESERVED_`. If not set, cohorts are named by their zero based index `cohort_0`, `cohort_1`, etc.
407 pub name: Option<String>,
408}
409
410impl common::Part for Cohort {}
411
412/// Optional settings of a cohort report.
413///
414/// This type is not used in any activity, and only used as *part* of another schema.
415///
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct CohortReportSettings {
420 /// If true, accumulates the result from first touch day to the end day. Not supported in `RunReportRequest`.
421 pub accumulate: Option<bool>,
422}
423
424impl common::Part for CohortReportSettings {}
425
426/// The specification of cohorts for a cohort report. Cohort reports create a time series of user retention for the cohort. For example, you could select the cohort of users that were acquired in the first week of September and follow that cohort for the next six weeks. Selecting the users acquired in the first week of September cohort is specified in the `cohort` object. Following that cohort for the next six weeks is specified in the `cohortsRange` object. For examples, see [Cohort Report Examples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples). The report response could show a weekly time series where say your app has retained 60% of this cohort after three weeks and 25% of this cohort after six weeks. These two percentages can be calculated by the metric `cohortActiveUsers/cohortTotalUsers` and will be separate rows in the report.
427///
428/// This type is not used in any activity, and only used as *part* of another schema.
429///
430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
431#[serde_with::serde_as]
432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
433pub struct CohortSpec {
434 /// Optional settings for a cohort report.
435 #[serde(rename = "cohortReportSettings")]
436 pub cohort_report_settings: Option<CohortReportSettings>,
437 /// Defines the selection criteria to group users into cohorts. Most cohort reports define only a single cohort. If multiple cohorts are specified, each cohort can be recognized in the report by their name.
438 pub cohorts: Option<Vec<Cohort>>,
439 /// Cohort reports follow cohorts over an extended reporting date range. This range specifies an offset duration to follow the cohorts over.
440 #[serde(rename = "cohortsRange")]
441 pub cohorts_range: Option<CohortsRange>,
442}
443
444impl common::Part for CohortSpec {}
445
446/// Configures the extended reporting date range for a cohort report. Specifies an offset duration to follow the cohorts over.
447///
448/// This type is not used in any activity, and only used as *part* of another schema.
449///
450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
451#[serde_with::serde_as]
452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
453pub struct CohortsRange {
454 /// Required. `endOffset` specifies the end date of the extended reporting date range for a cohort report. `endOffset` can be any positive integer but is commonly set to 5 to 10 so that reports contain data on the cohort for the next several granularity time periods. If `granularity` is `DAILY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset` days. If `granularity` is `WEEKLY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset * 7` days. If `granularity` is `MONTHLY`, the `endDate` of the extended reporting date range is `endDate` of the cohort plus `endOffset * 30` days.
455 #[serde(rename = "endOffset")]
456 pub end_offset: Option<i32>,
457 /// Required. The granularity used to interpret the `startOffset` and `endOffset` for the extended reporting date range for a cohort report.
458 pub granularity: Option<String>,
459 /// `startOffset` specifies the start date of the extended reporting date range for a cohort report. `startOffset` is commonly set to 0 so that reports contain data from the acquisition of the cohort forward. If `granularity` is `DAILY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset` days. If `granularity` is `WEEKLY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset * 7` days. If `granularity` is `MONTHLY`, the `startDate` of the extended reporting date range is `startDate` of the cohort plus `startOffset * 30` days.
460 #[serde(rename = "startOffset")]
461 pub start_offset: Option<i32>,
462}
463
464impl common::Part for CohortsRange {}
465
466/// Defines an individual comparison. Most requests will include multiple comparisons so that the report compares between the comparisons.
467///
468/// This type is not used in any activity, and only used as *part* of another schema.
469///
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct Comparison {
474 /// A saved comparison identified by the comparison's resource name. For example, 'comparisons/1234'.
475 pub comparison: Option<String>,
476 /// A basic comparison.
477 #[serde(rename = "dimensionFilter")]
478 pub dimension_filter: Option<FilterExpression>,
479 /// Each comparison produces separate rows in the response. In the response, this comparison is identified by this name. If name is unspecified, we will use the saved comparisons display name.
480 pub name: Option<String>,
481}
482
483impl common::Part for Comparison {}
484
485/// The metadata for a single comparison.
486///
487/// This type is not used in any activity, and only used as *part* of another schema.
488///
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct ComparisonMetadata {
493 /// This comparison’s resource name. Useable in [Comparison](#Comparison)’s `comparison` field. For example, ‘comparisons/1234’.
494 #[serde(rename = "apiName")]
495 pub api_name: Option<String>,
496 /// This comparison's description.
497 pub description: Option<String>,
498 /// This comparison's name within the Google Analytics user interface.
499 #[serde(rename = "uiName")]
500 pub ui_name: Option<String>,
501}
502
503impl common::Part for ComparisonMetadata {}
504
505/// Used to combine dimension values to a single dimension.
506///
507/// This type is not used in any activity, and only used as *part* of another schema.
508///
509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
510#[serde_with::serde_as]
511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
512pub struct ConcatenateExpression {
513 /// The delimiter placed between dimension names. Delimiters are often single characters such as "|" or "," but can be longer strings. If a dimension value contains the delimiter, both will be present in response with no distinction. For example if dimension 1 value = "US,FR", dimension 2 value = "JP", and delimiter = ",", then the response will contain "US,FR,JP".
514 pub delimiter: Option<String>,
515 /// Names of dimensions. The names must refer back to names in the dimensions field of the request.
516 #[serde(rename = "dimensionNames")]
517 pub dimension_names: Option<Vec<String>>,
518}
519
520impl common::Part for ConcatenateExpression {}
521
522/// A contiguous set of days: `startDate`, `startDate + 1`, ..., `endDate`. Requests are allowed up to 4 date ranges.
523///
524/// This type is not used in any activity, and only used as *part* of another schema.
525///
526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
527#[serde_with::serde_as]
528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
529pub struct DateRange {
530 /// The inclusive end date for the query in the format `YYYY-MM-DD`. Cannot be before `start_date`. The format `NdaysAgo`, `yesterday`, or `today` is also accepted, and in that case, the date is inferred based on the property's reporting time zone.
531 #[serde(rename = "endDate")]
532 pub end_date: Option<String>,
533 /// Assigns a name to this date range. The dimension `dateRange` is valued to this name in a report response. If set, cannot begin with `date_range_` or `RESERVED_`. If not set, date ranges are named by their zero based index in the request: `date_range_0`, `date_range_1`, etc.
534 pub name: Option<String>,
535 /// The inclusive start date for the query in the format `YYYY-MM-DD`. Cannot be after `end_date`. The format `NdaysAgo`, `yesterday`, or `today` is also accepted, and in that case, the date is inferred based on the property's reporting time zone.
536 #[serde(rename = "startDate")]
537 pub start_date: Option<String>,
538}
539
540impl common::Part for DateRange {}
541
542/// Dimensions are attributes of your data. For example, the dimension city indicates the city from which an event originates. Dimension values in report responses are strings; for example, the city could be "Paris" or "New York". Requests are allowed up to 9 dimensions.
543///
544/// This type is not used in any activity, and only used as *part* of another schema.
545///
546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
547#[serde_with::serde_as]
548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
549pub struct Dimension {
550 /// One dimension can be the result of an expression of multiple dimensions. For example, dimension "country, city": concatenate(country, ", ", city).
551 #[serde(rename = "dimensionExpression")]
552 pub dimension_expression: Option<DimensionExpression>,
553 /// The name of the dimension. See the [API Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#dimensions) for the list of dimension names supported by core reporting methods such as `runReport` and `batchRunReports`. See [Realtime Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#dimensions) for the list of dimension names supported by the `runRealtimeReport` method. See [Funnel Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema#dimensions) for the list of dimension names supported by the `runFunnelReport` method. If `dimensionExpression` is specified, `name` can be any string that you would like within the allowed character set. For example if a `dimensionExpression` concatenates `country` and `city`, you could call that dimension `countryAndCity`. Dimension names that you choose must match the regular expression `^[a-zA-Z0-9_]$`. Dimensions are referenced by `name` in `dimensionFilter`, `orderBys`, `dimensionExpression`, and `pivots`.
554 pub name: Option<String>,
555}
556
557impl common::Part for Dimension {}
558
559/// The compatibility for a single dimension.
560///
561/// This type is not used in any activity, and only used as *part* of another schema.
562///
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct DimensionCompatibility {
567 /// The compatibility of this dimension. If the compatibility is COMPATIBLE, this dimension can be successfully added to the report.
568 pub compatibility: Option<String>,
569 /// The dimension metadata contains the API name for this compatibility information. The dimension metadata also contains other helpful information like the UI name and description.
570 #[serde(rename = "dimensionMetadata")]
571 pub dimension_metadata: Option<DimensionMetadata>,
572}
573
574impl common::Part for DimensionCompatibility {}
575
576/// Used to express a dimension which is the result of a formula of multiple dimensions. Example usages: 1) lower_case(dimension) 2) concatenate(dimension1, symbol, dimension2).
577///
578/// This type is not used in any activity, and only used as *part* of another schema.
579///
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct DimensionExpression {
584 /// Used to combine dimension values to a single dimension. For example, dimension "country, city": concatenate(country, ", ", city).
585 pub concatenate: Option<ConcatenateExpression>,
586 /// Used to convert a dimension value to lower case.
587 #[serde(rename = "lowerCase")]
588 pub lower_case: Option<CaseExpression>,
589 /// Used to convert a dimension value to upper case.
590 #[serde(rename = "upperCase")]
591 pub upper_case: Option<CaseExpression>,
592}
593
594impl common::Part for DimensionExpression {}
595
596/// Describes a dimension column in the report. Dimensions requested in a report produce column entries within rows and DimensionHeaders. However, dimensions used exclusively within filters or expressions do not produce columns in a report; correspondingly, those dimensions do not produce headers.
597///
598/// This type is not used in any activity, and only used as *part* of another schema.
599///
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct DimensionHeader {
604 /// The dimension's name.
605 pub name: Option<String>,
606}
607
608impl common::Part for DimensionHeader {}
609
610/// Explains a dimension.
611///
612/// This type is not used in any activity, and only used as *part* of another schema.
613///
614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
615#[serde_with::serde_as]
616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
617pub struct DimensionMetadata {
618 /// This dimension’s name. Useable in [Dimension](#Dimension)’s `name`. For example, `eventName`.
619 #[serde(rename = "apiName")]
620 pub api_name: Option<String>,
621 /// The display name of the category that this dimension belongs to. Similar dimensions and metrics are categorized together.
622 pub category: Option<String>,
623 /// True if the dimension is custom to this property. This includes user, event, & item scoped custom dimensions; to learn more about custom dimensions, see https://support.google.com/analytics/answer/14240153. This also include custom channel groups; to learn more about custom channel groups, see https://support.google.com/analytics/answer/13051316.
624 #[serde(rename = "customDefinition")]
625 pub custom_definition: Option<bool>,
626 /// Still usable but deprecated names for this dimension. If populated, this dimension is available by either `apiName` or one of `deprecatedApiNames` for a period of time. After the deprecation period, the dimension will be available only by `apiName`.
627 #[serde(rename = "deprecatedApiNames")]
628 pub deprecated_api_names: Option<Vec<String>>,
629 /// Description of how this dimension is used and calculated.
630 pub description: Option<String>,
631 /// This dimension's name within the Google Analytics user interface. For example, `Event name`.
632 #[serde(rename = "uiName")]
633 pub ui_name: Option<String>,
634}
635
636impl common::Part for DimensionMetadata {}
637
638/// Sorts by dimension values.
639///
640/// This type is not used in any activity, and only used as *part* of another schema.
641///
642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
643#[serde_with::serde_as]
644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
645pub struct DimensionOrderBy {
646 /// A dimension name in the request to order by.
647 #[serde(rename = "dimensionName")]
648 pub dimension_name: Option<String>,
649 /// Controls the rule for dimension value ordering.
650 #[serde(rename = "orderType")]
651 pub order_type: Option<String>,
652}
653
654impl common::Part for DimensionOrderBy {}
655
656/// The value of a dimension.
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct DimensionValue {
664 /// Value as a string if the dimension type is a string.
665 pub value: Option<String>,
666}
667
668impl common::Part for DimensionValue {}
669
670/// An expression to filter dimension or metric values.
671///
672/// This type is not used in any activity, and only used as *part* of another schema.
673///
674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
675#[serde_with::serde_as]
676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
677pub struct Filter {
678 /// A filter for two values.
679 #[serde(rename = "betweenFilter")]
680 pub between_filter: Option<BetweenFilter>,
681 /// The dimension name or metric name. In most methods, dimensions & metrics can be used for the first time in this field. However in a RunPivotReportRequest, this field must be additionally specified by name in the RunPivotReportRequest's dimensions or metrics.
682 #[serde(rename = "fieldName")]
683 pub field_name: Option<String>,
684 /// A filter for in list values.
685 #[serde(rename = "inListFilter")]
686 pub in_list_filter: Option<InListFilter>,
687 /// A filter for numeric or date values.
688 #[serde(rename = "numericFilter")]
689 pub numeric_filter: Option<NumericFilter>,
690 /// Strings related filter.
691 #[serde(rename = "stringFilter")]
692 pub string_filter: Option<StringFilter>,
693}
694
695impl common::Part for Filter {}
696
697/// To express dimension or metric filters. The fields in the same FilterExpression need to be either all dimensions or all metrics.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct FilterExpression {
705 /// The FilterExpressions in and_group have an AND relationship.
706 #[serde(rename = "andGroup")]
707 pub and_group: Option<FilterExpressionList>,
708 /// A primitive filter. In the same FilterExpression, all of the filter's field names need to be either all dimensions or all metrics.
709 pub filter: Option<Filter>,
710 /// The FilterExpression is NOT of not_expression.
711 #[serde(rename = "notExpression")]
712 pub not_expression: Option<Option<Box<FilterExpression>>>,
713 /// The FilterExpressions in or_group have an OR relationship.
714 #[serde(rename = "orGroup")]
715 pub or_group: Option<FilterExpressionList>,
716}
717
718impl common::Part for FilterExpression {}
719
720/// A list of filter expressions.
721///
722/// This type is not used in any activity, and only used as *part* of another schema.
723///
724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
725#[serde_with::serde_as]
726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
727pub struct FilterExpressionList {
728 /// A list of filter expressions.
729 pub expressions: Option<Vec<FilterExpression>>,
730}
731
732impl common::Part for FilterExpressionList {}
733
734/// The result needs to be in a list of string values.
735///
736/// This type is not used in any activity, and only used as *part* of another schema.
737///
738#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
739#[serde_with::serde_as]
740#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
741pub struct InListFilter {
742 /// If true, the string value is case sensitive.
743 #[serde(rename = "caseSensitive")]
744 pub case_sensitive: Option<bool>,
745 /// The list of string values. Must be non-empty.
746 pub values: Option<Vec<String>>,
747}
748
749impl common::Part for InListFilter {}
750
751/// A list of all audience exports for a property.
752///
753/// # Activities
754///
755/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
756/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
757///
758/// * [audience exports list properties](PropertyAudienceExportListCall) (response)
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct ListAudienceExportsResponse {
763 /// Each audience export for a property.
764 #[serde(rename = "audienceExports")]
765 pub audience_exports: Option<Vec<AudienceExport>>,
766 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
767 #[serde(rename = "nextPageToken")]
768 pub next_page_token: Option<String>,
769}
770
771impl common::ResponseResult for ListAudienceExportsResponse {}
772
773/// The dimensions, metrics and comparisons currently accepted in reporting methods.
774///
775/// # Activities
776///
777/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
778/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
779///
780/// * [get metadata properties](PropertyGetMetadataCall) (response)
781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
782#[serde_with::serde_as]
783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
784pub struct Metadata {
785 /// The comparison descriptions.
786 pub comparisons: Option<Vec<ComparisonMetadata>>,
787 /// The dimension descriptions.
788 pub dimensions: Option<Vec<DimensionMetadata>>,
789 /// The metric descriptions.
790 pub metrics: Option<Vec<MetricMetadata>>,
791 /// Resource name of this metadata.
792 pub name: Option<String>,
793}
794
795impl common::ResponseResult for Metadata {}
796
797/// The quantitative measurements of a report. For example, the metric `eventCount` is the total number of events. Requests are allowed up to 10 metrics.
798///
799/// This type is not used in any activity, and only used as *part* of another schema.
800///
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct Metric {
805 /// A mathematical expression for derived metrics. For example, the metric Event count per user is `eventCount/totalUsers`.
806 pub expression: Option<String>,
807 /// Indicates if a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in `metricFilter`, `orderBys`, or a metric `expression`.
808 pub invisible: Option<bool>,
809 /// The name of the metric. See the [API Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#metrics) for the list of metric names supported by core reporting methods such as `runReport` and `batchRunReports`. See [Realtime Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-api-schema#metrics) for the list of metric names supported by the `runRealtimeReport` method. See [Funnel Metrics](https://developers.google.com/analytics/devguides/reporting/data/v1/exploration-api-schema#metrics) for the list of metric names supported by the `runFunnelReport` method. If `expression` is specified, `name` can be any string that you would like within the allowed character set. For example if `expression` is `screenPageViews/sessions`, you could call that metric's name = `viewsPerSession`. Metric names that you choose must match the regular expression `^[a-zA-Z0-9_]$`. Metrics are referenced by `name` in `metricFilter`, `orderBys`, and metric `expression`.
810 pub name: Option<String>,
811}
812
813impl common::Part for Metric {}
814
815/// The compatibility for a single metric.
816///
817/// This type is not used in any activity, and only used as *part* of another schema.
818///
819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
820#[serde_with::serde_as]
821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
822pub struct MetricCompatibility {
823 /// The compatibility of this metric. If the compatibility is COMPATIBLE, this metric can be successfully added to the report.
824 pub compatibility: Option<String>,
825 /// The metric metadata contains the API name for this compatibility information. The metric metadata also contains other helpful information like the UI name and description.
826 #[serde(rename = "metricMetadata")]
827 pub metric_metadata: Option<MetricMetadata>,
828}
829
830impl common::Part for MetricCompatibility {}
831
832/// Describes a metric column in the report. Visible metrics requested in a report produce column entries within rows and MetricHeaders. However, metrics used exclusively within filters or expressions do not produce columns in a report; correspondingly, those metrics do not produce headers.
833///
834/// This type is not used in any activity, and only used as *part* of another schema.
835///
836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
837#[serde_with::serde_as]
838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
839pub struct MetricHeader {
840 /// The metric's name.
841 pub name: Option<String>,
842 /// The metric's data type.
843 #[serde(rename = "type")]
844 pub type_: Option<String>,
845}
846
847impl common::Part for MetricHeader {}
848
849/// Explains a metric.
850///
851/// This type is not used in any activity, and only used as *part* of another schema.
852///
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct MetricMetadata {
857 /// A metric name. Useable in [Metric](#Metric)’s `name`. For example, `eventCount`.
858 #[serde(rename = "apiName")]
859 pub api_name: Option<String>,
860 /// If reasons are specified, your access is blocked to this metric for this property. API requests from you to this property for this metric will succeed; however, the report will contain only zeros for this metric. API requests with metric filters on blocked metrics will fail. If reasons are empty, you have access to this metric. To learn more, see [Access and data-restriction management](https://support.google.com/analytics/answer/10851388).
861 #[serde(rename = "blockedReasons")]
862 pub blocked_reasons: Option<Vec<String>>,
863 /// The display name of the category that this metrics belongs to. Similar dimensions and metrics are categorized together.
864 pub category: Option<String>,
865 /// True if the metric is a custom metric for this property.
866 #[serde(rename = "customDefinition")]
867 pub custom_definition: Option<bool>,
868 /// Still usable but deprecated names for this metric. If populated, this metric is available by either `apiName` or one of `deprecatedApiNames` for a period of time. After the deprecation period, the metric will be available only by `apiName`.
869 #[serde(rename = "deprecatedApiNames")]
870 pub deprecated_api_names: Option<Vec<String>>,
871 /// Description of how this metric is used and calculated.
872 pub description: Option<String>,
873 /// The mathematical expression for this derived metric. Can be used in [Metric](#Metric)’s `expression` field for equivalent reports. Most metrics are not expressions, and for non-expressions, this field is empty.
874 pub expression: Option<String>,
875 /// The type of this metric.
876 #[serde(rename = "type")]
877 pub type_: Option<String>,
878 /// This metric's name within the Google Analytics user interface. For example, `Event count`.
879 #[serde(rename = "uiName")]
880 pub ui_name: Option<String>,
881}
882
883impl common::Part for MetricMetadata {}
884
885/// Sorts by metric values.
886///
887/// This type is not used in any activity, and only used as *part* of another schema.
888///
889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
890#[serde_with::serde_as]
891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
892pub struct MetricOrderBy {
893 /// A metric name in the request to order by.
894 #[serde(rename = "metricName")]
895 pub metric_name: Option<String>,
896}
897
898impl common::Part for MetricOrderBy {}
899
900/// The value of a metric.
901///
902/// This type is not used in any activity, and only used as *part* of another schema.
903///
904#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
905#[serde_with::serde_as]
906#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
907pub struct MetricValue {
908 /// Measurement value. See MetricHeader for type.
909 pub value: Option<String>,
910}
911
912impl common::Part for MetricValue {}
913
914/// A contiguous set of minutes: `startMinutesAgo`, `startMinutesAgo + 1`, ..., `endMinutesAgo`. Requests are allowed up to 2 minute ranges.
915///
916/// This type is not used in any activity, and only used as *part* of another schema.
917///
918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
919#[serde_with::serde_as]
920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
921pub struct MinuteRange {
922 /// The inclusive end minute for the query as a number of minutes before now. Cannot be before `startMinutesAgo`. For example, `"endMinutesAgo": 15` specifies the report should include event data from prior to 15 minutes ago. If unspecified, `endMinutesAgo` is defaulted to 0. Standard Analytics properties can request any minute in the last 30 minutes of event data (`endMinutesAgo <= 29`), and 360 Analytics properties can request any minute in the last 60 minutes of event data (`endMinutesAgo <= 59`).
923 #[serde(rename = "endMinutesAgo")]
924 pub end_minutes_ago: Option<i32>,
925 /// Assigns a name to this minute range. The dimension `dateRange` is valued to this name in a report response. If set, cannot begin with `date_range_` or `RESERVED_`. If not set, minute ranges are named by their zero based index in the request: `date_range_0`, `date_range_1`, etc.
926 pub name: Option<String>,
927 /// The inclusive start minute for the query as a number of minutes before now. For example, `"startMinutesAgo": 29` specifies the report should include event data from 29 minutes ago and after. Cannot be after `endMinutesAgo`. If unspecified, `startMinutesAgo` is defaulted to 29. Standard Analytics properties can request up to the last 30 minutes of event data (`startMinutesAgo <= 29`), and 360 Analytics properties can request up to the last 60 minutes of event data (`startMinutesAgo <= 59`).
928 #[serde(rename = "startMinutesAgo")]
929 pub start_minutes_ago: Option<i32>,
930}
931
932impl common::Part for MinuteRange {}
933
934/// Filters for numeric or date values.
935///
936/// This type is not used in any activity, and only used as *part* of another schema.
937///
938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
939#[serde_with::serde_as]
940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
941pub struct NumericFilter {
942 /// The operation type for this filter.
943 pub operation: Option<String>,
944 /// A numeric value or a date value.
945 pub value: Option<NumericValue>,
946}
947
948impl common::Part for NumericFilter {}
949
950/// To represent a number.
951///
952/// This type is not used in any activity, and only used as *part* of another schema.
953///
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct NumericValue {
958 /// Double value
959 #[serde(rename = "doubleValue")]
960 pub double_value: Option<f64>,
961 /// Integer value
962 #[serde(rename = "int64Value")]
963 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
964 pub int64_value: Option<i64>,
965}
966
967impl common::Part for NumericValue {}
968
969/// This resource represents a long-running operation that is the result of a network API call.
970///
971/// # Activities
972///
973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
975///
976/// * [audience exports create properties](PropertyAudienceExportCreateCall) (response)
977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
978#[serde_with::serde_as]
979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
980pub struct Operation {
981 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
982 pub done: Option<bool>,
983 /// The error result of the operation in case of failure or cancellation.
984 pub error: Option<Status>,
985 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
986 pub metadata: Option<HashMap<String, serde_json::Value>>,
987 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
988 pub name: Option<String>,
989 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
990 pub response: Option<HashMap<String, serde_json::Value>>,
991}
992
993impl common::ResponseResult for Operation {}
994
995/// Order bys define how rows will be sorted in the response. For example, ordering rows by descending event count is one ordering, and ordering rows by the event name string is a different ordering.
996///
997/// This type is not used in any activity, and only used as *part* of another schema.
998///
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct OrderBy {
1003 /// If true, sorts by descending order.
1004 pub desc: Option<bool>,
1005 /// Sorts results by a dimension's values.
1006 pub dimension: Option<DimensionOrderBy>,
1007 /// Sorts results by a metric's values.
1008 pub metric: Option<MetricOrderBy>,
1009 /// Sorts results by a metric's values within a pivot column group.
1010 pub pivot: Option<PivotOrderBy>,
1011}
1012
1013impl common::Part for OrderBy {}
1014
1015/// Describes the visible dimension columns and rows in the report response.
1016///
1017/// This type is not used in any activity, and only used as *part* of another schema.
1018///
1019#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1020#[serde_with::serde_as]
1021#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1022pub struct Pivot {
1023 /// Dimension names for visible columns in the report response. Including "dateRange" produces a date range column; for each row in the response, dimension values in the date range column will indicate the corresponding date range from the request.
1024 #[serde(rename = "fieldNames")]
1025 pub field_names: Option<Vec<String>>,
1026 /// The number of unique combinations of dimension values to return in this pivot. The `limit` parameter is required. A `limit` of 10,000 is common for single pivot requests. The product of the `limit` for each `pivot` in a `RunPivotReportRequest` must not exceed 250,000. For example, a two pivot request with `limit: 1000` in each pivot will fail because the product is `1,000,000`.
1027 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1028 pub limit: Option<i64>,
1029 /// Aggregate the metrics by dimensions in this pivot using the specified metric_aggregations.
1030 #[serde(rename = "metricAggregations")]
1031 pub metric_aggregations: Option<Vec<String>>,
1032 /// The row count of the start row. The first row is counted as row 0.
1033 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1034 pub offset: Option<i64>,
1035 /// Specifies how dimensions are ordered in the pivot. In the first Pivot, the OrderBys determine Row and PivotDimensionHeader ordering; in subsequent Pivots, the OrderBys determine only PivotDimensionHeader ordering. Dimensions specified in these OrderBys must be a subset of Pivot.field_names.
1036 #[serde(rename = "orderBys")]
1037 pub order_bys: Option<Vec<OrderBy>>,
1038}
1039
1040impl common::Part for Pivot {}
1041
1042/// Summarizes dimension values from a row for this pivot.
1043///
1044/// This type is not used in any activity, and only used as *part* of another schema.
1045///
1046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1047#[serde_with::serde_as]
1048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1049pub struct PivotDimensionHeader {
1050 /// Values of multiple dimensions in a pivot.
1051 #[serde(rename = "dimensionValues")]
1052 pub dimension_values: Option<Vec<DimensionValue>>,
1053}
1054
1055impl common::Part for PivotDimensionHeader {}
1056
1057/// Dimensions' values in a single pivot.
1058///
1059/// This type is not used in any activity, and only used as *part* of another schema.
1060///
1061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1062#[serde_with::serde_as]
1063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1064pub struct PivotHeader {
1065 /// The size is the same as the cardinality of the corresponding dimension combinations.
1066 #[serde(rename = "pivotDimensionHeaders")]
1067 pub pivot_dimension_headers: Option<Vec<PivotDimensionHeader>>,
1068 /// The cardinality of the pivot. The total number of rows for this pivot's fields regardless of how the parameters `offset` and `limit` are specified in the request.
1069 #[serde(rename = "rowCount")]
1070 pub row_count: Option<i32>,
1071}
1072
1073impl common::Part for PivotHeader {}
1074
1075/// Sorts by a pivot column group.
1076///
1077/// This type is not used in any activity, and only used as *part* of another schema.
1078///
1079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1080#[serde_with::serde_as]
1081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1082pub struct PivotOrderBy {
1083 /// In the response to order by, order rows by this column. Must be a metric name from the request.
1084 #[serde(rename = "metricName")]
1085 pub metric_name: Option<String>,
1086 /// Used to select a dimension name and value pivot. If multiple pivot selections are given, the sort occurs on rows where all pivot selection dimension name and value pairs match the row's dimension name and value pair.
1087 #[serde(rename = "pivotSelections")]
1088 pub pivot_selections: Option<Vec<PivotSelection>>,
1089}
1090
1091impl common::Part for PivotOrderBy {}
1092
1093/// A pair of dimension names and values. Rows with this dimension pivot pair are ordered by the metric's value. For example if pivots = {{"browser", "Chrome"}} and metric_name = "Sessions", then the rows will be sorted based on Sessions in Chrome. ---------|----------|----------------|----------|---------------- | Chrome | Chrome | Safari | Safari ---------|----------|----------------|----------|---------------- Country | Sessions | Pages/Sessions | Sessions | Pages/Sessions ---------|----------|----------------|----------|---------------- US | 2 | 2 | 3 | 1 ---------|----------|----------------|----------|---------------- Canada | 3 | 1 | 4 | 1 ---------|----------|----------------|----------|----------------
1094///
1095/// This type is not used in any activity, and only used as *part* of another schema.
1096///
1097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1098#[serde_with::serde_as]
1099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1100pub struct PivotSelection {
1101 /// Must be a dimension name from the request.
1102 #[serde(rename = "dimensionName")]
1103 pub dimension_name: Option<String>,
1104 /// Order by only when the named dimension is this value.
1105 #[serde(rename = "dimensionValue")]
1106 pub dimension_value: Option<String>,
1107}
1108
1109impl common::Part for PivotSelection {}
1110
1111/// Current state of all quotas for this Analytics Property. If any quota for a property is exhausted, all requests to that property will return Resource Exhausted errors.
1112///
1113/// This type is not used in any activity, and only used as *part* of another schema.
1114///
1115#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1116#[serde_with::serde_as]
1117#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1118pub struct PropertyQuota {
1119 /// Standard Analytics Properties can send up to 10 concurrent requests; Analytics 360 Properties can use up to 50 concurrent requests.
1120 #[serde(rename = "concurrentRequests")]
1121 pub concurrent_requests: Option<QuotaStatus>,
1122 /// Analytics Properties can send up to 120 requests with potentially thresholded dimensions per hour. In a batch request, each report request is individually counted for this quota if the request contains potentially thresholded dimensions.
1123 #[serde(rename = "potentiallyThresholdedRequestsPerHour")]
1124 pub potentially_thresholded_requests_per_hour: Option<QuotaStatus>,
1125 /// Standard Analytics Properties and cloud project pairs can have up to 10 server errors per hour; Analytics 360 Properties and cloud project pairs can have up to 50 server errors per hour.
1126 #[serde(rename = "serverErrorsPerProjectPerHour")]
1127 pub server_errors_per_project_per_hour: Option<QuotaStatus>,
1128 /// Standard Analytics Properties can use up to 200,000 tokens per day; Analytics 360 Properties can use 2,000,000 tokens per day. Most requests consume fewer than 10 tokens.
1129 #[serde(rename = "tokensPerDay")]
1130 pub tokens_per_day: Option<QuotaStatus>,
1131 /// Standard Analytics Properties can use up to 40,000 tokens per hour; Analytics 360 Properties can use 400,000 tokens per hour. An API request consumes a single number of tokens, and that number is deducted from all of the hourly, daily, and per project hourly quotas.
1132 #[serde(rename = "tokensPerHour")]
1133 pub tokens_per_hour: Option<QuotaStatus>,
1134 /// Analytics Properties can use up to 35% of their tokens per project per hour. This amounts to standard Analytics Properties can use up to 14,000 tokens per project per hour, and Analytics 360 Properties can use 140,000 tokens per project per hour. An API request consumes a single number of tokens, and that number is deducted from all of the hourly, daily, and per project hourly quotas.
1135 #[serde(rename = "tokensPerProjectPerHour")]
1136 pub tokens_per_project_per_hour: Option<QuotaStatus>,
1137}
1138
1139impl common::Part for PropertyQuota {}
1140
1141/// A request to list users in an audience export.
1142///
1143/// # Activities
1144///
1145/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1146/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1147///
1148/// * [audience exports query properties](PropertyAudienceExportQueryCall) (request)
1149#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1150#[serde_with::serde_as]
1151#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1152pub struct QueryAudienceExportRequest {
1153 /// Optional. The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must be positive. The API can also return fewer rows than the requested `limit`, if there aren't as many dimension values as the `limit`. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1154 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1155 pub limit: Option<i64>,
1156 /// Optional. The row count of the start row. The first row is counted as row 0. When paging, the first request does not specify offset; or equivalently, sets offset to 0; the first request returns the first `limit` of rows. The second request sets offset to the `limit` of the first request; the second request returns the second `limit` of rows. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1157 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1158 pub offset: Option<i64>,
1159}
1160
1161impl common::RequestValue for QueryAudienceExportRequest {}
1162
1163/// A list of users in an audience export.
1164///
1165/// # Activities
1166///
1167/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1168/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1169///
1170/// * [audience exports query properties](PropertyAudienceExportQueryCall) (response)
1171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1172#[serde_with::serde_as]
1173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1174pub struct QueryAudienceExportResponse {
1175 /// Configuration data about AudienceExport being queried. Returned to help interpret the audience rows in this response. For example, the dimensions in this AudienceExport correspond to the columns in the AudienceRows.
1176 #[serde(rename = "audienceExport")]
1177 pub audience_export: Option<AudienceExport>,
1178 /// Rows for each user in an audience export. The number of rows in this response will be less than or equal to request's page size.
1179 #[serde(rename = "audienceRows")]
1180 pub audience_rows: Option<Vec<V1betaAudienceRow>>,
1181 /// The total number of rows in the AudienceExport result. `rowCount` is independent of the number of rows returned in the response, the `limit` request parameter, and the `offset` request parameter. For example if a query returns 175 rows and includes `limit` of 50 in the API request, the response will contain `rowCount` of 175 but only 50 rows. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1182 #[serde(rename = "rowCount")]
1183 pub row_count: Option<i32>,
1184}
1185
1186impl common::ResponseResult for QueryAudienceExportResponse {}
1187
1188/// Current state for a particular quota group.
1189///
1190/// This type is not used in any activity, and only used as *part* of another schema.
1191///
1192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1193#[serde_with::serde_as]
1194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1195pub struct QuotaStatus {
1196 /// Quota consumed by this request.
1197 pub consumed: Option<i32>,
1198 /// Quota remaining after this request.
1199 pub remaining: Option<i32>,
1200}
1201
1202impl common::Part for QuotaStatus {}
1203
1204/// Response's metadata carrying additional information about the report content.
1205///
1206/// This type is not used in any activity, and only used as *part* of another schema.
1207///
1208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1209#[serde_with::serde_as]
1210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1211pub struct ResponseMetaData {
1212 /// The currency code used in this report. Intended to be used in formatting currency metrics like `purchaseRevenue` for visualization. If currency_code was specified in the request, this response parameter will echo the request parameter; otherwise, this response parameter is the property's current currency_code. Currency codes are string encodings of currency types from the ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217); for example "USD", "EUR", "JPY". To learn more, see https://support.google.com/analytics/answer/9796179.
1213 #[serde(rename = "currencyCode")]
1214 pub currency_code: Option<String>,
1215 /// If true, indicates some buckets of dimension combinations are rolled into "(other)" row. This can happen for high cardinality reports. The metadata parameter dataLossFromOtherRow is populated based on the aggregated data table used in the report. The parameter will be accurately populated regardless of the filters and limits in the report. For example, the (other) row could be dropped from the report because the request contains a filter on sessionSource = google. This parameter will still be populated if data loss from other row was present in the input aggregate data used to generate this report. To learn more, see [About the (other) row and data sampling](https://support.google.com/analytics/answer/13208658#reports).
1216 #[serde(rename = "dataLossFromOtherRow")]
1217 pub data_loss_from_other_row: Option<bool>,
1218 /// If empty reason is specified, the report is empty for this reason.
1219 #[serde(rename = "emptyReason")]
1220 pub empty_reason: Option<String>,
1221 /// If this report results is [sampled](https://support.google.com/analytics/answer/13331292), this describes the percentage of events used in this report. One `samplingMetadatas` is populated for each date range. Each `samplingMetadatas` corresponds to a date range in order that date ranges were specified in the request. However if the results are not sampled, this field will not be defined.
1222 #[serde(rename = "samplingMetadatas")]
1223 pub sampling_metadatas: Option<Vec<SamplingMetadata>>,
1224 /// Describes the schema restrictions actively enforced in creating this report. To learn more, see [Access and data-restriction management](https://support.google.com/analytics/answer/10851388).
1225 #[serde(rename = "schemaRestrictionResponse")]
1226 pub schema_restriction_response: Option<SchemaRestrictionResponse>,
1227 /// If `subjectToThresholding` is true, this report is subject to thresholding and only returns data that meets the minimum aggregation thresholds. It is possible for a request to be subject to thresholding thresholding and no data is absent from the report, and this happens when all data is above the thresholds. To learn more, see [Data thresholds](https://support.google.com/analytics/answer/9383630).
1228 #[serde(rename = "subjectToThresholding")]
1229 pub subject_to_thresholding: Option<bool>,
1230 /// The property's current timezone. Intended to be used to interpret time-based dimensions like `hour` and `minute`. Formatted as strings from the IANA Time Zone database (https://www.iana.org/time-zones); for example "America/New_York" or "Asia/Tokyo".
1231 #[serde(rename = "timeZone")]
1232 pub time_zone: Option<String>,
1233}
1234
1235impl common::Part for ResponseMetaData {}
1236
1237/// Report data for each row. For example if RunReportRequest contains: ```none "dimensions": [ { "name": "eventName" }, { "name": "countryId" } ], "metrics": [ { "name": "eventCount" } ] ``` One row with 'in_app_purchase' as the eventName, 'JP' as the countryId, and 15 as the eventCount, would be: ```none "dimensionValues": [ { "value": "in_app_purchase" }, { "value": "JP" } ], "metricValues": [ { "value": "15" } ] ```
1238///
1239/// This type is not used in any activity, and only used as *part* of another schema.
1240///
1241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1242#[serde_with::serde_as]
1243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1244pub struct Row {
1245 /// List of requested dimension values. In a PivotReport, dimension_values are only listed for dimensions included in a pivot.
1246 #[serde(rename = "dimensionValues")]
1247 pub dimension_values: Option<Vec<DimensionValue>>,
1248 /// List of requested visible metric values.
1249 #[serde(rename = "metricValues")]
1250 pub metric_values: Option<Vec<MetricValue>>,
1251}
1252
1253impl common::Part for Row {}
1254
1255/// The request to generate a pivot report.
1256///
1257/// # Activities
1258///
1259/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1260/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1261///
1262/// * [run pivot report properties](PropertyRunPivotReportCall) (request)
1263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1264#[serde_with::serde_as]
1265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1266pub struct RunPivotReportRequest {
1267 /// Cohort group associated with this request. If there is a cohort group in the request the 'cohort' dimension must be present.
1268 #[serde(rename = "cohortSpec")]
1269 pub cohort_spec: Option<CohortSpec>,
1270 /// Optional. The configuration of comparisons requested and displayed. The request requires both a comparisons field and a comparisons dimension to receive a comparison column in the response.
1271 pub comparisons: Option<Vec<Comparison>>,
1272 /// A currency code in ISO4217 format, such as "AED", "USD", "JPY". If the field is empty, the report uses the property's default currency.
1273 #[serde(rename = "currencyCode")]
1274 pub currency_code: Option<String>,
1275 /// The date range to retrieve event data for the report. If multiple date ranges are specified, event data from each date range is used in the report. A special dimension with field name "dateRange" can be included in a Pivot's field names; if included, the report compares between date ranges. In a cohort request, this `dateRanges` must be unspecified.
1276 #[serde(rename = "dateRanges")]
1277 pub date_ranges: Option<Vec<DateRange>>,
1278 /// The filter clause of dimensions. Dimensions must be requested to be used in this filter. Metrics cannot be used in this filter.
1279 #[serde(rename = "dimensionFilter")]
1280 pub dimension_filter: Option<FilterExpression>,
1281 /// The dimensions requested. All defined dimensions must be used by one of the following: dimension_expression, dimension_filter, pivots, order_bys.
1282 pub dimensions: Option<Vec<Dimension>>,
1283 /// If false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. Regardless of this `keep_empty_rows` setting, only data recorded by the Google Analytics (GA4) property can be displayed in a report. For example if a property never logs a `purchase` event, then a query for the `eventName` dimension and `eventCount` metric will not have a row eventName: "purchase" and eventCount: 0.
1284 #[serde(rename = "keepEmptyRows")]
1285 pub keep_empty_rows: Option<bool>,
1286 /// The filter clause of metrics. Applied at post aggregation phase, similar to SQL having-clause. Metrics must be requested to be used in this filter. Dimensions cannot be used in this filter.
1287 #[serde(rename = "metricFilter")]
1288 pub metric_filter: Option<FilterExpression>,
1289 /// The metrics requested, at least one metric needs to be specified. All defined metrics must be used by one of the following: metric_expression, metric_filter, order_bys.
1290 pub metrics: Option<Vec<Metric>>,
1291 /// Describes the visual format of the report's dimensions in columns or rows. The union of the fieldNames (dimension names) in all pivots must be a subset of dimension names defined in Dimensions. No two pivots can share a dimension. A dimension is only visible if it appears in a pivot.
1292 pub pivots: Option<Vec<Pivot>>,
1293 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
1294 pub property: Option<String>,
1295 /// Toggles whether to return the current state of this Analytics Property’s quota. Quota is returned in [PropertyQuota](#PropertyQuota).
1296 #[serde(rename = "returnPropertyQuota")]
1297 pub return_property_quota: Option<bool>,
1298}
1299
1300impl common::RequestValue for RunPivotReportRequest {}
1301
1302/// The response pivot report table corresponding to a pivot request.
1303///
1304/// # Activities
1305///
1306/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1307/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1308///
1309/// * [run pivot report properties](PropertyRunPivotReportCall) (response)
1310#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1311#[serde_with::serde_as]
1312#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1313pub struct RunPivotReportResponse {
1314 /// Aggregation of metric values. Can be totals, minimums, or maximums. The returned aggregations are controlled by the metric_aggregations in the pivot. The type of aggregation returned in each row is shown by the dimension_values which are set to "RESERVED_".
1315 pub aggregates: Option<Vec<Row>>,
1316 /// Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders matches the dimensions present in rows.
1317 #[serde(rename = "dimensionHeaders")]
1318 pub dimension_headers: Option<Vec<DimensionHeader>>,
1319 /// Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#runPivotReport". Useful to distinguish between response types in JSON.
1320 pub kind: Option<String>,
1321 /// Metadata for the report.
1322 pub metadata: Option<ResponseMetaData>,
1323 /// Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders matches the metrics present in rows.
1324 #[serde(rename = "metricHeaders")]
1325 pub metric_headers: Option<Vec<MetricHeader>>,
1326 /// Summarizes the columns and rows created by a pivot. Each pivot in the request produces one header in the response. If we have a request like this: "pivots": [{ "fieldNames": ["country", "city"] }, { "fieldNames": "eventName" }] We will have the following `pivotHeaders` in the response: "pivotHeaders" : [{ "dimensionHeaders": [{ "dimensionValues": [ { "value": "United Kingdom" }, { "value": "London" } ] }, { "dimensionValues": [ { "value": "Japan" }, { "value": "Osaka" } ] }] }, { "dimensionHeaders": [{ "dimensionValues": [{ "value": "session_start" }] }, { "dimensionValues": [{ "value": "scroll" }] }] }]
1327 #[serde(rename = "pivotHeaders")]
1328 pub pivot_headers: Option<Vec<PivotHeader>>,
1329 /// This Analytics Property's quota state including this request.
1330 #[serde(rename = "propertyQuota")]
1331 pub property_quota: Option<PropertyQuota>,
1332 /// Rows of dimension value combinations and metric values in the report.
1333 pub rows: Option<Vec<Row>>,
1334}
1335
1336impl common::ResponseResult for RunPivotReportResponse {}
1337
1338/// The request to generate a realtime report.
1339///
1340/// # Activities
1341///
1342/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1343/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1344///
1345/// * [run realtime report properties](PropertyRunRealtimeReportCall) (request)
1346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1347#[serde_with::serde_as]
1348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1349pub struct RunRealtimeReportRequest {
1350 /// The filter clause of dimensions. Metrics cannot be used in this filter.
1351 #[serde(rename = "dimensionFilter")]
1352 pub dimension_filter: Option<FilterExpression>,
1353 /// The dimensions requested and displayed.
1354 pub dimensions: Option<Vec<Dimension>>,
1355 /// The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must be positive. The API can also return fewer rows than the requested `limit`, if there aren't as many dimension values as the `limit`. For instance, there are fewer than 300 possible values for the dimension `country`, so when reporting on only `country`, you can't get more than 300 rows, even if you set `limit` to a higher value.
1356 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1357 pub limit: Option<i64>,
1358 /// Aggregation of metrics. Aggregated metric values will be shown in rows where the dimension_values are set to "RESERVED_(MetricAggregation)".
1359 #[serde(rename = "metricAggregations")]
1360 pub metric_aggregations: Option<Vec<String>>,
1361 /// The filter clause of metrics. Applied at post aggregation phase, similar to SQL having-clause. Dimensions cannot be used in this filter.
1362 #[serde(rename = "metricFilter")]
1363 pub metric_filter: Option<FilterExpression>,
1364 /// The metrics requested and displayed.
1365 pub metrics: Option<Vec<Metric>>,
1366 /// The minute ranges of event data to read. If unspecified, one minute range for the last 30 minutes will be used. If multiple minute ranges are requested, each response row will contain a zero based minute range index. If two minute ranges overlap, the event data for the overlapping minutes is included in the response rows for both minute ranges.
1367 #[serde(rename = "minuteRanges")]
1368 pub minute_ranges: Option<Vec<MinuteRange>>,
1369 /// Specifies how rows are ordered in the response.
1370 #[serde(rename = "orderBys")]
1371 pub order_bys: Option<Vec<OrderBy>>,
1372 /// Toggles whether to return the current state of this Analytics Property’s Realtime quota. Quota is returned in [PropertyQuota](#PropertyQuota).
1373 #[serde(rename = "returnPropertyQuota")]
1374 pub return_property_quota: Option<bool>,
1375}
1376
1377impl common::RequestValue for RunRealtimeReportRequest {}
1378
1379/// The response realtime report table corresponding to a request.
1380///
1381/// # Activities
1382///
1383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1385///
1386/// * [run realtime report properties](PropertyRunRealtimeReportCall) (response)
1387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1388#[serde_with::serde_as]
1389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1390pub struct RunRealtimeReportResponse {
1391 /// Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders matches the dimensions present in rows.
1392 #[serde(rename = "dimensionHeaders")]
1393 pub dimension_headers: Option<Vec<DimensionHeader>>,
1394 /// Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#runRealtimeReport". Useful to distinguish between response types in JSON.
1395 pub kind: Option<String>,
1396 /// If requested, the maximum values of metrics.
1397 pub maximums: Option<Vec<Row>>,
1398 /// Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders matches the metrics present in rows.
1399 #[serde(rename = "metricHeaders")]
1400 pub metric_headers: Option<Vec<MetricHeader>>,
1401 /// If requested, the minimum values of metrics.
1402 pub minimums: Option<Vec<Row>>,
1403 /// This Analytics Property's Realtime quota state including this request.
1404 #[serde(rename = "propertyQuota")]
1405 pub property_quota: Option<PropertyQuota>,
1406 /// The total number of rows in the query result. `rowCount` is independent of the number of rows returned in the response and the `limit` request parameter. For example if a query returns 175 rows and includes `limit` of 50 in the API request, the response will contain `rowCount` of 175 but only 50 rows.
1407 #[serde(rename = "rowCount")]
1408 pub row_count: Option<i32>,
1409 /// Rows of dimension value combinations and metric values in the report.
1410 pub rows: Option<Vec<Row>>,
1411 /// If requested, the totaled values of metrics.
1412 pub totals: Option<Vec<Row>>,
1413}
1414
1415impl common::ResponseResult for RunRealtimeReportResponse {}
1416
1417/// The request to generate a report.
1418///
1419/// # Activities
1420///
1421/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1422/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1423///
1424/// * [run report properties](PropertyRunReportCall) (request)
1425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1426#[serde_with::serde_as]
1427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1428pub struct RunReportRequest {
1429 /// Cohort group associated with this request. If there is a cohort group in the request the 'cohort' dimension must be present.
1430 #[serde(rename = "cohortSpec")]
1431 pub cohort_spec: Option<CohortSpec>,
1432 /// Optional. The configuration of comparisons requested and displayed. The request only requires a comparisons field in order to receive a comparison column in the response.
1433 pub comparisons: Option<Vec<Comparison>>,
1434 /// A currency code in ISO4217 format, such as "AED", "USD", "JPY". If the field is empty, the report uses the property's default currency.
1435 #[serde(rename = "currencyCode")]
1436 pub currency_code: Option<String>,
1437 /// Date ranges of data to read. If multiple date ranges are requested, each response row will contain a zero based date range index. If two date ranges overlap, the event data for the overlapping days is included in the response rows for both date ranges. In a cohort request, this `dateRanges` must be unspecified.
1438 #[serde(rename = "dateRanges")]
1439 pub date_ranges: Option<Vec<DateRange>>,
1440 /// Dimension filters let you ask for only specific dimension values in the report. To learn more, see [Fundamentals of Dimension Filters](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimension_filters) for examples. Metrics cannot be used in this filter.
1441 #[serde(rename = "dimensionFilter")]
1442 pub dimension_filter: Option<FilterExpression>,
1443 /// The dimensions requested and displayed.
1444 pub dimensions: Option<Vec<Dimension>>,
1445 /// If false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. Regardless of this `keep_empty_rows` setting, only data recorded by the Google Analytics (GA4) property can be displayed in a report. For example if a property never logs a `purchase` event, then a query for the `eventName` dimension and `eventCount` metric will not have a row eventName: "purchase" and eventCount: 0.
1446 #[serde(rename = "keepEmptyRows")]
1447 pub keep_empty_rows: Option<bool>,
1448 /// The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. `limit` must be positive. The API can also return fewer rows than the requested `limit`, if there aren't as many dimension values as the `limit`. For instance, there are fewer than 300 possible values for the dimension `country`, so when reporting on only `country`, you can't get more than 300 rows, even if you set `limit` to a higher value. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1449 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1450 pub limit: Option<i64>,
1451 /// Aggregation of metrics. Aggregated metric values will be shown in rows where the dimension_values are set to "RESERVED_(MetricAggregation)".
1452 #[serde(rename = "metricAggregations")]
1453 pub metric_aggregations: Option<Vec<String>>,
1454 /// The filter clause of metrics. Applied after aggregating the report's rows, similar to SQL having-clause. Dimensions cannot be used in this filter.
1455 #[serde(rename = "metricFilter")]
1456 pub metric_filter: Option<FilterExpression>,
1457 /// The metrics requested and displayed.
1458 pub metrics: Option<Vec<Metric>>,
1459 /// The row count of the start row. The first row is counted as row 0. When paging, the first request does not specify offset; or equivalently, sets offset to 0; the first request returns the first `limit` of rows. The second request sets offset to the `limit` of the first request; the second request returns the second `limit` of rows. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1460 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1461 pub offset: Option<i64>,
1462 /// Specifies how rows are ordered in the response.
1463 #[serde(rename = "orderBys")]
1464 pub order_bys: Option<Vec<OrderBy>>,
1465 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
1466 pub property: Option<String>,
1467 /// Toggles whether to return the current state of this Analytics Property’s quota. Quota is returned in [PropertyQuota](#PropertyQuota).
1468 #[serde(rename = "returnPropertyQuota")]
1469 pub return_property_quota: Option<bool>,
1470}
1471
1472impl common::RequestValue for RunReportRequest {}
1473
1474/// The response report table corresponding to a request.
1475///
1476/// # Activities
1477///
1478/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1479/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1480///
1481/// * [run report properties](PropertyRunReportCall) (response)
1482#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1483#[serde_with::serde_as]
1484#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1485pub struct RunReportResponse {
1486 /// Describes dimension columns. The number of DimensionHeaders and ordering of DimensionHeaders matches the dimensions present in rows.
1487 #[serde(rename = "dimensionHeaders")]
1488 pub dimension_headers: Option<Vec<DimensionHeader>>,
1489 /// Identifies what kind of resource this message is. This `kind` is always the fixed string "analyticsData#runReport". Useful to distinguish between response types in JSON.
1490 pub kind: Option<String>,
1491 /// If requested, the maximum values of metrics.
1492 pub maximums: Option<Vec<Row>>,
1493 /// Metadata for the report.
1494 pub metadata: Option<ResponseMetaData>,
1495 /// Describes metric columns. The number of MetricHeaders and ordering of MetricHeaders matches the metrics present in rows.
1496 #[serde(rename = "metricHeaders")]
1497 pub metric_headers: Option<Vec<MetricHeader>>,
1498 /// If requested, the minimum values of metrics.
1499 pub minimums: Option<Vec<Row>>,
1500 /// This Analytics Property's quota state including this request.
1501 #[serde(rename = "propertyQuota")]
1502 pub property_quota: Option<PropertyQuota>,
1503 /// The total number of rows in the query result. `rowCount` is independent of the number of rows returned in the response, the `limit` request parameter, and the `offset` request parameter. For example if a query returns 175 rows and includes `limit` of 50 in the API request, the response will contain `rowCount` of 175 but only 50 rows. To learn more about this pagination parameter, see [Pagination](https://developers.google.com/analytics/devguides/reporting/data/v1/basics#pagination).
1504 #[serde(rename = "rowCount")]
1505 pub row_count: Option<i32>,
1506 /// Rows of dimension value combinations and metric values in the report.
1507 pub rows: Option<Vec<Row>>,
1508 /// If requested, the totaled values of metrics.
1509 pub totals: Option<Vec<Row>>,
1510}
1511
1512impl common::ResponseResult for RunReportResponse {}
1513
1514/// If this report results is [sampled](https://support.google.com/analytics/answer/13331292), this describes the percentage of events used in this report. Sampling is the practice of analyzing a subset of all data in order to uncover the meaningful information in the larger data set.
1515///
1516/// This type is not used in any activity, and only used as *part* of another schema.
1517///
1518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1519#[serde_with::serde_as]
1520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1521pub struct SamplingMetadata {
1522 /// The total number of events read in this sampled report for a date range. This is the size of the subset this property's data that was analyzed in this report.
1523 #[serde(rename = "samplesReadCount")]
1524 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1525 pub samples_read_count: Option<i64>,
1526 /// The total number of events present in this property's data that could have been analyzed in this report for a date range. Sampling uncovers the meaningful information about the larger data set, and this is the size of the larger data set. To calculate the percentage of available data that was used in this report, compute `samplesReadCount/samplingSpaceSize`.
1527 #[serde(rename = "samplingSpaceSize")]
1528 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1529 pub sampling_space_size: Option<i64>,
1530}
1531
1532impl common::Part for SamplingMetadata {}
1533
1534/// The schema restrictions actively enforced in creating this report. To learn more, see [Access and data-restriction management](https://support.google.com/analytics/answer/10851388).
1535///
1536/// This type is not used in any activity, and only used as *part* of another schema.
1537///
1538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1539#[serde_with::serde_as]
1540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1541pub struct SchemaRestrictionResponse {
1542 /// All restrictions actively enforced in creating the report. For example, `purchaseRevenue` always has the restriction type `REVENUE_DATA`. However, this active response restriction is only populated if the user's custom role disallows access to `REVENUE_DATA`.
1543 #[serde(rename = "activeMetricRestrictions")]
1544 pub active_metric_restrictions: Option<Vec<ActiveMetricRestriction>>,
1545}
1546
1547impl common::Part for SchemaRestrictionResponse {}
1548
1549/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1550///
1551/// This type is not used in any activity, and only used as *part* of another schema.
1552///
1553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1554#[serde_with::serde_as]
1555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1556pub struct Status {
1557 /// The status code, which should be an enum value of google.rpc.Code.
1558 pub code: Option<i32>,
1559 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1560 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1561 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1562 pub message: Option<String>,
1563}
1564
1565impl common::Part for Status {}
1566
1567/// The filter for string
1568///
1569/// This type is not used in any activity, and only used as *part* of another schema.
1570///
1571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1572#[serde_with::serde_as]
1573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1574pub struct StringFilter {
1575 /// If true, the string value is case sensitive.
1576 #[serde(rename = "caseSensitive")]
1577 pub case_sensitive: Option<bool>,
1578 /// The match type for this filter.
1579 #[serde(rename = "matchType")]
1580 pub match_type: Option<String>,
1581 /// The string value used for the matching.
1582 pub value: Option<String>,
1583}
1584
1585impl common::Part for StringFilter {}
1586
1587/// An audience dimension is a user attribute. Specific user attributed are requested and then later returned in the `QueryAudienceExportResponse`.
1588///
1589/// This type is not used in any activity, and only used as *part* of another schema.
1590///
1591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1592#[serde_with::serde_as]
1593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1594pub struct V1betaAudienceDimension {
1595 /// Optional. The API name of the dimension. See the [API Dimensions](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-api-schema#dimensions) for the list of dimension names.
1596 #[serde(rename = "dimensionName")]
1597 pub dimension_name: Option<String>,
1598}
1599
1600impl common::Part for V1betaAudienceDimension {}
1601
1602/// The value of a dimension.
1603///
1604/// This type is not used in any activity, and only used as *part* of another schema.
1605///
1606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1607#[serde_with::serde_as]
1608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1609pub struct V1betaAudienceDimensionValue {
1610 /// Value as a string if the dimension type is a string.
1611 pub value: Option<String>,
1612}
1613
1614impl common::Part for V1betaAudienceDimensionValue {}
1615
1616/// Dimension value attributes for the audience user row.
1617///
1618/// This type is not used in any activity, and only used as *part* of another schema.
1619///
1620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1621#[serde_with::serde_as]
1622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1623pub struct V1betaAudienceRow {
1624 /// Each dimension value attribute for an audience user. One dimension value will be added for each dimension column requested.
1625 #[serde(rename = "dimensionValues")]
1626 pub dimension_values: Option<Vec<V1betaAudienceDimensionValue>>,
1627}
1628
1629impl common::Part for V1betaAudienceRow {}
1630
1631// ###################
1632// MethodBuilders ###
1633// #################
1634
1635/// A builder providing access to all methods supported on *property* resources.
1636/// It is not used directly, but through the [`AnalyticsData`] hub.
1637///
1638/// # Example
1639///
1640/// Instantiate a resource builder
1641///
1642/// ```test_harness,no_run
1643/// extern crate hyper;
1644/// extern crate hyper_rustls;
1645/// extern crate google_analyticsdata1_beta as analyticsdata1_beta;
1646///
1647/// # async fn dox() {
1648/// use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1649///
1650/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1651/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1652/// secret,
1653/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1654/// ).build().await.unwrap();
1655///
1656/// let client = hyper_util::client::legacy::Client::builder(
1657/// hyper_util::rt::TokioExecutor::new()
1658/// )
1659/// .build(
1660/// hyper_rustls::HttpsConnectorBuilder::new()
1661/// .with_native_roots()
1662/// .unwrap()
1663/// .https_or_http()
1664/// .enable_http1()
1665/// .build()
1666/// );
1667/// let mut hub = AnalyticsData::new(client, auth);
1668/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1669/// // like `audience_exports_create(...)`, `audience_exports_get(...)`, `audience_exports_list(...)`, `audience_exports_query(...)`, `batch_run_pivot_reports(...)`, `batch_run_reports(...)`, `check_compatibility(...)`, `get_metadata(...)`, `run_pivot_report(...)`, `run_realtime_report(...)` and `run_report(...)`
1670/// // to build up your call.
1671/// let rb = hub.properties();
1672/// # }
1673/// ```
1674pub struct PropertyMethods<'a, C>
1675where
1676 C: 'a,
1677{
1678 hub: &'a AnalyticsData<C>,
1679}
1680
1681impl<'a, C> common::MethodsBuilder for PropertyMethods<'a, C> {}
1682
1683impl<'a, C> PropertyMethods<'a, C> {
1684 /// Create a builder to help you perform the following task:
1685 ///
1686 /// Creates an audience export for later retrieval. This method quickly returns the audience export's resource name and initiates a long running asynchronous request to form an audience export. To export the users in an audience export, first create the audience export through this method and then send the audience resource name to the `QueryAudienceExport` method. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. An audience export is a snapshot of the users currently in the audience at the time of audience export creation. Creating audience exports for one audience on different days will return different results as users enter and exit the audience. Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience exports contain the users in each audience. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
1687 ///
1688 /// # Arguments
1689 ///
1690 /// * `request` - No description provided.
1691 /// * `parent` - Required. The parent resource where this audience export will be created. Format: `properties/{property}`
1692 pub fn audience_exports_create(
1693 &self,
1694 request: AudienceExport,
1695 parent: &str,
1696 ) -> PropertyAudienceExportCreateCall<'a, C> {
1697 PropertyAudienceExportCreateCall {
1698 hub: self.hub,
1699 _request: request,
1700 _parent: parent.to_string(),
1701 _delegate: Default::default(),
1702 _additional_params: Default::default(),
1703 _scopes: Default::default(),
1704 }
1705 }
1706
1707 /// Create a builder to help you perform the following task:
1708 ///
1709 /// Gets configuration metadata about a specific audience export. This method can be used to understand an audience export after it has been created. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
1710 ///
1711 /// # Arguments
1712 ///
1713 /// * `name` - Required. The audience export resource name. Format: `properties/{property}/audienceExports/{audience_export}`
1714 pub fn audience_exports_get(&self, name: &str) -> PropertyAudienceExportGetCall<'a, C> {
1715 PropertyAudienceExportGetCall {
1716 hub: self.hub,
1717 _name: name.to_string(),
1718 _delegate: Default::default(),
1719 _additional_params: Default::default(),
1720 _scopes: Default::default(),
1721 }
1722 }
1723
1724 /// Create a builder to help you perform the following task:
1725 ///
1726 /// Lists all audience exports for a property. This method can be used for you to find and reuse existing audience exports rather than creating unnecessary new audience exports. The same audience can have multiple audience exports that represent the export of users that were in an audience on different days. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
1727 ///
1728 /// # Arguments
1729 ///
1730 /// * `parent` - Required. All audience exports for this property will be listed in the response. Format: `properties/{property}`
1731 pub fn audience_exports_list(&self, parent: &str) -> PropertyAudienceExportListCall<'a, C> {
1732 PropertyAudienceExportListCall {
1733 hub: self.hub,
1734 _parent: parent.to_string(),
1735 _page_token: Default::default(),
1736 _page_size: Default::default(),
1737 _delegate: Default::default(),
1738 _additional_params: Default::default(),
1739 _scopes: Default::default(),
1740 }
1741 }
1742
1743 /// Create a builder to help you perform the following task:
1744 ///
1745 /// Retrieves an audience export of users. After creating an audience, the users are not immediately available for exporting. First, a request to `CreateAudienceExport` is necessary to create an audience export of users, and then second, this method is used to retrieve the users in the audience export. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
1746 ///
1747 /// # Arguments
1748 ///
1749 /// * `request` - No description provided.
1750 /// * `name` - Required. The name of the audience export to retrieve users from. Format: `properties/{property}/audienceExports/{audience_export}`
1751 pub fn audience_exports_query(
1752 &self,
1753 request: QueryAudienceExportRequest,
1754 name: &str,
1755 ) -> PropertyAudienceExportQueryCall<'a, C> {
1756 PropertyAudienceExportQueryCall {
1757 hub: self.hub,
1758 _request: request,
1759 _name: name.to_string(),
1760 _delegate: Default::default(),
1761 _additional_params: Default::default(),
1762 _scopes: Default::default(),
1763 }
1764 }
1765
1766 /// Create a builder to help you perform the following task:
1767 ///
1768 /// Returns multiple pivot reports in a batch. All reports must be for the same GA4 Property.
1769 ///
1770 /// # Arguments
1771 ///
1772 /// * `request` - No description provided.
1773 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunPivotReportRequest may either be unspecified or consistent with this property. Example: properties/1234
1774 pub fn batch_run_pivot_reports(
1775 &self,
1776 request: BatchRunPivotReportsRequest,
1777 property: &str,
1778 ) -> PropertyBatchRunPivotReportCall<'a, C> {
1779 PropertyBatchRunPivotReportCall {
1780 hub: self.hub,
1781 _request: request,
1782 _property: property.to_string(),
1783 _delegate: Default::default(),
1784 _additional_params: Default::default(),
1785 _scopes: Default::default(),
1786 }
1787 }
1788
1789 /// Create a builder to help you perform the following task:
1790 ///
1791 /// Returns multiple reports in a batch. All reports must be for the same GA4 Property.
1792 ///
1793 /// # Arguments
1794 ///
1795 /// * `request` - No description provided.
1796 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunReportRequest may either be unspecified or consistent with this property. Example: properties/1234
1797 pub fn batch_run_reports(
1798 &self,
1799 request: BatchRunReportsRequest,
1800 property: &str,
1801 ) -> PropertyBatchRunReportCall<'a, C> {
1802 PropertyBatchRunReportCall {
1803 hub: self.hub,
1804 _request: request,
1805 _property: property.to_string(),
1806 _delegate: Default::default(),
1807 _additional_params: Default::default(),
1808 _scopes: Default::default(),
1809 }
1810 }
1811
1812 /// Create a builder to help you perform the following task:
1813 ///
1814 /// This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible. In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible. The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports.
1815 ///
1816 /// # Arguments
1817 ///
1818 /// * `request` - No description provided.
1819 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). `property` should be the same value as in your `runReport` request. Example: properties/1234
1820 pub fn check_compatibility(
1821 &self,
1822 request: CheckCompatibilityRequest,
1823 property: &str,
1824 ) -> PropertyCheckCompatibilityCall<'a, C> {
1825 PropertyCheckCompatibilityCall {
1826 hub: self.hub,
1827 _request: request,
1828 _property: property.to_string(),
1829 _delegate: Default::default(),
1830 _additional_params: Default::default(),
1831 _scopes: Default::default(),
1832 }
1833 }
1834
1835 /// Create a builder to help you perform the following task:
1836 ///
1837 /// Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
1838 ///
1839 /// # Arguments
1840 ///
1841 /// * `name` - Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics GA4 Property identifier. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics.
1842 pub fn get_metadata(&self, name: &str) -> PropertyGetMetadataCall<'a, C> {
1843 PropertyGetMetadataCall {
1844 hub: self.hub,
1845 _name: name.to_string(),
1846 _delegate: Default::default(),
1847 _additional_params: Default::default(),
1848 _scopes: Default::default(),
1849 }
1850 }
1851
1852 /// Create a builder to help you perform the following task:
1853 ///
1854 /// Returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data.
1855 ///
1856 /// # Arguments
1857 ///
1858 /// * `request` - No description provided.
1859 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
1860 pub fn run_pivot_report(
1861 &self,
1862 request: RunPivotReportRequest,
1863 property: &str,
1864 ) -> PropertyRunPivotReportCall<'a, C> {
1865 PropertyRunPivotReportCall {
1866 hub: self.hub,
1867 _request: request,
1868 _property: property.to_string(),
1869 _delegate: Default::default(),
1870 _additional_params: Default::default(),
1871 _scopes: Default::default(),
1872 }
1873 }
1874
1875 /// Create a builder to help you perform the following task:
1876 ///
1877 /// Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
1878 ///
1879 /// # Arguments
1880 ///
1881 /// * `request` - No description provided.
1882 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234
1883 pub fn run_realtime_report(
1884 &self,
1885 request: RunRealtimeReportRequest,
1886 property: &str,
1887 ) -> PropertyRunRealtimeReportCall<'a, C> {
1888 PropertyRunRealtimeReportCall {
1889 hub: self.hub,
1890 _request: request,
1891 _property: property.to_string(),
1892 _delegate: Default::default(),
1893 _additional_params: Default::default(),
1894 _scopes: Default::default(),
1895 }
1896 }
1897
1898 /// Create a builder to help you perform the following task:
1899 ///
1900 /// Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name. For a guide to constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
1901 ///
1902 /// # Arguments
1903 ///
1904 /// * `request` - No description provided.
1905 /// * `property` - A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
1906 pub fn run_report(
1907 &self,
1908 request: RunReportRequest,
1909 property: &str,
1910 ) -> PropertyRunReportCall<'a, C> {
1911 PropertyRunReportCall {
1912 hub: self.hub,
1913 _request: request,
1914 _property: property.to_string(),
1915 _delegate: Default::default(),
1916 _additional_params: Default::default(),
1917 _scopes: Default::default(),
1918 }
1919 }
1920}
1921
1922// ###################
1923// CallBuilders ###
1924// #################
1925
1926/// Creates an audience export for later retrieval. This method quickly returns the audience export's resource name and initiates a long running asynchronous request to form an audience export. To export the users in an audience export, first create the audience export through this method and then send the audience resource name to the `QueryAudienceExport` method. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. An audience export is a snapshot of the users currently in the audience at the time of audience export creation. Creating audience exports for one audience on different days will return different results as users enter and exit the audience. Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience exports contain the users in each audience. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
1927///
1928/// A builder for the *audienceExports.create* method supported by a *property* resource.
1929/// It is not used directly, but through a [`PropertyMethods`] instance.
1930///
1931/// # Example
1932///
1933/// Instantiate a resource method builder
1934///
1935/// ```test_harness,no_run
1936/// # extern crate hyper;
1937/// # extern crate hyper_rustls;
1938/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
1939/// use analyticsdata1_beta::api::AudienceExport;
1940/// # async fn dox() {
1941/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1942///
1943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1945/// # secret,
1946/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1947/// # ).build().await.unwrap();
1948///
1949/// # let client = hyper_util::client::legacy::Client::builder(
1950/// # hyper_util::rt::TokioExecutor::new()
1951/// # )
1952/// # .build(
1953/// # hyper_rustls::HttpsConnectorBuilder::new()
1954/// # .with_native_roots()
1955/// # .unwrap()
1956/// # .https_or_http()
1957/// # .enable_http1()
1958/// # .build()
1959/// # );
1960/// # let mut hub = AnalyticsData::new(client, auth);
1961/// // As the method needs a request, you would usually fill it with the desired information
1962/// // into the respective structure. Some of the parts shown here might not be applicable !
1963/// // Values shown here are possibly random and not representative !
1964/// let mut req = AudienceExport::default();
1965///
1966/// // You can configure optional parameters by calling the respective setters at will, and
1967/// // execute the final call using `doit()`.
1968/// // Values shown here are possibly random and not representative !
1969/// let result = hub.properties().audience_exports_create(req, "parent")
1970/// .doit().await;
1971/// # }
1972/// ```
1973pub struct PropertyAudienceExportCreateCall<'a, C>
1974where
1975 C: 'a,
1976{
1977 hub: &'a AnalyticsData<C>,
1978 _request: AudienceExport,
1979 _parent: String,
1980 _delegate: Option<&'a mut dyn common::Delegate>,
1981 _additional_params: HashMap<String, String>,
1982 _scopes: BTreeSet<String>,
1983}
1984
1985impl<'a, C> common::CallBuilder for PropertyAudienceExportCreateCall<'a, C> {}
1986
1987impl<'a, C> PropertyAudienceExportCreateCall<'a, C>
1988where
1989 C: common::Connector,
1990{
1991 /// Perform the operation you have build so far.
1992 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1993 use std::borrow::Cow;
1994 use std::io::{Read, Seek};
1995
1996 use common::{url::Params, ToParts};
1997 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1998
1999 let mut dd = common::DefaultDelegate;
2000 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2001 dlg.begin(common::MethodInfo {
2002 id: "analyticsdata.properties.audienceExports.create",
2003 http_method: hyper::Method::POST,
2004 });
2005
2006 for &field in ["alt", "parent"].iter() {
2007 if self._additional_params.contains_key(field) {
2008 dlg.finished(false);
2009 return Err(common::Error::FieldClash(field));
2010 }
2011 }
2012
2013 let mut params = Params::with_capacity(4 + self._additional_params.len());
2014 params.push("parent", self._parent);
2015
2016 params.extend(self._additional_params.iter());
2017
2018 params.push("alt", "json");
2019 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/audienceExports";
2020 if self._scopes.is_empty() {
2021 self._scopes.insert(Scope::Analytic.as_ref().to_string());
2022 }
2023
2024 #[allow(clippy::single_element_loop)]
2025 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2026 url = params.uri_replacement(url, param_name, find_this, true);
2027 }
2028 {
2029 let to_remove = ["parent"];
2030 params.remove_params(&to_remove);
2031 }
2032
2033 let url = params.parse_with_url(&url);
2034
2035 let mut json_mime_type = mime::APPLICATION_JSON;
2036 let mut request_value_reader = {
2037 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2038 common::remove_json_null_values(&mut value);
2039 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2040 serde_json::to_writer(&mut dst, &value).unwrap();
2041 dst
2042 };
2043 let request_size = request_value_reader
2044 .seek(std::io::SeekFrom::End(0))
2045 .unwrap();
2046 request_value_reader
2047 .seek(std::io::SeekFrom::Start(0))
2048 .unwrap();
2049
2050 loop {
2051 let token = match self
2052 .hub
2053 .auth
2054 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2055 .await
2056 {
2057 Ok(token) => token,
2058 Err(e) => match dlg.token(e) {
2059 Ok(token) => token,
2060 Err(e) => {
2061 dlg.finished(false);
2062 return Err(common::Error::MissingToken(e));
2063 }
2064 },
2065 };
2066 request_value_reader
2067 .seek(std::io::SeekFrom::Start(0))
2068 .unwrap();
2069 let mut req_result = {
2070 let client = &self.hub.client;
2071 dlg.pre_request();
2072 let mut req_builder = hyper::Request::builder()
2073 .method(hyper::Method::POST)
2074 .uri(url.as_str())
2075 .header(USER_AGENT, self.hub._user_agent.clone());
2076
2077 if let Some(token) = token.as_ref() {
2078 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2079 }
2080
2081 let request = req_builder
2082 .header(CONTENT_TYPE, json_mime_type.to_string())
2083 .header(CONTENT_LENGTH, request_size as u64)
2084 .body(common::to_body(
2085 request_value_reader.get_ref().clone().into(),
2086 ));
2087
2088 client.request(request.unwrap()).await
2089 };
2090
2091 match req_result {
2092 Err(err) => {
2093 if let common::Retry::After(d) = dlg.http_error(&err) {
2094 sleep(d).await;
2095 continue;
2096 }
2097 dlg.finished(false);
2098 return Err(common::Error::HttpError(err));
2099 }
2100 Ok(res) => {
2101 let (mut parts, body) = res.into_parts();
2102 let mut body = common::Body::new(body);
2103 if !parts.status.is_success() {
2104 let bytes = common::to_bytes(body).await.unwrap_or_default();
2105 let error = serde_json::from_str(&common::to_string(&bytes));
2106 let response = common::to_response(parts, bytes.into());
2107
2108 if let common::Retry::After(d) =
2109 dlg.http_failure(&response, error.as_ref().ok())
2110 {
2111 sleep(d).await;
2112 continue;
2113 }
2114
2115 dlg.finished(false);
2116
2117 return Err(match error {
2118 Ok(value) => common::Error::BadRequest(value),
2119 _ => common::Error::Failure(response),
2120 });
2121 }
2122 let response = {
2123 let bytes = common::to_bytes(body).await.unwrap_or_default();
2124 let encoded = common::to_string(&bytes);
2125 match serde_json::from_str(&encoded) {
2126 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2127 Err(error) => {
2128 dlg.response_json_decode_error(&encoded, &error);
2129 return Err(common::Error::JsonDecodeError(
2130 encoded.to_string(),
2131 error,
2132 ));
2133 }
2134 }
2135 };
2136
2137 dlg.finished(true);
2138 return Ok(response);
2139 }
2140 }
2141 }
2142 }
2143
2144 ///
2145 /// Sets the *request* property to the given value.
2146 ///
2147 /// Even though the property as already been set when instantiating this call,
2148 /// we provide this method for API completeness.
2149 pub fn request(mut self, new_value: AudienceExport) -> PropertyAudienceExportCreateCall<'a, C> {
2150 self._request = new_value;
2151 self
2152 }
2153 /// Required. The parent resource where this audience export will be created. Format: `properties/{property}`
2154 ///
2155 /// Sets the *parent* path property to the given value.
2156 ///
2157 /// Even though the property as already been set when instantiating this call,
2158 /// we provide this method for API completeness.
2159 pub fn parent(mut self, new_value: &str) -> PropertyAudienceExportCreateCall<'a, C> {
2160 self._parent = new_value.to_string();
2161 self
2162 }
2163 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2164 /// while executing the actual API request.
2165 ///
2166 /// ````text
2167 /// It should be used to handle progress information, and to implement a certain level of resilience.
2168 /// ````
2169 ///
2170 /// Sets the *delegate* property to the given value.
2171 pub fn delegate(
2172 mut self,
2173 new_value: &'a mut dyn common::Delegate,
2174 ) -> PropertyAudienceExportCreateCall<'a, C> {
2175 self._delegate = Some(new_value);
2176 self
2177 }
2178
2179 /// Set any additional parameter of the query string used in the request.
2180 /// It should be used to set parameters which are not yet available through their own
2181 /// setters.
2182 ///
2183 /// Please note that this method must not be used to set any of the known parameters
2184 /// which have their own setter method. If done anyway, the request will fail.
2185 ///
2186 /// # Additional Parameters
2187 ///
2188 /// * *$.xgafv* (query-string) - V1 error format.
2189 /// * *access_token* (query-string) - OAuth access token.
2190 /// * *alt* (query-string) - Data format for response.
2191 /// * *callback* (query-string) - JSONP
2192 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2193 /// * *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.
2194 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2195 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2196 /// * *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.
2197 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2198 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2199 pub fn param<T>(mut self, name: T, value: T) -> PropertyAudienceExportCreateCall<'a, C>
2200 where
2201 T: AsRef<str>,
2202 {
2203 self._additional_params
2204 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2205 self
2206 }
2207
2208 /// Identifies the authorization scope for the method you are building.
2209 ///
2210 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2211 /// [`Scope::Analytic`].
2212 ///
2213 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2214 /// tokens for more than one scope.
2215 ///
2216 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2217 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2218 /// sufficient, a read-write scope will do as well.
2219 pub fn add_scope<St>(mut self, scope: St) -> PropertyAudienceExportCreateCall<'a, C>
2220 where
2221 St: AsRef<str>,
2222 {
2223 self._scopes.insert(String::from(scope.as_ref()));
2224 self
2225 }
2226 /// Identifies the authorization scope(s) for the method you are building.
2227 ///
2228 /// See [`Self::add_scope()`] for details.
2229 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyAudienceExportCreateCall<'a, C>
2230 where
2231 I: IntoIterator<Item = St>,
2232 St: AsRef<str>,
2233 {
2234 self._scopes
2235 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2236 self
2237 }
2238
2239 /// Removes all scopes, and no default scope will be used either.
2240 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2241 /// for details).
2242 pub fn clear_scopes(mut self) -> PropertyAudienceExportCreateCall<'a, C> {
2243 self._scopes.clear();
2244 self
2245 }
2246}
2247
2248/// Gets configuration metadata about a specific audience export. This method can be used to understand an audience export after it has been created. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
2249///
2250/// A builder for the *audienceExports.get* method supported by a *property* resource.
2251/// It is not used directly, but through a [`PropertyMethods`] instance.
2252///
2253/// # Example
2254///
2255/// Instantiate a resource method builder
2256///
2257/// ```test_harness,no_run
2258/// # extern crate hyper;
2259/// # extern crate hyper_rustls;
2260/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
2261/// # async fn dox() {
2262/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2263///
2264/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2265/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2266/// # secret,
2267/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2268/// # ).build().await.unwrap();
2269///
2270/// # let client = hyper_util::client::legacy::Client::builder(
2271/// # hyper_util::rt::TokioExecutor::new()
2272/// # )
2273/// # .build(
2274/// # hyper_rustls::HttpsConnectorBuilder::new()
2275/// # .with_native_roots()
2276/// # .unwrap()
2277/// # .https_or_http()
2278/// # .enable_http1()
2279/// # .build()
2280/// # );
2281/// # let mut hub = AnalyticsData::new(client, auth);
2282/// // You can configure optional parameters by calling the respective setters at will, and
2283/// // execute the final call using `doit()`.
2284/// // Values shown here are possibly random and not representative !
2285/// let result = hub.properties().audience_exports_get("name")
2286/// .doit().await;
2287/// # }
2288/// ```
2289pub struct PropertyAudienceExportGetCall<'a, C>
2290where
2291 C: 'a,
2292{
2293 hub: &'a AnalyticsData<C>,
2294 _name: String,
2295 _delegate: Option<&'a mut dyn common::Delegate>,
2296 _additional_params: HashMap<String, String>,
2297 _scopes: BTreeSet<String>,
2298}
2299
2300impl<'a, C> common::CallBuilder for PropertyAudienceExportGetCall<'a, C> {}
2301
2302impl<'a, C> PropertyAudienceExportGetCall<'a, C>
2303where
2304 C: common::Connector,
2305{
2306 /// Perform the operation you have build so far.
2307 pub async fn doit(mut self) -> common::Result<(common::Response, AudienceExport)> {
2308 use std::borrow::Cow;
2309 use std::io::{Read, Seek};
2310
2311 use common::{url::Params, ToParts};
2312 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2313
2314 let mut dd = common::DefaultDelegate;
2315 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2316 dlg.begin(common::MethodInfo {
2317 id: "analyticsdata.properties.audienceExports.get",
2318 http_method: hyper::Method::GET,
2319 });
2320
2321 for &field in ["alt", "name"].iter() {
2322 if self._additional_params.contains_key(field) {
2323 dlg.finished(false);
2324 return Err(common::Error::FieldClash(field));
2325 }
2326 }
2327
2328 let mut params = Params::with_capacity(3 + self._additional_params.len());
2329 params.push("name", self._name);
2330
2331 params.extend(self._additional_params.iter());
2332
2333 params.push("alt", "json");
2334 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
2335 if self._scopes.is_empty() {
2336 self._scopes
2337 .insert(Scope::AnalyticReadonly.as_ref().to_string());
2338 }
2339
2340 #[allow(clippy::single_element_loop)]
2341 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2342 url = params.uri_replacement(url, param_name, find_this, true);
2343 }
2344 {
2345 let to_remove = ["name"];
2346 params.remove_params(&to_remove);
2347 }
2348
2349 let url = params.parse_with_url(&url);
2350
2351 loop {
2352 let token = match self
2353 .hub
2354 .auth
2355 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2356 .await
2357 {
2358 Ok(token) => token,
2359 Err(e) => match dlg.token(e) {
2360 Ok(token) => token,
2361 Err(e) => {
2362 dlg.finished(false);
2363 return Err(common::Error::MissingToken(e));
2364 }
2365 },
2366 };
2367 let mut req_result = {
2368 let client = &self.hub.client;
2369 dlg.pre_request();
2370 let mut req_builder = hyper::Request::builder()
2371 .method(hyper::Method::GET)
2372 .uri(url.as_str())
2373 .header(USER_AGENT, self.hub._user_agent.clone());
2374
2375 if let Some(token) = token.as_ref() {
2376 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2377 }
2378
2379 let request = req_builder
2380 .header(CONTENT_LENGTH, 0_u64)
2381 .body(common::to_body::<String>(None));
2382
2383 client.request(request.unwrap()).await
2384 };
2385
2386 match req_result {
2387 Err(err) => {
2388 if let common::Retry::After(d) = dlg.http_error(&err) {
2389 sleep(d).await;
2390 continue;
2391 }
2392 dlg.finished(false);
2393 return Err(common::Error::HttpError(err));
2394 }
2395 Ok(res) => {
2396 let (mut parts, body) = res.into_parts();
2397 let mut body = common::Body::new(body);
2398 if !parts.status.is_success() {
2399 let bytes = common::to_bytes(body).await.unwrap_or_default();
2400 let error = serde_json::from_str(&common::to_string(&bytes));
2401 let response = common::to_response(parts, bytes.into());
2402
2403 if let common::Retry::After(d) =
2404 dlg.http_failure(&response, error.as_ref().ok())
2405 {
2406 sleep(d).await;
2407 continue;
2408 }
2409
2410 dlg.finished(false);
2411
2412 return Err(match error {
2413 Ok(value) => common::Error::BadRequest(value),
2414 _ => common::Error::Failure(response),
2415 });
2416 }
2417 let response = {
2418 let bytes = common::to_bytes(body).await.unwrap_or_default();
2419 let encoded = common::to_string(&bytes);
2420 match serde_json::from_str(&encoded) {
2421 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2422 Err(error) => {
2423 dlg.response_json_decode_error(&encoded, &error);
2424 return Err(common::Error::JsonDecodeError(
2425 encoded.to_string(),
2426 error,
2427 ));
2428 }
2429 }
2430 };
2431
2432 dlg.finished(true);
2433 return Ok(response);
2434 }
2435 }
2436 }
2437 }
2438
2439 /// Required. The audience export resource name. Format: `properties/{property}/audienceExports/{audience_export}`
2440 ///
2441 /// Sets the *name* path property to the given value.
2442 ///
2443 /// Even though the property as already been set when instantiating this call,
2444 /// we provide this method for API completeness.
2445 pub fn name(mut self, new_value: &str) -> PropertyAudienceExportGetCall<'a, C> {
2446 self._name = new_value.to_string();
2447 self
2448 }
2449 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2450 /// while executing the actual API request.
2451 ///
2452 /// ````text
2453 /// It should be used to handle progress information, and to implement a certain level of resilience.
2454 /// ````
2455 ///
2456 /// Sets the *delegate* property to the given value.
2457 pub fn delegate(
2458 mut self,
2459 new_value: &'a mut dyn common::Delegate,
2460 ) -> PropertyAudienceExportGetCall<'a, C> {
2461 self._delegate = Some(new_value);
2462 self
2463 }
2464
2465 /// Set any additional parameter of the query string used in the request.
2466 /// It should be used to set parameters which are not yet available through their own
2467 /// setters.
2468 ///
2469 /// Please note that this method must not be used to set any of the known parameters
2470 /// which have their own setter method. If done anyway, the request will fail.
2471 ///
2472 /// # Additional Parameters
2473 ///
2474 /// * *$.xgafv* (query-string) - V1 error format.
2475 /// * *access_token* (query-string) - OAuth access token.
2476 /// * *alt* (query-string) - Data format for response.
2477 /// * *callback* (query-string) - JSONP
2478 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2479 /// * *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.
2480 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2481 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2482 /// * *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.
2483 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2484 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2485 pub fn param<T>(mut self, name: T, value: T) -> PropertyAudienceExportGetCall<'a, C>
2486 where
2487 T: AsRef<str>,
2488 {
2489 self._additional_params
2490 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2491 self
2492 }
2493
2494 /// Identifies the authorization scope for the method you are building.
2495 ///
2496 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2497 /// [`Scope::AnalyticReadonly`].
2498 ///
2499 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2500 /// tokens for more than one scope.
2501 ///
2502 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2503 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2504 /// sufficient, a read-write scope will do as well.
2505 pub fn add_scope<St>(mut self, scope: St) -> PropertyAudienceExportGetCall<'a, C>
2506 where
2507 St: AsRef<str>,
2508 {
2509 self._scopes.insert(String::from(scope.as_ref()));
2510 self
2511 }
2512 /// Identifies the authorization scope(s) for the method you are building.
2513 ///
2514 /// See [`Self::add_scope()`] for details.
2515 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyAudienceExportGetCall<'a, C>
2516 where
2517 I: IntoIterator<Item = St>,
2518 St: AsRef<str>,
2519 {
2520 self._scopes
2521 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2522 self
2523 }
2524
2525 /// Removes all scopes, and no default scope will be used either.
2526 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2527 /// for details).
2528 pub fn clear_scopes(mut self) -> PropertyAudienceExportGetCall<'a, C> {
2529 self._scopes.clear();
2530 self
2531 }
2532}
2533
2534/// Lists all audience exports for a property. This method can be used for you to find and reuse existing audience exports rather than creating unnecessary new audience exports. The same audience can have multiple audience exports that represent the export of users that were in an audience on different days. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
2535///
2536/// A builder for the *audienceExports.list* method supported by a *property* resource.
2537/// It is not used directly, but through a [`PropertyMethods`] instance.
2538///
2539/// # Example
2540///
2541/// Instantiate a resource method builder
2542///
2543/// ```test_harness,no_run
2544/// # extern crate hyper;
2545/// # extern crate hyper_rustls;
2546/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
2547/// # async fn dox() {
2548/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2549///
2550/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2551/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2552/// # secret,
2553/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2554/// # ).build().await.unwrap();
2555///
2556/// # let client = hyper_util::client::legacy::Client::builder(
2557/// # hyper_util::rt::TokioExecutor::new()
2558/// # )
2559/// # .build(
2560/// # hyper_rustls::HttpsConnectorBuilder::new()
2561/// # .with_native_roots()
2562/// # .unwrap()
2563/// # .https_or_http()
2564/// # .enable_http1()
2565/// # .build()
2566/// # );
2567/// # let mut hub = AnalyticsData::new(client, auth);
2568/// // You can configure optional parameters by calling the respective setters at will, and
2569/// // execute the final call using `doit()`.
2570/// // Values shown here are possibly random and not representative !
2571/// let result = hub.properties().audience_exports_list("parent")
2572/// .page_token("sanctus")
2573/// .page_size(-80)
2574/// .doit().await;
2575/// # }
2576/// ```
2577pub struct PropertyAudienceExportListCall<'a, C>
2578where
2579 C: 'a,
2580{
2581 hub: &'a AnalyticsData<C>,
2582 _parent: String,
2583 _page_token: Option<String>,
2584 _page_size: Option<i32>,
2585 _delegate: Option<&'a mut dyn common::Delegate>,
2586 _additional_params: HashMap<String, String>,
2587 _scopes: BTreeSet<String>,
2588}
2589
2590impl<'a, C> common::CallBuilder for PropertyAudienceExportListCall<'a, C> {}
2591
2592impl<'a, C> PropertyAudienceExportListCall<'a, C>
2593where
2594 C: common::Connector,
2595{
2596 /// Perform the operation you have build so far.
2597 pub async fn doit(mut self) -> common::Result<(common::Response, ListAudienceExportsResponse)> {
2598 use std::borrow::Cow;
2599 use std::io::{Read, Seek};
2600
2601 use common::{url::Params, ToParts};
2602 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2603
2604 let mut dd = common::DefaultDelegate;
2605 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2606 dlg.begin(common::MethodInfo {
2607 id: "analyticsdata.properties.audienceExports.list",
2608 http_method: hyper::Method::GET,
2609 });
2610
2611 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2612 if self._additional_params.contains_key(field) {
2613 dlg.finished(false);
2614 return Err(common::Error::FieldClash(field));
2615 }
2616 }
2617
2618 let mut params = Params::with_capacity(5 + self._additional_params.len());
2619 params.push("parent", self._parent);
2620 if let Some(value) = self._page_token.as_ref() {
2621 params.push("pageToken", value);
2622 }
2623 if let Some(value) = self._page_size.as_ref() {
2624 params.push("pageSize", value.to_string());
2625 }
2626
2627 params.extend(self._additional_params.iter());
2628
2629 params.push("alt", "json");
2630 let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/audienceExports";
2631 if self._scopes.is_empty() {
2632 self._scopes
2633 .insert(Scope::AnalyticReadonly.as_ref().to_string());
2634 }
2635
2636 #[allow(clippy::single_element_loop)]
2637 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2638 url = params.uri_replacement(url, param_name, find_this, true);
2639 }
2640 {
2641 let to_remove = ["parent"];
2642 params.remove_params(&to_remove);
2643 }
2644
2645 let url = params.parse_with_url(&url);
2646
2647 loop {
2648 let token = match self
2649 .hub
2650 .auth
2651 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2652 .await
2653 {
2654 Ok(token) => token,
2655 Err(e) => match dlg.token(e) {
2656 Ok(token) => token,
2657 Err(e) => {
2658 dlg.finished(false);
2659 return Err(common::Error::MissingToken(e));
2660 }
2661 },
2662 };
2663 let mut req_result = {
2664 let client = &self.hub.client;
2665 dlg.pre_request();
2666 let mut req_builder = hyper::Request::builder()
2667 .method(hyper::Method::GET)
2668 .uri(url.as_str())
2669 .header(USER_AGENT, self.hub._user_agent.clone());
2670
2671 if let Some(token) = token.as_ref() {
2672 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2673 }
2674
2675 let request = req_builder
2676 .header(CONTENT_LENGTH, 0_u64)
2677 .body(common::to_body::<String>(None));
2678
2679 client.request(request.unwrap()).await
2680 };
2681
2682 match req_result {
2683 Err(err) => {
2684 if let common::Retry::After(d) = dlg.http_error(&err) {
2685 sleep(d).await;
2686 continue;
2687 }
2688 dlg.finished(false);
2689 return Err(common::Error::HttpError(err));
2690 }
2691 Ok(res) => {
2692 let (mut parts, body) = res.into_parts();
2693 let mut body = common::Body::new(body);
2694 if !parts.status.is_success() {
2695 let bytes = common::to_bytes(body).await.unwrap_or_default();
2696 let error = serde_json::from_str(&common::to_string(&bytes));
2697 let response = common::to_response(parts, bytes.into());
2698
2699 if let common::Retry::After(d) =
2700 dlg.http_failure(&response, error.as_ref().ok())
2701 {
2702 sleep(d).await;
2703 continue;
2704 }
2705
2706 dlg.finished(false);
2707
2708 return Err(match error {
2709 Ok(value) => common::Error::BadRequest(value),
2710 _ => common::Error::Failure(response),
2711 });
2712 }
2713 let response = {
2714 let bytes = common::to_bytes(body).await.unwrap_or_default();
2715 let encoded = common::to_string(&bytes);
2716 match serde_json::from_str(&encoded) {
2717 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2718 Err(error) => {
2719 dlg.response_json_decode_error(&encoded, &error);
2720 return Err(common::Error::JsonDecodeError(
2721 encoded.to_string(),
2722 error,
2723 ));
2724 }
2725 }
2726 };
2727
2728 dlg.finished(true);
2729 return Ok(response);
2730 }
2731 }
2732 }
2733 }
2734
2735 /// Required. All audience exports for this property will be listed in the response. Format: `properties/{property}`
2736 ///
2737 /// Sets the *parent* path property to the given value.
2738 ///
2739 /// Even though the property as already been set when instantiating this call,
2740 /// we provide this method for API completeness.
2741 pub fn parent(mut self, new_value: &str) -> PropertyAudienceExportListCall<'a, C> {
2742 self._parent = new_value.to_string();
2743 self
2744 }
2745 /// Optional. A page token, received from a previous `ListAudienceExports` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListAudienceExports` must match the call that provided the page token.
2746 ///
2747 /// Sets the *page token* query property to the given value.
2748 pub fn page_token(mut self, new_value: &str) -> PropertyAudienceExportListCall<'a, C> {
2749 self._page_token = Some(new_value.to_string());
2750 self
2751 }
2752 /// Optional. The maximum number of audience exports to return. The service may return fewer than this value. If unspecified, at most 200 audience exports will be returned. The maximum value is 1000 (higher values will be coerced to the maximum).
2753 ///
2754 /// Sets the *page size* query property to the given value.
2755 pub fn page_size(mut self, new_value: i32) -> PropertyAudienceExportListCall<'a, C> {
2756 self._page_size = Some(new_value);
2757 self
2758 }
2759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2760 /// while executing the actual API request.
2761 ///
2762 /// ````text
2763 /// It should be used to handle progress information, and to implement a certain level of resilience.
2764 /// ````
2765 ///
2766 /// Sets the *delegate* property to the given value.
2767 pub fn delegate(
2768 mut self,
2769 new_value: &'a mut dyn common::Delegate,
2770 ) -> PropertyAudienceExportListCall<'a, C> {
2771 self._delegate = Some(new_value);
2772 self
2773 }
2774
2775 /// Set any additional parameter of the query string used in the request.
2776 /// It should be used to set parameters which are not yet available through their own
2777 /// setters.
2778 ///
2779 /// Please note that this method must not be used to set any of the known parameters
2780 /// which have their own setter method. If done anyway, the request will fail.
2781 ///
2782 /// # Additional Parameters
2783 ///
2784 /// * *$.xgafv* (query-string) - V1 error format.
2785 /// * *access_token* (query-string) - OAuth access token.
2786 /// * *alt* (query-string) - Data format for response.
2787 /// * *callback* (query-string) - JSONP
2788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2789 /// * *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.
2790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2792 /// * *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.
2793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2795 pub fn param<T>(mut self, name: T, value: T) -> PropertyAudienceExportListCall<'a, C>
2796 where
2797 T: AsRef<str>,
2798 {
2799 self._additional_params
2800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2801 self
2802 }
2803
2804 /// Identifies the authorization scope for the method you are building.
2805 ///
2806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2807 /// [`Scope::AnalyticReadonly`].
2808 ///
2809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2810 /// tokens for more than one scope.
2811 ///
2812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2814 /// sufficient, a read-write scope will do as well.
2815 pub fn add_scope<St>(mut self, scope: St) -> PropertyAudienceExportListCall<'a, C>
2816 where
2817 St: AsRef<str>,
2818 {
2819 self._scopes.insert(String::from(scope.as_ref()));
2820 self
2821 }
2822 /// Identifies the authorization scope(s) for the method you are building.
2823 ///
2824 /// See [`Self::add_scope()`] for details.
2825 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyAudienceExportListCall<'a, C>
2826 where
2827 I: IntoIterator<Item = St>,
2828 St: AsRef<str>,
2829 {
2830 self._scopes
2831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2832 self
2833 }
2834
2835 /// Removes all scopes, and no default scope will be used either.
2836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2837 /// for details).
2838 pub fn clear_scopes(mut self) -> PropertyAudienceExportListCall<'a, C> {
2839 self._scopes.clear();
2840 self
2841 }
2842}
2843
2844/// Retrieves an audience export of users. After creating an audience, the users are not immediately available for exporting. First, a request to `CreateAudienceExport` is necessary to create an audience export of users, and then second, this method is used to retrieve the users in the audience export. See [Creating an Audience Export](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics) for an introduction to Audience Exports with examples. Audiences in Google Analytics 4 allow you to segment your users in the ways that are important to your business. To learn more, see https://support.google.com/analytics/answer/9267572. Audience Export APIs have some methods at alpha and other methods at beta stability. The intention is to advance methods to beta stability after some feedback and adoption. To give your feedback on this API, complete the [Google Analytics Audience Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
2845///
2846/// A builder for the *audienceExports.query* method supported by a *property* resource.
2847/// It is not used directly, but through a [`PropertyMethods`] instance.
2848///
2849/// # Example
2850///
2851/// Instantiate a resource method builder
2852///
2853/// ```test_harness,no_run
2854/// # extern crate hyper;
2855/// # extern crate hyper_rustls;
2856/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
2857/// use analyticsdata1_beta::api::QueryAudienceExportRequest;
2858/// # async fn dox() {
2859/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2860///
2861/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2862/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2863/// # secret,
2864/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2865/// # ).build().await.unwrap();
2866///
2867/// # let client = hyper_util::client::legacy::Client::builder(
2868/// # hyper_util::rt::TokioExecutor::new()
2869/// # )
2870/// # .build(
2871/// # hyper_rustls::HttpsConnectorBuilder::new()
2872/// # .with_native_roots()
2873/// # .unwrap()
2874/// # .https_or_http()
2875/// # .enable_http1()
2876/// # .build()
2877/// # );
2878/// # let mut hub = AnalyticsData::new(client, auth);
2879/// // As the method needs a request, you would usually fill it with the desired information
2880/// // into the respective structure. Some of the parts shown here might not be applicable !
2881/// // Values shown here are possibly random and not representative !
2882/// let mut req = QueryAudienceExportRequest::default();
2883///
2884/// // You can configure optional parameters by calling the respective setters at will, and
2885/// // execute the final call using `doit()`.
2886/// // Values shown here are possibly random and not representative !
2887/// let result = hub.properties().audience_exports_query(req, "name")
2888/// .doit().await;
2889/// # }
2890/// ```
2891pub struct PropertyAudienceExportQueryCall<'a, C>
2892where
2893 C: 'a,
2894{
2895 hub: &'a AnalyticsData<C>,
2896 _request: QueryAudienceExportRequest,
2897 _name: String,
2898 _delegate: Option<&'a mut dyn common::Delegate>,
2899 _additional_params: HashMap<String, String>,
2900 _scopes: BTreeSet<String>,
2901}
2902
2903impl<'a, C> common::CallBuilder for PropertyAudienceExportQueryCall<'a, C> {}
2904
2905impl<'a, C> PropertyAudienceExportQueryCall<'a, C>
2906where
2907 C: common::Connector,
2908{
2909 /// Perform the operation you have build so far.
2910 pub async fn doit(mut self) -> common::Result<(common::Response, QueryAudienceExportResponse)> {
2911 use std::borrow::Cow;
2912 use std::io::{Read, Seek};
2913
2914 use common::{url::Params, ToParts};
2915 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2916
2917 let mut dd = common::DefaultDelegate;
2918 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2919 dlg.begin(common::MethodInfo {
2920 id: "analyticsdata.properties.audienceExports.query",
2921 http_method: hyper::Method::POST,
2922 });
2923
2924 for &field in ["alt", "name"].iter() {
2925 if self._additional_params.contains_key(field) {
2926 dlg.finished(false);
2927 return Err(common::Error::FieldClash(field));
2928 }
2929 }
2930
2931 let mut params = Params::with_capacity(4 + self._additional_params.len());
2932 params.push("name", self._name);
2933
2934 params.extend(self._additional_params.iter());
2935
2936 params.push("alt", "json");
2937 let mut url = self.hub._base_url.clone() + "v1beta/{+name}:query";
2938 if self._scopes.is_empty() {
2939 self._scopes.insert(Scope::Analytic.as_ref().to_string());
2940 }
2941
2942 #[allow(clippy::single_element_loop)]
2943 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2944 url = params.uri_replacement(url, param_name, find_this, true);
2945 }
2946 {
2947 let to_remove = ["name"];
2948 params.remove_params(&to_remove);
2949 }
2950
2951 let url = params.parse_with_url(&url);
2952
2953 let mut json_mime_type = mime::APPLICATION_JSON;
2954 let mut request_value_reader = {
2955 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2956 common::remove_json_null_values(&mut value);
2957 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2958 serde_json::to_writer(&mut dst, &value).unwrap();
2959 dst
2960 };
2961 let request_size = request_value_reader
2962 .seek(std::io::SeekFrom::End(0))
2963 .unwrap();
2964 request_value_reader
2965 .seek(std::io::SeekFrom::Start(0))
2966 .unwrap();
2967
2968 loop {
2969 let token = match self
2970 .hub
2971 .auth
2972 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2973 .await
2974 {
2975 Ok(token) => token,
2976 Err(e) => match dlg.token(e) {
2977 Ok(token) => token,
2978 Err(e) => {
2979 dlg.finished(false);
2980 return Err(common::Error::MissingToken(e));
2981 }
2982 },
2983 };
2984 request_value_reader
2985 .seek(std::io::SeekFrom::Start(0))
2986 .unwrap();
2987 let mut req_result = {
2988 let client = &self.hub.client;
2989 dlg.pre_request();
2990 let mut req_builder = hyper::Request::builder()
2991 .method(hyper::Method::POST)
2992 .uri(url.as_str())
2993 .header(USER_AGENT, self.hub._user_agent.clone());
2994
2995 if let Some(token) = token.as_ref() {
2996 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2997 }
2998
2999 let request = req_builder
3000 .header(CONTENT_TYPE, json_mime_type.to_string())
3001 .header(CONTENT_LENGTH, request_size as u64)
3002 .body(common::to_body(
3003 request_value_reader.get_ref().clone().into(),
3004 ));
3005
3006 client.request(request.unwrap()).await
3007 };
3008
3009 match req_result {
3010 Err(err) => {
3011 if let common::Retry::After(d) = dlg.http_error(&err) {
3012 sleep(d).await;
3013 continue;
3014 }
3015 dlg.finished(false);
3016 return Err(common::Error::HttpError(err));
3017 }
3018 Ok(res) => {
3019 let (mut parts, body) = res.into_parts();
3020 let mut body = common::Body::new(body);
3021 if !parts.status.is_success() {
3022 let bytes = common::to_bytes(body).await.unwrap_or_default();
3023 let error = serde_json::from_str(&common::to_string(&bytes));
3024 let response = common::to_response(parts, bytes.into());
3025
3026 if let common::Retry::After(d) =
3027 dlg.http_failure(&response, error.as_ref().ok())
3028 {
3029 sleep(d).await;
3030 continue;
3031 }
3032
3033 dlg.finished(false);
3034
3035 return Err(match error {
3036 Ok(value) => common::Error::BadRequest(value),
3037 _ => common::Error::Failure(response),
3038 });
3039 }
3040 let response = {
3041 let bytes = common::to_bytes(body).await.unwrap_or_default();
3042 let encoded = common::to_string(&bytes);
3043 match serde_json::from_str(&encoded) {
3044 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3045 Err(error) => {
3046 dlg.response_json_decode_error(&encoded, &error);
3047 return Err(common::Error::JsonDecodeError(
3048 encoded.to_string(),
3049 error,
3050 ));
3051 }
3052 }
3053 };
3054
3055 dlg.finished(true);
3056 return Ok(response);
3057 }
3058 }
3059 }
3060 }
3061
3062 ///
3063 /// Sets the *request* property to the given value.
3064 ///
3065 /// Even though the property as already been set when instantiating this call,
3066 /// we provide this method for API completeness.
3067 pub fn request(
3068 mut self,
3069 new_value: QueryAudienceExportRequest,
3070 ) -> PropertyAudienceExportQueryCall<'a, C> {
3071 self._request = new_value;
3072 self
3073 }
3074 /// Required. The name of the audience export to retrieve users from. Format: `properties/{property}/audienceExports/{audience_export}`
3075 ///
3076 /// Sets the *name* path property to the given value.
3077 ///
3078 /// Even though the property as already been set when instantiating this call,
3079 /// we provide this method for API completeness.
3080 pub fn name(mut self, new_value: &str) -> PropertyAudienceExportQueryCall<'a, C> {
3081 self._name = new_value.to_string();
3082 self
3083 }
3084 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3085 /// while executing the actual API request.
3086 ///
3087 /// ````text
3088 /// It should be used to handle progress information, and to implement a certain level of resilience.
3089 /// ````
3090 ///
3091 /// Sets the *delegate* property to the given value.
3092 pub fn delegate(
3093 mut self,
3094 new_value: &'a mut dyn common::Delegate,
3095 ) -> PropertyAudienceExportQueryCall<'a, C> {
3096 self._delegate = Some(new_value);
3097 self
3098 }
3099
3100 /// Set any additional parameter of the query string used in the request.
3101 /// It should be used to set parameters which are not yet available through their own
3102 /// setters.
3103 ///
3104 /// Please note that this method must not be used to set any of the known parameters
3105 /// which have their own setter method. If done anyway, the request will fail.
3106 ///
3107 /// # Additional Parameters
3108 ///
3109 /// * *$.xgafv* (query-string) - V1 error format.
3110 /// * *access_token* (query-string) - OAuth access token.
3111 /// * *alt* (query-string) - Data format for response.
3112 /// * *callback* (query-string) - JSONP
3113 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3114 /// * *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.
3115 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3116 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3117 /// * *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.
3118 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3119 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3120 pub fn param<T>(mut self, name: T, value: T) -> PropertyAudienceExportQueryCall<'a, C>
3121 where
3122 T: AsRef<str>,
3123 {
3124 self._additional_params
3125 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3126 self
3127 }
3128
3129 /// Identifies the authorization scope for the method you are building.
3130 ///
3131 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3132 /// [`Scope::Analytic`].
3133 ///
3134 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3135 /// tokens for more than one scope.
3136 ///
3137 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3138 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3139 /// sufficient, a read-write scope will do as well.
3140 pub fn add_scope<St>(mut self, scope: St) -> PropertyAudienceExportQueryCall<'a, C>
3141 where
3142 St: AsRef<str>,
3143 {
3144 self._scopes.insert(String::from(scope.as_ref()));
3145 self
3146 }
3147 /// Identifies the authorization scope(s) for the method you are building.
3148 ///
3149 /// See [`Self::add_scope()`] for details.
3150 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyAudienceExportQueryCall<'a, C>
3151 where
3152 I: IntoIterator<Item = St>,
3153 St: AsRef<str>,
3154 {
3155 self._scopes
3156 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3157 self
3158 }
3159
3160 /// Removes all scopes, and no default scope will be used either.
3161 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3162 /// for details).
3163 pub fn clear_scopes(mut self) -> PropertyAudienceExportQueryCall<'a, C> {
3164 self._scopes.clear();
3165 self
3166 }
3167}
3168
3169/// Returns multiple pivot reports in a batch. All reports must be for the same GA4 Property.
3170///
3171/// A builder for the *batchRunPivotReports* method supported by a *property* resource.
3172/// It is not used directly, but through a [`PropertyMethods`] instance.
3173///
3174/// # Example
3175///
3176/// Instantiate a resource method builder
3177///
3178/// ```test_harness,no_run
3179/// # extern crate hyper;
3180/// # extern crate hyper_rustls;
3181/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
3182/// use analyticsdata1_beta::api::BatchRunPivotReportsRequest;
3183/// # async fn dox() {
3184/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3185///
3186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3187/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3188/// # secret,
3189/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3190/// # ).build().await.unwrap();
3191///
3192/// # let client = hyper_util::client::legacy::Client::builder(
3193/// # hyper_util::rt::TokioExecutor::new()
3194/// # )
3195/// # .build(
3196/// # hyper_rustls::HttpsConnectorBuilder::new()
3197/// # .with_native_roots()
3198/// # .unwrap()
3199/// # .https_or_http()
3200/// # .enable_http1()
3201/// # .build()
3202/// # );
3203/// # let mut hub = AnalyticsData::new(client, auth);
3204/// // As the method needs a request, you would usually fill it with the desired information
3205/// // into the respective structure. Some of the parts shown here might not be applicable !
3206/// // Values shown here are possibly random and not representative !
3207/// let mut req = BatchRunPivotReportsRequest::default();
3208///
3209/// // You can configure optional parameters by calling the respective setters at will, and
3210/// // execute the final call using `doit()`.
3211/// // Values shown here are possibly random and not representative !
3212/// let result = hub.properties().batch_run_pivot_reports(req, "property")
3213/// .doit().await;
3214/// # }
3215/// ```
3216pub struct PropertyBatchRunPivotReportCall<'a, C>
3217where
3218 C: 'a,
3219{
3220 hub: &'a AnalyticsData<C>,
3221 _request: BatchRunPivotReportsRequest,
3222 _property: String,
3223 _delegate: Option<&'a mut dyn common::Delegate>,
3224 _additional_params: HashMap<String, String>,
3225 _scopes: BTreeSet<String>,
3226}
3227
3228impl<'a, C> common::CallBuilder for PropertyBatchRunPivotReportCall<'a, C> {}
3229
3230impl<'a, C> PropertyBatchRunPivotReportCall<'a, C>
3231where
3232 C: common::Connector,
3233{
3234 /// Perform the operation you have build so far.
3235 pub async fn doit(
3236 mut self,
3237 ) -> common::Result<(common::Response, BatchRunPivotReportsResponse)> {
3238 use std::borrow::Cow;
3239 use std::io::{Read, Seek};
3240
3241 use common::{url::Params, ToParts};
3242 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3243
3244 let mut dd = common::DefaultDelegate;
3245 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3246 dlg.begin(common::MethodInfo {
3247 id: "analyticsdata.properties.batchRunPivotReports",
3248 http_method: hyper::Method::POST,
3249 });
3250
3251 for &field in ["alt", "property"].iter() {
3252 if self._additional_params.contains_key(field) {
3253 dlg.finished(false);
3254 return Err(common::Error::FieldClash(field));
3255 }
3256 }
3257
3258 let mut params = Params::with_capacity(4 + self._additional_params.len());
3259 params.push("property", self._property);
3260
3261 params.extend(self._additional_params.iter());
3262
3263 params.push("alt", "json");
3264 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:batchRunPivotReports";
3265 if self._scopes.is_empty() {
3266 self._scopes.insert(Scope::Analytic.as_ref().to_string());
3267 }
3268
3269 #[allow(clippy::single_element_loop)]
3270 for &(find_this, param_name) in [("{+property}", "property")].iter() {
3271 url = params.uri_replacement(url, param_name, find_this, true);
3272 }
3273 {
3274 let to_remove = ["property"];
3275 params.remove_params(&to_remove);
3276 }
3277
3278 let url = params.parse_with_url(&url);
3279
3280 let mut json_mime_type = mime::APPLICATION_JSON;
3281 let mut request_value_reader = {
3282 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3283 common::remove_json_null_values(&mut value);
3284 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3285 serde_json::to_writer(&mut dst, &value).unwrap();
3286 dst
3287 };
3288 let request_size = request_value_reader
3289 .seek(std::io::SeekFrom::End(0))
3290 .unwrap();
3291 request_value_reader
3292 .seek(std::io::SeekFrom::Start(0))
3293 .unwrap();
3294
3295 loop {
3296 let token = match self
3297 .hub
3298 .auth
3299 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3300 .await
3301 {
3302 Ok(token) => token,
3303 Err(e) => match dlg.token(e) {
3304 Ok(token) => token,
3305 Err(e) => {
3306 dlg.finished(false);
3307 return Err(common::Error::MissingToken(e));
3308 }
3309 },
3310 };
3311 request_value_reader
3312 .seek(std::io::SeekFrom::Start(0))
3313 .unwrap();
3314 let mut req_result = {
3315 let client = &self.hub.client;
3316 dlg.pre_request();
3317 let mut req_builder = hyper::Request::builder()
3318 .method(hyper::Method::POST)
3319 .uri(url.as_str())
3320 .header(USER_AGENT, self.hub._user_agent.clone());
3321
3322 if let Some(token) = token.as_ref() {
3323 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3324 }
3325
3326 let request = req_builder
3327 .header(CONTENT_TYPE, json_mime_type.to_string())
3328 .header(CONTENT_LENGTH, request_size as u64)
3329 .body(common::to_body(
3330 request_value_reader.get_ref().clone().into(),
3331 ));
3332
3333 client.request(request.unwrap()).await
3334 };
3335
3336 match req_result {
3337 Err(err) => {
3338 if let common::Retry::After(d) = dlg.http_error(&err) {
3339 sleep(d).await;
3340 continue;
3341 }
3342 dlg.finished(false);
3343 return Err(common::Error::HttpError(err));
3344 }
3345 Ok(res) => {
3346 let (mut parts, body) = res.into_parts();
3347 let mut body = common::Body::new(body);
3348 if !parts.status.is_success() {
3349 let bytes = common::to_bytes(body).await.unwrap_or_default();
3350 let error = serde_json::from_str(&common::to_string(&bytes));
3351 let response = common::to_response(parts, bytes.into());
3352
3353 if let common::Retry::After(d) =
3354 dlg.http_failure(&response, error.as_ref().ok())
3355 {
3356 sleep(d).await;
3357 continue;
3358 }
3359
3360 dlg.finished(false);
3361
3362 return Err(match error {
3363 Ok(value) => common::Error::BadRequest(value),
3364 _ => common::Error::Failure(response),
3365 });
3366 }
3367 let response = {
3368 let bytes = common::to_bytes(body).await.unwrap_or_default();
3369 let encoded = common::to_string(&bytes);
3370 match serde_json::from_str(&encoded) {
3371 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3372 Err(error) => {
3373 dlg.response_json_decode_error(&encoded, &error);
3374 return Err(common::Error::JsonDecodeError(
3375 encoded.to_string(),
3376 error,
3377 ));
3378 }
3379 }
3380 };
3381
3382 dlg.finished(true);
3383 return Ok(response);
3384 }
3385 }
3386 }
3387 }
3388
3389 ///
3390 /// Sets the *request* property to the given value.
3391 ///
3392 /// Even though the property as already been set when instantiating this call,
3393 /// we provide this method for API completeness.
3394 pub fn request(
3395 mut self,
3396 new_value: BatchRunPivotReportsRequest,
3397 ) -> PropertyBatchRunPivotReportCall<'a, C> {
3398 self._request = new_value;
3399 self
3400 }
3401 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunPivotReportRequest may either be unspecified or consistent with this property. Example: properties/1234
3402 ///
3403 /// Sets the *property* path property to the given value.
3404 ///
3405 /// Even though the property as already been set when instantiating this call,
3406 /// we provide this method for API completeness.
3407 pub fn property(mut self, new_value: &str) -> PropertyBatchRunPivotReportCall<'a, C> {
3408 self._property = new_value.to_string();
3409 self
3410 }
3411 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3412 /// while executing the actual API request.
3413 ///
3414 /// ````text
3415 /// It should be used to handle progress information, and to implement a certain level of resilience.
3416 /// ````
3417 ///
3418 /// Sets the *delegate* property to the given value.
3419 pub fn delegate(
3420 mut self,
3421 new_value: &'a mut dyn common::Delegate,
3422 ) -> PropertyBatchRunPivotReportCall<'a, C> {
3423 self._delegate = Some(new_value);
3424 self
3425 }
3426
3427 /// Set any additional parameter of the query string used in the request.
3428 /// It should be used to set parameters which are not yet available through their own
3429 /// setters.
3430 ///
3431 /// Please note that this method must not be used to set any of the known parameters
3432 /// which have their own setter method. If done anyway, the request will fail.
3433 ///
3434 /// # Additional Parameters
3435 ///
3436 /// * *$.xgafv* (query-string) - V1 error format.
3437 /// * *access_token* (query-string) - OAuth access token.
3438 /// * *alt* (query-string) - Data format for response.
3439 /// * *callback* (query-string) - JSONP
3440 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3441 /// * *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.
3442 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3443 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3444 /// * *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.
3445 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3446 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3447 pub fn param<T>(mut self, name: T, value: T) -> PropertyBatchRunPivotReportCall<'a, C>
3448 where
3449 T: AsRef<str>,
3450 {
3451 self._additional_params
3452 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3453 self
3454 }
3455
3456 /// Identifies the authorization scope for the method you are building.
3457 ///
3458 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3459 /// [`Scope::Analytic`].
3460 ///
3461 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3462 /// tokens for more than one scope.
3463 ///
3464 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3465 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3466 /// sufficient, a read-write scope will do as well.
3467 pub fn add_scope<St>(mut self, scope: St) -> PropertyBatchRunPivotReportCall<'a, C>
3468 where
3469 St: AsRef<str>,
3470 {
3471 self._scopes.insert(String::from(scope.as_ref()));
3472 self
3473 }
3474 /// Identifies the authorization scope(s) for the method you are building.
3475 ///
3476 /// See [`Self::add_scope()`] for details.
3477 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyBatchRunPivotReportCall<'a, C>
3478 where
3479 I: IntoIterator<Item = St>,
3480 St: AsRef<str>,
3481 {
3482 self._scopes
3483 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3484 self
3485 }
3486
3487 /// Removes all scopes, and no default scope will be used either.
3488 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3489 /// for details).
3490 pub fn clear_scopes(mut self) -> PropertyBatchRunPivotReportCall<'a, C> {
3491 self._scopes.clear();
3492 self
3493 }
3494}
3495
3496/// Returns multiple reports in a batch. All reports must be for the same GA4 Property.
3497///
3498/// A builder for the *batchRunReports* method supported by a *property* resource.
3499/// It is not used directly, but through a [`PropertyMethods`] instance.
3500///
3501/// # Example
3502///
3503/// Instantiate a resource method builder
3504///
3505/// ```test_harness,no_run
3506/// # extern crate hyper;
3507/// # extern crate hyper_rustls;
3508/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
3509/// use analyticsdata1_beta::api::BatchRunReportsRequest;
3510/// # async fn dox() {
3511/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3512///
3513/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3514/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3515/// # secret,
3516/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3517/// # ).build().await.unwrap();
3518///
3519/// # let client = hyper_util::client::legacy::Client::builder(
3520/// # hyper_util::rt::TokioExecutor::new()
3521/// # )
3522/// # .build(
3523/// # hyper_rustls::HttpsConnectorBuilder::new()
3524/// # .with_native_roots()
3525/// # .unwrap()
3526/// # .https_or_http()
3527/// # .enable_http1()
3528/// # .build()
3529/// # );
3530/// # let mut hub = AnalyticsData::new(client, auth);
3531/// // As the method needs a request, you would usually fill it with the desired information
3532/// // into the respective structure. Some of the parts shown here might not be applicable !
3533/// // Values shown here are possibly random and not representative !
3534/// let mut req = BatchRunReportsRequest::default();
3535///
3536/// // You can configure optional parameters by calling the respective setters at will, and
3537/// // execute the final call using `doit()`.
3538/// // Values shown here are possibly random and not representative !
3539/// let result = hub.properties().batch_run_reports(req, "property")
3540/// .doit().await;
3541/// # }
3542/// ```
3543pub struct PropertyBatchRunReportCall<'a, C>
3544where
3545 C: 'a,
3546{
3547 hub: &'a AnalyticsData<C>,
3548 _request: BatchRunReportsRequest,
3549 _property: String,
3550 _delegate: Option<&'a mut dyn common::Delegate>,
3551 _additional_params: HashMap<String, String>,
3552 _scopes: BTreeSet<String>,
3553}
3554
3555impl<'a, C> common::CallBuilder for PropertyBatchRunReportCall<'a, C> {}
3556
3557impl<'a, C> PropertyBatchRunReportCall<'a, C>
3558where
3559 C: common::Connector,
3560{
3561 /// Perform the operation you have build so far.
3562 pub async fn doit(mut self) -> common::Result<(common::Response, BatchRunReportsResponse)> {
3563 use std::borrow::Cow;
3564 use std::io::{Read, Seek};
3565
3566 use common::{url::Params, ToParts};
3567 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3568
3569 let mut dd = common::DefaultDelegate;
3570 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3571 dlg.begin(common::MethodInfo {
3572 id: "analyticsdata.properties.batchRunReports",
3573 http_method: hyper::Method::POST,
3574 });
3575
3576 for &field in ["alt", "property"].iter() {
3577 if self._additional_params.contains_key(field) {
3578 dlg.finished(false);
3579 return Err(common::Error::FieldClash(field));
3580 }
3581 }
3582
3583 let mut params = Params::with_capacity(4 + self._additional_params.len());
3584 params.push("property", self._property);
3585
3586 params.extend(self._additional_params.iter());
3587
3588 params.push("alt", "json");
3589 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:batchRunReports";
3590 if self._scopes.is_empty() {
3591 self._scopes.insert(Scope::Analytic.as_ref().to_string());
3592 }
3593
3594 #[allow(clippy::single_element_loop)]
3595 for &(find_this, param_name) in [("{+property}", "property")].iter() {
3596 url = params.uri_replacement(url, param_name, find_this, true);
3597 }
3598 {
3599 let to_remove = ["property"];
3600 params.remove_params(&to_remove);
3601 }
3602
3603 let url = params.parse_with_url(&url);
3604
3605 let mut json_mime_type = mime::APPLICATION_JSON;
3606 let mut request_value_reader = {
3607 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3608 common::remove_json_null_values(&mut value);
3609 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3610 serde_json::to_writer(&mut dst, &value).unwrap();
3611 dst
3612 };
3613 let request_size = request_value_reader
3614 .seek(std::io::SeekFrom::End(0))
3615 .unwrap();
3616 request_value_reader
3617 .seek(std::io::SeekFrom::Start(0))
3618 .unwrap();
3619
3620 loop {
3621 let token = match self
3622 .hub
3623 .auth
3624 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3625 .await
3626 {
3627 Ok(token) => token,
3628 Err(e) => match dlg.token(e) {
3629 Ok(token) => token,
3630 Err(e) => {
3631 dlg.finished(false);
3632 return Err(common::Error::MissingToken(e));
3633 }
3634 },
3635 };
3636 request_value_reader
3637 .seek(std::io::SeekFrom::Start(0))
3638 .unwrap();
3639 let mut req_result = {
3640 let client = &self.hub.client;
3641 dlg.pre_request();
3642 let mut req_builder = hyper::Request::builder()
3643 .method(hyper::Method::POST)
3644 .uri(url.as_str())
3645 .header(USER_AGENT, self.hub._user_agent.clone());
3646
3647 if let Some(token) = token.as_ref() {
3648 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3649 }
3650
3651 let request = req_builder
3652 .header(CONTENT_TYPE, json_mime_type.to_string())
3653 .header(CONTENT_LENGTH, request_size as u64)
3654 .body(common::to_body(
3655 request_value_reader.get_ref().clone().into(),
3656 ));
3657
3658 client.request(request.unwrap()).await
3659 };
3660
3661 match req_result {
3662 Err(err) => {
3663 if let common::Retry::After(d) = dlg.http_error(&err) {
3664 sleep(d).await;
3665 continue;
3666 }
3667 dlg.finished(false);
3668 return Err(common::Error::HttpError(err));
3669 }
3670 Ok(res) => {
3671 let (mut parts, body) = res.into_parts();
3672 let mut body = common::Body::new(body);
3673 if !parts.status.is_success() {
3674 let bytes = common::to_bytes(body).await.unwrap_or_default();
3675 let error = serde_json::from_str(&common::to_string(&bytes));
3676 let response = common::to_response(parts, bytes.into());
3677
3678 if let common::Retry::After(d) =
3679 dlg.http_failure(&response, error.as_ref().ok())
3680 {
3681 sleep(d).await;
3682 continue;
3683 }
3684
3685 dlg.finished(false);
3686
3687 return Err(match error {
3688 Ok(value) => common::Error::BadRequest(value),
3689 _ => common::Error::Failure(response),
3690 });
3691 }
3692 let response = {
3693 let bytes = common::to_bytes(body).await.unwrap_or_default();
3694 let encoded = common::to_string(&bytes);
3695 match serde_json::from_str(&encoded) {
3696 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3697 Err(error) => {
3698 dlg.response_json_decode_error(&encoded, &error);
3699 return Err(common::Error::JsonDecodeError(
3700 encoded.to_string(),
3701 error,
3702 ));
3703 }
3704 }
3705 };
3706
3707 dlg.finished(true);
3708 return Ok(response);
3709 }
3710 }
3711 }
3712 }
3713
3714 ///
3715 /// Sets the *request* property to the given value.
3716 ///
3717 /// Even though the property as already been set when instantiating this call,
3718 /// we provide this method for API completeness.
3719 pub fn request(
3720 mut self,
3721 new_value: BatchRunReportsRequest,
3722 ) -> PropertyBatchRunReportCall<'a, C> {
3723 self._request = new_value;
3724 self
3725 }
3726 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). This property must be specified for the batch. The property within RunReportRequest may either be unspecified or consistent with this property. Example: properties/1234
3727 ///
3728 /// Sets the *property* path property to the given value.
3729 ///
3730 /// Even though the property as already been set when instantiating this call,
3731 /// we provide this method for API completeness.
3732 pub fn property(mut self, new_value: &str) -> PropertyBatchRunReportCall<'a, C> {
3733 self._property = new_value.to_string();
3734 self
3735 }
3736 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3737 /// while executing the actual API request.
3738 ///
3739 /// ````text
3740 /// It should be used to handle progress information, and to implement a certain level of resilience.
3741 /// ````
3742 ///
3743 /// Sets the *delegate* property to the given value.
3744 pub fn delegate(
3745 mut self,
3746 new_value: &'a mut dyn common::Delegate,
3747 ) -> PropertyBatchRunReportCall<'a, C> {
3748 self._delegate = Some(new_value);
3749 self
3750 }
3751
3752 /// Set any additional parameter of the query string used in the request.
3753 /// It should be used to set parameters which are not yet available through their own
3754 /// setters.
3755 ///
3756 /// Please note that this method must not be used to set any of the known parameters
3757 /// which have their own setter method. If done anyway, the request will fail.
3758 ///
3759 /// # Additional Parameters
3760 ///
3761 /// * *$.xgafv* (query-string) - V1 error format.
3762 /// * *access_token* (query-string) - OAuth access token.
3763 /// * *alt* (query-string) - Data format for response.
3764 /// * *callback* (query-string) - JSONP
3765 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3766 /// * *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.
3767 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3768 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3769 /// * *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.
3770 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3771 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3772 pub fn param<T>(mut self, name: T, value: T) -> PropertyBatchRunReportCall<'a, C>
3773 where
3774 T: AsRef<str>,
3775 {
3776 self._additional_params
3777 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3778 self
3779 }
3780
3781 /// Identifies the authorization scope for the method you are building.
3782 ///
3783 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3784 /// [`Scope::Analytic`].
3785 ///
3786 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3787 /// tokens for more than one scope.
3788 ///
3789 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3790 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3791 /// sufficient, a read-write scope will do as well.
3792 pub fn add_scope<St>(mut self, scope: St) -> PropertyBatchRunReportCall<'a, C>
3793 where
3794 St: AsRef<str>,
3795 {
3796 self._scopes.insert(String::from(scope.as_ref()));
3797 self
3798 }
3799 /// Identifies the authorization scope(s) for the method you are building.
3800 ///
3801 /// See [`Self::add_scope()`] for details.
3802 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyBatchRunReportCall<'a, C>
3803 where
3804 I: IntoIterator<Item = St>,
3805 St: AsRef<str>,
3806 {
3807 self._scopes
3808 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3809 self
3810 }
3811
3812 /// Removes all scopes, and no default scope will be used either.
3813 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3814 /// for details).
3815 pub fn clear_scopes(mut self) -> PropertyBatchRunReportCall<'a, C> {
3816 self._scopes.clear();
3817 self
3818 }
3819}
3820
3821/// This compatibility method lists dimensions and metrics that can be added to a report request and maintain compatibility. This method fails if the request's dimensions and metrics are incompatible. In Google Analytics, reports fail if they request incompatible dimensions and/or metrics; in that case, you will need to remove dimensions and/or metrics from the incompatible report until the report is compatible. The Realtime and Core reports have different compatibility rules. This method checks compatibility for Core reports.
3822///
3823/// A builder for the *checkCompatibility* method supported by a *property* resource.
3824/// It is not used directly, but through a [`PropertyMethods`] instance.
3825///
3826/// # Example
3827///
3828/// Instantiate a resource method builder
3829///
3830/// ```test_harness,no_run
3831/// # extern crate hyper;
3832/// # extern crate hyper_rustls;
3833/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
3834/// use analyticsdata1_beta::api::CheckCompatibilityRequest;
3835/// # async fn dox() {
3836/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3837///
3838/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3840/// # secret,
3841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3842/// # ).build().await.unwrap();
3843///
3844/// # let client = hyper_util::client::legacy::Client::builder(
3845/// # hyper_util::rt::TokioExecutor::new()
3846/// # )
3847/// # .build(
3848/// # hyper_rustls::HttpsConnectorBuilder::new()
3849/// # .with_native_roots()
3850/// # .unwrap()
3851/// # .https_or_http()
3852/// # .enable_http1()
3853/// # .build()
3854/// # );
3855/// # let mut hub = AnalyticsData::new(client, auth);
3856/// // As the method needs a request, you would usually fill it with the desired information
3857/// // into the respective structure. Some of the parts shown here might not be applicable !
3858/// // Values shown here are possibly random and not representative !
3859/// let mut req = CheckCompatibilityRequest::default();
3860///
3861/// // You can configure optional parameters by calling the respective setters at will, and
3862/// // execute the final call using `doit()`.
3863/// // Values shown here are possibly random and not representative !
3864/// let result = hub.properties().check_compatibility(req, "property")
3865/// .doit().await;
3866/// # }
3867/// ```
3868pub struct PropertyCheckCompatibilityCall<'a, C>
3869where
3870 C: 'a,
3871{
3872 hub: &'a AnalyticsData<C>,
3873 _request: CheckCompatibilityRequest,
3874 _property: String,
3875 _delegate: Option<&'a mut dyn common::Delegate>,
3876 _additional_params: HashMap<String, String>,
3877 _scopes: BTreeSet<String>,
3878}
3879
3880impl<'a, C> common::CallBuilder for PropertyCheckCompatibilityCall<'a, C> {}
3881
3882impl<'a, C> PropertyCheckCompatibilityCall<'a, C>
3883where
3884 C: common::Connector,
3885{
3886 /// Perform the operation you have build so far.
3887 pub async fn doit(mut self) -> common::Result<(common::Response, CheckCompatibilityResponse)> {
3888 use std::borrow::Cow;
3889 use std::io::{Read, Seek};
3890
3891 use common::{url::Params, ToParts};
3892 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3893
3894 let mut dd = common::DefaultDelegate;
3895 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3896 dlg.begin(common::MethodInfo {
3897 id: "analyticsdata.properties.checkCompatibility",
3898 http_method: hyper::Method::POST,
3899 });
3900
3901 for &field in ["alt", "property"].iter() {
3902 if self._additional_params.contains_key(field) {
3903 dlg.finished(false);
3904 return Err(common::Error::FieldClash(field));
3905 }
3906 }
3907
3908 let mut params = Params::with_capacity(4 + self._additional_params.len());
3909 params.push("property", self._property);
3910
3911 params.extend(self._additional_params.iter());
3912
3913 params.push("alt", "json");
3914 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:checkCompatibility";
3915 if self._scopes.is_empty() {
3916 self._scopes.insert(Scope::Analytic.as_ref().to_string());
3917 }
3918
3919 #[allow(clippy::single_element_loop)]
3920 for &(find_this, param_name) in [("{+property}", "property")].iter() {
3921 url = params.uri_replacement(url, param_name, find_this, true);
3922 }
3923 {
3924 let to_remove = ["property"];
3925 params.remove_params(&to_remove);
3926 }
3927
3928 let url = params.parse_with_url(&url);
3929
3930 let mut json_mime_type = mime::APPLICATION_JSON;
3931 let mut request_value_reader = {
3932 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3933 common::remove_json_null_values(&mut value);
3934 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3935 serde_json::to_writer(&mut dst, &value).unwrap();
3936 dst
3937 };
3938 let request_size = request_value_reader
3939 .seek(std::io::SeekFrom::End(0))
3940 .unwrap();
3941 request_value_reader
3942 .seek(std::io::SeekFrom::Start(0))
3943 .unwrap();
3944
3945 loop {
3946 let token = match self
3947 .hub
3948 .auth
3949 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3950 .await
3951 {
3952 Ok(token) => token,
3953 Err(e) => match dlg.token(e) {
3954 Ok(token) => token,
3955 Err(e) => {
3956 dlg.finished(false);
3957 return Err(common::Error::MissingToken(e));
3958 }
3959 },
3960 };
3961 request_value_reader
3962 .seek(std::io::SeekFrom::Start(0))
3963 .unwrap();
3964 let mut req_result = {
3965 let client = &self.hub.client;
3966 dlg.pre_request();
3967 let mut req_builder = hyper::Request::builder()
3968 .method(hyper::Method::POST)
3969 .uri(url.as_str())
3970 .header(USER_AGENT, self.hub._user_agent.clone());
3971
3972 if let Some(token) = token.as_ref() {
3973 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3974 }
3975
3976 let request = req_builder
3977 .header(CONTENT_TYPE, json_mime_type.to_string())
3978 .header(CONTENT_LENGTH, request_size as u64)
3979 .body(common::to_body(
3980 request_value_reader.get_ref().clone().into(),
3981 ));
3982
3983 client.request(request.unwrap()).await
3984 };
3985
3986 match req_result {
3987 Err(err) => {
3988 if let common::Retry::After(d) = dlg.http_error(&err) {
3989 sleep(d).await;
3990 continue;
3991 }
3992 dlg.finished(false);
3993 return Err(common::Error::HttpError(err));
3994 }
3995 Ok(res) => {
3996 let (mut parts, body) = res.into_parts();
3997 let mut body = common::Body::new(body);
3998 if !parts.status.is_success() {
3999 let bytes = common::to_bytes(body).await.unwrap_or_default();
4000 let error = serde_json::from_str(&common::to_string(&bytes));
4001 let response = common::to_response(parts, bytes.into());
4002
4003 if let common::Retry::After(d) =
4004 dlg.http_failure(&response, error.as_ref().ok())
4005 {
4006 sleep(d).await;
4007 continue;
4008 }
4009
4010 dlg.finished(false);
4011
4012 return Err(match error {
4013 Ok(value) => common::Error::BadRequest(value),
4014 _ => common::Error::Failure(response),
4015 });
4016 }
4017 let response = {
4018 let bytes = common::to_bytes(body).await.unwrap_or_default();
4019 let encoded = common::to_string(&bytes);
4020 match serde_json::from_str(&encoded) {
4021 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4022 Err(error) => {
4023 dlg.response_json_decode_error(&encoded, &error);
4024 return Err(common::Error::JsonDecodeError(
4025 encoded.to_string(),
4026 error,
4027 ));
4028 }
4029 }
4030 };
4031
4032 dlg.finished(true);
4033 return Ok(response);
4034 }
4035 }
4036 }
4037 }
4038
4039 ///
4040 /// Sets the *request* property to the given value.
4041 ///
4042 /// Even though the property as already been set when instantiating this call,
4043 /// we provide this method for API completeness.
4044 pub fn request(
4045 mut self,
4046 new_value: CheckCompatibilityRequest,
4047 ) -> PropertyCheckCompatibilityCall<'a, C> {
4048 self._request = new_value;
4049 self
4050 }
4051 /// A Google Analytics GA4 property identifier whose events are tracked. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). `property` should be the same value as in your `runReport` request. Example: properties/1234
4052 ///
4053 /// Sets the *property* path property to the given value.
4054 ///
4055 /// Even though the property as already been set when instantiating this call,
4056 /// we provide this method for API completeness.
4057 pub fn property(mut self, new_value: &str) -> PropertyCheckCompatibilityCall<'a, C> {
4058 self._property = new_value.to_string();
4059 self
4060 }
4061 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4062 /// while executing the actual API request.
4063 ///
4064 /// ````text
4065 /// It should be used to handle progress information, and to implement a certain level of resilience.
4066 /// ````
4067 ///
4068 /// Sets the *delegate* property to the given value.
4069 pub fn delegate(
4070 mut self,
4071 new_value: &'a mut dyn common::Delegate,
4072 ) -> PropertyCheckCompatibilityCall<'a, C> {
4073 self._delegate = Some(new_value);
4074 self
4075 }
4076
4077 /// Set any additional parameter of the query string used in the request.
4078 /// It should be used to set parameters which are not yet available through their own
4079 /// setters.
4080 ///
4081 /// Please note that this method must not be used to set any of the known parameters
4082 /// which have their own setter method. If done anyway, the request will fail.
4083 ///
4084 /// # Additional Parameters
4085 ///
4086 /// * *$.xgafv* (query-string) - V1 error format.
4087 /// * *access_token* (query-string) - OAuth access token.
4088 /// * *alt* (query-string) - Data format for response.
4089 /// * *callback* (query-string) - JSONP
4090 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4091 /// * *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.
4092 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4093 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4094 /// * *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.
4095 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4096 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4097 pub fn param<T>(mut self, name: T, value: T) -> PropertyCheckCompatibilityCall<'a, C>
4098 where
4099 T: AsRef<str>,
4100 {
4101 self._additional_params
4102 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4103 self
4104 }
4105
4106 /// Identifies the authorization scope for the method you are building.
4107 ///
4108 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4109 /// [`Scope::Analytic`].
4110 ///
4111 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4112 /// tokens for more than one scope.
4113 ///
4114 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4115 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4116 /// sufficient, a read-write scope will do as well.
4117 pub fn add_scope<St>(mut self, scope: St) -> PropertyCheckCompatibilityCall<'a, C>
4118 where
4119 St: AsRef<str>,
4120 {
4121 self._scopes.insert(String::from(scope.as_ref()));
4122 self
4123 }
4124 /// Identifies the authorization scope(s) for the method you are building.
4125 ///
4126 /// See [`Self::add_scope()`] for details.
4127 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyCheckCompatibilityCall<'a, C>
4128 where
4129 I: IntoIterator<Item = St>,
4130 St: AsRef<str>,
4131 {
4132 self._scopes
4133 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4134 self
4135 }
4136
4137 /// Removes all scopes, and no default scope will be used either.
4138 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4139 /// for details).
4140 pub fn clear_scopes(mut self) -> PropertyCheckCompatibilityCall<'a, C> {
4141 self._scopes.clear();
4142 self
4143 }
4144}
4145
4146/// Returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata. For example if a custom metric with parameter name `levels_unlocked` is registered to a property, the Metadata response will contain `customEvent:levels_unlocked`. Universal metadata are dimensions and metrics applicable to any property such as `country` and `totalUsers`.
4147///
4148/// A builder for the *getMetadata* method supported by a *property* resource.
4149/// It is not used directly, but through a [`PropertyMethods`] instance.
4150///
4151/// # Example
4152///
4153/// Instantiate a resource method builder
4154///
4155/// ```test_harness,no_run
4156/// # extern crate hyper;
4157/// # extern crate hyper_rustls;
4158/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
4159/// # async fn dox() {
4160/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4161///
4162/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4163/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4164/// # secret,
4165/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4166/// # ).build().await.unwrap();
4167///
4168/// # let client = hyper_util::client::legacy::Client::builder(
4169/// # hyper_util::rt::TokioExecutor::new()
4170/// # )
4171/// # .build(
4172/// # hyper_rustls::HttpsConnectorBuilder::new()
4173/// # .with_native_roots()
4174/// # .unwrap()
4175/// # .https_or_http()
4176/// # .enable_http1()
4177/// # .build()
4178/// # );
4179/// # let mut hub = AnalyticsData::new(client, auth);
4180/// // You can configure optional parameters by calling the respective setters at will, and
4181/// // execute the final call using `doit()`.
4182/// // Values shown here are possibly random and not representative !
4183/// let result = hub.properties().get_metadata("name")
4184/// .doit().await;
4185/// # }
4186/// ```
4187pub struct PropertyGetMetadataCall<'a, C>
4188where
4189 C: 'a,
4190{
4191 hub: &'a AnalyticsData<C>,
4192 _name: String,
4193 _delegate: Option<&'a mut dyn common::Delegate>,
4194 _additional_params: HashMap<String, String>,
4195 _scopes: BTreeSet<String>,
4196}
4197
4198impl<'a, C> common::CallBuilder for PropertyGetMetadataCall<'a, C> {}
4199
4200impl<'a, C> PropertyGetMetadataCall<'a, C>
4201where
4202 C: common::Connector,
4203{
4204 /// Perform the operation you have build so far.
4205 pub async fn doit(mut self) -> common::Result<(common::Response, Metadata)> {
4206 use std::borrow::Cow;
4207 use std::io::{Read, Seek};
4208
4209 use common::{url::Params, ToParts};
4210 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4211
4212 let mut dd = common::DefaultDelegate;
4213 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4214 dlg.begin(common::MethodInfo {
4215 id: "analyticsdata.properties.getMetadata",
4216 http_method: hyper::Method::GET,
4217 });
4218
4219 for &field in ["alt", "name"].iter() {
4220 if self._additional_params.contains_key(field) {
4221 dlg.finished(false);
4222 return Err(common::Error::FieldClash(field));
4223 }
4224 }
4225
4226 let mut params = Params::with_capacity(3 + self._additional_params.len());
4227 params.push("name", self._name);
4228
4229 params.extend(self._additional_params.iter());
4230
4231 params.push("alt", "json");
4232 let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
4233 if self._scopes.is_empty() {
4234 self._scopes
4235 .insert(Scope::AnalyticReadonly.as_ref().to_string());
4236 }
4237
4238 #[allow(clippy::single_element_loop)]
4239 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4240 url = params.uri_replacement(url, param_name, find_this, true);
4241 }
4242 {
4243 let to_remove = ["name"];
4244 params.remove_params(&to_remove);
4245 }
4246
4247 let url = params.parse_with_url(&url);
4248
4249 loop {
4250 let token = match self
4251 .hub
4252 .auth
4253 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4254 .await
4255 {
4256 Ok(token) => token,
4257 Err(e) => match dlg.token(e) {
4258 Ok(token) => token,
4259 Err(e) => {
4260 dlg.finished(false);
4261 return Err(common::Error::MissingToken(e));
4262 }
4263 },
4264 };
4265 let mut req_result = {
4266 let client = &self.hub.client;
4267 dlg.pre_request();
4268 let mut req_builder = hyper::Request::builder()
4269 .method(hyper::Method::GET)
4270 .uri(url.as_str())
4271 .header(USER_AGENT, self.hub._user_agent.clone());
4272
4273 if let Some(token) = token.as_ref() {
4274 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4275 }
4276
4277 let request = req_builder
4278 .header(CONTENT_LENGTH, 0_u64)
4279 .body(common::to_body::<String>(None));
4280
4281 client.request(request.unwrap()).await
4282 };
4283
4284 match req_result {
4285 Err(err) => {
4286 if let common::Retry::After(d) = dlg.http_error(&err) {
4287 sleep(d).await;
4288 continue;
4289 }
4290 dlg.finished(false);
4291 return Err(common::Error::HttpError(err));
4292 }
4293 Ok(res) => {
4294 let (mut parts, body) = res.into_parts();
4295 let mut body = common::Body::new(body);
4296 if !parts.status.is_success() {
4297 let bytes = common::to_bytes(body).await.unwrap_or_default();
4298 let error = serde_json::from_str(&common::to_string(&bytes));
4299 let response = common::to_response(parts, bytes.into());
4300
4301 if let common::Retry::After(d) =
4302 dlg.http_failure(&response, error.as_ref().ok())
4303 {
4304 sleep(d).await;
4305 continue;
4306 }
4307
4308 dlg.finished(false);
4309
4310 return Err(match error {
4311 Ok(value) => common::Error::BadRequest(value),
4312 _ => common::Error::Failure(response),
4313 });
4314 }
4315 let response = {
4316 let bytes = common::to_bytes(body).await.unwrap_or_default();
4317 let encoded = common::to_string(&bytes);
4318 match serde_json::from_str(&encoded) {
4319 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4320 Err(error) => {
4321 dlg.response_json_decode_error(&encoded, &error);
4322 return Err(common::Error::JsonDecodeError(
4323 encoded.to_string(),
4324 error,
4325 ));
4326 }
4327 }
4328 };
4329
4330 dlg.finished(true);
4331 return Ok(response);
4332 }
4333 }
4334 }
4335 }
4336
4337 /// Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics GA4 Property identifier. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics.
4338 ///
4339 /// Sets the *name* path property to the given value.
4340 ///
4341 /// Even though the property as already been set when instantiating this call,
4342 /// we provide this method for API completeness.
4343 pub fn name(mut self, new_value: &str) -> PropertyGetMetadataCall<'a, C> {
4344 self._name = new_value.to_string();
4345 self
4346 }
4347 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4348 /// while executing the actual API request.
4349 ///
4350 /// ````text
4351 /// It should be used to handle progress information, and to implement a certain level of resilience.
4352 /// ````
4353 ///
4354 /// Sets the *delegate* property to the given value.
4355 pub fn delegate(
4356 mut self,
4357 new_value: &'a mut dyn common::Delegate,
4358 ) -> PropertyGetMetadataCall<'a, C> {
4359 self._delegate = Some(new_value);
4360 self
4361 }
4362
4363 /// Set any additional parameter of the query string used in the request.
4364 /// It should be used to set parameters which are not yet available through their own
4365 /// setters.
4366 ///
4367 /// Please note that this method must not be used to set any of the known parameters
4368 /// which have their own setter method. If done anyway, the request will fail.
4369 ///
4370 /// # Additional Parameters
4371 ///
4372 /// * *$.xgafv* (query-string) - V1 error format.
4373 /// * *access_token* (query-string) - OAuth access token.
4374 /// * *alt* (query-string) - Data format for response.
4375 /// * *callback* (query-string) - JSONP
4376 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4377 /// * *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.
4378 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4379 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4380 /// * *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.
4381 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4382 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4383 pub fn param<T>(mut self, name: T, value: T) -> PropertyGetMetadataCall<'a, C>
4384 where
4385 T: AsRef<str>,
4386 {
4387 self._additional_params
4388 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4389 self
4390 }
4391
4392 /// Identifies the authorization scope for the method you are building.
4393 ///
4394 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4395 /// [`Scope::AnalyticReadonly`].
4396 ///
4397 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4398 /// tokens for more than one scope.
4399 ///
4400 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4401 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4402 /// sufficient, a read-write scope will do as well.
4403 pub fn add_scope<St>(mut self, scope: St) -> PropertyGetMetadataCall<'a, C>
4404 where
4405 St: AsRef<str>,
4406 {
4407 self._scopes.insert(String::from(scope.as_ref()));
4408 self
4409 }
4410 /// Identifies the authorization scope(s) for the method you are building.
4411 ///
4412 /// See [`Self::add_scope()`] for details.
4413 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyGetMetadataCall<'a, C>
4414 where
4415 I: IntoIterator<Item = St>,
4416 St: AsRef<str>,
4417 {
4418 self._scopes
4419 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4420 self
4421 }
4422
4423 /// Removes all scopes, and no default scope will be used either.
4424 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4425 /// for details).
4426 pub fn clear_scopes(mut self) -> PropertyGetMetadataCall<'a, C> {
4427 self._scopes.clear();
4428 self
4429 }
4430}
4431
4432/// Returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data.
4433///
4434/// A builder for the *runPivotReport* method supported by a *property* resource.
4435/// It is not used directly, but through a [`PropertyMethods`] instance.
4436///
4437/// # Example
4438///
4439/// Instantiate a resource method builder
4440///
4441/// ```test_harness,no_run
4442/// # extern crate hyper;
4443/// # extern crate hyper_rustls;
4444/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
4445/// use analyticsdata1_beta::api::RunPivotReportRequest;
4446/// # async fn dox() {
4447/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4448///
4449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4450/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4451/// # secret,
4452/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4453/// # ).build().await.unwrap();
4454///
4455/// # let client = hyper_util::client::legacy::Client::builder(
4456/// # hyper_util::rt::TokioExecutor::new()
4457/// # )
4458/// # .build(
4459/// # hyper_rustls::HttpsConnectorBuilder::new()
4460/// # .with_native_roots()
4461/// # .unwrap()
4462/// # .https_or_http()
4463/// # .enable_http1()
4464/// # .build()
4465/// # );
4466/// # let mut hub = AnalyticsData::new(client, auth);
4467/// // As the method needs a request, you would usually fill it with the desired information
4468/// // into the respective structure. Some of the parts shown here might not be applicable !
4469/// // Values shown here are possibly random and not representative !
4470/// let mut req = RunPivotReportRequest::default();
4471///
4472/// // You can configure optional parameters by calling the respective setters at will, and
4473/// // execute the final call using `doit()`.
4474/// // Values shown here are possibly random and not representative !
4475/// let result = hub.properties().run_pivot_report(req, "property")
4476/// .doit().await;
4477/// # }
4478/// ```
4479pub struct PropertyRunPivotReportCall<'a, C>
4480where
4481 C: 'a,
4482{
4483 hub: &'a AnalyticsData<C>,
4484 _request: RunPivotReportRequest,
4485 _property: String,
4486 _delegate: Option<&'a mut dyn common::Delegate>,
4487 _additional_params: HashMap<String, String>,
4488 _scopes: BTreeSet<String>,
4489}
4490
4491impl<'a, C> common::CallBuilder for PropertyRunPivotReportCall<'a, C> {}
4492
4493impl<'a, C> PropertyRunPivotReportCall<'a, C>
4494where
4495 C: common::Connector,
4496{
4497 /// Perform the operation you have build so far.
4498 pub async fn doit(mut self) -> common::Result<(common::Response, RunPivotReportResponse)> {
4499 use std::borrow::Cow;
4500 use std::io::{Read, Seek};
4501
4502 use common::{url::Params, ToParts};
4503 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4504
4505 let mut dd = common::DefaultDelegate;
4506 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4507 dlg.begin(common::MethodInfo {
4508 id: "analyticsdata.properties.runPivotReport",
4509 http_method: hyper::Method::POST,
4510 });
4511
4512 for &field in ["alt", "property"].iter() {
4513 if self._additional_params.contains_key(field) {
4514 dlg.finished(false);
4515 return Err(common::Error::FieldClash(field));
4516 }
4517 }
4518
4519 let mut params = Params::with_capacity(4 + self._additional_params.len());
4520 params.push("property", self._property);
4521
4522 params.extend(self._additional_params.iter());
4523
4524 params.push("alt", "json");
4525 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:runPivotReport";
4526 if self._scopes.is_empty() {
4527 self._scopes.insert(Scope::Analytic.as_ref().to_string());
4528 }
4529
4530 #[allow(clippy::single_element_loop)]
4531 for &(find_this, param_name) in [("{+property}", "property")].iter() {
4532 url = params.uri_replacement(url, param_name, find_this, true);
4533 }
4534 {
4535 let to_remove = ["property"];
4536 params.remove_params(&to_remove);
4537 }
4538
4539 let url = params.parse_with_url(&url);
4540
4541 let mut json_mime_type = mime::APPLICATION_JSON;
4542 let mut request_value_reader = {
4543 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4544 common::remove_json_null_values(&mut value);
4545 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4546 serde_json::to_writer(&mut dst, &value).unwrap();
4547 dst
4548 };
4549 let request_size = request_value_reader
4550 .seek(std::io::SeekFrom::End(0))
4551 .unwrap();
4552 request_value_reader
4553 .seek(std::io::SeekFrom::Start(0))
4554 .unwrap();
4555
4556 loop {
4557 let token = match self
4558 .hub
4559 .auth
4560 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4561 .await
4562 {
4563 Ok(token) => token,
4564 Err(e) => match dlg.token(e) {
4565 Ok(token) => token,
4566 Err(e) => {
4567 dlg.finished(false);
4568 return Err(common::Error::MissingToken(e));
4569 }
4570 },
4571 };
4572 request_value_reader
4573 .seek(std::io::SeekFrom::Start(0))
4574 .unwrap();
4575 let mut req_result = {
4576 let client = &self.hub.client;
4577 dlg.pre_request();
4578 let mut req_builder = hyper::Request::builder()
4579 .method(hyper::Method::POST)
4580 .uri(url.as_str())
4581 .header(USER_AGENT, self.hub._user_agent.clone());
4582
4583 if let Some(token) = token.as_ref() {
4584 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4585 }
4586
4587 let request = req_builder
4588 .header(CONTENT_TYPE, json_mime_type.to_string())
4589 .header(CONTENT_LENGTH, request_size as u64)
4590 .body(common::to_body(
4591 request_value_reader.get_ref().clone().into(),
4592 ));
4593
4594 client.request(request.unwrap()).await
4595 };
4596
4597 match req_result {
4598 Err(err) => {
4599 if let common::Retry::After(d) = dlg.http_error(&err) {
4600 sleep(d).await;
4601 continue;
4602 }
4603 dlg.finished(false);
4604 return Err(common::Error::HttpError(err));
4605 }
4606 Ok(res) => {
4607 let (mut parts, body) = res.into_parts();
4608 let mut body = common::Body::new(body);
4609 if !parts.status.is_success() {
4610 let bytes = common::to_bytes(body).await.unwrap_or_default();
4611 let error = serde_json::from_str(&common::to_string(&bytes));
4612 let response = common::to_response(parts, bytes.into());
4613
4614 if let common::Retry::After(d) =
4615 dlg.http_failure(&response, error.as_ref().ok())
4616 {
4617 sleep(d).await;
4618 continue;
4619 }
4620
4621 dlg.finished(false);
4622
4623 return Err(match error {
4624 Ok(value) => common::Error::BadRequest(value),
4625 _ => common::Error::Failure(response),
4626 });
4627 }
4628 let response = {
4629 let bytes = common::to_bytes(body).await.unwrap_or_default();
4630 let encoded = common::to_string(&bytes);
4631 match serde_json::from_str(&encoded) {
4632 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4633 Err(error) => {
4634 dlg.response_json_decode_error(&encoded, &error);
4635 return Err(common::Error::JsonDecodeError(
4636 encoded.to_string(),
4637 error,
4638 ));
4639 }
4640 }
4641 };
4642
4643 dlg.finished(true);
4644 return Ok(response);
4645 }
4646 }
4647 }
4648 }
4649
4650 ///
4651 /// Sets the *request* property to the given value.
4652 ///
4653 /// Even though the property as already been set when instantiating this call,
4654 /// we provide this method for API completeness.
4655 pub fn request(
4656 mut self,
4657 new_value: RunPivotReportRequest,
4658 ) -> PropertyRunPivotReportCall<'a, C> {
4659 self._request = new_value;
4660 self
4661 }
4662 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
4663 ///
4664 /// Sets the *property* path property to the given value.
4665 ///
4666 /// Even though the property as already been set when instantiating this call,
4667 /// we provide this method for API completeness.
4668 pub fn property(mut self, new_value: &str) -> PropertyRunPivotReportCall<'a, C> {
4669 self._property = new_value.to_string();
4670 self
4671 }
4672 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4673 /// while executing the actual API request.
4674 ///
4675 /// ````text
4676 /// It should be used to handle progress information, and to implement a certain level of resilience.
4677 /// ````
4678 ///
4679 /// Sets the *delegate* property to the given value.
4680 pub fn delegate(
4681 mut self,
4682 new_value: &'a mut dyn common::Delegate,
4683 ) -> PropertyRunPivotReportCall<'a, C> {
4684 self._delegate = Some(new_value);
4685 self
4686 }
4687
4688 /// Set any additional parameter of the query string used in the request.
4689 /// It should be used to set parameters which are not yet available through their own
4690 /// setters.
4691 ///
4692 /// Please note that this method must not be used to set any of the known parameters
4693 /// which have their own setter method. If done anyway, the request will fail.
4694 ///
4695 /// # Additional Parameters
4696 ///
4697 /// * *$.xgafv* (query-string) - V1 error format.
4698 /// * *access_token* (query-string) - OAuth access token.
4699 /// * *alt* (query-string) - Data format for response.
4700 /// * *callback* (query-string) - JSONP
4701 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4702 /// * *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.
4703 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4704 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4705 /// * *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.
4706 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4707 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4708 pub fn param<T>(mut self, name: T, value: T) -> PropertyRunPivotReportCall<'a, C>
4709 where
4710 T: AsRef<str>,
4711 {
4712 self._additional_params
4713 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4714 self
4715 }
4716
4717 /// Identifies the authorization scope for the method you are building.
4718 ///
4719 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4720 /// [`Scope::Analytic`].
4721 ///
4722 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4723 /// tokens for more than one scope.
4724 ///
4725 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4726 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4727 /// sufficient, a read-write scope will do as well.
4728 pub fn add_scope<St>(mut self, scope: St) -> PropertyRunPivotReportCall<'a, C>
4729 where
4730 St: AsRef<str>,
4731 {
4732 self._scopes.insert(String::from(scope.as_ref()));
4733 self
4734 }
4735 /// Identifies the authorization scope(s) for the method you are building.
4736 ///
4737 /// See [`Self::add_scope()`] for details.
4738 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyRunPivotReportCall<'a, C>
4739 where
4740 I: IntoIterator<Item = St>,
4741 St: AsRef<str>,
4742 {
4743 self._scopes
4744 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4745 self
4746 }
4747
4748 /// Removes all scopes, and no default scope will be used either.
4749 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4750 /// for details).
4751 pub fn clear_scopes(mut self) -> PropertyRunPivotReportCall<'a, C> {
4752 self._scopes.clear();
4753 self
4754 }
4755}
4756
4757/// Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime requests & understanding responses, see [Creating a Realtime Report](https://developers.google.com/analytics/devguides/reporting/data/v1/realtime-basics).
4758///
4759/// A builder for the *runRealtimeReport* method supported by a *property* resource.
4760/// It is not used directly, but through a [`PropertyMethods`] instance.
4761///
4762/// # Example
4763///
4764/// Instantiate a resource method builder
4765///
4766/// ```test_harness,no_run
4767/// # extern crate hyper;
4768/// # extern crate hyper_rustls;
4769/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
4770/// use analyticsdata1_beta::api::RunRealtimeReportRequest;
4771/// # async fn dox() {
4772/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4773///
4774/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4775/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4776/// # secret,
4777/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4778/// # ).build().await.unwrap();
4779///
4780/// # let client = hyper_util::client::legacy::Client::builder(
4781/// # hyper_util::rt::TokioExecutor::new()
4782/// # )
4783/// # .build(
4784/// # hyper_rustls::HttpsConnectorBuilder::new()
4785/// # .with_native_roots()
4786/// # .unwrap()
4787/// # .https_or_http()
4788/// # .enable_http1()
4789/// # .build()
4790/// # );
4791/// # let mut hub = AnalyticsData::new(client, auth);
4792/// // As the method needs a request, you would usually fill it with the desired information
4793/// // into the respective structure. Some of the parts shown here might not be applicable !
4794/// // Values shown here are possibly random and not representative !
4795/// let mut req = RunRealtimeReportRequest::default();
4796///
4797/// // You can configure optional parameters by calling the respective setters at will, and
4798/// // execute the final call using `doit()`.
4799/// // Values shown here are possibly random and not representative !
4800/// let result = hub.properties().run_realtime_report(req, "property")
4801/// .doit().await;
4802/// # }
4803/// ```
4804pub struct PropertyRunRealtimeReportCall<'a, C>
4805where
4806 C: 'a,
4807{
4808 hub: &'a AnalyticsData<C>,
4809 _request: RunRealtimeReportRequest,
4810 _property: String,
4811 _delegate: Option<&'a mut dyn common::Delegate>,
4812 _additional_params: HashMap<String, String>,
4813 _scopes: BTreeSet<String>,
4814}
4815
4816impl<'a, C> common::CallBuilder for PropertyRunRealtimeReportCall<'a, C> {}
4817
4818impl<'a, C> PropertyRunRealtimeReportCall<'a, C>
4819where
4820 C: common::Connector,
4821{
4822 /// Perform the operation you have build so far.
4823 pub async fn doit(mut self) -> common::Result<(common::Response, RunRealtimeReportResponse)> {
4824 use std::borrow::Cow;
4825 use std::io::{Read, Seek};
4826
4827 use common::{url::Params, ToParts};
4828 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4829
4830 let mut dd = common::DefaultDelegate;
4831 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4832 dlg.begin(common::MethodInfo {
4833 id: "analyticsdata.properties.runRealtimeReport",
4834 http_method: hyper::Method::POST,
4835 });
4836
4837 for &field in ["alt", "property"].iter() {
4838 if self._additional_params.contains_key(field) {
4839 dlg.finished(false);
4840 return Err(common::Error::FieldClash(field));
4841 }
4842 }
4843
4844 let mut params = Params::with_capacity(4 + self._additional_params.len());
4845 params.push("property", self._property);
4846
4847 params.extend(self._additional_params.iter());
4848
4849 params.push("alt", "json");
4850 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:runRealtimeReport";
4851 if self._scopes.is_empty() {
4852 self._scopes.insert(Scope::Analytic.as_ref().to_string());
4853 }
4854
4855 #[allow(clippy::single_element_loop)]
4856 for &(find_this, param_name) in [("{+property}", "property")].iter() {
4857 url = params.uri_replacement(url, param_name, find_this, true);
4858 }
4859 {
4860 let to_remove = ["property"];
4861 params.remove_params(&to_remove);
4862 }
4863
4864 let url = params.parse_with_url(&url);
4865
4866 let mut json_mime_type = mime::APPLICATION_JSON;
4867 let mut request_value_reader = {
4868 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4869 common::remove_json_null_values(&mut value);
4870 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4871 serde_json::to_writer(&mut dst, &value).unwrap();
4872 dst
4873 };
4874 let request_size = request_value_reader
4875 .seek(std::io::SeekFrom::End(0))
4876 .unwrap();
4877 request_value_reader
4878 .seek(std::io::SeekFrom::Start(0))
4879 .unwrap();
4880
4881 loop {
4882 let token = match self
4883 .hub
4884 .auth
4885 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4886 .await
4887 {
4888 Ok(token) => token,
4889 Err(e) => match dlg.token(e) {
4890 Ok(token) => token,
4891 Err(e) => {
4892 dlg.finished(false);
4893 return Err(common::Error::MissingToken(e));
4894 }
4895 },
4896 };
4897 request_value_reader
4898 .seek(std::io::SeekFrom::Start(0))
4899 .unwrap();
4900 let mut req_result = {
4901 let client = &self.hub.client;
4902 dlg.pre_request();
4903 let mut req_builder = hyper::Request::builder()
4904 .method(hyper::Method::POST)
4905 .uri(url.as_str())
4906 .header(USER_AGENT, self.hub._user_agent.clone());
4907
4908 if let Some(token) = token.as_ref() {
4909 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4910 }
4911
4912 let request = req_builder
4913 .header(CONTENT_TYPE, json_mime_type.to_string())
4914 .header(CONTENT_LENGTH, request_size as u64)
4915 .body(common::to_body(
4916 request_value_reader.get_ref().clone().into(),
4917 ));
4918
4919 client.request(request.unwrap()).await
4920 };
4921
4922 match req_result {
4923 Err(err) => {
4924 if let common::Retry::After(d) = dlg.http_error(&err) {
4925 sleep(d).await;
4926 continue;
4927 }
4928 dlg.finished(false);
4929 return Err(common::Error::HttpError(err));
4930 }
4931 Ok(res) => {
4932 let (mut parts, body) = res.into_parts();
4933 let mut body = common::Body::new(body);
4934 if !parts.status.is_success() {
4935 let bytes = common::to_bytes(body).await.unwrap_or_default();
4936 let error = serde_json::from_str(&common::to_string(&bytes));
4937 let response = common::to_response(parts, bytes.into());
4938
4939 if let common::Retry::After(d) =
4940 dlg.http_failure(&response, error.as_ref().ok())
4941 {
4942 sleep(d).await;
4943 continue;
4944 }
4945
4946 dlg.finished(false);
4947
4948 return Err(match error {
4949 Ok(value) => common::Error::BadRequest(value),
4950 _ => common::Error::Failure(response),
4951 });
4952 }
4953 let response = {
4954 let bytes = common::to_bytes(body).await.unwrap_or_default();
4955 let encoded = common::to_string(&bytes);
4956 match serde_json::from_str(&encoded) {
4957 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4958 Err(error) => {
4959 dlg.response_json_decode_error(&encoded, &error);
4960 return Err(common::Error::JsonDecodeError(
4961 encoded.to_string(),
4962 error,
4963 ));
4964 }
4965 }
4966 };
4967
4968 dlg.finished(true);
4969 return Ok(response);
4970 }
4971 }
4972 }
4973 }
4974
4975 ///
4976 /// Sets the *request* property to the given value.
4977 ///
4978 /// Even though the property as already been set when instantiating this call,
4979 /// we provide this method for API completeness.
4980 pub fn request(
4981 mut self,
4982 new_value: RunRealtimeReportRequest,
4983 ) -> PropertyRunRealtimeReportCall<'a, C> {
4984 self._request = new_value;
4985 self
4986 }
4987 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Example: properties/1234
4988 ///
4989 /// Sets the *property* path property to the given value.
4990 ///
4991 /// Even though the property as already been set when instantiating this call,
4992 /// we provide this method for API completeness.
4993 pub fn property(mut self, new_value: &str) -> PropertyRunRealtimeReportCall<'a, C> {
4994 self._property = new_value.to_string();
4995 self
4996 }
4997 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4998 /// while executing the actual API request.
4999 ///
5000 /// ````text
5001 /// It should be used to handle progress information, and to implement a certain level of resilience.
5002 /// ````
5003 ///
5004 /// Sets the *delegate* property to the given value.
5005 pub fn delegate(
5006 mut self,
5007 new_value: &'a mut dyn common::Delegate,
5008 ) -> PropertyRunRealtimeReportCall<'a, C> {
5009 self._delegate = Some(new_value);
5010 self
5011 }
5012
5013 /// Set any additional parameter of the query string used in the request.
5014 /// It should be used to set parameters which are not yet available through their own
5015 /// setters.
5016 ///
5017 /// Please note that this method must not be used to set any of the known parameters
5018 /// which have their own setter method. If done anyway, the request will fail.
5019 ///
5020 /// # Additional Parameters
5021 ///
5022 /// * *$.xgafv* (query-string) - V1 error format.
5023 /// * *access_token* (query-string) - OAuth access token.
5024 /// * *alt* (query-string) - Data format for response.
5025 /// * *callback* (query-string) - JSONP
5026 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5027 /// * *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.
5028 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5029 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5030 /// * *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.
5031 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5032 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5033 pub fn param<T>(mut self, name: T, value: T) -> PropertyRunRealtimeReportCall<'a, C>
5034 where
5035 T: AsRef<str>,
5036 {
5037 self._additional_params
5038 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5039 self
5040 }
5041
5042 /// Identifies the authorization scope for the method you are building.
5043 ///
5044 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5045 /// [`Scope::Analytic`].
5046 ///
5047 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5048 /// tokens for more than one scope.
5049 ///
5050 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5051 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5052 /// sufficient, a read-write scope will do as well.
5053 pub fn add_scope<St>(mut self, scope: St) -> PropertyRunRealtimeReportCall<'a, C>
5054 where
5055 St: AsRef<str>,
5056 {
5057 self._scopes.insert(String::from(scope.as_ref()));
5058 self
5059 }
5060 /// Identifies the authorization scope(s) for the method you are building.
5061 ///
5062 /// See [`Self::add_scope()`] for details.
5063 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyRunRealtimeReportCall<'a, C>
5064 where
5065 I: IntoIterator<Item = St>,
5066 St: AsRef<str>,
5067 {
5068 self._scopes
5069 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5070 self
5071 }
5072
5073 /// Removes all scopes, and no default scope will be used either.
5074 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5075 /// for details).
5076 pub fn clear_scopes(mut self) -> PropertyRunRealtimeReportCall<'a, C> {
5077 self._scopes.clear();
5078 self
5079 }
5080}
5081
5082/// Returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name. For a guide to constructing requests & understanding responses, see [Creating a Report](https://developers.google.com/analytics/devguides/reporting/data/v1/basics).
5083///
5084/// A builder for the *runReport* method supported by a *property* resource.
5085/// It is not used directly, but through a [`PropertyMethods`] instance.
5086///
5087/// # Example
5088///
5089/// Instantiate a resource method builder
5090///
5091/// ```test_harness,no_run
5092/// # extern crate hyper;
5093/// # extern crate hyper_rustls;
5094/// # extern crate google_analyticsdata1_beta as analyticsdata1_beta;
5095/// use analyticsdata1_beta::api::RunReportRequest;
5096/// # async fn dox() {
5097/// # use analyticsdata1_beta::{AnalyticsData, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5098///
5099/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5100/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5101/// # secret,
5102/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5103/// # ).build().await.unwrap();
5104///
5105/// # let client = hyper_util::client::legacy::Client::builder(
5106/// # hyper_util::rt::TokioExecutor::new()
5107/// # )
5108/// # .build(
5109/// # hyper_rustls::HttpsConnectorBuilder::new()
5110/// # .with_native_roots()
5111/// # .unwrap()
5112/// # .https_or_http()
5113/// # .enable_http1()
5114/// # .build()
5115/// # );
5116/// # let mut hub = AnalyticsData::new(client, auth);
5117/// // As the method needs a request, you would usually fill it with the desired information
5118/// // into the respective structure. Some of the parts shown here might not be applicable !
5119/// // Values shown here are possibly random and not representative !
5120/// let mut req = RunReportRequest::default();
5121///
5122/// // You can configure optional parameters by calling the respective setters at will, and
5123/// // execute the final call using `doit()`.
5124/// // Values shown here are possibly random and not representative !
5125/// let result = hub.properties().run_report(req, "property")
5126/// .doit().await;
5127/// # }
5128/// ```
5129pub struct PropertyRunReportCall<'a, C>
5130where
5131 C: 'a,
5132{
5133 hub: &'a AnalyticsData<C>,
5134 _request: RunReportRequest,
5135 _property: String,
5136 _delegate: Option<&'a mut dyn common::Delegate>,
5137 _additional_params: HashMap<String, String>,
5138 _scopes: BTreeSet<String>,
5139}
5140
5141impl<'a, C> common::CallBuilder for PropertyRunReportCall<'a, C> {}
5142
5143impl<'a, C> PropertyRunReportCall<'a, C>
5144where
5145 C: common::Connector,
5146{
5147 /// Perform the operation you have build so far.
5148 pub async fn doit(mut self) -> common::Result<(common::Response, RunReportResponse)> {
5149 use std::borrow::Cow;
5150 use std::io::{Read, Seek};
5151
5152 use common::{url::Params, ToParts};
5153 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5154
5155 let mut dd = common::DefaultDelegate;
5156 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5157 dlg.begin(common::MethodInfo {
5158 id: "analyticsdata.properties.runReport",
5159 http_method: hyper::Method::POST,
5160 });
5161
5162 for &field in ["alt", "property"].iter() {
5163 if self._additional_params.contains_key(field) {
5164 dlg.finished(false);
5165 return Err(common::Error::FieldClash(field));
5166 }
5167 }
5168
5169 let mut params = Params::with_capacity(4 + self._additional_params.len());
5170 params.push("property", self._property);
5171
5172 params.extend(self._additional_params.iter());
5173
5174 params.push("alt", "json");
5175 let mut url = self.hub._base_url.clone() + "v1beta/{+property}:runReport";
5176 if self._scopes.is_empty() {
5177 self._scopes.insert(Scope::Analytic.as_ref().to_string());
5178 }
5179
5180 #[allow(clippy::single_element_loop)]
5181 for &(find_this, param_name) in [("{+property}", "property")].iter() {
5182 url = params.uri_replacement(url, param_name, find_this, true);
5183 }
5184 {
5185 let to_remove = ["property"];
5186 params.remove_params(&to_remove);
5187 }
5188
5189 let url = params.parse_with_url(&url);
5190
5191 let mut json_mime_type = mime::APPLICATION_JSON;
5192 let mut request_value_reader = {
5193 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5194 common::remove_json_null_values(&mut value);
5195 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5196 serde_json::to_writer(&mut dst, &value).unwrap();
5197 dst
5198 };
5199 let request_size = request_value_reader
5200 .seek(std::io::SeekFrom::End(0))
5201 .unwrap();
5202 request_value_reader
5203 .seek(std::io::SeekFrom::Start(0))
5204 .unwrap();
5205
5206 loop {
5207 let token = match self
5208 .hub
5209 .auth
5210 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5211 .await
5212 {
5213 Ok(token) => token,
5214 Err(e) => match dlg.token(e) {
5215 Ok(token) => token,
5216 Err(e) => {
5217 dlg.finished(false);
5218 return Err(common::Error::MissingToken(e));
5219 }
5220 },
5221 };
5222 request_value_reader
5223 .seek(std::io::SeekFrom::Start(0))
5224 .unwrap();
5225 let mut req_result = {
5226 let client = &self.hub.client;
5227 dlg.pre_request();
5228 let mut req_builder = hyper::Request::builder()
5229 .method(hyper::Method::POST)
5230 .uri(url.as_str())
5231 .header(USER_AGENT, self.hub._user_agent.clone());
5232
5233 if let Some(token) = token.as_ref() {
5234 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5235 }
5236
5237 let request = req_builder
5238 .header(CONTENT_TYPE, json_mime_type.to_string())
5239 .header(CONTENT_LENGTH, request_size as u64)
5240 .body(common::to_body(
5241 request_value_reader.get_ref().clone().into(),
5242 ));
5243
5244 client.request(request.unwrap()).await
5245 };
5246
5247 match req_result {
5248 Err(err) => {
5249 if let common::Retry::After(d) = dlg.http_error(&err) {
5250 sleep(d).await;
5251 continue;
5252 }
5253 dlg.finished(false);
5254 return Err(common::Error::HttpError(err));
5255 }
5256 Ok(res) => {
5257 let (mut parts, body) = res.into_parts();
5258 let mut body = common::Body::new(body);
5259 if !parts.status.is_success() {
5260 let bytes = common::to_bytes(body).await.unwrap_or_default();
5261 let error = serde_json::from_str(&common::to_string(&bytes));
5262 let response = common::to_response(parts, bytes.into());
5263
5264 if let common::Retry::After(d) =
5265 dlg.http_failure(&response, error.as_ref().ok())
5266 {
5267 sleep(d).await;
5268 continue;
5269 }
5270
5271 dlg.finished(false);
5272
5273 return Err(match error {
5274 Ok(value) => common::Error::BadRequest(value),
5275 _ => common::Error::Failure(response),
5276 });
5277 }
5278 let response = {
5279 let bytes = common::to_bytes(body).await.unwrap_or_default();
5280 let encoded = common::to_string(&bytes);
5281 match serde_json::from_str(&encoded) {
5282 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5283 Err(error) => {
5284 dlg.response_json_decode_error(&encoded, &error);
5285 return Err(common::Error::JsonDecodeError(
5286 encoded.to_string(),
5287 error,
5288 ));
5289 }
5290 }
5291 };
5292
5293 dlg.finished(true);
5294 return Ok(response);
5295 }
5296 }
5297 }
5298 }
5299
5300 ///
5301 /// Sets the *request* property to the given value.
5302 ///
5303 /// Even though the property as already been set when instantiating this call,
5304 /// we provide this method for API completeness.
5305 pub fn request(mut self, new_value: RunReportRequest) -> PropertyRunReportCall<'a, C> {
5306 self._request = new_value;
5307 self
5308 }
5309 /// A Google Analytics GA4 property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see [where to find your Property ID](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234
5310 ///
5311 /// Sets the *property* path property to the given value.
5312 ///
5313 /// Even though the property as already been set when instantiating this call,
5314 /// we provide this method for API completeness.
5315 pub fn property(mut self, new_value: &str) -> PropertyRunReportCall<'a, C> {
5316 self._property = new_value.to_string();
5317 self
5318 }
5319 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5320 /// while executing the actual API request.
5321 ///
5322 /// ````text
5323 /// It should be used to handle progress information, and to implement a certain level of resilience.
5324 /// ````
5325 ///
5326 /// Sets the *delegate* property to the given value.
5327 pub fn delegate(
5328 mut self,
5329 new_value: &'a mut dyn common::Delegate,
5330 ) -> PropertyRunReportCall<'a, C> {
5331 self._delegate = Some(new_value);
5332 self
5333 }
5334
5335 /// Set any additional parameter of the query string used in the request.
5336 /// It should be used to set parameters which are not yet available through their own
5337 /// setters.
5338 ///
5339 /// Please note that this method must not be used to set any of the known parameters
5340 /// which have their own setter method. If done anyway, the request will fail.
5341 ///
5342 /// # Additional Parameters
5343 ///
5344 /// * *$.xgafv* (query-string) - V1 error format.
5345 /// * *access_token* (query-string) - OAuth access token.
5346 /// * *alt* (query-string) - Data format for response.
5347 /// * *callback* (query-string) - JSONP
5348 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5349 /// * *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.
5350 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5351 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5352 /// * *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.
5353 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5354 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5355 pub fn param<T>(mut self, name: T, value: T) -> PropertyRunReportCall<'a, C>
5356 where
5357 T: AsRef<str>,
5358 {
5359 self._additional_params
5360 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5361 self
5362 }
5363
5364 /// Identifies the authorization scope for the method you are building.
5365 ///
5366 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5367 /// [`Scope::Analytic`].
5368 ///
5369 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5370 /// tokens for more than one scope.
5371 ///
5372 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5373 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5374 /// sufficient, a read-write scope will do as well.
5375 pub fn add_scope<St>(mut self, scope: St) -> PropertyRunReportCall<'a, C>
5376 where
5377 St: AsRef<str>,
5378 {
5379 self._scopes.insert(String::from(scope.as_ref()));
5380 self
5381 }
5382 /// Identifies the authorization scope(s) for the method you are building.
5383 ///
5384 /// See [`Self::add_scope()`] for details.
5385 pub fn add_scopes<I, St>(mut self, scopes: I) -> PropertyRunReportCall<'a, C>
5386 where
5387 I: IntoIterator<Item = St>,
5388 St: AsRef<str>,
5389 {
5390 self._scopes
5391 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5392 self
5393 }
5394
5395 /// Removes all scopes, and no default scope will be used either.
5396 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5397 /// for details).
5398 pub fn clear_scopes(mut self) -> PropertyRunReportCall<'a, C> {
5399 self._scopes.clear();
5400 self
5401 }
5402}