google_analyticsreporting4/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 AnalyticsReporting 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_analyticsreporting4 as analyticsreporting4;
53/// use analyticsreporting4::api::SearchUserActivityRequest;
54/// use analyticsreporting4::{Result, Error};
55/// # async fn dox() {
56/// use analyticsreporting4::{AnalyticsReporting, 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 connector = hyper_rustls::HttpsConnectorBuilder::new()
67/// .with_native_roots()
68/// .unwrap()
69/// .https_only()
70/// .enable_http2()
71/// .build();
72///
73/// let executor = hyper_util::rt::TokioExecutor::new();
74/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
75/// secret,
76/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77/// yup_oauth2::client::CustomHyperClientBuilder::from(
78/// hyper_util::client::legacy::Client::builder(executor).build(connector),
79/// ),
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83/// hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86/// hyper_rustls::HttpsConnectorBuilder::new()
87/// .with_native_roots()
88/// .unwrap()
89/// .https_or_http()
90/// .enable_http2()
91/// .build()
92/// );
93/// let mut hub = AnalyticsReporting::new(client, auth);
94/// // As the method needs a request, you would usually fill it with the desired information
95/// // into the respective structure. Some of the parts shown here might not be applicable !
96/// // Values shown here are possibly random and not representative !
97/// let mut req = SearchUserActivityRequest::default();
98///
99/// // You can configure optional parameters by calling the respective setters at will, and
100/// // execute the final call using `doit()`.
101/// // Values shown here are possibly random and not representative !
102/// let result = hub.user_activity().search(req)
103/// .doit().await;
104///
105/// match result {
106/// Err(e) => match e {
107/// // The Error enum provides details about what exactly happened.
108/// // You can also just use its `Debug`, `Display` or `Error` traits
109/// Error::HttpError(_)
110/// |Error::Io(_)
111/// |Error::MissingAPIKey
112/// |Error::MissingToken(_)
113/// |Error::Cancelled
114/// |Error::UploadSizeLimitExceeded(_, _)
115/// |Error::Failure(_)
116/// |Error::BadRequest(_)
117/// |Error::FieldClash(_)
118/// |Error::JsonDecodeError(_, _) => println!("{}", e),
119/// },
120/// Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct AnalyticsReporting<C> {
126 pub client: common::Client<C>,
127 pub auth: Box<dyn common::GetToken>,
128 _user_agent: String,
129 _base_url: String,
130 _root_url: String,
131}
132
133impl<C> common::Hub for AnalyticsReporting<C> {}
134
135impl<'a, C> AnalyticsReporting<C> {
136 pub fn new<A: 'static + common::GetToken>(
137 client: common::Client<C>,
138 auth: A,
139 ) -> AnalyticsReporting<C> {
140 AnalyticsReporting {
141 client,
142 auth: Box::new(auth),
143 _user_agent: "google-api-rust-client/7.0.0".to_string(),
144 _base_url: "https://analyticsreporting.googleapis.com/".to_string(),
145 _root_url: "https://analyticsreporting.googleapis.com/".to_string(),
146 }
147 }
148
149 pub fn reports(&'a self) -> ReportMethods<'a, C> {
150 ReportMethods { hub: self }
151 }
152 pub fn user_activity(&'a self) -> UserActivityMethods<'a, C> {
153 UserActivityMethods { hub: self }
154 }
155
156 /// Set the user-agent header field to use in all requests to the server.
157 /// It defaults to `google-api-rust-client/7.0.0`.
158 ///
159 /// Returns the previously set user-agent.
160 pub fn user_agent(&mut self, agent_name: String) -> String {
161 std::mem::replace(&mut self._user_agent, agent_name)
162 }
163
164 /// Set the base url to use in all requests to the server.
165 /// It defaults to `https://analyticsreporting.googleapis.com/`.
166 ///
167 /// Returns the previously set base url.
168 pub fn base_url(&mut self, new_base_url: String) -> String {
169 std::mem::replace(&mut self._base_url, new_base_url)
170 }
171
172 /// Set the root url to use in all requests to the server.
173 /// It defaults to `https://analyticsreporting.googleapis.com/`.
174 ///
175 /// Returns the previously set root url.
176 pub fn root_url(&mut self, new_root_url: String) -> String {
177 std::mem::replace(&mut self._root_url, new_root_url)
178 }
179}
180
181// ############
182// SCHEMAS ###
183// ##########
184/// An Activity represents data for an activity of a user. Note that an Activity is different from a hit. A hit might result in multiple Activity's. For example, if a hit includes a transaction and a goal completion, there will be two Activity protos for this hit, one for ECOMMERCE and one for GOAL. Conversely, multiple hits can also construct one Activity. In classic e-commerce, data for one transaction might be sent through multiple hits. These hits will be merged into one ECOMMERCE Activity.
185///
186/// This type is not used in any activity, and only used as *part* of another schema.
187///
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct Activity {
192 /// Timestamp of the activity. If activities for a visit cross midnight and occur in two separate dates, then two sessions (one per date) share the session identifier. For example, say session ID 113472 has activity within 2019-08-20, and session ID 243742 has activity within 2019-08-25 and 2019-08-26. Session ID 113472 is one session, and session ID 243742 is two sessions.
193 #[serde(rename = "activityTime")]
194 pub activity_time: Option<chrono::DateTime<chrono::offset::Utc>>,
195 /// Type of this activity.
196 #[serde(rename = "activityType")]
197 pub activity_type: Option<String>,
198 /// This will be set if `activity_type` equals `SCREEN_VIEW`.
199 pub appview: Option<ScreenviewData>,
200 /// For manual campaign tracking, it is the value of the utm_campaign campaign tracking parameter. For AdWords autotagging, it is the name(s) of the online ad campaign(s) you use for the property. If you use neither, its value is (not set).
201 pub campaign: Option<String>,
202 /// The Channel Group associated with an end user's session for this View (defined by the View's Channel Groupings).
203 #[serde(rename = "channelGrouping")]
204 pub channel_grouping: Option<String>,
205 /// A list of all custom dimensions associated with this activity.
206 #[serde(rename = "customDimension")]
207 pub custom_dimension: Option<Vec<CustomDimension>>,
208 /// This will be set if `activity_type` equals `ECOMMERCE`.
209 pub ecommerce: Option<EcommerceData>,
210 /// This field contains all the details pertaining to an event and will be set if `activity_type` equals `EVENT`.
211 pub event: Option<EventData>,
212 /// This field contains a list of all the goals that were reached in this activity when `activity_type` equals `GOAL`.
213 pub goals: Option<GoalSetData>,
214 /// The hostname from which the tracking request was made.
215 pub hostname: Option<String>,
216 /// For manual campaign tracking, it is the value of the utm_term campaign tracking parameter. For AdWords traffic, it contains the best matching targeting criteria. For the display network, where multiple targeting criteria could have caused the ad to show up, it returns the best matching targeting criteria as selected by Ads. This could be display_keyword, site placement, boomuserlist, user_interest, age, or gender. Otherwise its value is (not set).
217 pub keyword: Option<String>,
218 /// The first page in users' sessions, or the landing page.
219 #[serde(rename = "landingPagePath")]
220 pub landing_page_path: Option<String>,
221 /// The type of referrals. For manual campaign tracking, it is the value of the utm_medium campaign tracking parameter. For AdWords autotagging, it is cpc. If users came from a search engine detected by Google Analytics, it is organic. If the referrer is not a search engine, it is referral. If users came directly to the property and document.referrer is empty, its value is (none).
222 pub medium: Option<String>,
223 /// This will be set if `activity_type` equals `PAGEVIEW`. This field contains all the details about the visitor and the page that was visited.
224 pub pageview: Option<PageviewData>,
225 /// The source of referrals. For manual campaign tracking, it is the value of the utm_source campaign tracking parameter. For AdWords autotagging, it is google. If you use neither, it is the domain of the source (e.g., document.referrer) referring the users. It may also contain a port address. If users arrived without a referrer, its value is (direct).
226 pub source: Option<String>,
227}
228
229impl common::Part for Activity {}
230
231/// Defines a cohort. A cohort is a group of users who share a common characteristic. For example, all users with the same acquisition date belong to the same cohort.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct Cohort {
239 /// This is used for `FIRST_VISIT_DATE` cohort, the cohort selects users whose first visit date is between start date and end date defined in the DateRange. The date ranges should be aligned for cohort requests. If the request contains `ga:cohortNthDay` it should be exactly one day long, if `ga:cohortNthWeek` it should be aligned to the week boundary (starting at Sunday and ending Saturday), and for `ga:cohortNthMonth` the date range should be aligned to the month (starting at the first and ending on the last day of the month). For LTV requests there are no such restrictions. You do not need to supply a date range for the `reportsRequest.dateRanges` field.
240 #[serde(rename = "dateRange")]
241 pub date_range: Option<DateRange>,
242 /// A unique name for the cohort. If not defined name will be auto-generated with values cohort_[1234...].
243 pub name: Option<String>,
244 /// Type of the cohort. The only supported type as of now is `FIRST_VISIT_DATE`. If this field is unspecified the cohort is treated as `FIRST_VISIT_DATE` type cohort.
245 #[serde(rename = "type")]
246 pub type_: Option<String>,
247}
248
249impl common::Part for Cohort {}
250
251/// Defines a cohort group. For example: "cohortGroup": { "cohorts": [{ "name": "cohort 1", "type": "FIRST_VISIT_DATE", "dateRange": { "startDate": "2015-08-01", "endDate": "2015-08-01" } },{ "name": "cohort 2" "type": "FIRST_VISIT_DATE" "dateRange": { "startDate": "2015-07-01", "endDate": "2015-07-01" } }] }
252///
253/// This type is not used in any activity, and only used as *part* of another schema.
254///
255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
256#[serde_with::serde_as]
257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
258pub struct CohortGroup {
259 /// The definition for the cohort.
260 pub cohorts: Option<Vec<Cohort>>,
261 /// Enable Life Time Value (LTV). LTV measures lifetime value for users acquired through different channels. Please see: [Cohort Analysis](https://support.google.com/analytics/answer/6074676) and [Lifetime Value](https://support.google.com/analytics/answer/6182550) If the value of lifetimeValue is false: - The metric values are similar to the values in the web interface cohort report. - The cohort definition date ranges must be aligned to the calendar week and month. i.e. while requesting `ga:cohortNthWeek` the `startDate` in the cohort definition should be a Sunday and the `endDate` should be the following Saturday, and for `ga:cohortNthMonth`, the `startDate` should be the 1st of the month and `endDate` should be the last day of the month. When the lifetimeValue is true: - The metric values will correspond to the values in the web interface LifeTime value report. - The Lifetime Value report shows you how user value (Revenue) and engagement (Appviews, Goal Completions, Sessions, and Session Duration) grow during the 90 days after a user is acquired. - The metrics are calculated as a cumulative average per user per the time increment. - The cohort definition date ranges need not be aligned to the calendar week and month boundaries. - The `viewId` must be an [app view ID](https://support.google.com/analytics/answer/2649553#WebVersusAppViews)
262 #[serde(rename = "lifetimeValue")]
263 pub lifetime_value: Option<bool>,
264}
265
266impl common::Part for CohortGroup {}
267
268/// Column headers.
269///
270/// This type is not used in any activity, and only used as *part* of another schema.
271///
272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
273#[serde_with::serde_as]
274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
275pub struct ColumnHeader {
276 /// The dimension names in the response.
277 pub dimensions: Option<Vec<String>>,
278 /// Metric headers for the metrics in the response.
279 #[serde(rename = "metricHeader")]
280 pub metric_header: Option<MetricHeader>,
281}
282
283impl common::Part for ColumnHeader {}
284
285/// Custom dimension.
286///
287/// This type is not used in any activity, and only used as *part* of another schema.
288///
289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
290#[serde_with::serde_as]
291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
292pub struct CustomDimension {
293 /// Slot number of custom dimension.
294 pub index: Option<i32>,
295 /// Value of the custom dimension. Default value (i.e. empty string) indicates clearing sesion/visitor scope custom dimension value.
296 pub value: Option<String>,
297}
298
299impl common::Part for CustomDimension {}
300
301/// A contiguous set of days: startDate, startDate + 1 day, ..., endDate. The start and end dates are specified in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) date format `YYYY-MM-DD`.
302///
303/// This type is not used in any activity, and only used as *part* of another schema.
304///
305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
306#[serde_with::serde_as]
307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
308pub struct DateRange {
309 /// The end date for the query in the format `YYYY-MM-DD`.
310 #[serde(rename = "endDate")]
311 pub end_date: Option<String>,
312 /// The start date for the query in the format `YYYY-MM-DD`.
313 #[serde(rename = "startDate")]
314 pub start_date: Option<String>,
315}
316
317impl common::Part for DateRange {}
318
319/// Used to return a list of metrics for a single DateRange / dimension combination
320///
321/// This type is not used in any activity, and only used as *part* of another schema.
322///
323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
324#[serde_with::serde_as]
325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
326pub struct DateRangeValues {
327 /// The values of each pivot region.
328 #[serde(rename = "pivotValueRegions")]
329 pub pivot_value_regions: Option<Vec<PivotValueRegion>>,
330 /// Each value corresponds to each Metric in the request.
331 pub values: Option<Vec<String>>,
332}
333
334impl common::Part for DateRangeValues {}
335
336/// [Dimensions](https://support.google.com/analytics/answer/1033861) are attributes of your data. For example, the dimension `ga:city` indicates the city, for example, "Paris" or "New York", from which a session originates.
337///
338/// This type is not used in any activity, and only used as *part* of another schema.
339///
340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
341#[serde_with::serde_as]
342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
343pub struct Dimension {
344 /// If non-empty, we place dimension values into buckets after string to int64. Dimension values that are not the string representation of an integral value will be converted to zero. The bucket values have to be in increasing order. Each bucket is closed on the lower end, and open on the upper end. The "first" bucket includes all values less than the first boundary, the "last" bucket includes all values up to infinity. Dimension values that fall in a bucket get transformed to a new dimension value. For example, if one gives a list of "0, 1, 3, 4, 7", then we return the following buckets: - bucket #1: values < 0, dimension value "<0" - bucket #2: values in [0,1), dimension value "0" - bucket #3: values in [1,3), dimension value "1-2" - bucket #4: values in [3,4), dimension value "3" - bucket #5: values in [4,7), dimension value "4-6" - bucket #6: values >= 7, dimension value "7+" NOTE: If you are applying histogram mutation on any dimension, and using that dimension in sort, you will want to use the sort type `HISTOGRAM_BUCKET` for that purpose. Without that the dimension values will be sorted according to dictionary (lexicographic) order. For example the ascending dictionary order is: "<50", "1001+", "121-1000", "50-120" And the ascending `HISTOGRAM_BUCKET` order is: "<50", "50-120", "121-1000", "1001+" The client has to explicitly request `"orderType": "HISTOGRAM_BUCKET"` for a histogram-mutated dimension.
345 #[serde(rename = "histogramBuckets")]
346 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
347 pub histogram_buckets: Option<Vec<i64>>,
348 /// Name of the dimension to fetch, for example `ga:browser`.
349 pub name: Option<String>,
350}
351
352impl common::Part for Dimension {}
353
354/// Dimension filter specifies the filtering options on a dimension.
355///
356/// This type is not used in any activity, and only used as *part* of another schema.
357///
358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
359#[serde_with::serde_as]
360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
361pub struct DimensionFilter {
362 /// Should the match be case sensitive? Default is false.
363 #[serde(rename = "caseSensitive")]
364 pub case_sensitive: Option<bool>,
365 /// The dimension to filter on. A DimensionFilter must contain a dimension.
366 #[serde(rename = "dimensionName")]
367 pub dimension_name: Option<String>,
368 /// Strings or regular expression to match against. Only the first value of the list is used for comparison unless the operator is `IN_LIST`. If `IN_LIST` operator, then the entire list is used to filter the dimensions as explained in the description of the `IN_LIST` operator.
369 pub expressions: Option<Vec<String>>,
370 /// Logical `NOT` operator. If this boolean is set to true, then the matching dimension values will be excluded in the report. The default is false.
371 pub not: Option<bool>,
372 /// How to match the dimension to the expression. The default is REGEXP.
373 pub operator: Option<String>,
374}
375
376impl common::Part for DimensionFilter {}
377
378/// A group of dimension filters. Set the operator value to specify how the filters are logically combined.
379///
380/// This type is not used in any activity, and only used as *part* of another schema.
381///
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct DimensionFilterClause {
386 /// The repeated set of filters. They are logically combined based on the operator specified.
387 pub filters: Option<Vec<DimensionFilter>>,
388 /// The operator for combining multiple dimension filters. If unspecified, it is treated as an `OR`.
389 pub operator: Option<String>,
390}
391
392impl common::Part for DimensionFilterClause {}
393
394/// Dynamic segment definition for defining the segment within the request. A segment can select users, sessions or both.
395///
396/// This type is not used in any activity, and only used as *part* of another schema.
397///
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct DynamicSegment {
402 /// The name of the dynamic segment.
403 pub name: Option<String>,
404 /// Session Segment to select sessions to include in the segment.
405 #[serde(rename = "sessionSegment")]
406 pub session_segment: Option<SegmentDefinition>,
407 /// User Segment to select users to include in the segment.
408 #[serde(rename = "userSegment")]
409 pub user_segment: Option<SegmentDefinition>,
410}
411
412impl common::Part for DynamicSegment {}
413
414/// E-commerce details associated with the user activity.
415///
416/// This type is not used in any activity, and only used as *part* of another schema.
417///
418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
419#[serde_with::serde_as]
420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
421pub struct EcommerceData {
422 /// Action associated with this e-commerce action.
423 #[serde(rename = "actionType")]
424 pub action_type: Option<String>,
425 /// The type of this e-commerce activity.
426 #[serde(rename = "ecommerceType")]
427 pub ecommerce_type: Option<String>,
428 /// Details of the products in this transaction.
429 pub products: Option<Vec<ProductData>>,
430 /// Transaction details of this e-commerce action.
431 pub transaction: Option<TransactionData>,
432}
433
434impl common::Part for EcommerceData {}
435
436/// Represents all the details pertaining to an event.
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct EventData {
444 /// Type of interaction with the object. Eg: 'play'.
445 #[serde(rename = "eventAction")]
446 pub event_action: Option<String>,
447 /// The object on the page that was interacted with. Eg: 'Video'.
448 #[serde(rename = "eventCategory")]
449 pub event_category: Option<String>,
450 /// Number of such events in this activity.
451 #[serde(rename = "eventCount")]
452 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
453 pub event_count: Option<i64>,
454 /// Label attached with the event.
455 #[serde(rename = "eventLabel")]
456 pub event_label: Option<String>,
457 /// Numeric value associated with the event.
458 #[serde(rename = "eventValue")]
459 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
460 pub event_value: Option<i64>,
461}
462
463impl common::Part for EventData {}
464
465/// The batch request containing multiple report request.
466///
467/// # Activities
468///
469/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
470/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
471///
472/// * [batch get reports](ReportBatchGetCall) (request)
473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
474#[serde_with::serde_as]
475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
476pub struct GetReportsRequest {
477 /// Requests, each request will have a separate response. There can be a maximum of 5 requests. All requests should have the same `dateRanges`, `viewId`, `segments`, `samplingLevel`, and `cohortGroup`.
478 #[serde(rename = "reportRequests")]
479 pub report_requests: Option<Vec<ReportRequest>>,
480 /// Enables [resource based quotas](https://developers.google.com/analytics/devguides/reporting/core/v4/limits-quotas#analytics_reporting_api_v4), (defaults to `False`). If this field is set to `True` the per view (profile) quotas are governed by the computational cost of the request. Note that using cost based quotas will higher enable sampling rates. (10 Million for `SMALL`, 100M for `LARGE`. See the [limits and quotas documentation](https://developers.google.com/analytics/devguides/reporting/core/v4/limits-quotas#analytics_reporting_api_v4) for details.
481 #[serde(rename = "useResourceQuotas")]
482 pub use_resource_quotas: Option<bool>,
483}
484
485impl common::RequestValue for GetReportsRequest {}
486
487/// The main response class which holds the reports from the Reporting API `batchGet` call.
488///
489/// # Activities
490///
491/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
492/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
493///
494/// * [batch get reports](ReportBatchGetCall) (response)
495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
496#[serde_with::serde_as]
497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
498pub struct GetReportsResponse {
499 /// The amount of resource quota tokens deducted to execute the query. Includes all responses.
500 #[serde(rename = "queryCost")]
501 pub query_cost: Option<i32>,
502 /// Responses corresponding to each of the request.
503 pub reports: Option<Vec<Report>>,
504 /// The amount of resource quota remaining for the property.
505 #[serde(rename = "resourceQuotasRemaining")]
506 pub resource_quotas_remaining: Option<ResourceQuotasRemaining>,
507}
508
509impl common::ResponseResult for GetReportsResponse {}
510
511/// Represents all the details pertaining to a goal.
512///
513/// This type is not used in any activity, and only used as *part* of another schema.
514///
515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
516#[serde_with::serde_as]
517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
518pub struct GoalData {
519 /// URL of the page where this goal was completed.
520 #[serde(rename = "goalCompletionLocation")]
521 pub goal_completion_location: Option<String>,
522 /// Total number of goal completions in this activity.
523 #[serde(rename = "goalCompletions")]
524 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
525 pub goal_completions: Option<i64>,
526 /// This identifies the goal as configured for the profile.
527 #[serde(rename = "goalIndex")]
528 pub goal_index: Option<i32>,
529 /// Name of the goal.
530 #[serde(rename = "goalName")]
531 pub goal_name: Option<String>,
532 /// URL of the page one step prior to the goal completion.
533 #[serde(rename = "goalPreviousStep1")]
534 pub goal_previous_step1: Option<String>,
535 /// URL of the page two steps prior to the goal completion.
536 #[serde(rename = "goalPreviousStep2")]
537 pub goal_previous_step2: Option<String>,
538 /// URL of the page three steps prior to the goal completion.
539 #[serde(rename = "goalPreviousStep3")]
540 pub goal_previous_step3: Option<String>,
541 /// Value in this goal.
542 #[serde(rename = "goalValue")]
543 pub goal_value: Option<f64>,
544}
545
546impl common::Part for GoalData {}
547
548/// Represents a set of goals that were reached in an activity.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct GoalSetData {
556 /// All the goals that were reached in the current activity.
557 pub goals: Option<Vec<GoalData>>,
558}
559
560impl common::Part for GoalSetData {}
561
562/// [Metrics](https://support.google.com/analytics/answer/1033861) are the quantitative measurements. For example, the metric `ga:users` indicates the total number of users for the requested time period.
563///
564/// This type is not used in any activity, and only used as *part* of another schema.
565///
566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
567#[serde_with::serde_as]
568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
569pub struct Metric {
570 /// An alias for the metric expression is an alternate name for the expression. The alias can be used for filtering and sorting. This field is optional and is useful if the expression is not a single metric but a complex expression which cannot be used in filtering and sorting. The alias is also used in the response column header.
571 pub alias: Option<String>,
572 /// A metric expression in the request. An expression is constructed from one or more metrics and numbers. Accepted operators include: Plus (+), Minus (-), Negation (Unary -), Divided by (/), Multiplied by (*), Parenthesis, Positive cardinal numbers (0-9), can include decimals and is limited to 1024 characters. Example `ga:totalRefunds/ga:users`, in most cases the metric expression is just a single metric name like `ga:users`. Adding mixed `MetricType` (E.g., `CURRENCY` + `PERCENTAGE`) metrics will result in unexpected results.
573 pub expression: Option<String>,
574 /// Specifies how the metric expression should be formatted, for example `INTEGER`.
575 #[serde(rename = "formattingType")]
576 pub formatting_type: Option<String>,
577}
578
579impl common::Part for Metric {}
580
581/// MetricFilter specifies the filter on a metric.
582///
583/// This type is not used in any activity, and only used as *part* of another schema.
584///
585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
586#[serde_with::serde_as]
587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
588pub struct MetricFilter {
589 /// The value to compare against.
590 #[serde(rename = "comparisonValue")]
591 pub comparison_value: Option<String>,
592 /// The metric that will be filtered on. A metricFilter must contain a metric name. A metric name can be an alias earlier defined as a metric or it can also be a metric expression.
593 #[serde(rename = "metricName")]
594 pub metric_name: Option<String>,
595 /// Logical `NOT` operator. If this boolean is set to true, then the matching metric values will be excluded in the report. The default is false.
596 pub not: Option<bool>,
597 /// Is the metric `EQUAL`, `LESS_THAN` or `GREATER_THAN` the comparisonValue, the default is `EQUAL`. If the operator is `IS_MISSING`, checks if the metric is missing and would ignore the comparisonValue.
598 pub operator: Option<String>,
599}
600
601impl common::Part for MetricFilter {}
602
603/// Represents a group of metric filters. Set the operator value to specify how the filters are logically combined.
604///
605/// This type is not used in any activity, and only used as *part* of another schema.
606///
607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
608#[serde_with::serde_as]
609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
610pub struct MetricFilterClause {
611 /// The repeated set of filters. They are logically combined based on the operator specified.
612 pub filters: Option<Vec<MetricFilter>>,
613 /// The operator for combining multiple metric filters. If unspecified, it is treated as an `OR`.
614 pub operator: Option<String>,
615}
616
617impl common::Part for MetricFilterClause {}
618
619/// The headers for the metrics.
620///
621/// This type is not used in any activity, and only used as *part* of another schema.
622///
623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
624#[serde_with::serde_as]
625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
626pub struct MetricHeader {
627 /// Headers for the metrics in the response.
628 #[serde(rename = "metricHeaderEntries")]
629 pub metric_header_entries: Option<Vec<MetricHeaderEntry>>,
630 /// Headers for the pivots in the response.
631 #[serde(rename = "pivotHeaders")]
632 pub pivot_headers: Option<Vec<PivotHeader>>,
633}
634
635impl common::Part for MetricHeader {}
636
637/// Header for the metrics.
638///
639/// This type is not used in any activity, and only used as *part* of another schema.
640///
641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
642#[serde_with::serde_as]
643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
644pub struct MetricHeaderEntry {
645 /// The name of the header.
646 pub name: Option<String>,
647 /// The type of the metric, for example `INTEGER`.
648 #[serde(rename = "type")]
649 pub type_: Option<String>,
650}
651
652impl common::Part for MetricHeaderEntry {}
653
654/// A list of segment filters in the `OR` group are combined with the logical OR operator.
655///
656/// This type is not used in any activity, and only used as *part* of another schema.
657///
658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
659#[serde_with::serde_as]
660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
661pub struct OrFiltersForSegment {
662 /// List of segment filters to be combined with a `OR` operator.
663 #[serde(rename = "segmentFilterClauses")]
664 pub segment_filter_clauses: Option<Vec<SegmentFilterClause>>,
665}
666
667impl common::Part for OrFiltersForSegment {}
668
669/// Specifies the sorting options.
670///
671/// This type is not used in any activity, and only used as *part* of another schema.
672///
673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
674#[serde_with::serde_as]
675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
676pub struct OrderBy {
677 /// The field which to sort by. The default sort order is ascending. Example: `ga:browser`. Note, that you can only specify one field for sort here. For example, `ga:browser, ga:city` is not valid.
678 #[serde(rename = "fieldName")]
679 pub field_name: Option<String>,
680 /// The order type. The default orderType is `VALUE`.
681 #[serde(rename = "orderType")]
682 pub order_type: Option<String>,
683 /// The sorting order for the field.
684 #[serde(rename = "sortOrder")]
685 pub sort_order: Option<String>,
686}
687
688impl common::Part for OrderBy {}
689
690/// Represents details collected when the visitor views a page.
691///
692/// This type is not used in any activity, and only used as *part* of another schema.
693///
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct PageviewData {
698 /// The URL of the page that the visitor viewed.
699 #[serde(rename = "pagePath")]
700 pub page_path: Option<String>,
701 /// The title of the page that the visitor viewed.
702 #[serde(rename = "pageTitle")]
703 pub page_title: Option<String>,
704}
705
706impl common::Part for PageviewData {}
707
708/// The Pivot describes the pivot section in the request. The Pivot helps rearrange the information in the table for certain reports by pivoting your data on a second dimension.
709///
710/// This type is not used in any activity, and only used as *part* of another schema.
711///
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct Pivot {
716 /// DimensionFilterClauses are logically combined with an `AND` operator: only data that is included by all these DimensionFilterClauses contributes to the values in this pivot region. Dimension filters can be used to restrict the columns shown in the pivot region. For example if you have `ga:browser` as the requested dimension in the pivot region, and you specify key filters to restrict `ga:browser` to only "IE" or "Firefox", then only those two browsers would show up as columns.
717 #[serde(rename = "dimensionFilterClauses")]
718 pub dimension_filter_clauses: Option<Vec<DimensionFilterClause>>,
719 /// A list of dimensions to show as pivot columns. A Pivot can have a maximum of 4 dimensions. Pivot dimensions are part of the restriction on the total number of dimensions allowed in the request.
720 pub dimensions: Option<Vec<Dimension>>,
721 /// Specifies the maximum number of groups to return. The default value is 10, also the maximum value is 1,000.
722 #[serde(rename = "maxGroupCount")]
723 pub max_group_count: Option<i32>,
724 /// The pivot metrics. Pivot metrics are part of the restriction on total number of metrics allowed in the request.
725 pub metrics: Option<Vec<Metric>>,
726 /// If k metrics were requested, then the response will contain some data-dependent multiple of k columns in the report. E.g., if you pivoted on the dimension `ga:browser` then you'd get k columns for "Firefox", k columns for "IE", k columns for "Chrome", etc. The ordering of the groups of columns is determined by descending order of "total" for the first of the k values. Ties are broken by lexicographic ordering of the first pivot dimension, then lexicographic ordering of the second pivot dimension, and so on. E.g., if the totals for the first value for Firefox, IE, and Chrome were 8, 2, 8, respectively, the order of columns would be Chrome, Firefox, IE. The following let you choose which of the groups of k columns are included in the response.
727 #[serde(rename = "startGroup")]
728 pub start_group: Option<i32>,
729}
730
731impl common::Part for Pivot {}
732
733/// The headers for each of the pivot sections defined in the request.
734///
735/// This type is not used in any activity, and only used as *part* of another schema.
736///
737#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
738#[serde_with::serde_as]
739#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
740pub struct PivotHeader {
741 /// A single pivot section header.
742 #[serde(rename = "pivotHeaderEntries")]
743 pub pivot_header_entries: Option<Vec<PivotHeaderEntry>>,
744 /// The total number of groups for this pivot.
745 #[serde(rename = "totalPivotGroupsCount")]
746 pub total_pivot_groups_count: Option<i32>,
747}
748
749impl common::Part for PivotHeader {}
750
751/// The headers for the each of the metric column corresponding to the metrics requested in the pivots section of the response.
752///
753/// This type is not used in any activity, and only used as *part* of another schema.
754///
755#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
756#[serde_with::serde_as]
757#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
758pub struct PivotHeaderEntry {
759 /// The name of the dimensions in the pivot response.
760 #[serde(rename = "dimensionNames")]
761 pub dimension_names: Option<Vec<String>>,
762 /// The values for the dimensions in the pivot.
763 #[serde(rename = "dimensionValues")]
764 pub dimension_values: Option<Vec<String>>,
765 /// The metric header for the metric in the pivot.
766 pub metric: Option<MetricHeaderEntry>,
767}
768
769impl common::Part for PivotHeaderEntry {}
770
771/// The metric values in the pivot region.
772///
773/// This type is not used in any activity, and only used as *part* of another schema.
774///
775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
776#[serde_with::serde_as]
777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
778pub struct PivotValueRegion {
779 /// The values of the metrics in each of the pivot regions.
780 pub values: Option<Vec<String>>,
781}
782
783impl common::Part for PivotValueRegion {}
784
785/// Details of the products in an e-commerce transaction.
786///
787/// This type is not used in any activity, and only used as *part* of another schema.
788///
789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
790#[serde_with::serde_as]
791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
792pub struct ProductData {
793 /// The total revenue from purchased product items.
794 #[serde(rename = "itemRevenue")]
795 pub item_revenue: Option<f64>,
796 /// The product name, supplied by the e-commerce tracking application, for the purchased items.
797 #[serde(rename = "productName")]
798 pub product_name: Option<String>,
799 /// Total number of this product units in the transaction.
800 #[serde(rename = "productQuantity")]
801 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
802 pub product_quantity: Option<i64>,
803 /// Unique code that represents the product.
804 #[serde(rename = "productSku")]
805 pub product_sku: Option<String>,
806}
807
808impl common::Part for ProductData {}
809
810/// The data response corresponding to the request.
811///
812/// # Activities
813///
814/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
815/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
816///
817/// * [batch get reports](ReportBatchGetCall) (none)
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct Report {
822 /// The column headers.
823 #[serde(rename = "columnHeader")]
824 pub column_header: Option<ColumnHeader>,
825 /// Response data.
826 pub data: Option<ReportData>,
827 /// Page token to retrieve the next page of results in the list.
828 #[serde(rename = "nextPageToken")]
829 pub next_page_token: Option<String>,
830}
831
832impl common::Resource for Report {}
833
834/// The data part of the report.
835///
836/// This type is not used in any activity, and only used as *part* of another schema.
837///
838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
839#[serde_with::serde_as]
840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
841pub struct ReportData {
842 /// The last time the data in the report was refreshed. All the hits received before this timestamp are included in the calculation of the report.
843 #[serde(rename = "dataLastRefreshed")]
844 pub data_last_refreshed: Option<chrono::DateTime<chrono::offset::Utc>>,
845 /// If empty reason is specified, the report is empty for this reason.
846 #[serde(rename = "emptyReason")]
847 pub empty_reason: Option<String>,
848 /// Indicates if response to this request is golden or not. Data is golden when the exact same request will not produce any new results if asked at a later point in time.
849 #[serde(rename = "isDataGolden")]
850 pub is_data_golden: Option<bool>,
851 /// Minimum and maximum values seen over all matching rows. These are both empty when `hideValueRanges` in the request is false, or when rowCount is zero.
852 pub maximums: Option<Vec<DateRangeValues>>,
853 /// Minimum and maximum values seen over all matching rows. These are both empty when `hideValueRanges` in the request is false, or when rowCount is zero.
854 pub minimums: Option<Vec<DateRangeValues>>,
855 /// Total number of matching rows for this query.
856 #[serde(rename = "rowCount")]
857 pub row_count: Option<i32>,
858 /// There's one ReportRow for every unique combination of dimensions.
859 pub rows: Option<Vec<ReportRow>>,
860 /// If the results are [sampled](https://support.google.com/analytics/answer/2637192), this returns the total number of samples read, one entry per date range. If the results are not sampled this field will not be defined. See [developer guide](https://developers.google.com/analytics/devguides/reporting/core/v4/basics#sampling) for details.
861 #[serde(rename = "samplesReadCounts")]
862 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
863 pub samples_read_counts: Option<Vec<i64>>,
864 /// If the results are [sampled](https://support.google.com/analytics/answer/2637192), this returns the total number of samples present, one entry per date range. If the results are not sampled this field will not be defined. See [developer guide](https://developers.google.com/analytics/devguides/reporting/core/v4/basics#sampling) for details.
865 #[serde(rename = "samplingSpaceSizes")]
866 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
867 pub sampling_space_sizes: Option<Vec<i64>>,
868 /// For each requested date range, for the set of all rows that match the query, every requested value format gets a total. The total for a value format is computed by first totaling the metrics mentioned in the value format and then evaluating the value format as a scalar expression. E.g., The "totals" for `3 / (ga:sessions + 2)` we compute `3 / ((sum of all relevant ga:sessions) + 2)`. Totals are computed before pagination.
869 pub totals: Option<Vec<DateRangeValues>>,
870}
871
872impl common::Part for ReportData {}
873
874/// The main request class which specifies the Reporting API request.
875///
876/// This type is not used in any activity, and only used as *part* of another schema.
877///
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct ReportRequest {
882 /// Cohort group associated with this request. If there is a cohort group in the request the `ga:cohort` dimension must be present. Every [ReportRequest](#ReportRequest) within a `batchGet` method must contain the same `cohortGroup` definition.
883 #[serde(rename = "cohortGroup")]
884 pub cohort_group: Option<CohortGroup>,
885 /// Date ranges in the request. The request can have a maximum of 2 date ranges. The response will contain a set of metric values for each combination of the dimensions for each date range in the request. So, if there are two date ranges, there will be two set of metric values, one for the original date range and one for the second date range. The `reportRequest.dateRanges` field should not be specified for cohorts or Lifetime value requests. If a date range is not provided, the default date range is (startDate: current date - 7 days, endDate: current date - 1 day). Every [ReportRequest](#ReportRequest) within a `batchGet` method must contain the same `dateRanges` definition.
886 #[serde(rename = "dateRanges")]
887 pub date_ranges: Option<Vec<DateRange>>,
888 /// The dimension filter clauses for filtering Dimension Values. They are logically combined with the `AND` operator. Note that filtering occurs before any dimensions are aggregated, so that the returned metrics represent the total for only the relevant dimensions.
889 #[serde(rename = "dimensionFilterClauses")]
890 pub dimension_filter_clauses: Option<Vec<DimensionFilterClause>>,
891 /// The dimensions requested. Requests can have a total of 9 dimensions.
892 pub dimensions: Option<Vec<Dimension>>,
893 /// Dimension or metric filters that restrict the data returned for your request. To use the `filtersExpression`, supply a dimension or metric on which to filter, followed by the filter expression. For example, the following expression selects `ga:browser` dimension which starts with Firefox; `ga:browser=~^Firefox`. For more information on dimensions and metric filters, see [Filters reference](https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters).
894 #[serde(rename = "filtersExpression")]
895 pub filters_expression: Option<String>,
896 /// If set to true, hides the total of all metrics for all the matching rows, for every date range. The default false and will return the totals.
897 #[serde(rename = "hideTotals")]
898 pub hide_totals: Option<bool>,
899 /// If set to true, hides the minimum and maximum across all matching rows. The default is false and the value ranges are returned.
900 #[serde(rename = "hideValueRanges")]
901 pub hide_value_ranges: Option<bool>,
902 /// If set to false, the response does not include rows if all the retrieved metrics are equal to zero. The default is false which will exclude these rows.
903 #[serde(rename = "includeEmptyRows")]
904 pub include_empty_rows: Option<bool>,
905 /// The metric filter clauses. They are logically combined with the `AND` operator. Metric filters look at only the first date range and not the comparing date range. Note that filtering on metrics occurs after the metrics are aggregated.
906 #[serde(rename = "metricFilterClauses")]
907 pub metric_filter_clauses: Option<Vec<MetricFilterClause>>,
908 /// The metrics requested. Requests must specify at least one metric. Requests can have a total of 10 metrics.
909 pub metrics: Option<Vec<Metric>>,
910 /// Sort order on output rows. To compare two rows, the elements of the following are applied in order until a difference is found. All date ranges in the output get the same row order.
911 #[serde(rename = "orderBys")]
912 pub order_bys: Option<Vec<OrderBy>>,
913 /// Page size is for paging and specifies the maximum number of returned rows. Page size should be >= 0. A query returns the default of 1,000 rows. The Analytics Core Reporting API returns a maximum of 100,000 rows per request, no matter how many you ask for. It can also return fewer rows than requested, if there aren't as many dimension segments as you expect. For instance, there are fewer than 300 possible values for `ga:country`, so when segmenting only by country, you can't get more than 300 rows, even if you set `pageSize` to a higher value.
914 #[serde(rename = "pageSize")]
915 pub page_size: Option<i32>,
916 /// A continuation token to get the next page of the results. Adding this to the request will return the rows after the pageToken. The pageToken should be the value returned in the nextPageToken parameter in the response to the GetReports request.
917 #[serde(rename = "pageToken")]
918 pub page_token: Option<String>,
919 /// The pivot definitions. Requests can have a maximum of 2 pivots.
920 pub pivots: Option<Vec<Pivot>>,
921 /// The desired report [sample](https://support.google.com/analytics/answer/2637192) size. If the the `samplingLevel` field is unspecified the `DEFAULT` sampling level is used. Every [ReportRequest](#ReportRequest) within a `batchGet` method must contain the same `samplingLevel` definition. See [developer guide](https://developers.google.com/analytics/devguides/reporting/core/v4/basics#sampling) for details.
922 #[serde(rename = "samplingLevel")]
923 pub sampling_level: Option<String>,
924 /// Segment the data returned for the request. A segment definition helps look at a subset of the segment request. A request can contain up to four segments. Every [ReportRequest](#ReportRequest) within a `batchGet` method must contain the same `segments` definition. Requests with segments must have the `ga:segment` dimension.
925 pub segments: Option<Vec<Segment>>,
926 /// The Analytics [view ID](https://support.google.com/analytics/answer/1009618) from which to retrieve data. Every [ReportRequest](#ReportRequest) within a `batchGet` method must contain the same `viewId`.
927 #[serde(rename = "viewId")]
928 pub view_id: Option<String>,
929}
930
931impl common::Part for ReportRequest {}
932
933/// A row in the report.
934///
935/// This type is not used in any activity, and only used as *part* of another schema.
936///
937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
938#[serde_with::serde_as]
939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
940pub struct ReportRow {
941 /// List of requested dimensions.
942 pub dimensions: Option<Vec<String>>,
943 /// List of metrics for each requested DateRange.
944 pub metrics: Option<Vec<DateRangeValues>>,
945}
946
947impl common::Part for ReportRow {}
948
949/// The resource quota tokens remaining for the property after the request is completed.
950///
951/// This type is not used in any activity, and only used as *part* of another schema.
952///
953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
954#[serde_with::serde_as]
955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
956pub struct ResourceQuotasRemaining {
957 /// Daily resource quota remaining remaining.
958 #[serde(rename = "dailyQuotaTokensRemaining")]
959 pub daily_quota_tokens_remaining: Option<i32>,
960 /// Hourly resource quota tokens remaining.
961 #[serde(rename = "hourlyQuotaTokensRemaining")]
962 pub hourly_quota_tokens_remaining: Option<i32>,
963}
964
965impl common::Part for ResourceQuotasRemaining {}
966
967/// There is no detailed description.
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct ScreenviewData {
975 /// The application name.
976 #[serde(rename = "appName")]
977 pub app_name: Option<String>,
978 /// Mobile manufacturer or branded name. Eg: "Google", "Apple" etc.
979 #[serde(rename = "mobileDeviceBranding")]
980 pub mobile_device_branding: Option<String>,
981 /// Mobile device model. Eg: "Pixel", "iPhone" etc.
982 #[serde(rename = "mobileDeviceModel")]
983 pub mobile_device_model: Option<String>,
984 /// The name of the screen.
985 #[serde(rename = "screenName")]
986 pub screen_name: Option<String>,
987}
988
989impl common::Part for ScreenviewData {}
990
991/// The request to fetch User Report from Reporting API `userActivity:get` call.
992///
993/// # Activities
994///
995/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
996/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
997///
998/// * [search user activity](UserActivitySearchCall) (request)
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct SearchUserActivityRequest {
1003 /// Set of all activity types being requested. Only acvities matching these types will be returned in the response. If empty, all activies will be returned.
1004 #[serde(rename = "activityTypes")]
1005 pub activity_types: Option<Vec<String>>,
1006 /// Date range for which to retrieve the user activity. If a date range is not provided, the default date range is (startDate: current date - 7 days, endDate: current date - 1 day).
1007 #[serde(rename = "dateRange")]
1008 pub date_range: Option<DateRange>,
1009 /// Page size is for paging and specifies the maximum number of returned rows. Page size should be > 0. If the value is 0 or if the field isn't specified, the request returns the default of 1000 rows per page.
1010 #[serde(rename = "pageSize")]
1011 pub page_size: Option<i32>,
1012 /// A continuation token to get the next page of the results. Adding this to the request will return the rows after the pageToken. The pageToken should be the value returned in the nextPageToken parameter in the response to the [SearchUserActivityRequest](#SearchUserActivityRequest) request.
1013 #[serde(rename = "pageToken")]
1014 pub page_token: Option<String>,
1015 /// Required. Unique user Id to query for. Every [SearchUserActivityRequest](#SearchUserActivityRequest) must contain this field.
1016 pub user: Option<User>,
1017 /// Required. The Analytics [view ID](https://support.google.com/analytics/answer/1009618) from which to retrieve data. Every [SearchUserActivityRequest](#SearchUserActivityRequest) must contain the `viewId`.
1018 #[serde(rename = "viewId")]
1019 pub view_id: Option<String>,
1020}
1021
1022impl common::RequestValue for SearchUserActivityRequest {}
1023
1024/// The response from `userActivity:get` call.
1025///
1026/// # Activities
1027///
1028/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1029/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1030///
1031/// * [search user activity](UserActivitySearchCall) (response)
1032#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1033#[serde_with::serde_as]
1034#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1035pub struct SearchUserActivityResponse {
1036 /// This token should be passed to [SearchUserActivityRequest](#SearchUserActivityRequest) to retrieve the next page.
1037 #[serde(rename = "nextPageToken")]
1038 pub next_page_token: Option<String>,
1039 /// This field represents the [sampling rate](https://support.google.com/analytics/answer/2637192) for the given request and is a number between 0.0 to 1.0. See [developer guide](https://developers.google.com/analytics/devguides/reporting/core/v4/basics#sampling) for details.
1040 #[serde(rename = "sampleRate")]
1041 pub sample_rate: Option<f64>,
1042 /// Each record represents a session (device details, duration, etc).
1043 pub sessions: Option<Vec<UserActivitySession>>,
1044 /// Total rows returned by this query (across different pages).
1045 #[serde(rename = "totalRows")]
1046 pub total_rows: Option<i32>,
1047}
1048
1049impl common::ResponseResult for SearchUserActivityResponse {}
1050
1051/// The segment definition, if the report needs to be segmented. A Segment is a subset of the Analytics data. For example, of the entire set of users, one Segment might be users from a particular country or city.
1052///
1053/// This type is not used in any activity, and only used as *part* of another schema.
1054///
1055#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1056#[serde_with::serde_as]
1057#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1058pub struct Segment {
1059 /// A dynamic segment definition in the request.
1060 #[serde(rename = "dynamicSegment")]
1061 pub dynamic_segment: Option<DynamicSegment>,
1062 /// The segment ID of a built-in or custom segment, for example `gaid::-3`.
1063 #[serde(rename = "segmentId")]
1064 pub segment_id: Option<String>,
1065}
1066
1067impl common::Part for Segment {}
1068
1069/// SegmentDefinition defines the segment to be a set of SegmentFilters which are combined together with a logical `AND` operation.
1070///
1071/// This type is not used in any activity, and only used as *part* of another schema.
1072///
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct SegmentDefinition {
1077 /// A segment is defined by a set of segment filters which are combined together with a logical `AND` operation.
1078 #[serde(rename = "segmentFilters")]
1079 pub segment_filters: Option<Vec<SegmentFilter>>,
1080}
1081
1082impl common::Part for SegmentDefinition {}
1083
1084/// Dimension filter specifies the filtering options on a dimension.
1085///
1086/// This type is not used in any activity, and only used as *part* of another schema.
1087///
1088#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1089#[serde_with::serde_as]
1090#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1091pub struct SegmentDimensionFilter {
1092 /// Should the match be case sensitive, ignored for `IN_LIST` operator.
1093 #[serde(rename = "caseSensitive")]
1094 pub case_sensitive: Option<bool>,
1095 /// Name of the dimension for which the filter is being applied.
1096 #[serde(rename = "dimensionName")]
1097 pub dimension_name: Option<String>,
1098 /// The list of expressions, only the first element is used for all operators
1099 pub expressions: Option<Vec<String>>,
1100 /// Maximum comparison values for `BETWEEN` match type.
1101 #[serde(rename = "maxComparisonValue")]
1102 pub max_comparison_value: Option<String>,
1103 /// Minimum comparison values for `BETWEEN` match type.
1104 #[serde(rename = "minComparisonValue")]
1105 pub min_comparison_value: Option<String>,
1106 /// The operator to use to match the dimension with the expressions.
1107 pub operator: Option<String>,
1108}
1109
1110impl common::Part for SegmentDimensionFilter {}
1111
1112/// SegmentFilter defines the segment to be either a simple or a sequence segment. A simple segment condition contains dimension and metric conditions to select the sessions or users. A sequence segment condition can be used to select users or sessions based on sequential conditions.
1113///
1114/// This type is not used in any activity, and only used as *part* of another schema.
1115///
1116#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1117#[serde_with::serde_as]
1118#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1119pub struct SegmentFilter {
1120 /// If true, match the complement of simple or sequence segment. For example, to match all visits not from "New York", we can define the segment as follows: "sessionSegment": { "segmentFilters": [{ "simpleSegment" :{ "orFiltersForSegment": [{ "segmentFilterClauses":[{ "dimensionFilter": { "dimensionName": "ga:city", "expressions": ["New York"] } }] }] }, "not": "True" }] },
1121 pub not: Option<bool>,
1122 /// Sequence conditions consist of one or more steps, where each step is defined by one or more dimension/metric conditions. Multiple steps can be combined with special sequence operators.
1123 #[serde(rename = "sequenceSegment")]
1124 pub sequence_segment: Option<SequenceSegment>,
1125 /// A Simple segment conditions consist of one or more dimension/metric conditions that can be combined
1126 #[serde(rename = "simpleSegment")]
1127 pub simple_segment: Option<SimpleSegment>,
1128}
1129
1130impl common::Part for SegmentFilter {}
1131
1132/// Filter Clause to be used in a segment definition, can be wither a metric or a dimension filter.
1133///
1134/// This type is not used in any activity, and only used as *part* of another schema.
1135///
1136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1137#[serde_with::serde_as]
1138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1139pub struct SegmentFilterClause {
1140 /// Dimension Filter for the segment definition.
1141 #[serde(rename = "dimensionFilter")]
1142 pub dimension_filter: Option<SegmentDimensionFilter>,
1143 /// Metric Filter for the segment definition.
1144 #[serde(rename = "metricFilter")]
1145 pub metric_filter: Option<SegmentMetricFilter>,
1146 /// Matches the complement (`!`) of the filter.
1147 pub not: Option<bool>,
1148}
1149
1150impl common::Part for SegmentFilterClause {}
1151
1152/// Metric filter to be used in a segment filter clause.
1153///
1154/// This type is not used in any activity, and only used as *part* of another schema.
1155///
1156#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1157#[serde_with::serde_as]
1158#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1159pub struct SegmentMetricFilter {
1160 /// The value to compare against. If the operator is `BETWEEN`, this value is treated as minimum comparison value.
1161 #[serde(rename = "comparisonValue")]
1162 pub comparison_value: Option<String>,
1163 /// Max comparison value is only used for `BETWEEN` operator.
1164 #[serde(rename = "maxComparisonValue")]
1165 pub max_comparison_value: Option<String>,
1166 /// The metric that will be filtered on. A `metricFilter` must contain a metric name.
1167 #[serde(rename = "metricName")]
1168 pub metric_name: Option<String>,
1169 /// Specifies is the operation to perform to compare the metric. The default is `EQUAL`.
1170 pub operator: Option<String>,
1171 /// Scope for a metric defines the level at which that metric is defined. The specified metric scope must be equal to or greater than its primary scope as defined in the data model. The primary scope is defined by if the segment is selecting users or sessions.
1172 pub scope: Option<String>,
1173}
1174
1175impl common::Part for SegmentMetricFilter {}
1176
1177/// A segment sequence definition.
1178///
1179/// This type is not used in any activity, and only used as *part* of another schema.
1180///
1181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1182#[serde_with::serde_as]
1183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1184pub struct SegmentSequenceStep {
1185 /// Specifies if the step immediately precedes or can be any time before the next step.
1186 #[serde(rename = "matchType")]
1187 pub match_type: Option<String>,
1188 /// A sequence is specified with a list of Or grouped filters which are combined with `AND` operator.
1189 #[serde(rename = "orFiltersForSegment")]
1190 pub or_filters_for_segment: Option<Vec<OrFiltersForSegment>>,
1191}
1192
1193impl common::Part for SegmentSequenceStep {}
1194
1195/// Sequence conditions consist of one or more steps, where each step is defined by one or more dimension/metric conditions. Multiple steps can be combined with special sequence operators.
1196///
1197/// This type is not used in any activity, and only used as *part* of another schema.
1198///
1199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1200#[serde_with::serde_as]
1201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1202pub struct SequenceSegment {
1203 /// If set, first step condition must match the first hit of the visitor (in the date range).
1204 #[serde(rename = "firstStepShouldMatchFirstHit")]
1205 pub first_step_should_match_first_hit: Option<bool>,
1206 /// The list of steps in the sequence.
1207 #[serde(rename = "segmentSequenceSteps")]
1208 pub segment_sequence_steps: Option<Vec<SegmentSequenceStep>>,
1209}
1210
1211impl common::Part for SequenceSegment {}
1212
1213/// A Simple segment conditions consist of one or more dimension/metric conditions that can be combined.
1214///
1215/// This type is not used in any activity, and only used as *part* of another schema.
1216///
1217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1218#[serde_with::serde_as]
1219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1220pub struct SimpleSegment {
1221 /// A list of segment filters groups which are combined with logical `AND` operator.
1222 #[serde(rename = "orFiltersForSegment")]
1223 pub or_filters_for_segment: Option<Vec<OrFiltersForSegment>>,
1224}
1225
1226impl common::Part for SimpleSegment {}
1227
1228/// Represents details collected when the visitor performs a transaction on the page.
1229///
1230/// This type is not used in any activity, and only used as *part* of another schema.
1231///
1232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1233#[serde_with::serde_as]
1234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1235pub struct TransactionData {
1236 /// The transaction ID, supplied by the e-commerce tracking method, for the purchase in the shopping cart.
1237 #[serde(rename = "transactionId")]
1238 pub transaction_id: Option<String>,
1239 /// The total sale revenue (excluding shipping and tax) of the transaction.
1240 #[serde(rename = "transactionRevenue")]
1241 pub transaction_revenue: Option<f64>,
1242 /// Total cost of shipping.
1243 #[serde(rename = "transactionShipping")]
1244 pub transaction_shipping: Option<f64>,
1245 /// Total tax for the transaction.
1246 #[serde(rename = "transactionTax")]
1247 pub transaction_tax: Option<f64>,
1248}
1249
1250impl common::Part for TransactionData {}
1251
1252/// Contains information to identify a particular user uniquely.
1253///
1254/// This type is not used in any activity, and only used as *part* of another schema.
1255///
1256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1257#[serde_with::serde_as]
1258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1259pub struct User {
1260 /// Type of the user in the request. The field `userId` is associated with this type.
1261 #[serde(rename = "type")]
1262 pub type_: Option<String>,
1263 /// Unique Id of the user for which the data is being requested.
1264 #[serde(rename = "userId")]
1265 pub user_id: Option<String>,
1266}
1267
1268impl common::Part for User {}
1269
1270/// This represents a user session performed on a specific device at a certain time over a period of time.
1271///
1272/// This type is not used in any activity, and only used as *part* of another schema.
1273///
1274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1275#[serde_with::serde_as]
1276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1277pub struct UserActivitySession {
1278 /// Represents a detailed view into each of the activity in this session.
1279 pub activities: Option<Vec<Activity>>,
1280 /// The data source of a hit. By default, hits sent from analytics.js are reported as "web" and hits sent from the mobile SDKs are reported as "app". These values can be overridden in the Measurement Protocol.
1281 #[serde(rename = "dataSource")]
1282 pub data_source: Option<String>,
1283 /// The type of device used: "mobile", "tablet" etc.
1284 #[serde(rename = "deviceCategory")]
1285 pub device_category: Option<String>,
1286 /// Platform on which the activity happened: "android", "ios" etc.
1287 pub platform: Option<String>,
1288 /// Date of this session in ISO-8601 format.
1289 #[serde(rename = "sessionDate")]
1290 pub session_date: Option<String>,
1291 /// Unique ID of the session.
1292 #[serde(rename = "sessionId")]
1293 pub session_id: Option<String>,
1294}
1295
1296impl common::Part for UserActivitySession {}
1297
1298// ###################
1299// MethodBuilders ###
1300// #################
1301
1302/// A builder providing access to all methods supported on *report* resources.
1303/// It is not used directly, but through the [`AnalyticsReporting`] hub.
1304///
1305/// # Example
1306///
1307/// Instantiate a resource builder
1308///
1309/// ```test_harness,no_run
1310/// extern crate hyper;
1311/// extern crate hyper_rustls;
1312/// extern crate google_analyticsreporting4 as analyticsreporting4;
1313///
1314/// # async fn dox() {
1315/// use analyticsreporting4::{AnalyticsReporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1316///
1317/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1318/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1319/// .with_native_roots()
1320/// .unwrap()
1321/// .https_only()
1322/// .enable_http2()
1323/// .build();
1324///
1325/// let executor = hyper_util::rt::TokioExecutor::new();
1326/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1327/// secret,
1328/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1329/// yup_oauth2::client::CustomHyperClientBuilder::from(
1330/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1331/// ),
1332/// ).build().await.unwrap();
1333///
1334/// let client = hyper_util::client::legacy::Client::builder(
1335/// hyper_util::rt::TokioExecutor::new()
1336/// )
1337/// .build(
1338/// hyper_rustls::HttpsConnectorBuilder::new()
1339/// .with_native_roots()
1340/// .unwrap()
1341/// .https_or_http()
1342/// .enable_http2()
1343/// .build()
1344/// );
1345/// let mut hub = AnalyticsReporting::new(client, auth);
1346/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1347/// // like `batch_get(...)`
1348/// // to build up your call.
1349/// let rb = hub.reports();
1350/// # }
1351/// ```
1352pub struct ReportMethods<'a, C>
1353where
1354 C: 'a,
1355{
1356 hub: &'a AnalyticsReporting<C>,
1357}
1358
1359impl<'a, C> common::MethodsBuilder for ReportMethods<'a, C> {}
1360
1361impl<'a, C> ReportMethods<'a, C> {
1362 /// Create a builder to help you perform the following task:
1363 ///
1364 /// Returns the Analytics data.
1365 ///
1366 /// # Arguments
1367 ///
1368 /// * `request` - No description provided.
1369 pub fn batch_get(&self, request: GetReportsRequest) -> ReportBatchGetCall<'a, C> {
1370 ReportBatchGetCall {
1371 hub: self.hub,
1372 _request: request,
1373 _delegate: Default::default(),
1374 _additional_params: Default::default(),
1375 _scopes: Default::default(),
1376 }
1377 }
1378}
1379
1380/// A builder providing access to all methods supported on *userActivity* resources.
1381/// It is not used directly, but through the [`AnalyticsReporting`] hub.
1382///
1383/// # Example
1384///
1385/// Instantiate a resource builder
1386///
1387/// ```test_harness,no_run
1388/// extern crate hyper;
1389/// extern crate hyper_rustls;
1390/// extern crate google_analyticsreporting4 as analyticsreporting4;
1391///
1392/// # async fn dox() {
1393/// use analyticsreporting4::{AnalyticsReporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1394///
1395/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1396/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1397/// .with_native_roots()
1398/// .unwrap()
1399/// .https_only()
1400/// .enable_http2()
1401/// .build();
1402///
1403/// let executor = hyper_util::rt::TokioExecutor::new();
1404/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1405/// secret,
1406/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1407/// yup_oauth2::client::CustomHyperClientBuilder::from(
1408/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1409/// ),
1410/// ).build().await.unwrap();
1411///
1412/// let client = hyper_util::client::legacy::Client::builder(
1413/// hyper_util::rt::TokioExecutor::new()
1414/// )
1415/// .build(
1416/// hyper_rustls::HttpsConnectorBuilder::new()
1417/// .with_native_roots()
1418/// .unwrap()
1419/// .https_or_http()
1420/// .enable_http2()
1421/// .build()
1422/// );
1423/// let mut hub = AnalyticsReporting::new(client, auth);
1424/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1425/// // like `search(...)`
1426/// // to build up your call.
1427/// let rb = hub.user_activity();
1428/// # }
1429/// ```
1430pub struct UserActivityMethods<'a, C>
1431where
1432 C: 'a,
1433{
1434 hub: &'a AnalyticsReporting<C>,
1435}
1436
1437impl<'a, C> common::MethodsBuilder for UserActivityMethods<'a, C> {}
1438
1439impl<'a, C> UserActivityMethods<'a, C> {
1440 /// Create a builder to help you perform the following task:
1441 ///
1442 /// Returns User Activity data.
1443 ///
1444 /// # Arguments
1445 ///
1446 /// * `request` - No description provided.
1447 pub fn search(&self, request: SearchUserActivityRequest) -> UserActivitySearchCall<'a, C> {
1448 UserActivitySearchCall {
1449 hub: self.hub,
1450 _request: request,
1451 _delegate: Default::default(),
1452 _additional_params: Default::default(),
1453 _scopes: Default::default(),
1454 }
1455 }
1456}
1457
1458// ###################
1459// CallBuilders ###
1460// #################
1461
1462/// Returns the Analytics data.
1463///
1464/// A builder for the *batchGet* method supported by a *report* resource.
1465/// It is not used directly, but through a [`ReportMethods`] instance.
1466///
1467/// # Example
1468///
1469/// Instantiate a resource method builder
1470///
1471/// ```test_harness,no_run
1472/// # extern crate hyper;
1473/// # extern crate hyper_rustls;
1474/// # extern crate google_analyticsreporting4 as analyticsreporting4;
1475/// use analyticsreporting4::api::GetReportsRequest;
1476/// # async fn dox() {
1477/// # use analyticsreporting4::{AnalyticsReporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1478///
1479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1481/// # .with_native_roots()
1482/// # .unwrap()
1483/// # .https_only()
1484/// # .enable_http2()
1485/// # .build();
1486///
1487/// # let executor = hyper_util::rt::TokioExecutor::new();
1488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1489/// # secret,
1490/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1491/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1492/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1493/// # ),
1494/// # ).build().await.unwrap();
1495///
1496/// # let client = hyper_util::client::legacy::Client::builder(
1497/// # hyper_util::rt::TokioExecutor::new()
1498/// # )
1499/// # .build(
1500/// # hyper_rustls::HttpsConnectorBuilder::new()
1501/// # .with_native_roots()
1502/// # .unwrap()
1503/// # .https_or_http()
1504/// # .enable_http2()
1505/// # .build()
1506/// # );
1507/// # let mut hub = AnalyticsReporting::new(client, auth);
1508/// // As the method needs a request, you would usually fill it with the desired information
1509/// // into the respective structure. Some of the parts shown here might not be applicable !
1510/// // Values shown here are possibly random and not representative !
1511/// let mut req = GetReportsRequest::default();
1512///
1513/// // You can configure optional parameters by calling the respective setters at will, and
1514/// // execute the final call using `doit()`.
1515/// // Values shown here are possibly random and not representative !
1516/// let result = hub.reports().batch_get(req)
1517/// .doit().await;
1518/// # }
1519/// ```
1520pub struct ReportBatchGetCall<'a, C>
1521where
1522 C: 'a,
1523{
1524 hub: &'a AnalyticsReporting<C>,
1525 _request: GetReportsRequest,
1526 _delegate: Option<&'a mut dyn common::Delegate>,
1527 _additional_params: HashMap<String, String>,
1528 _scopes: BTreeSet<String>,
1529}
1530
1531impl<'a, C> common::CallBuilder for ReportBatchGetCall<'a, C> {}
1532
1533impl<'a, C> ReportBatchGetCall<'a, C>
1534where
1535 C: common::Connector,
1536{
1537 /// Perform the operation you have build so far.
1538 pub async fn doit(mut self) -> common::Result<(common::Response, GetReportsResponse)> {
1539 use std::borrow::Cow;
1540 use std::io::{Read, Seek};
1541
1542 use common::{url::Params, ToParts};
1543 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1544
1545 let mut dd = common::DefaultDelegate;
1546 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1547 dlg.begin(common::MethodInfo {
1548 id: "analyticsreporting.reports.batchGet",
1549 http_method: hyper::Method::POST,
1550 });
1551
1552 for &field in ["alt"].iter() {
1553 if self._additional_params.contains_key(field) {
1554 dlg.finished(false);
1555 return Err(common::Error::FieldClash(field));
1556 }
1557 }
1558
1559 let mut params = Params::with_capacity(3 + self._additional_params.len());
1560
1561 params.extend(self._additional_params.iter());
1562
1563 params.push("alt", "json");
1564 let mut url = self.hub._base_url.clone() + "v4/reports:batchGet";
1565 if self._scopes.is_empty() {
1566 self._scopes
1567 .insert(Scope::AnalyticReadonly.as_ref().to_string());
1568 }
1569
1570 let url = params.parse_with_url(&url);
1571
1572 let mut json_mime_type = mime::APPLICATION_JSON;
1573 let mut request_value_reader = {
1574 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1575 common::remove_json_null_values(&mut value);
1576 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1577 serde_json::to_writer(&mut dst, &value).unwrap();
1578 dst
1579 };
1580 let request_size = request_value_reader
1581 .seek(std::io::SeekFrom::End(0))
1582 .unwrap();
1583 request_value_reader
1584 .seek(std::io::SeekFrom::Start(0))
1585 .unwrap();
1586
1587 loop {
1588 let token = match self
1589 .hub
1590 .auth
1591 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1592 .await
1593 {
1594 Ok(token) => token,
1595 Err(e) => match dlg.token(e) {
1596 Ok(token) => token,
1597 Err(e) => {
1598 dlg.finished(false);
1599 return Err(common::Error::MissingToken(e));
1600 }
1601 },
1602 };
1603 request_value_reader
1604 .seek(std::io::SeekFrom::Start(0))
1605 .unwrap();
1606 let mut req_result = {
1607 let client = &self.hub.client;
1608 dlg.pre_request();
1609 let mut req_builder = hyper::Request::builder()
1610 .method(hyper::Method::POST)
1611 .uri(url.as_str())
1612 .header(USER_AGENT, self.hub._user_agent.clone());
1613
1614 if let Some(token) = token.as_ref() {
1615 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1616 }
1617
1618 let request = req_builder
1619 .header(CONTENT_TYPE, json_mime_type.to_string())
1620 .header(CONTENT_LENGTH, request_size as u64)
1621 .body(common::to_body(
1622 request_value_reader.get_ref().clone().into(),
1623 ));
1624
1625 client.request(request.unwrap()).await
1626 };
1627
1628 match req_result {
1629 Err(err) => {
1630 if let common::Retry::After(d) = dlg.http_error(&err) {
1631 sleep(d).await;
1632 continue;
1633 }
1634 dlg.finished(false);
1635 return Err(common::Error::HttpError(err));
1636 }
1637 Ok(res) => {
1638 let (mut parts, body) = res.into_parts();
1639 let mut body = common::Body::new(body);
1640 if !parts.status.is_success() {
1641 let bytes = common::to_bytes(body).await.unwrap_or_default();
1642 let error = serde_json::from_str(&common::to_string(&bytes));
1643 let response = common::to_response(parts, bytes.into());
1644
1645 if let common::Retry::After(d) =
1646 dlg.http_failure(&response, error.as_ref().ok())
1647 {
1648 sleep(d).await;
1649 continue;
1650 }
1651
1652 dlg.finished(false);
1653
1654 return Err(match error {
1655 Ok(value) => common::Error::BadRequest(value),
1656 _ => common::Error::Failure(response),
1657 });
1658 }
1659 let response = {
1660 let bytes = common::to_bytes(body).await.unwrap_or_default();
1661 let encoded = common::to_string(&bytes);
1662 match serde_json::from_str(&encoded) {
1663 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1664 Err(error) => {
1665 dlg.response_json_decode_error(&encoded, &error);
1666 return Err(common::Error::JsonDecodeError(
1667 encoded.to_string(),
1668 error,
1669 ));
1670 }
1671 }
1672 };
1673
1674 dlg.finished(true);
1675 return Ok(response);
1676 }
1677 }
1678 }
1679 }
1680
1681 ///
1682 /// Sets the *request* property to the given value.
1683 ///
1684 /// Even though the property as already been set when instantiating this call,
1685 /// we provide this method for API completeness.
1686 pub fn request(mut self, new_value: GetReportsRequest) -> ReportBatchGetCall<'a, C> {
1687 self._request = new_value;
1688 self
1689 }
1690 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1691 /// while executing the actual API request.
1692 ///
1693 /// ````text
1694 /// It should be used to handle progress information, and to implement a certain level of resilience.
1695 /// ````
1696 ///
1697 /// Sets the *delegate* property to the given value.
1698 pub fn delegate(
1699 mut self,
1700 new_value: &'a mut dyn common::Delegate,
1701 ) -> ReportBatchGetCall<'a, C> {
1702 self._delegate = Some(new_value);
1703 self
1704 }
1705
1706 /// Set any additional parameter of the query string used in the request.
1707 /// It should be used to set parameters which are not yet available through their own
1708 /// setters.
1709 ///
1710 /// Please note that this method must not be used to set any of the known parameters
1711 /// which have their own setter method. If done anyway, the request will fail.
1712 ///
1713 /// # Additional Parameters
1714 ///
1715 /// * *$.xgafv* (query-string) - V1 error format.
1716 /// * *access_token* (query-string) - OAuth access token.
1717 /// * *alt* (query-string) - Data format for response.
1718 /// * *callback* (query-string) - JSONP
1719 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1720 /// * *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.
1721 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1722 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1723 /// * *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.
1724 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1725 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1726 pub fn param<T>(mut self, name: T, value: T) -> ReportBatchGetCall<'a, C>
1727 where
1728 T: AsRef<str>,
1729 {
1730 self._additional_params
1731 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1732 self
1733 }
1734
1735 /// Identifies the authorization scope for the method you are building.
1736 ///
1737 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1738 /// [`Scope::AnalyticReadonly`].
1739 ///
1740 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1741 /// tokens for more than one scope.
1742 ///
1743 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1744 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1745 /// sufficient, a read-write scope will do as well.
1746 pub fn add_scope<St>(mut self, scope: St) -> ReportBatchGetCall<'a, C>
1747 where
1748 St: AsRef<str>,
1749 {
1750 self._scopes.insert(String::from(scope.as_ref()));
1751 self
1752 }
1753 /// Identifies the authorization scope(s) for the method you are building.
1754 ///
1755 /// See [`Self::add_scope()`] for details.
1756 pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportBatchGetCall<'a, C>
1757 where
1758 I: IntoIterator<Item = St>,
1759 St: AsRef<str>,
1760 {
1761 self._scopes
1762 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1763 self
1764 }
1765
1766 /// Removes all scopes, and no default scope will be used either.
1767 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1768 /// for details).
1769 pub fn clear_scopes(mut self) -> ReportBatchGetCall<'a, C> {
1770 self._scopes.clear();
1771 self
1772 }
1773}
1774
1775/// Returns User Activity data.
1776///
1777/// A builder for the *search* method supported by a *userActivity* resource.
1778/// It is not used directly, but through a [`UserActivityMethods`] instance.
1779///
1780/// # Example
1781///
1782/// Instantiate a resource method builder
1783///
1784/// ```test_harness,no_run
1785/// # extern crate hyper;
1786/// # extern crate hyper_rustls;
1787/// # extern crate google_analyticsreporting4 as analyticsreporting4;
1788/// use analyticsreporting4::api::SearchUserActivityRequest;
1789/// # async fn dox() {
1790/// # use analyticsreporting4::{AnalyticsReporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1791///
1792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1794/// # .with_native_roots()
1795/// # .unwrap()
1796/// # .https_only()
1797/// # .enable_http2()
1798/// # .build();
1799///
1800/// # let executor = hyper_util::rt::TokioExecutor::new();
1801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1802/// # secret,
1803/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1804/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1805/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1806/// # ),
1807/// # ).build().await.unwrap();
1808///
1809/// # let client = hyper_util::client::legacy::Client::builder(
1810/// # hyper_util::rt::TokioExecutor::new()
1811/// # )
1812/// # .build(
1813/// # hyper_rustls::HttpsConnectorBuilder::new()
1814/// # .with_native_roots()
1815/// # .unwrap()
1816/// # .https_or_http()
1817/// # .enable_http2()
1818/// # .build()
1819/// # );
1820/// # let mut hub = AnalyticsReporting::new(client, auth);
1821/// // As the method needs a request, you would usually fill it with the desired information
1822/// // into the respective structure. Some of the parts shown here might not be applicable !
1823/// // Values shown here are possibly random and not representative !
1824/// let mut req = SearchUserActivityRequest::default();
1825///
1826/// // You can configure optional parameters by calling the respective setters at will, and
1827/// // execute the final call using `doit()`.
1828/// // Values shown here are possibly random and not representative !
1829/// let result = hub.user_activity().search(req)
1830/// .doit().await;
1831/// # }
1832/// ```
1833pub struct UserActivitySearchCall<'a, C>
1834where
1835 C: 'a,
1836{
1837 hub: &'a AnalyticsReporting<C>,
1838 _request: SearchUserActivityRequest,
1839 _delegate: Option<&'a mut dyn common::Delegate>,
1840 _additional_params: HashMap<String, String>,
1841 _scopes: BTreeSet<String>,
1842}
1843
1844impl<'a, C> common::CallBuilder for UserActivitySearchCall<'a, C> {}
1845
1846impl<'a, C> UserActivitySearchCall<'a, C>
1847where
1848 C: common::Connector,
1849{
1850 /// Perform the operation you have build so far.
1851 pub async fn doit(mut self) -> common::Result<(common::Response, SearchUserActivityResponse)> {
1852 use std::borrow::Cow;
1853 use std::io::{Read, Seek};
1854
1855 use common::{url::Params, ToParts};
1856 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1857
1858 let mut dd = common::DefaultDelegate;
1859 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1860 dlg.begin(common::MethodInfo {
1861 id: "analyticsreporting.userActivity.search",
1862 http_method: hyper::Method::POST,
1863 });
1864
1865 for &field in ["alt"].iter() {
1866 if self._additional_params.contains_key(field) {
1867 dlg.finished(false);
1868 return Err(common::Error::FieldClash(field));
1869 }
1870 }
1871
1872 let mut params = Params::with_capacity(3 + self._additional_params.len());
1873
1874 params.extend(self._additional_params.iter());
1875
1876 params.push("alt", "json");
1877 let mut url = self.hub._base_url.clone() + "v4/userActivity:search";
1878 if self._scopes.is_empty() {
1879 self._scopes
1880 .insert(Scope::AnalyticReadonly.as_ref().to_string());
1881 }
1882
1883 let url = params.parse_with_url(&url);
1884
1885 let mut json_mime_type = mime::APPLICATION_JSON;
1886 let mut request_value_reader = {
1887 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1888 common::remove_json_null_values(&mut value);
1889 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1890 serde_json::to_writer(&mut dst, &value).unwrap();
1891 dst
1892 };
1893 let request_size = request_value_reader
1894 .seek(std::io::SeekFrom::End(0))
1895 .unwrap();
1896 request_value_reader
1897 .seek(std::io::SeekFrom::Start(0))
1898 .unwrap();
1899
1900 loop {
1901 let token = match self
1902 .hub
1903 .auth
1904 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1905 .await
1906 {
1907 Ok(token) => token,
1908 Err(e) => match dlg.token(e) {
1909 Ok(token) => token,
1910 Err(e) => {
1911 dlg.finished(false);
1912 return Err(common::Error::MissingToken(e));
1913 }
1914 },
1915 };
1916 request_value_reader
1917 .seek(std::io::SeekFrom::Start(0))
1918 .unwrap();
1919 let mut req_result = {
1920 let client = &self.hub.client;
1921 dlg.pre_request();
1922 let mut req_builder = hyper::Request::builder()
1923 .method(hyper::Method::POST)
1924 .uri(url.as_str())
1925 .header(USER_AGENT, self.hub._user_agent.clone());
1926
1927 if let Some(token) = token.as_ref() {
1928 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1929 }
1930
1931 let request = req_builder
1932 .header(CONTENT_TYPE, json_mime_type.to_string())
1933 .header(CONTENT_LENGTH, request_size as u64)
1934 .body(common::to_body(
1935 request_value_reader.get_ref().clone().into(),
1936 ));
1937
1938 client.request(request.unwrap()).await
1939 };
1940
1941 match req_result {
1942 Err(err) => {
1943 if let common::Retry::After(d) = dlg.http_error(&err) {
1944 sleep(d).await;
1945 continue;
1946 }
1947 dlg.finished(false);
1948 return Err(common::Error::HttpError(err));
1949 }
1950 Ok(res) => {
1951 let (mut parts, body) = res.into_parts();
1952 let mut body = common::Body::new(body);
1953 if !parts.status.is_success() {
1954 let bytes = common::to_bytes(body).await.unwrap_or_default();
1955 let error = serde_json::from_str(&common::to_string(&bytes));
1956 let response = common::to_response(parts, bytes.into());
1957
1958 if let common::Retry::After(d) =
1959 dlg.http_failure(&response, error.as_ref().ok())
1960 {
1961 sleep(d).await;
1962 continue;
1963 }
1964
1965 dlg.finished(false);
1966
1967 return Err(match error {
1968 Ok(value) => common::Error::BadRequest(value),
1969 _ => common::Error::Failure(response),
1970 });
1971 }
1972 let response = {
1973 let bytes = common::to_bytes(body).await.unwrap_or_default();
1974 let encoded = common::to_string(&bytes);
1975 match serde_json::from_str(&encoded) {
1976 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1977 Err(error) => {
1978 dlg.response_json_decode_error(&encoded, &error);
1979 return Err(common::Error::JsonDecodeError(
1980 encoded.to_string(),
1981 error,
1982 ));
1983 }
1984 }
1985 };
1986
1987 dlg.finished(true);
1988 return Ok(response);
1989 }
1990 }
1991 }
1992 }
1993
1994 ///
1995 /// Sets the *request* property to the given value.
1996 ///
1997 /// Even though the property as already been set when instantiating this call,
1998 /// we provide this method for API completeness.
1999 pub fn request(
2000 mut self,
2001 new_value: SearchUserActivityRequest,
2002 ) -> UserActivitySearchCall<'a, C> {
2003 self._request = new_value;
2004 self
2005 }
2006 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2007 /// while executing the actual API request.
2008 ///
2009 /// ````text
2010 /// It should be used to handle progress information, and to implement a certain level of resilience.
2011 /// ````
2012 ///
2013 /// Sets the *delegate* property to the given value.
2014 pub fn delegate(
2015 mut self,
2016 new_value: &'a mut dyn common::Delegate,
2017 ) -> UserActivitySearchCall<'a, C> {
2018 self._delegate = Some(new_value);
2019 self
2020 }
2021
2022 /// Set any additional parameter of the query string used in the request.
2023 /// It should be used to set parameters which are not yet available through their own
2024 /// setters.
2025 ///
2026 /// Please note that this method must not be used to set any of the known parameters
2027 /// which have their own setter method. If done anyway, the request will fail.
2028 ///
2029 /// # Additional Parameters
2030 ///
2031 /// * *$.xgafv* (query-string) - V1 error format.
2032 /// * *access_token* (query-string) - OAuth access token.
2033 /// * *alt* (query-string) - Data format for response.
2034 /// * *callback* (query-string) - JSONP
2035 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2036 /// * *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.
2037 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2038 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2039 /// * *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.
2040 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2041 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2042 pub fn param<T>(mut self, name: T, value: T) -> UserActivitySearchCall<'a, C>
2043 where
2044 T: AsRef<str>,
2045 {
2046 self._additional_params
2047 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2048 self
2049 }
2050
2051 /// Identifies the authorization scope for the method you are building.
2052 ///
2053 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2054 /// [`Scope::AnalyticReadonly`].
2055 ///
2056 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2057 /// tokens for more than one scope.
2058 ///
2059 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2060 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2061 /// sufficient, a read-write scope will do as well.
2062 pub fn add_scope<St>(mut self, scope: St) -> UserActivitySearchCall<'a, C>
2063 where
2064 St: AsRef<str>,
2065 {
2066 self._scopes.insert(String::from(scope.as_ref()));
2067 self
2068 }
2069 /// Identifies the authorization scope(s) for the method you are building.
2070 ///
2071 /// See [`Self::add_scope()`] for details.
2072 pub fn add_scopes<I, St>(mut self, scopes: I) -> UserActivitySearchCall<'a, C>
2073 where
2074 I: IntoIterator<Item = St>,
2075 St: AsRef<str>,
2076 {
2077 self._scopes
2078 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2079 self
2080 }
2081
2082 /// Removes all scopes, and no default scope will be used either.
2083 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2084 /// for details).
2085 pub fn clear_scopes(mut self) -> UserActivitySearchCall<'a, C> {
2086 self._scopes.clear();
2087 self
2088 }
2089}