google_admin1_reports/
lib.rs

1// DO NOT EDIT !
2// This file was generated automatically from 'src/mako/api/lib.rs.mako'
3// DO NOT EDIT !
4
5//! This documentation was generated from *reports* crate version *1.0.12+20190521*, where *20190521* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.12*.
6//! 
7//! Everything else about the *reports* *v1_reports* API can be found at the
8//! [official documentation site](https://developers.google.com/admin-sdk/reports/).
9//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_reports).
10//! # Features
11//! 
12//! Handle the following *Resources* with ease from the central [hub](struct.Reports.html) ... 
13//! 
14//! * [activities](struct.Activity.html)
15//!  * [*list*](struct.ActivityListCall.html) and [*watch*](struct.ActivityWatchCall.html)
16//! * [channels](struct.Channel.html)
17//!  * [*stop*](struct.ChannelStopCall.html)
18//! * customer usage reports
19//!  * [*get*](struct.CustomerUsageReportGetCall.html)
20//! * entity usage reports
21//!  * [*get*](struct.EntityUsageReportGetCall.html)
22//! * user usage report
23//!  * [*get*](struct.UserUsageReportGetCall.html)
24//! 
25//! 
26//! Subscription supported by ...
27//! 
28//! * [*list activities*](struct.ActivityListCall.html)
29//! * [*watch activities*](struct.ActivityWatchCall.html)
30//! 
31//! 
32//! 
33//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
34//! 
35//! # Structure of this Library
36//! 
37//! The API is structured into the following primary items:
38//! 
39//! * **[Hub](struct.Reports.html)**
40//!     * a central object to maintain state and allow accessing all *Activities*
41//!     * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn
42//!       allow access to individual [*Call Builders*](trait.CallBuilder.html)
43//! * **[Resources](trait.Resource.html)**
44//!     * primary types that you can apply *Activities* to
45//!     * a collection of properties and *Parts*
46//!     * **[Parts](trait.Part.html)**
47//!         * a collection of properties
48//!         * never directly used in *Activities*
49//! * **[Activities](trait.CallBuilder.html)**
50//!     * operations to apply to *Resources*
51//! 
52//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
53//! 
54//! Generally speaking, you can invoke *Activities* like this:
55//! 
56//! ```Rust,ignore
57//! let r = hub.resource().activity(...).doit()
58//! ```
59//! 
60//! Or specifically ...
61//! 
62//! ```ignore
63//! let r = hub.user_usage_report().get(...).doit()
64//! let r = hub.entity_usage_reports().get(...).doit()
65//! let r = hub.customer_usage_reports().get(...).doit()
66//! ```
67//! 
68//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` 
69//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be 
70//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
71//! The `doit()` method performs the actual communication with the server and returns the respective result.
72//! 
73//! # Usage
74//! 
75//! ## Setting up your Project
76//! 
77//! To use this library, you would put the following lines into your `Cargo.toml` file:
78//! 
79//! ```toml
80//! [dependencies]
81//! google-admin1_reports = "*"
82//! # This project intentionally uses an old version of Hyper. See
83//! # https://github.com/Byron/google-apis-rs/issues/173 for more
84//! # information.
85//! hyper = "^0.10"
86//! hyper-rustls = "^0.6"
87//! serde = "^1.0"
88//! serde_json = "^1.0"
89//! yup-oauth2 = "^1.0"
90//! ```
91//! 
92//! ## A complete example
93//! 
94//! ```test_harness,no_run
95//! extern crate hyper;
96//! extern crate hyper_rustls;
97//! extern crate yup_oauth2 as oauth2;
98//! extern crate google_admin1_reports as admin1_reports;
99//! use admin1_reports::{Result, Error};
100//! # #[test] fn egal() {
101//! use std::default::Default;
102//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
103//! use admin1_reports::Reports;
104//! 
105//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and 
106//! // `client_secret`, among other things.
107//! let secret: ApplicationSecret = Default::default();
108//! // Instantiate the authenticator. It will choose a suitable authentication flow for you, 
109//! // unless you replace  `None` with the desired Flow.
110//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
111//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
112//! // retrieve them from storage.
113//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
114//!                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
115//!                               <MemoryStorage as Default>::default(), None);
116//! let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
117//! // You can configure optional parameters by calling the respective setters at will, and
118//! // execute the final call using `doit()`.
119//! // Values shown here are possibly random and not representative !
120//! let result = hub.user_usage_report().get("userKey", "date")
121//!              .parameters("amet.")
122//!              .page_token("erat")
123//!              .org_unit_id("labore")
124//!              .max_results(92)
125//!              .filters("nonumy")
126//!              .customer_id("dolores")
127//!              .doit();
128//! 
129//! match result {
130//!     Err(e) => match e {
131//!         // The Error enum provides details about what exactly happened.
132//!         // You can also just use its `Debug`, `Display` or `Error` traits
133//!          Error::HttpError(_)
134//!         |Error::MissingAPIKey
135//!         |Error::MissingToken(_)
136//!         |Error::Cancelled
137//!         |Error::UploadSizeLimitExceeded(_, _)
138//!         |Error::Failure(_)
139//!         |Error::BadRequest(_)
140//!         |Error::FieldClash(_)
141//!         |Error::JsonDecodeError(_, _) => println!("{}", e),
142//!     },
143//!     Ok(res) => println!("Success: {:?}", res),
144//! }
145//! # }
146//! ```
147//! ## Handling Errors
148//! 
149//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of 
150//! the doit() methods, or handed as possibly intermediate results to either the 
151//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
152//! 
153//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This 
154//! makes the system potentially resilient to all kinds of errors.
155//! 
156//! ## Uploads and Downloads
157//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be
158//! read by you to obtain the media.
159//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default.
160//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
161//! this call: `.param("alt", "media")`.
162//! 
163//! Methods supporting uploads can do so using up to 2 different protocols: 
164//! *simple* and *resumable*. The distinctiveness of each is represented by customized 
165//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
166//! 
167//! ## Customization and Callbacks
168//! 
169//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the 
170//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. 
171//! Respective methods will be called to provide progress information, as well as determine whether the system should 
172//! retry on failure.
173//! 
174//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort.
175//! 
176//! ## Optional Parts in Server-Requests
177//! 
178//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and 
179//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses 
180//! are valid.
181//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to 
182//! the server to indicate either the set parts of the request or the desired parts in the response.
183//! 
184//! ## Builder Arguments
185//! 
186//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods.
187//! These will always take a single argument, for which the following statements are true.
188//! 
189//! * [PODs][wiki-pod] are handed by copy
190//! * strings are passed as `&str`
191//! * [request values](trait.RequestValue.html) are moved
192//! 
193//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
194//! 
195//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
196//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
197//! [google-go-api]: https://github.com/google/google-api-go-client
198//! 
199//! 
200
201// Unused attributes happen thanks to defined, but unused structures
202// We don't warn about this, as depending on the API, some data structures or facilities are never used.
203// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
204// unused imports in fully featured APIs. Same with unused_mut ... .
205#![allow(unused_imports, unused_mut, dead_code)]
206
207// DO NOT EDIT !
208// This file was generated automatically from 'src/mako/api/lib.rs.mako'
209// DO NOT EDIT !
210
211#[macro_use]
212extern crate serde_derive;
213
214extern crate hyper;
215extern crate serde;
216extern crate serde_json;
217extern crate yup_oauth2 as oauth2;
218extern crate mime;
219extern crate url;
220
221mod cmn;
222
223use std::collections::HashMap;
224use std::cell::RefCell;
225use std::borrow::BorrowMut;
226use std::default::Default;
227use std::collections::BTreeMap;
228use serde_json as json;
229use std::io;
230use std::fs;
231use std::mem;
232use std::thread::sleep;
233use std::time::Duration;
234
235pub use cmn::*;
236
237
238// ##############
239// UTILITIES ###
240// ############
241
242/// Identifies the an OAuth2 authorization scope.
243/// A scope is needed when requesting an
244/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
245#[derive(PartialEq, Eq, Hash)]
246pub enum Scope {
247    /// View audit reports for your G Suite domain
248    ReportAuditReadonly,
249
250    /// View usage reports for your G Suite domain
251    ReportUsageReadonly,
252}
253
254impl AsRef<str> for Scope {
255    fn as_ref(&self) -> &str {
256        match *self {
257            Scope::ReportAuditReadonly => "https://www.googleapis.com/auth/admin.reports.audit.readonly",
258            Scope::ReportUsageReadonly => "https://www.googleapis.com/auth/admin.reports.usage.readonly",
259        }
260    }
261}
262
263impl Default for Scope {
264    fn default() -> Scope {
265        Scope::ReportAuditReadonly
266    }
267}
268
269
270
271// ########
272// HUB ###
273// ######
274
275/// Central instance to access all Reports related resource activities
276///
277/// # Examples
278///
279/// Instantiate a new hub
280///
281/// ```test_harness,no_run
282/// extern crate hyper;
283/// extern crate hyper_rustls;
284/// extern crate yup_oauth2 as oauth2;
285/// extern crate google_admin1_reports as admin1_reports;
286/// use admin1_reports::{Result, Error};
287/// # #[test] fn egal() {
288/// use std::default::Default;
289/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
290/// use admin1_reports::Reports;
291/// 
292/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and 
293/// // `client_secret`, among other things.
294/// let secret: ApplicationSecret = Default::default();
295/// // Instantiate the authenticator. It will choose a suitable authentication flow for you, 
296/// // unless you replace  `None` with the desired Flow.
297/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about 
298/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
299/// // retrieve them from storage.
300/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
301///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
302///                               <MemoryStorage as Default>::default(), None);
303/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
304/// // You can configure optional parameters by calling the respective setters at will, and
305/// // execute the final call using `doit()`.
306/// // Values shown here are possibly random and not representative !
307/// let result = hub.user_usage_report().get("userKey", "date")
308///              .parameters("aliquyam")
309///              .page_token("ea")
310///              .org_unit_id("no")
311///              .max_results(80)
312///              .filters("justo")
313///              .customer_id("et")
314///              .doit();
315/// 
316/// match result {
317///     Err(e) => match e {
318///         // The Error enum provides details about what exactly happened.
319///         // You can also just use its `Debug`, `Display` or `Error` traits
320///          Error::HttpError(_)
321///         |Error::MissingAPIKey
322///         |Error::MissingToken(_)
323///         |Error::Cancelled
324///         |Error::UploadSizeLimitExceeded(_, _)
325///         |Error::Failure(_)
326///         |Error::BadRequest(_)
327///         |Error::FieldClash(_)
328///         |Error::JsonDecodeError(_, _) => println!("{}", e),
329///     },
330///     Ok(res) => println!("Success: {:?}", res),
331/// }
332/// # }
333/// ```
334pub struct Reports<C, A> {
335    client: RefCell<C>,
336    auth: RefCell<A>,
337    _user_agent: String,
338    _base_url: String,
339    _root_url: String,
340}
341
342impl<'a, C, A> Hub for Reports<C, A> {}
343
344impl<'a, C, A> Reports<C, A>
345    where  C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
346
347    pub fn new(client: C, authenticator: A) -> Reports<C, A> {
348        Reports {
349            client: RefCell::new(client),
350            auth: RefCell::new(authenticator),
351            _user_agent: "google-api-rust-client/1.0.12".to_string(),
352            _base_url: "https://www.googleapis.com/admin/reports/v1/".to_string(),
353            _root_url: "https://www.googleapis.com/".to_string(),
354        }
355    }
356
357    pub fn activities(&'a self) -> ActivityMethods<'a, C, A> {
358        ActivityMethods { hub: &self }
359    }
360    pub fn channels(&'a self) -> ChannelMethods<'a, C, A> {
361        ChannelMethods { hub: &self }
362    }
363    pub fn customer_usage_reports(&'a self) -> CustomerUsageReportMethods<'a, C, A> {
364        CustomerUsageReportMethods { hub: &self }
365    }
366    pub fn entity_usage_reports(&'a self) -> EntityUsageReportMethods<'a, C, A> {
367        EntityUsageReportMethods { hub: &self }
368    }
369    pub fn user_usage_report(&'a self) -> UserUsageReportMethods<'a, C, A> {
370        UserUsageReportMethods { hub: &self }
371    }
372
373    /// Set the user-agent header field to use in all requests to the server.
374    /// It defaults to `google-api-rust-client/1.0.12`.
375    ///
376    /// Returns the previously set user-agent.
377    pub fn user_agent(&mut self, agent_name: String) -> String {
378        mem::replace(&mut self._user_agent, agent_name)
379    }
380
381    /// Set the base url to use in all requests to the server.
382    /// It defaults to `https://www.googleapis.com/admin/reports/v1/`.
383    ///
384    /// Returns the previously set base url.
385    pub fn base_url(&mut self, new_base_url: String) -> String {
386        mem::replace(&mut self._base_url, new_base_url)
387    }
388
389    /// Set the root url to use in all requests to the server.
390    /// It defaults to `https://www.googleapis.com/`.
391    ///
392    /// Returns the previously set root url.
393    pub fn root_url(&mut self, new_root_url: String) -> String {
394        mem::replace(&mut self._root_url, new_root_url)
395    }
396}
397
398
399// ############
400// SCHEMAS ###
401// ##########
402/// Nested value of the parameter.
403/// 
404/// This type is not used in any activity, and only used as *part* of another schema.
405/// 
406#[derive(Default, Clone, Debug, Serialize, Deserialize)]
407pub struct ActivityEventsParametersMessageValue {
408    /// Looping to get parameter values.
409    pub parameter: Option<Vec<NestedParameter>>,
410}
411
412impl NestedType for ActivityEventsParametersMessageValue {}
413impl Part for ActivityEventsParametersMessageValue {}
414
415
416/// Key-Value pairs to give detailed information on the warning.
417/// 
418/// This type is not used in any activity, and only used as *part* of another schema.
419/// 
420#[derive(Default, Clone, Debug, Serialize, Deserialize)]
421pub struct UsageReportsWarningsData {
422    /// Key associated with a key-value pair to give detailed information on the warning.
423    pub key: Option<String>,
424    /// Value associated with a key-value pair to give detailed information on the warning.
425    pub value: Option<String>,
426}
427
428impl NestedType for UsageReportsWarningsData {}
429impl Part for UsageReportsWarningsData {}
430
431
432/// JSON template for a usage report.
433/// 
434/// This type is not used in any activity, and only used as *part* of another schema.
435/// 
436#[derive(Default, Clone, Debug, Serialize, Deserialize)]
437pub struct UsageReport {
438    /// The date to which the record belongs.
439    pub date: Option<String>,
440    /// The kind of object.
441    pub kind: Option<String>,
442    /// ETag of the resource.
443    pub etag: Option<String>,
444    /// Parameter value pairs for various applications.
445    pub parameters: Option<Vec<UsageReportParameters>>,
446    /// Information about the type of the item.
447    pub entity: Option<UsageReportEntity>,
448}
449
450impl Part for UsageReport {}
451
452
453/// Unique identifier for each activity record.
454/// 
455/// This type is not used in any activity, and only used as *part* of another schema.
456/// 
457#[derive(Default, Clone, Debug, Serialize, Deserialize)]
458pub struct ActivityId {
459    /// Application name to which the event belongs.
460    #[serde(rename="applicationName")]
461    pub application_name: Option<String>,
462    /// Unique qualifier if multiple events have the same time.
463    #[serde(rename="uniqueQualifier")]
464    pub unique_qualifier: Option<String>,
465    /// Obfuscated customer ID of the source customer.
466    #[serde(rename="customerId")]
467    pub customer_id: Option<String>,
468    /// Time of occurrence of the activity.
469    pub time: Option<String>,
470}
471
472impl NestedType for ActivityId {}
473impl Part for ActivityId {}
474
475
476/// Warnings if any.
477/// 
478/// This type is not used in any activity, and only used as *part* of another schema.
479/// 
480#[derive(Default, Clone, Debug, Serialize, Deserialize)]
481pub struct UsageReportsWarnings {
482    /// Human readable message for the warning.
483    pub message: Option<String>,
484    /// Machine readable code / warning type.
485    pub code: Option<String>,
486    /// Key-Value pairs to give detailed information on the warning.
487    pub data: Option<Vec<UsageReportsWarningsData>>,
488}
489
490impl NestedType for UsageReportsWarnings {}
491impl Part for UsageReportsWarnings {}
492
493
494/// JSON template for the activity resource.
495/// 
496/// This type is not used in any activity, and only used as *part* of another schema.
497/// 
498#[derive(Default, Clone, Debug, Serialize, Deserialize)]
499pub struct Activity {
500    /// Kind of resource this is.
501    pub kind: Option<String>,
502    /// ETag of the entry.
503    pub etag: Option<String>,
504    /// Activity events.
505    pub events: Option<Vec<ActivityEvents>>,
506    /// IP Address of the user doing the action.
507    #[serde(rename="ipAddress")]
508    pub ip_address: Option<String>,
509    /// Domain of source customer.
510    #[serde(rename="ownerDomain")]
511    pub owner_domain: Option<String>,
512    /// User doing the action.
513    pub actor: Option<ActivityActor>,
514    /// Unique identifier for each activity record.
515    pub id: Option<ActivityId>,
516}
517
518impl Part for Activity {}
519
520
521/// JSON template for a parameter used in various reports.
522/// 
523/// This type is not used in any activity, and only used as *part* of another schema.
524/// 
525#[derive(Default, Clone, Debug, Serialize, Deserialize)]
526pub struct NestedParameter {
527    /// Multiple boolean values of the parameter.
528    #[serde(rename="multiBoolValue")]
529    pub multi_bool_value: Option<Vec<bool>>,
530    /// Boolean value of the parameter.
531    #[serde(rename="boolValue")]
532    pub bool_value: Option<bool>,
533    /// Multiple string values of the parameter.
534    #[serde(rename="multiValue")]
535    pub multi_value: Option<Vec<String>>,
536    /// The name of the parameter.
537    pub name: Option<String>,
538    /// Multiple integral values of the parameter.
539    #[serde(rename="multiIntValue")]
540    pub multi_int_value: Option<Vec<String>>,
541    /// Integral value of the parameter.
542    #[serde(rename="intValue")]
543    pub int_value: Option<String>,
544    /// String value of the parameter.
545    pub value: Option<String>,
546}
547
548impl Part for NestedParameter {}
549
550
551/// An notification channel used to watch for resource changes.
552/// 
553/// # Activities
554/// 
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557/// 
558/// * [watch activities](struct.ActivityWatchCall.html) (request|response)
559/// * [stop channels](struct.ChannelStopCall.html) (request)
560/// 
561#[derive(Default, Clone, Debug, Serialize, Deserialize)]
562pub struct Channel {
563    /// A version-specific identifier for the watched resource.
564    #[serde(rename="resourceUri")]
565    pub resource_uri: Option<String>,
566    /// Identifies this as a notification channel used to watch for changes to a resource, which is "api#channel".
567    pub kind: Option<String>,
568    /// An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
569    #[serde(rename="resourceId")]
570    pub resource_id: Option<String>,
571    /// A UUID or similar unique string that identifies this channel.
572    pub id: Option<String>,
573    /// An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
574    pub token: Option<String>,
575    /// Additional parameters controlling delivery channel behavior. Optional.
576    pub params: Option<HashMap<String, String>>,
577    /// Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
578    pub expiration: Option<String>,
579    /// The address where notifications are delivered for this channel.
580    pub address: Option<String>,
581    /// The type of delivery mechanism used for this channel.
582    #[serde(rename="type")]
583    pub type_: Option<String>,
584    /// A Boolean value to indicate whether payload is wanted. Optional.
585    pub payload: Option<bool>,
586}
587
588impl RequestValue for Channel {}
589impl Resource for Channel {}
590impl ResponseResult for Channel {}
591
592
593/// JSON template for a collection of activites.
594/// 
595/// # Activities
596/// 
597/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
598/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
599/// 
600/// * [list activities](struct.ActivityListCall.html) (response)
601/// 
602#[derive(Default, Clone, Debug, Serialize, Deserialize)]
603pub struct Activities {
604    /// Token for retrieving the next page
605    #[serde(rename="nextPageToken")]
606    pub next_page_token: Option<String>,
607    /// Each record in read response.
608    pub items: Option<Vec<Activity>>,
609    /// Kind of list response this is.
610    pub kind: Option<String>,
611    /// ETag of the resource.
612    pub etag: Option<String>,
613}
614
615impl ResponseResult for Activities {}
616
617
618/// Nested values of the parameter.
619/// 
620/// This type is not used in any activity, and only used as *part* of another schema.
621/// 
622#[derive(Default, Clone, Debug, Serialize, Deserialize)]
623pub struct ActivityEventsParametersMultiMessageValue {
624    /// Parameter value.
625    pub parameter: Option<Vec<NestedParameter>>,
626}
627
628impl NestedType for ActivityEventsParametersMultiMessageValue {}
629impl Part for ActivityEventsParametersMultiMessageValue {}
630
631
632/// Parameter value pairs for various applications.
633/// 
634/// This type is not used in any activity, and only used as *part* of another schema.
635/// 
636#[derive(Default, Clone, Debug, Serialize, Deserialize)]
637pub struct UsageReportParameters {
638    /// Nested message value of the parameter.
639    #[serde(rename="msgValue")]
640    pub msg_value: Option<Vec<HashMap<String, String>>>,
641    /// RFC 3339 formatted value of the parameter.
642    #[serde(rename="datetimeValue")]
643    pub datetime_value: Option<String>,
644    /// The name of the parameter.
645    pub name: Option<String>,
646    /// String value of the parameter.
647    #[serde(rename="stringValue")]
648    pub string_value: Option<String>,
649    /// Boolean value of the parameter.
650    #[serde(rename="boolValue")]
651    pub bool_value: Option<bool>,
652    /// Integral value of the parameter.
653    #[serde(rename="intValue")]
654    pub int_value: Option<String>,
655}
656
657impl NestedType for UsageReportParameters {}
658impl Part for UsageReportParameters {}
659
660
661/// User doing the action.
662/// 
663/// This type is not used in any activity, and only used as *part* of another schema.
664/// 
665#[derive(Default, Clone, Debug, Serialize, Deserialize)]
666pub struct ActivityActor {
667    /// Obfuscated user id of the user.
668    #[serde(rename="profileId")]
669    pub profile_id: Option<String>,
670    /// Email address of the user.
671    pub email: Option<String>,
672    /// For OAuth 2LO API requests, consumer_key of the requestor.
673    pub key: Option<String>,
674    /// User or OAuth 2LO request.
675    #[serde(rename="callerType")]
676    pub caller_type: Option<String>,
677}
678
679impl NestedType for ActivityActor {}
680impl Part for ActivityActor {}
681
682
683/// JSON template for a collection of usage reports.
684/// 
685/// # Activities
686/// 
687/// This type is used in activities, which are methods you may call on this type or where this type is involved in. 
688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
689/// 
690/// * [get user usage report](struct.UserUsageReportGetCall.html) (response)
691/// * [get entity usage reports](struct.EntityUsageReportGetCall.html) (response)
692/// * [get customer usage reports](struct.CustomerUsageReportGetCall.html) (response)
693/// 
694#[derive(Default, Clone, Debug, Serialize, Deserialize)]
695pub struct UsageReports {
696    /// Token for retrieving the next page
697    #[serde(rename="nextPageToken")]
698    pub next_page_token: Option<String>,
699    /// The kind of object.
700    pub kind: Option<String>,
701    /// ETag of the resource.
702    pub etag: Option<String>,
703    /// Various application parameter records.
704    #[serde(rename="usageReports")]
705    pub usage_reports: Option<Vec<UsageReport>>,
706    /// Warnings if any.
707    pub warnings: Option<Vec<UsageReportsWarnings>>,
708}
709
710impl ResponseResult for UsageReports {}
711
712
713/// Parameter value pairs for various applications.
714/// 
715/// This type is not used in any activity, and only used as *part* of another schema.
716/// 
717#[derive(Default, Clone, Debug, Serialize, Deserialize)]
718pub struct ActivityEventsParameters {
719    /// The name of the parameter.
720    pub name: Option<String>,
721    /// Nested value of the parameter.
722    #[serde(rename="messageValue")]
723    pub message_value: Option<ActivityEventsParametersMessageValue>,
724    /// Boolean value of the parameter.
725    #[serde(rename="boolValue")]
726    pub bool_value: Option<bool>,
727    /// String value of the parameter.
728    pub value: Option<String>,
729    /// Integral value of the parameter.
730    #[serde(rename="intValue")]
731    pub int_value: Option<String>,
732    /// Multi-string value of the parameter.
733    #[serde(rename="multiValue")]
734    pub multi_value: Option<Vec<String>>,
735    /// Multi-int value of the parameter.
736    #[serde(rename="multiIntValue")]
737    pub multi_int_value: Option<Vec<String>>,
738    /// Nested values of the parameter.
739    #[serde(rename="multiMessageValue")]
740    pub multi_message_value: Option<Vec<ActivityEventsParametersMultiMessageValue>>,
741}
742
743impl NestedType for ActivityEventsParameters {}
744impl Part for ActivityEventsParameters {}
745
746
747/// Activity events.
748/// 
749/// This type is not used in any activity, and only used as *part* of another schema.
750/// 
751#[derive(Default, Clone, Debug, Serialize, Deserialize)]
752pub struct ActivityEvents {
753    /// Type of event.
754    #[serde(rename="type")]
755    pub type_: Option<String>,
756    /// Name of event.
757    pub name: Option<String>,
758    /// Parameter value pairs for various applications.
759    pub parameters: Option<Vec<ActivityEventsParameters>>,
760}
761
762impl NestedType for ActivityEvents {}
763impl Part for ActivityEvents {}
764
765
766/// Information about the type of the item.
767/// 
768/// This type is not used in any activity, and only used as *part* of another schema.
769/// 
770#[derive(Default, Clone, Debug, Serialize, Deserialize)]
771pub struct UsageReportEntity {
772    /// Obfuscated user id for the record.
773    #[serde(rename="profileId")]
774    pub profile_id: Option<String>,
775    /// user's email. Only relevant if entity.type = "USER"
776    #[serde(rename="userEmail")]
777    pub user_email: Option<String>,
778    /// The type of item, can be customer, user, or entity (aka. object).
779    #[serde(rename="type")]
780    pub type_: Option<String>,
781    /// Object key. Only relevant if entity.type = "OBJECT" Note: external-facing name of report is "Entities" rather than "Objects".
782    #[serde(rename="entityId")]
783    pub entity_id: Option<String>,
784    /// Obfuscated customer id for the record.
785    #[serde(rename="customerId")]
786    pub customer_id: Option<String>,
787}
788
789impl NestedType for UsageReportEntity {}
790impl Part for UsageReportEntity {}
791
792
793
794// ###################
795// MethodBuilders ###
796// #################
797
798/// A builder providing access to all methods supported on *channel* resources.
799/// It is not used directly, but through the `Reports` hub.
800///
801/// # Example
802///
803/// Instantiate a resource builder
804///
805/// ```test_harness,no_run
806/// extern crate hyper;
807/// extern crate hyper_rustls;
808/// extern crate yup_oauth2 as oauth2;
809/// extern crate google_admin1_reports as admin1_reports;
810/// 
811/// # #[test] fn egal() {
812/// use std::default::Default;
813/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
814/// use admin1_reports::Reports;
815/// 
816/// let secret: ApplicationSecret = Default::default();
817/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
818///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
819///                               <MemoryStorage as Default>::default(), None);
820/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
821/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
822/// // like `stop(...)`
823/// // to build up your call.
824/// let rb = hub.channels();
825/// # }
826/// ```
827pub struct ChannelMethods<'a, C, A>
828    where C: 'a, A: 'a {
829
830    hub: &'a Reports<C, A>,
831}
832
833impl<'a, C, A> MethodsBuilder for ChannelMethods<'a, C, A> {}
834
835impl<'a, C, A> ChannelMethods<'a, C, A> {
836    
837    /// Create a builder to help you perform the following task:
838    ///
839    /// Stop watching resources through this channel
840    /// 
841    /// # Arguments
842    ///
843    /// * `request` - No description provided.
844    pub fn stop(&self, request: Channel) -> ChannelStopCall<'a, C, A> {
845        ChannelStopCall {
846            hub: self.hub,
847            _request: request,
848            _delegate: Default::default(),
849            _scopes: Default::default(),
850            _additional_params: Default::default(),
851        }
852    }
853}
854
855
856
857/// A builder providing access to all methods supported on *entityUsageReport* resources.
858/// It is not used directly, but through the `Reports` hub.
859///
860/// # Example
861///
862/// Instantiate a resource builder
863///
864/// ```test_harness,no_run
865/// extern crate hyper;
866/// extern crate hyper_rustls;
867/// extern crate yup_oauth2 as oauth2;
868/// extern crate google_admin1_reports as admin1_reports;
869/// 
870/// # #[test] fn egal() {
871/// use std::default::Default;
872/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
873/// use admin1_reports::Reports;
874/// 
875/// let secret: ApplicationSecret = Default::default();
876/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
877///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
878///                               <MemoryStorage as Default>::default(), None);
879/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
880/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
881/// // like `get(...)`
882/// // to build up your call.
883/// let rb = hub.entity_usage_reports();
884/// # }
885/// ```
886pub struct EntityUsageReportMethods<'a, C, A>
887    where C: 'a, A: 'a {
888
889    hub: &'a Reports<C, A>,
890}
891
892impl<'a, C, A> MethodsBuilder for EntityUsageReportMethods<'a, C, A> {}
893
894impl<'a, C, A> EntityUsageReportMethods<'a, C, A> {
895    
896    /// Create a builder to help you perform the following task:
897    ///
898    /// Retrieves a report which is a collection of properties / statistics for a set of objects.
899    /// 
900    /// # Arguments
901    ///
902    /// * `entityType` - Type of object. Should be one of - gplus_communities.
903    /// * `entityKey` - Represents the key of object for which the data should be filtered.
904    /// * `date` - Represents the date in yyyy-mm-dd format for which the data is to be fetched.
905    pub fn get(&self, entity_type: &str, entity_key: &str, date: &str) -> EntityUsageReportGetCall<'a, C, A> {
906        EntityUsageReportGetCall {
907            hub: self.hub,
908            _entity_type: entity_type.to_string(),
909            _entity_key: entity_key.to_string(),
910            _date: date.to_string(),
911            _parameters: Default::default(),
912            _page_token: Default::default(),
913            _max_results: Default::default(),
914            _filters: Default::default(),
915            _customer_id: Default::default(),
916            _delegate: Default::default(),
917            _scopes: Default::default(),
918            _additional_params: Default::default(),
919        }
920    }
921}
922
923
924
925/// A builder providing access to all methods supported on *activity* resources.
926/// It is not used directly, but through the `Reports` hub.
927///
928/// # Example
929///
930/// Instantiate a resource builder
931///
932/// ```test_harness,no_run
933/// extern crate hyper;
934/// extern crate hyper_rustls;
935/// extern crate yup_oauth2 as oauth2;
936/// extern crate google_admin1_reports as admin1_reports;
937/// 
938/// # #[test] fn egal() {
939/// use std::default::Default;
940/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
941/// use admin1_reports::Reports;
942/// 
943/// let secret: ApplicationSecret = Default::default();
944/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
945///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
946///                               <MemoryStorage as Default>::default(), None);
947/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
948/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
949/// // like `list(...)` and `watch(...)`
950/// // to build up your call.
951/// let rb = hub.activities();
952/// # }
953/// ```
954pub struct ActivityMethods<'a, C, A>
955    where C: 'a, A: 'a {
956
957    hub: &'a Reports<C, A>,
958}
959
960impl<'a, C, A> MethodsBuilder for ActivityMethods<'a, C, A> {}
961
962impl<'a, C, A> ActivityMethods<'a, C, A> {
963    
964    /// Create a builder to help you perform the following task:
965    ///
966    /// Retrieves a list of activities for a specific customer and application.
967    /// 
968    /// # Arguments
969    ///
970    /// * `userKey` - Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.
971    /// * `applicationName` - Application name for which the events are to be retrieved.
972    pub fn list(&self, user_key: &str, application_name: &str) -> ActivityListCall<'a, C, A> {
973        ActivityListCall {
974            hub: self.hub,
975            _user_key: user_key.to_string(),
976            _application_name: application_name.to_string(),
977            _start_time: Default::default(),
978            _page_token: Default::default(),
979            _org_unit_id: Default::default(),
980            _max_results: Default::default(),
981            _filters: Default::default(),
982            _event_name: Default::default(),
983            _end_time: Default::default(),
984            _customer_id: Default::default(),
985            _actor_ip_address: Default::default(),
986            _delegate: Default::default(),
987            _scopes: Default::default(),
988            _additional_params: Default::default(),
989        }
990    }
991    
992    /// Create a builder to help you perform the following task:
993    ///
994    /// Push changes to activities
995    /// 
996    /// # Arguments
997    ///
998    /// * `request` - No description provided.
999    /// * `userKey` - Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.
1000    /// * `applicationName` - Application name for which the events are to be retrieved.
1001    pub fn watch(&self, request: Channel, user_key: &str, application_name: &str) -> ActivityWatchCall<'a, C, A> {
1002        ActivityWatchCall {
1003            hub: self.hub,
1004            _request: request,
1005            _user_key: user_key.to_string(),
1006            _application_name: application_name.to_string(),
1007            _start_time: Default::default(),
1008            _page_token: Default::default(),
1009            _org_unit_id: Default::default(),
1010            _max_results: Default::default(),
1011            _filters: Default::default(),
1012            _event_name: Default::default(),
1013            _end_time: Default::default(),
1014            _customer_id: Default::default(),
1015            _actor_ip_address: Default::default(),
1016            _delegate: Default::default(),
1017            _scopes: Default::default(),
1018            _additional_params: Default::default(),
1019        }
1020    }
1021}
1022
1023
1024
1025/// A builder providing access to all methods supported on *customerUsageReport* resources.
1026/// It is not used directly, but through the `Reports` hub.
1027///
1028/// # Example
1029///
1030/// Instantiate a resource builder
1031///
1032/// ```test_harness,no_run
1033/// extern crate hyper;
1034/// extern crate hyper_rustls;
1035/// extern crate yup_oauth2 as oauth2;
1036/// extern crate google_admin1_reports as admin1_reports;
1037/// 
1038/// # #[test] fn egal() {
1039/// use std::default::Default;
1040/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
1041/// use admin1_reports::Reports;
1042/// 
1043/// let secret: ApplicationSecret = Default::default();
1044/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
1045///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
1046///                               <MemoryStorage as Default>::default(), None);
1047/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
1048/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1049/// // like `get(...)`
1050/// // to build up your call.
1051/// let rb = hub.customer_usage_reports();
1052/// # }
1053/// ```
1054pub struct CustomerUsageReportMethods<'a, C, A>
1055    where C: 'a, A: 'a {
1056
1057    hub: &'a Reports<C, A>,
1058}
1059
1060impl<'a, C, A> MethodsBuilder for CustomerUsageReportMethods<'a, C, A> {}
1061
1062impl<'a, C, A> CustomerUsageReportMethods<'a, C, A> {
1063    
1064    /// Create a builder to help you perform the following task:
1065    ///
1066    /// Retrieves a report which is a collection of properties / statistics for a specific customer.
1067    /// 
1068    /// # Arguments
1069    ///
1070    /// * `date` - Represents the date in yyyy-mm-dd format for which the data is to be fetched.
1071    pub fn get(&self, date: &str) -> CustomerUsageReportGetCall<'a, C, A> {
1072        CustomerUsageReportGetCall {
1073            hub: self.hub,
1074            _date: date.to_string(),
1075            _parameters: Default::default(),
1076            _page_token: Default::default(),
1077            _customer_id: Default::default(),
1078            _delegate: Default::default(),
1079            _scopes: Default::default(),
1080            _additional_params: Default::default(),
1081        }
1082    }
1083}
1084
1085
1086
1087/// A builder providing access to all methods supported on *userUsageReport* resources.
1088/// It is not used directly, but through the `Reports` hub.
1089///
1090/// # Example
1091///
1092/// Instantiate a resource builder
1093///
1094/// ```test_harness,no_run
1095/// extern crate hyper;
1096/// extern crate hyper_rustls;
1097/// extern crate yup_oauth2 as oauth2;
1098/// extern crate google_admin1_reports as admin1_reports;
1099/// 
1100/// # #[test] fn egal() {
1101/// use std::default::Default;
1102/// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
1103/// use admin1_reports::Reports;
1104/// 
1105/// let secret: ApplicationSecret = Default::default();
1106/// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
1107///                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
1108///                               <MemoryStorage as Default>::default(), None);
1109/// let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
1110/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1111/// // like `get(...)`
1112/// // to build up your call.
1113/// let rb = hub.user_usage_report();
1114/// # }
1115/// ```
1116pub struct UserUsageReportMethods<'a, C, A>
1117    where C: 'a, A: 'a {
1118
1119    hub: &'a Reports<C, A>,
1120}
1121
1122impl<'a, C, A> MethodsBuilder for UserUsageReportMethods<'a, C, A> {}
1123
1124impl<'a, C, A> UserUsageReportMethods<'a, C, A> {
1125    
1126    /// Create a builder to help you perform the following task:
1127    ///
1128    /// Retrieves a report which is a collection of properties / statistics for a set of users.
1129    /// 
1130    /// # Arguments
1131    ///
1132    /// * `userKey` - Represents the profile id or the user email for which the data should be filtered.
1133    /// * `date` - Represents the date in yyyy-mm-dd format for which the data is to be fetched.
1134    pub fn get(&self, user_key: &str, date: &str) -> UserUsageReportGetCall<'a, C, A> {
1135        UserUsageReportGetCall {
1136            hub: self.hub,
1137            _user_key: user_key.to_string(),
1138            _date: date.to_string(),
1139            _parameters: Default::default(),
1140            _page_token: Default::default(),
1141            _org_unit_id: Default::default(),
1142            _max_results: Default::default(),
1143            _filters: Default::default(),
1144            _customer_id: Default::default(),
1145            _delegate: Default::default(),
1146            _scopes: Default::default(),
1147            _additional_params: Default::default(),
1148        }
1149    }
1150}
1151
1152
1153
1154
1155
1156// ###################
1157// CallBuilders   ###
1158// #################
1159
1160/// Stop watching resources through this channel
1161///
1162/// A builder for the *stop* method supported by a *channel* resource.
1163/// It is not used directly, but through a `ChannelMethods` instance.
1164///
1165/// # Example
1166///
1167/// Instantiate a resource method builder
1168///
1169/// ```test_harness,no_run
1170/// # extern crate hyper;
1171/// # extern crate hyper_rustls;
1172/// # extern crate yup_oauth2 as oauth2;
1173/// # extern crate google_admin1_reports as admin1_reports;
1174/// use admin1_reports::Channel;
1175/// # #[test] fn egal() {
1176/// # use std::default::Default;
1177/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
1178/// # use admin1_reports::Reports;
1179/// 
1180/// # let secret: ApplicationSecret = Default::default();
1181/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
1182/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
1183/// #                               <MemoryStorage as Default>::default(), None);
1184/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
1185/// // As the method needs a request, you would usually fill it with the desired information
1186/// // into the respective structure. Some of the parts shown here might not be applicable !
1187/// // Values shown here are possibly random and not representative !
1188/// let mut req = Channel::default();
1189/// 
1190/// // You can configure optional parameters by calling the respective setters at will, and
1191/// // execute the final call using `doit()`.
1192/// // Values shown here are possibly random and not representative !
1193/// let result = hub.channels().stop(req)
1194///              .doit();
1195/// # }
1196/// ```
1197pub struct ChannelStopCall<'a, C, A>
1198    where C: 'a, A: 'a {
1199
1200    hub: &'a Reports<C, A>,
1201    _request: Channel,
1202    _delegate: Option<&'a mut Delegate>,
1203    _additional_params: HashMap<String, String>,
1204    _scopes: BTreeMap<String, ()>
1205}
1206
1207impl<'a, C, A> CallBuilder for ChannelStopCall<'a, C, A> {}
1208
1209impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
1210
1211
1212    /// Perform the operation you have build so far.
1213    pub fn doit(mut self) -> Result<hyper::client::Response> {
1214        use std::io::{Read, Seek};
1215        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
1216        let mut dd = DefaultDelegate;
1217        let mut dlg: &mut Delegate = match self._delegate {
1218            Some(d) => d,
1219            None => &mut dd
1220        };
1221        dlg.begin(MethodInfo { id: "admin.channels.stop",
1222                               http_method: hyper::method::Method::Post });
1223        let mut params: Vec<(&str, String)> = Vec::with_capacity(2 + self._additional_params.len());
1224        for &field in [].iter() {
1225            if self._additional_params.contains_key(field) {
1226                dlg.finished(false);
1227                return Err(Error::FieldClash(field));
1228            }
1229        }
1230        for (name, value) in self._additional_params.iter() {
1231            params.push((&name, value.clone()));
1232        }
1233
1234
1235        let mut url = self.hub._base_url.clone() + "/admin/reports_v1/channels/stop";
1236        if self._scopes.len() == 0 {
1237            self._scopes.insert(Scope::ReportAuditReadonly.as_ref().to_string(), ());
1238        }
1239
1240
1241        let url = hyper::Url::parse_with_params(&url, params).unwrap();
1242
1243        let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
1244        let mut request_value_reader =
1245            {
1246                let mut value = json::value::to_value(&self._request).expect("serde to work");
1247                remove_json_null_values(&mut value);
1248                let mut dst = io::Cursor::new(Vec::with_capacity(128));
1249                json::to_writer(&mut dst, &value).unwrap();
1250                dst
1251            };
1252        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
1253        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1254
1255
1256        loop {
1257            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
1258                Ok(token) => token,
1259                Err(err) => {
1260                    match  dlg.token(&*err) {
1261                        Some(token) => token,
1262                        None => {
1263                            dlg.finished(false);
1264                            return Err(Error::MissingToken(err))
1265                        }
1266                    }
1267                }
1268            };
1269            let auth_header = Authorization(Bearer { token: token.access_token });
1270            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
1271            let mut req_result = {
1272                let mut client = &mut *self.hub.client.borrow_mut();
1273                let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
1274                    .header(UserAgent(self.hub._user_agent.clone()))
1275                    .header(auth_header.clone())
1276                    .header(ContentType(json_mime_type.clone()))
1277                    .header(ContentLength(request_size as u64))
1278                    .body(&mut request_value_reader);
1279
1280                dlg.pre_request();
1281                req.send()
1282            };
1283
1284            match req_result {
1285                Err(err) => {
1286                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
1287                        sleep(d);
1288                        continue;
1289                    }
1290                    dlg.finished(false);
1291                    return Err(Error::HttpError(err))
1292                }
1293                Ok(mut res) => {
1294                    if !res.status.is_success() {
1295                        let mut json_err = String::new();
1296                        res.read_to_string(&mut json_err).unwrap();
1297                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
1298                                                              json::from_str(&json_err).ok(),
1299                                                              json::from_str(&json_err).ok()) {
1300                            sleep(d);
1301                            continue;
1302                        }
1303                        dlg.finished(false);
1304                        return match json::from_str::<ErrorResponse>(&json_err){
1305                            Err(_) => Err(Error::Failure(res)),
1306                            Ok(serr) => Err(Error::BadRequest(serr))
1307                        }
1308                    }
1309                    let result_value = res;
1310
1311                    dlg.finished(true);
1312                    return Ok(result_value)
1313                }
1314            }
1315        }
1316    }
1317
1318
1319    ///
1320    /// Sets the *request* property to the given value.
1321    ///
1322    /// Even though the property as already been set when instantiating this call,
1323    /// we provide this method for API completeness.
1324    pub fn request(mut self, new_value: Channel) -> ChannelStopCall<'a, C, A> {
1325        self._request = new_value;
1326        self
1327    }
1328    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1329    /// while executing the actual API request.
1330    /// 
1331    /// It should be used to handle progress information, and to implement a certain level of resilience.
1332    ///
1333    /// Sets the *delegate* property to the given value.
1334    pub fn delegate(mut self, new_value: &'a mut Delegate) -> ChannelStopCall<'a, C, A> {
1335        self._delegate = Some(new_value);
1336        self
1337    }
1338
1339    /// Set any additional parameter of the query string used in the request.
1340    /// It should be used to set parameters which are not yet available through their own
1341    /// setters.
1342    ///
1343    /// Please note that this method must not be used to set any of the known parameters
1344    /// which have their own setter method. If done anyway, the request will fail.
1345    ///
1346    /// # Additional Parameters
1347    ///
1348    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
1349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1350    /// * *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.
1351    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1352    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
1353    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1354    /// * *alt* (query-string) - Data format for the response.
1355    pub fn param<T>(mut self, name: T, value: T) -> ChannelStopCall<'a, C, A>
1356                                                        where T: AsRef<str> {
1357        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
1358        self
1359    }
1360
1361    /// Identifies the authorization scope for the method you are building.
1362    ///
1363    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
1364    /// `Scope::ReportAuditReadonly`.
1365    ///
1366    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1367    /// tokens for more than one scope.
1368    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
1369    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
1370    /// function for details).
1371    ///
1372    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1373    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1374    /// sufficient, a read-write scope will do as well.
1375    pub fn add_scope<T, S>(mut self, scope: T) -> ChannelStopCall<'a, C, A>
1376                                                        where T: Into<Option<S>>,
1377                                                              S: AsRef<str> {
1378        match scope.into() {
1379          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
1380          None => None,
1381        };
1382        self
1383    }
1384}
1385
1386
1387/// Retrieves a report which is a collection of properties / statistics for a set of objects.
1388///
1389/// A builder for the *get* method supported by a *entityUsageReport* resource.
1390/// It is not used directly, but through a `EntityUsageReportMethods` instance.
1391///
1392/// # Example
1393///
1394/// Instantiate a resource method builder
1395///
1396/// ```test_harness,no_run
1397/// # extern crate hyper;
1398/// # extern crate hyper_rustls;
1399/// # extern crate yup_oauth2 as oauth2;
1400/// # extern crate google_admin1_reports as admin1_reports;
1401/// # #[test] fn egal() {
1402/// # use std::default::Default;
1403/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
1404/// # use admin1_reports::Reports;
1405/// 
1406/// # let secret: ApplicationSecret = Default::default();
1407/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
1408/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
1409/// #                               <MemoryStorage as Default>::default(), None);
1410/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
1411/// // You can configure optional parameters by calling the respective setters at will, and
1412/// // execute the final call using `doit()`.
1413/// // Values shown here are possibly random and not representative !
1414/// let result = hub.entity_usage_reports().get("entityType", "entityKey", "date")
1415///              .parameters("Lorem")
1416///              .page_token("et")
1417///              .max_results(31)
1418///              .filters("aliquyam")
1419///              .customer_id("sea")
1420///              .doit();
1421/// # }
1422/// ```
1423pub struct EntityUsageReportGetCall<'a, C, A>
1424    where C: 'a, A: 'a {
1425
1426    hub: &'a Reports<C, A>,
1427    _entity_type: String,
1428    _entity_key: String,
1429    _date: String,
1430    _parameters: Option<String>,
1431    _page_token: Option<String>,
1432    _max_results: Option<u32>,
1433    _filters: Option<String>,
1434    _customer_id: Option<String>,
1435    _delegate: Option<&'a mut Delegate>,
1436    _additional_params: HashMap<String, String>,
1437    _scopes: BTreeMap<String, ()>
1438}
1439
1440impl<'a, C, A> CallBuilder for EntityUsageReportGetCall<'a, C, A> {}
1441
1442impl<'a, C, A> EntityUsageReportGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
1443
1444
1445    /// Perform the operation you have build so far.
1446    pub fn doit(mut self) -> Result<(hyper::client::Response, UsageReports)> {
1447        use std::io::{Read, Seek};
1448        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
1449        let mut dd = DefaultDelegate;
1450        let mut dlg: &mut Delegate = match self._delegate {
1451            Some(d) => d,
1452            None => &mut dd
1453        };
1454        dlg.begin(MethodInfo { id: "reports.entityUsageReports.get",
1455                               http_method: hyper::method::Method::Get });
1456        let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len());
1457        params.push(("entityType", self._entity_type.to_string()));
1458        params.push(("entityKey", self._entity_key.to_string()));
1459        params.push(("date", self._date.to_string()));
1460        if let Some(value) = self._parameters {
1461            params.push(("parameters", value.to_string()));
1462        }
1463        if let Some(value) = self._page_token {
1464            params.push(("pageToken", value.to_string()));
1465        }
1466        if let Some(value) = self._max_results {
1467            params.push(("maxResults", value.to_string()));
1468        }
1469        if let Some(value) = self._filters {
1470            params.push(("filters", value.to_string()));
1471        }
1472        if let Some(value) = self._customer_id {
1473            params.push(("customerId", value.to_string()));
1474        }
1475        for &field in ["alt", "entityType", "entityKey", "date", "parameters", "pageToken", "maxResults", "filters", "customerId"].iter() {
1476            if self._additional_params.contains_key(field) {
1477                dlg.finished(false);
1478                return Err(Error::FieldClash(field));
1479            }
1480        }
1481        for (name, value) in self._additional_params.iter() {
1482            params.push((&name, value.clone()));
1483        }
1484
1485        params.push(("alt", "json".to_string()));
1486
1487        let mut url = self.hub._base_url.clone() + "usage/{entityType}/{entityKey}/dates/{date}";
1488        if self._scopes.len() == 0 {
1489            self._scopes.insert(Scope::ReportUsageReadonly.as_ref().to_string(), ());
1490        }
1491
1492        for &(find_this, param_name) in [("{entityType}", "entityType"), ("{entityKey}", "entityKey"), ("{date}", "date")].iter() {
1493            let mut replace_with: Option<&str> = None;
1494            for &(name, ref value) in params.iter() {
1495                if name == param_name {
1496                    replace_with = Some(value);
1497                    break;
1498                }
1499            }
1500            url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
1501        }
1502        {
1503            let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
1504            for param_name in ["date", "entityKey", "entityType"].iter() {
1505                if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
1506                    indices_for_removal.push(index);
1507                }
1508            }
1509            for &index in indices_for_removal.iter() {
1510                params.remove(index);
1511            }
1512        }
1513
1514        let url = hyper::Url::parse_with_params(&url, params).unwrap();
1515
1516
1517
1518        loop {
1519            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
1520                Ok(token) => token,
1521                Err(err) => {
1522                    match  dlg.token(&*err) {
1523                        Some(token) => token,
1524                        None => {
1525                            dlg.finished(false);
1526                            return Err(Error::MissingToken(err))
1527                        }
1528                    }
1529                }
1530            };
1531            let auth_header = Authorization(Bearer { token: token.access_token });
1532            let mut req_result = {
1533                let mut client = &mut *self.hub.client.borrow_mut();
1534                let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
1535                    .header(UserAgent(self.hub._user_agent.clone()))
1536                    .header(auth_header.clone());
1537
1538                dlg.pre_request();
1539                req.send()
1540            };
1541
1542            match req_result {
1543                Err(err) => {
1544                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
1545                        sleep(d);
1546                        continue;
1547                    }
1548                    dlg.finished(false);
1549                    return Err(Error::HttpError(err))
1550                }
1551                Ok(mut res) => {
1552                    if !res.status.is_success() {
1553                        let mut json_err = String::new();
1554                        res.read_to_string(&mut json_err).unwrap();
1555                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
1556                                                              json::from_str(&json_err).ok(),
1557                                                              json::from_str(&json_err).ok()) {
1558                            sleep(d);
1559                            continue;
1560                        }
1561                        dlg.finished(false);
1562                        return match json::from_str::<ErrorResponse>(&json_err){
1563                            Err(_) => Err(Error::Failure(res)),
1564                            Ok(serr) => Err(Error::BadRequest(serr))
1565                        }
1566                    }
1567                    let result_value = {
1568                        let mut json_response = String::new();
1569                        res.read_to_string(&mut json_response).unwrap();
1570                        match json::from_str(&json_response) {
1571                            Ok(decoded) => (res, decoded),
1572                            Err(err) => {
1573                                dlg.response_json_decode_error(&json_response, &err);
1574                                return Err(Error::JsonDecodeError(json_response, err));
1575                            }
1576                        }
1577                    };
1578
1579                    dlg.finished(true);
1580                    return Ok(result_value)
1581                }
1582            }
1583        }
1584    }
1585
1586
1587    /// Type of object. Should be one of - gplus_communities.
1588    ///
1589    /// Sets the *entity type* path property to the given value.
1590    ///
1591    /// Even though the property as already been set when instantiating this call,
1592    /// we provide this method for API completeness.
1593    pub fn entity_type(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1594        self._entity_type = new_value.to_string();
1595        self
1596    }
1597    /// Represents the key of object for which the data should be filtered.
1598    ///
1599    /// Sets the *entity key* path property to the given value.
1600    ///
1601    /// Even though the property as already been set when instantiating this call,
1602    /// we provide this method for API completeness.
1603    pub fn entity_key(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1604        self._entity_key = new_value.to_string();
1605        self
1606    }
1607    /// Represents the date in yyyy-mm-dd format for which the data is to be fetched.
1608    ///
1609    /// Sets the *date* path property to the given value.
1610    ///
1611    /// Even though the property as already been set when instantiating this call,
1612    /// we provide this method for API completeness.
1613    pub fn date(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1614        self._date = new_value.to_string();
1615        self
1616    }
1617    /// Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.
1618    ///
1619    /// Sets the *parameters* query property to the given value.
1620    pub fn parameters(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1621        self._parameters = Some(new_value.to_string());
1622        self
1623    }
1624    /// Token to specify next page.
1625    ///
1626    /// Sets the *page token* query property to the given value.
1627    pub fn page_token(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1628        self._page_token = Some(new_value.to_string());
1629        self
1630    }
1631    /// Maximum number of results to return. Maximum allowed is 1000
1632    ///
1633    /// Sets the *max results* query property to the given value.
1634    pub fn max_results(mut self, new_value: u32) -> EntityUsageReportGetCall<'a, C, A> {
1635        self._max_results = Some(new_value);
1636        self
1637    }
1638    /// Represents the set of filters including parameter operator value.
1639    ///
1640    /// Sets the *filters* query property to the given value.
1641    pub fn filters(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1642        self._filters = Some(new_value.to_string());
1643        self
1644    }
1645    /// Represents the customer for which the data is to be fetched.
1646    ///
1647    /// Sets the *customer id* query property to the given value.
1648    pub fn customer_id(mut self, new_value: &str) -> EntityUsageReportGetCall<'a, C, A> {
1649        self._customer_id = Some(new_value.to_string());
1650        self
1651    }
1652    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1653    /// while executing the actual API request.
1654    /// 
1655    /// It should be used to handle progress information, and to implement a certain level of resilience.
1656    ///
1657    /// Sets the *delegate* property to the given value.
1658    pub fn delegate(mut self, new_value: &'a mut Delegate) -> EntityUsageReportGetCall<'a, C, A> {
1659        self._delegate = Some(new_value);
1660        self
1661    }
1662
1663    /// Set any additional parameter of the query string used in the request.
1664    /// It should be used to set parameters which are not yet available through their own
1665    /// setters.
1666    ///
1667    /// Please note that this method must not be used to set any of the known parameters
1668    /// which have their own setter method. If done anyway, the request will fail.
1669    ///
1670    /// # Additional Parameters
1671    ///
1672    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
1673    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1674    /// * *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.
1675    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1676    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
1677    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1678    /// * *alt* (query-string) - Data format for the response.
1679    pub fn param<T>(mut self, name: T, value: T) -> EntityUsageReportGetCall<'a, C, A>
1680                                                        where T: AsRef<str> {
1681        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
1682        self
1683    }
1684
1685    /// Identifies the authorization scope for the method you are building.
1686    ///
1687    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
1688    /// `Scope::ReportUsageReadonly`.
1689    ///
1690    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1691    /// tokens for more than one scope.
1692    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
1693    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
1694    /// function for details).
1695    ///
1696    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1697    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1698    /// sufficient, a read-write scope will do as well.
1699    pub fn add_scope<T, S>(mut self, scope: T) -> EntityUsageReportGetCall<'a, C, A>
1700                                                        where T: Into<Option<S>>,
1701                                                              S: AsRef<str> {
1702        match scope.into() {
1703          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
1704          None => None,
1705        };
1706        self
1707    }
1708}
1709
1710
1711/// Retrieves a list of activities for a specific customer and application.
1712///
1713/// A builder for the *list* method supported by a *activity* resource.
1714/// It is not used directly, but through a `ActivityMethods` instance.
1715///
1716/// # Example
1717///
1718/// Instantiate a resource method builder
1719///
1720/// ```test_harness,no_run
1721/// # extern crate hyper;
1722/// # extern crate hyper_rustls;
1723/// # extern crate yup_oauth2 as oauth2;
1724/// # extern crate google_admin1_reports as admin1_reports;
1725/// # #[test] fn egal() {
1726/// # use std::default::Default;
1727/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
1728/// # use admin1_reports::Reports;
1729/// 
1730/// # let secret: ApplicationSecret = Default::default();
1731/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
1732/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
1733/// #                               <MemoryStorage as Default>::default(), None);
1734/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
1735/// // You can configure optional parameters by calling the respective setters at will, and
1736/// // execute the final call using `doit()`.
1737/// // Values shown here are possibly random and not representative !
1738/// let result = hub.activities().list("userKey", "applicationName")
1739///              .start_time("erat")
1740///              .page_token("sadipscing")
1741///              .org_unit_id("dolor")
1742///              .max_results(-39)
1743///              .filters("elitr")
1744///              .event_name("amet")
1745///              .end_time("no")
1746///              .customer_id("labore")
1747///              .actor_ip_address("eirmod")
1748///              .doit();
1749/// # }
1750/// ```
1751pub struct ActivityListCall<'a, C, A>
1752    where C: 'a, A: 'a {
1753
1754    hub: &'a Reports<C, A>,
1755    _user_key: String,
1756    _application_name: String,
1757    _start_time: Option<String>,
1758    _page_token: Option<String>,
1759    _org_unit_id: Option<String>,
1760    _max_results: Option<i32>,
1761    _filters: Option<String>,
1762    _event_name: Option<String>,
1763    _end_time: Option<String>,
1764    _customer_id: Option<String>,
1765    _actor_ip_address: Option<String>,
1766    _delegate: Option<&'a mut Delegate>,
1767    _additional_params: HashMap<String, String>,
1768    _scopes: BTreeMap<String, ()>
1769}
1770
1771impl<'a, C, A> CallBuilder for ActivityListCall<'a, C, A> {}
1772
1773impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
1774
1775
1776    /// Perform the operation you have build so far.
1777    pub fn doit(mut self) -> Result<(hyper::client::Response, Activities)> {
1778        use std::io::{Read, Seek};
1779        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
1780        let mut dd = DefaultDelegate;
1781        let mut dlg: &mut Delegate = match self._delegate {
1782            Some(d) => d,
1783            None => &mut dd
1784        };
1785        dlg.begin(MethodInfo { id: "reports.activities.list",
1786                               http_method: hyper::method::Method::Get });
1787        let mut params: Vec<(&str, String)> = Vec::with_capacity(13 + self._additional_params.len());
1788        params.push(("userKey", self._user_key.to_string()));
1789        params.push(("applicationName", self._application_name.to_string()));
1790        if let Some(value) = self._start_time {
1791            params.push(("startTime", value.to_string()));
1792        }
1793        if let Some(value) = self._page_token {
1794            params.push(("pageToken", value.to_string()));
1795        }
1796        if let Some(value) = self._org_unit_id {
1797            params.push(("orgUnitID", value.to_string()));
1798        }
1799        if let Some(value) = self._max_results {
1800            params.push(("maxResults", value.to_string()));
1801        }
1802        if let Some(value) = self._filters {
1803            params.push(("filters", value.to_string()));
1804        }
1805        if let Some(value) = self._event_name {
1806            params.push(("eventName", value.to_string()));
1807        }
1808        if let Some(value) = self._end_time {
1809            params.push(("endTime", value.to_string()));
1810        }
1811        if let Some(value) = self._customer_id {
1812            params.push(("customerId", value.to_string()));
1813        }
1814        if let Some(value) = self._actor_ip_address {
1815            params.push(("actorIpAddress", value.to_string()));
1816        }
1817        for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "orgUnitID", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() {
1818            if self._additional_params.contains_key(field) {
1819                dlg.finished(false);
1820                return Err(Error::FieldClash(field));
1821            }
1822        }
1823        for (name, value) in self._additional_params.iter() {
1824            params.push((&name, value.clone()));
1825        }
1826
1827        params.push(("alt", "json".to_string()));
1828
1829        let mut url = self.hub._base_url.clone() + "activity/users/{userKey}/applications/{applicationName}";
1830        if self._scopes.len() == 0 {
1831            self._scopes.insert(Scope::ReportAuditReadonly.as_ref().to_string(), ());
1832        }
1833
1834        for &(find_this, param_name) in [("{userKey}", "userKey"), ("{applicationName}", "applicationName")].iter() {
1835            let mut replace_with: Option<&str> = None;
1836            for &(name, ref value) in params.iter() {
1837                if name == param_name {
1838                    replace_with = Some(value);
1839                    break;
1840                }
1841            }
1842            url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
1843        }
1844        {
1845            let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
1846            for param_name in ["applicationName", "userKey"].iter() {
1847                if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
1848                    indices_for_removal.push(index);
1849                }
1850            }
1851            for &index in indices_for_removal.iter() {
1852                params.remove(index);
1853            }
1854        }
1855
1856        let url = hyper::Url::parse_with_params(&url, params).unwrap();
1857
1858
1859
1860        loop {
1861            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
1862                Ok(token) => token,
1863                Err(err) => {
1864                    match  dlg.token(&*err) {
1865                        Some(token) => token,
1866                        None => {
1867                            dlg.finished(false);
1868                            return Err(Error::MissingToken(err))
1869                        }
1870                    }
1871                }
1872            };
1873            let auth_header = Authorization(Bearer { token: token.access_token });
1874            let mut req_result = {
1875                let mut client = &mut *self.hub.client.borrow_mut();
1876                let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
1877                    .header(UserAgent(self.hub._user_agent.clone()))
1878                    .header(auth_header.clone());
1879
1880                dlg.pre_request();
1881                req.send()
1882            };
1883
1884            match req_result {
1885                Err(err) => {
1886                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
1887                        sleep(d);
1888                        continue;
1889                    }
1890                    dlg.finished(false);
1891                    return Err(Error::HttpError(err))
1892                }
1893                Ok(mut res) => {
1894                    if !res.status.is_success() {
1895                        let mut json_err = String::new();
1896                        res.read_to_string(&mut json_err).unwrap();
1897                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
1898                                                              json::from_str(&json_err).ok(),
1899                                                              json::from_str(&json_err).ok()) {
1900                            sleep(d);
1901                            continue;
1902                        }
1903                        dlg.finished(false);
1904                        return match json::from_str::<ErrorResponse>(&json_err){
1905                            Err(_) => Err(Error::Failure(res)),
1906                            Ok(serr) => Err(Error::BadRequest(serr))
1907                        }
1908                    }
1909                    let result_value = {
1910                        let mut json_response = String::new();
1911                        res.read_to_string(&mut json_response).unwrap();
1912                        match json::from_str(&json_response) {
1913                            Ok(decoded) => (res, decoded),
1914                            Err(err) => {
1915                                dlg.response_json_decode_error(&json_response, &err);
1916                                return Err(Error::JsonDecodeError(json_response, err));
1917                            }
1918                        }
1919                    };
1920
1921                    dlg.finished(true);
1922                    return Ok(result_value)
1923                }
1924            }
1925        }
1926    }
1927
1928
1929    /// Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.
1930    ///
1931    /// Sets the *user key* path property to the given value.
1932    ///
1933    /// Even though the property as already been set when instantiating this call,
1934    /// we provide this method for API completeness.
1935    pub fn user_key(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1936        self._user_key = new_value.to_string();
1937        self
1938    }
1939    /// Application name for which the events are to be retrieved.
1940    ///
1941    /// Sets the *application name* path property to the given value.
1942    ///
1943    /// Even though the property as already been set when instantiating this call,
1944    /// we provide this method for API completeness.
1945    pub fn application_name(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1946        self._application_name = new_value.to_string();
1947        self
1948    }
1949    /// Return events which occurred at or after this time.
1950    ///
1951    /// Sets the *start time* query property to the given value.
1952    pub fn start_time(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1953        self._start_time = Some(new_value.to_string());
1954        self
1955    }
1956    /// Token to specify next page.
1957    ///
1958    /// Sets the *page token* query property to the given value.
1959    pub fn page_token(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1960        self._page_token = Some(new_value.to_string());
1961        self
1962    }
1963    /// the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s)
1964    ///
1965    /// Sets the *org unit id* query property to the given value.
1966    pub fn org_unit_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1967        self._org_unit_id = Some(new_value.to_string());
1968        self
1969    }
1970    /// Number of activity records to be shown in each page.
1971    ///
1972    /// Sets the *max results* query property to the given value.
1973    pub fn max_results(mut self, new_value: i32) -> ActivityListCall<'a, C, A> {
1974        self._max_results = Some(new_value);
1975        self
1976    }
1977    /// Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...
1978    ///
1979    /// Sets the *filters* query property to the given value.
1980    pub fn filters(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1981        self._filters = Some(new_value.to_string());
1982        self
1983    }
1984    /// Name of the event being queried.
1985    ///
1986    /// Sets the *event name* query property to the given value.
1987    pub fn event_name(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1988        self._event_name = Some(new_value.to_string());
1989        self
1990    }
1991    /// Return events which occurred at or before this time.
1992    ///
1993    /// Sets the *end time* query property to the given value.
1994    pub fn end_time(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
1995        self._end_time = Some(new_value.to_string());
1996        self
1997    }
1998    /// Represents the customer for which the data is to be fetched.
1999    ///
2000    /// Sets the *customer id* query property to the given value.
2001    pub fn customer_id(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
2002        self._customer_id = Some(new_value.to_string());
2003        self
2004    }
2005    /// IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.
2006    ///
2007    /// Sets the *actor ip address* query property to the given value.
2008    pub fn actor_ip_address(mut self, new_value: &str) -> ActivityListCall<'a, C, A> {
2009        self._actor_ip_address = Some(new_value.to_string());
2010        self
2011    }
2012    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2013    /// while executing the actual API request.
2014    /// 
2015    /// It should be used to handle progress information, and to implement a certain level of resilience.
2016    ///
2017    /// Sets the *delegate* property to the given value.
2018    pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActivityListCall<'a, C, A> {
2019        self._delegate = Some(new_value);
2020        self
2021    }
2022
2023    /// Set any additional parameter of the query string used in the request.
2024    /// It should be used to set parameters which are not yet available through their own
2025    /// setters.
2026    ///
2027    /// Please note that this method must not be used to set any of the known parameters
2028    /// which have their own setter method. If done anyway, the request will fail.
2029    ///
2030    /// # Additional Parameters
2031    ///
2032    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2033    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2034    /// * *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.
2035    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2036    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2037    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2038    /// * *alt* (query-string) - Data format for the response.
2039    pub fn param<T>(mut self, name: T, value: T) -> ActivityListCall<'a, C, A>
2040                                                        where T: AsRef<str> {
2041        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2042        self
2043    }
2044
2045    /// Identifies the authorization scope for the method you are building.
2046    ///
2047    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
2048    /// `Scope::ReportAuditReadonly`.
2049    ///
2050    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2051    /// tokens for more than one scope.
2052    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
2053    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
2054    /// function for details).
2055    ///
2056    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2057    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2058    /// sufficient, a read-write scope will do as well.
2059    pub fn add_scope<T, S>(mut self, scope: T) -> ActivityListCall<'a, C, A>
2060                                                        where T: Into<Option<S>>,
2061                                                              S: AsRef<str> {
2062        match scope.into() {
2063          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
2064          None => None,
2065        };
2066        self
2067    }
2068}
2069
2070
2071/// Push changes to activities
2072///
2073/// A builder for the *watch* method supported by a *activity* resource.
2074/// It is not used directly, but through a `ActivityMethods` instance.
2075///
2076/// # Example
2077///
2078/// Instantiate a resource method builder
2079///
2080/// ```test_harness,no_run
2081/// # extern crate hyper;
2082/// # extern crate hyper_rustls;
2083/// # extern crate yup_oauth2 as oauth2;
2084/// # extern crate google_admin1_reports as admin1_reports;
2085/// use admin1_reports::Channel;
2086/// # #[test] fn egal() {
2087/// # use std::default::Default;
2088/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
2089/// # use admin1_reports::Reports;
2090/// 
2091/// # let secret: ApplicationSecret = Default::default();
2092/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
2093/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
2094/// #                               <MemoryStorage as Default>::default(), None);
2095/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
2096/// // As the method needs a request, you would usually fill it with the desired information
2097/// // into the respective structure. Some of the parts shown here might not be applicable !
2098/// // Values shown here are possibly random and not representative !
2099/// let mut req = Channel::default();
2100/// 
2101/// // You can configure optional parameters by calling the respective setters at will, and
2102/// // execute the final call using `doit()`.
2103/// // Values shown here are possibly random and not representative !
2104/// let result = hub.activities().watch(req, "userKey", "applicationName")
2105///              .start_time("aliquyam")
2106///              .page_token("accusam")
2107///              .org_unit_id("Lorem")
2108///              .max_results(-9)
2109///              .filters("et")
2110///              .event_name("duo")
2111///              .end_time("et")
2112///              .customer_id("eirmod")
2113///              .actor_ip_address("sanctus")
2114///              .doit();
2115/// # }
2116/// ```
2117pub struct ActivityWatchCall<'a, C, A>
2118    where C: 'a, A: 'a {
2119
2120    hub: &'a Reports<C, A>,
2121    _request: Channel,
2122    _user_key: String,
2123    _application_name: String,
2124    _start_time: Option<String>,
2125    _page_token: Option<String>,
2126    _org_unit_id: Option<String>,
2127    _max_results: Option<i32>,
2128    _filters: Option<String>,
2129    _event_name: Option<String>,
2130    _end_time: Option<String>,
2131    _customer_id: Option<String>,
2132    _actor_ip_address: Option<String>,
2133    _delegate: Option<&'a mut Delegate>,
2134    _additional_params: HashMap<String, String>,
2135    _scopes: BTreeMap<String, ()>
2136}
2137
2138impl<'a, C, A> CallBuilder for ActivityWatchCall<'a, C, A> {}
2139
2140impl<'a, C, A> ActivityWatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
2141
2142
2143    /// Perform the operation you have build so far.
2144    pub fn doit(mut self) -> Result<(hyper::client::Response, Channel)> {
2145        use std::io::{Read, Seek};
2146        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
2147        let mut dd = DefaultDelegate;
2148        let mut dlg: &mut Delegate = match self._delegate {
2149            Some(d) => d,
2150            None => &mut dd
2151        };
2152        dlg.begin(MethodInfo { id: "reports.activities.watch",
2153                               http_method: hyper::method::Method::Post });
2154        let mut params: Vec<(&str, String)> = Vec::with_capacity(14 + self._additional_params.len());
2155        params.push(("userKey", self._user_key.to_string()));
2156        params.push(("applicationName", self._application_name.to_string()));
2157        if let Some(value) = self._start_time {
2158            params.push(("startTime", value.to_string()));
2159        }
2160        if let Some(value) = self._page_token {
2161            params.push(("pageToken", value.to_string()));
2162        }
2163        if let Some(value) = self._org_unit_id {
2164            params.push(("orgUnitID", value.to_string()));
2165        }
2166        if let Some(value) = self._max_results {
2167            params.push(("maxResults", value.to_string()));
2168        }
2169        if let Some(value) = self._filters {
2170            params.push(("filters", value.to_string()));
2171        }
2172        if let Some(value) = self._event_name {
2173            params.push(("eventName", value.to_string()));
2174        }
2175        if let Some(value) = self._end_time {
2176            params.push(("endTime", value.to_string()));
2177        }
2178        if let Some(value) = self._customer_id {
2179            params.push(("customerId", value.to_string()));
2180        }
2181        if let Some(value) = self._actor_ip_address {
2182            params.push(("actorIpAddress", value.to_string()));
2183        }
2184        for &field in ["alt", "userKey", "applicationName", "startTime", "pageToken", "orgUnitID", "maxResults", "filters", "eventName", "endTime", "customerId", "actorIpAddress"].iter() {
2185            if self._additional_params.contains_key(field) {
2186                dlg.finished(false);
2187                return Err(Error::FieldClash(field));
2188            }
2189        }
2190        for (name, value) in self._additional_params.iter() {
2191            params.push((&name, value.clone()));
2192        }
2193
2194        params.push(("alt", "json".to_string()));
2195
2196        let mut url = self.hub._base_url.clone() + "activity/users/{userKey}/applications/{applicationName}/watch";
2197        if self._scopes.len() == 0 {
2198            self._scopes.insert(Scope::ReportAuditReadonly.as_ref().to_string(), ());
2199        }
2200
2201        for &(find_this, param_name) in [("{userKey}", "userKey"), ("{applicationName}", "applicationName")].iter() {
2202            let mut replace_with: Option<&str> = None;
2203            for &(name, ref value) in params.iter() {
2204                if name == param_name {
2205                    replace_with = Some(value);
2206                    break;
2207                }
2208            }
2209            url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
2210        }
2211        {
2212            let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
2213            for param_name in ["applicationName", "userKey"].iter() {
2214                if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2215                    indices_for_removal.push(index);
2216                }
2217            }
2218            for &index in indices_for_removal.iter() {
2219                params.remove(index);
2220            }
2221        }
2222
2223        let url = hyper::Url::parse_with_params(&url, params).unwrap();
2224
2225        let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
2226        let mut request_value_reader =
2227            {
2228                let mut value = json::value::to_value(&self._request).expect("serde to work");
2229                remove_json_null_values(&mut value);
2230                let mut dst = io::Cursor::new(Vec::with_capacity(128));
2231                json::to_writer(&mut dst, &value).unwrap();
2232                dst
2233            };
2234        let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
2235        request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2236
2237
2238        loop {
2239            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
2240                Ok(token) => token,
2241                Err(err) => {
2242                    match  dlg.token(&*err) {
2243                        Some(token) => token,
2244                        None => {
2245                            dlg.finished(false);
2246                            return Err(Error::MissingToken(err))
2247                        }
2248                    }
2249                }
2250            };
2251            let auth_header = Authorization(Bearer { token: token.access_token });
2252            request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2253            let mut req_result = {
2254                let mut client = &mut *self.hub.client.borrow_mut();
2255                let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
2256                    .header(UserAgent(self.hub._user_agent.clone()))
2257                    .header(auth_header.clone())
2258                    .header(ContentType(json_mime_type.clone()))
2259                    .header(ContentLength(request_size as u64))
2260                    .body(&mut request_value_reader);
2261
2262                dlg.pre_request();
2263                req.send()
2264            };
2265
2266            match req_result {
2267                Err(err) => {
2268                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
2269                        sleep(d);
2270                        continue;
2271                    }
2272                    dlg.finished(false);
2273                    return Err(Error::HttpError(err))
2274                }
2275                Ok(mut res) => {
2276                    if !res.status.is_success() {
2277                        let mut json_err = String::new();
2278                        res.read_to_string(&mut json_err).unwrap();
2279                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
2280                                                              json::from_str(&json_err).ok(),
2281                                                              json::from_str(&json_err).ok()) {
2282                            sleep(d);
2283                            continue;
2284                        }
2285                        dlg.finished(false);
2286                        return match json::from_str::<ErrorResponse>(&json_err){
2287                            Err(_) => Err(Error::Failure(res)),
2288                            Ok(serr) => Err(Error::BadRequest(serr))
2289                        }
2290                    }
2291                    let result_value = {
2292                        let mut json_response = String::new();
2293                        res.read_to_string(&mut json_response).unwrap();
2294                        match json::from_str(&json_response) {
2295                            Ok(decoded) => (res, decoded),
2296                            Err(err) => {
2297                                dlg.response_json_decode_error(&json_response, &err);
2298                                return Err(Error::JsonDecodeError(json_response, err));
2299                            }
2300                        }
2301                    };
2302
2303                    dlg.finished(true);
2304                    return Ok(result_value)
2305                }
2306            }
2307        }
2308    }
2309
2310
2311    ///
2312    /// Sets the *request* property to the given value.
2313    ///
2314    /// Even though the property as already been set when instantiating this call,
2315    /// we provide this method for API completeness.
2316    pub fn request(mut self, new_value: Channel) -> ActivityWatchCall<'a, C, A> {
2317        self._request = new_value;
2318        self
2319    }
2320    /// Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.
2321    ///
2322    /// Sets the *user key* path property to the given value.
2323    ///
2324    /// Even though the property as already been set when instantiating this call,
2325    /// we provide this method for API completeness.
2326    pub fn user_key(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2327        self._user_key = new_value.to_string();
2328        self
2329    }
2330    /// Application name for which the events are to be retrieved.
2331    ///
2332    /// Sets the *application name* path property to the given value.
2333    ///
2334    /// Even though the property as already been set when instantiating this call,
2335    /// we provide this method for API completeness.
2336    pub fn application_name(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2337        self._application_name = new_value.to_string();
2338        self
2339    }
2340    /// Return events which occurred at or after this time.
2341    ///
2342    /// Sets the *start time* query property to the given value.
2343    pub fn start_time(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2344        self._start_time = Some(new_value.to_string());
2345        self
2346    }
2347    /// Token to specify next page.
2348    ///
2349    /// Sets the *page token* query property to the given value.
2350    pub fn page_token(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2351        self._page_token = Some(new_value.to_string());
2352        self
2353    }
2354    /// the organizational unit's(OU) ID to filter activities from users belonging to a specific OU or one of its sub-OU(s)
2355    ///
2356    /// Sets the *org unit id* query property to the given value.
2357    pub fn org_unit_id(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2358        self._org_unit_id = Some(new_value.to_string());
2359        self
2360    }
2361    /// Number of activity records to be shown in each page.
2362    ///
2363    /// Sets the *max results* query property to the given value.
2364    pub fn max_results(mut self, new_value: i32) -> ActivityWatchCall<'a, C, A> {
2365        self._max_results = Some(new_value);
2366        self
2367    }
2368    /// Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...
2369    ///
2370    /// Sets the *filters* query property to the given value.
2371    pub fn filters(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2372        self._filters = Some(new_value.to_string());
2373        self
2374    }
2375    /// Name of the event being queried.
2376    ///
2377    /// Sets the *event name* query property to the given value.
2378    pub fn event_name(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2379        self._event_name = Some(new_value.to_string());
2380        self
2381    }
2382    /// Return events which occurred at or before this time.
2383    ///
2384    /// Sets the *end time* query property to the given value.
2385    pub fn end_time(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2386        self._end_time = Some(new_value.to_string());
2387        self
2388    }
2389    /// Represents the customer for which the data is to be fetched.
2390    ///
2391    /// Sets the *customer id* query property to the given value.
2392    pub fn customer_id(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2393        self._customer_id = Some(new_value.to_string());
2394        self
2395    }
2396    /// IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.
2397    ///
2398    /// Sets the *actor ip address* query property to the given value.
2399    pub fn actor_ip_address(mut self, new_value: &str) -> ActivityWatchCall<'a, C, A> {
2400        self._actor_ip_address = Some(new_value.to_string());
2401        self
2402    }
2403    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2404    /// while executing the actual API request.
2405    /// 
2406    /// It should be used to handle progress information, and to implement a certain level of resilience.
2407    ///
2408    /// Sets the *delegate* property to the given value.
2409    pub fn delegate(mut self, new_value: &'a mut Delegate) -> ActivityWatchCall<'a, C, A> {
2410        self._delegate = Some(new_value);
2411        self
2412    }
2413
2414    /// Set any additional parameter of the query string used in the request.
2415    /// It should be used to set parameters which are not yet available through their own
2416    /// setters.
2417    ///
2418    /// Please note that this method must not be used to set any of the known parameters
2419    /// which have their own setter method. If done anyway, the request will fail.
2420    ///
2421    /// # Additional Parameters
2422    ///
2423    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2424    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2425    /// * *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.
2426    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2427    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2428    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2429    /// * *alt* (query-string) - Data format for the response.
2430    pub fn param<T>(mut self, name: T, value: T) -> ActivityWatchCall<'a, C, A>
2431                                                        where T: AsRef<str> {
2432        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2433        self
2434    }
2435
2436    /// Identifies the authorization scope for the method you are building.
2437    ///
2438    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
2439    /// `Scope::ReportAuditReadonly`.
2440    ///
2441    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2442    /// tokens for more than one scope.
2443    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
2444    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
2445    /// function for details).
2446    ///
2447    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2448    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2449    /// sufficient, a read-write scope will do as well.
2450    pub fn add_scope<T, S>(mut self, scope: T) -> ActivityWatchCall<'a, C, A>
2451                                                        where T: Into<Option<S>>,
2452                                                              S: AsRef<str> {
2453        match scope.into() {
2454          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
2455          None => None,
2456        };
2457        self
2458    }
2459}
2460
2461
2462/// Retrieves a report which is a collection of properties / statistics for a specific customer.
2463///
2464/// A builder for the *get* method supported by a *customerUsageReport* resource.
2465/// It is not used directly, but through a `CustomerUsageReportMethods` instance.
2466///
2467/// # Example
2468///
2469/// Instantiate a resource method builder
2470///
2471/// ```test_harness,no_run
2472/// # extern crate hyper;
2473/// # extern crate hyper_rustls;
2474/// # extern crate yup_oauth2 as oauth2;
2475/// # extern crate google_admin1_reports as admin1_reports;
2476/// # #[test] fn egal() {
2477/// # use std::default::Default;
2478/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
2479/// # use admin1_reports::Reports;
2480/// 
2481/// # let secret: ApplicationSecret = Default::default();
2482/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
2483/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
2484/// #                               <MemoryStorage as Default>::default(), None);
2485/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
2486/// // You can configure optional parameters by calling the respective setters at will, and
2487/// // execute the final call using `doit()`.
2488/// // Values shown here are possibly random and not representative !
2489/// let result = hub.customer_usage_reports().get("date")
2490///              .parameters("amet")
2491///              .page_token("et")
2492///              .customer_id("consetetur")
2493///              .doit();
2494/// # }
2495/// ```
2496pub struct CustomerUsageReportGetCall<'a, C, A>
2497    where C: 'a, A: 'a {
2498
2499    hub: &'a Reports<C, A>,
2500    _date: String,
2501    _parameters: Option<String>,
2502    _page_token: Option<String>,
2503    _customer_id: Option<String>,
2504    _delegate: Option<&'a mut Delegate>,
2505    _additional_params: HashMap<String, String>,
2506    _scopes: BTreeMap<String, ()>
2507}
2508
2509impl<'a, C, A> CallBuilder for CustomerUsageReportGetCall<'a, C, A> {}
2510
2511impl<'a, C, A> CustomerUsageReportGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
2512
2513
2514    /// Perform the operation you have build so far.
2515    pub fn doit(mut self) -> Result<(hyper::client::Response, UsageReports)> {
2516        use std::io::{Read, Seek};
2517        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
2518        let mut dd = DefaultDelegate;
2519        let mut dlg: &mut Delegate = match self._delegate {
2520            Some(d) => d,
2521            None => &mut dd
2522        };
2523        dlg.begin(MethodInfo { id: "reports.customerUsageReports.get",
2524                               http_method: hyper::method::Method::Get });
2525        let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
2526        params.push(("date", self._date.to_string()));
2527        if let Some(value) = self._parameters {
2528            params.push(("parameters", value.to_string()));
2529        }
2530        if let Some(value) = self._page_token {
2531            params.push(("pageToken", value.to_string()));
2532        }
2533        if let Some(value) = self._customer_id {
2534            params.push(("customerId", value.to_string()));
2535        }
2536        for &field in ["alt", "date", "parameters", "pageToken", "customerId"].iter() {
2537            if self._additional_params.contains_key(field) {
2538                dlg.finished(false);
2539                return Err(Error::FieldClash(field));
2540            }
2541        }
2542        for (name, value) in self._additional_params.iter() {
2543            params.push((&name, value.clone()));
2544        }
2545
2546        params.push(("alt", "json".to_string()));
2547
2548        let mut url = self.hub._base_url.clone() + "usage/dates/{date}";
2549        if self._scopes.len() == 0 {
2550            self._scopes.insert(Scope::ReportUsageReadonly.as_ref().to_string(), ());
2551        }
2552
2553        for &(find_this, param_name) in [("{date}", "date")].iter() {
2554            let mut replace_with: Option<&str> = None;
2555            for &(name, ref value) in params.iter() {
2556                if name == param_name {
2557                    replace_with = Some(value);
2558                    break;
2559                }
2560            }
2561            url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
2562        }
2563        {
2564            let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
2565            for param_name in ["date"].iter() {
2566                if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2567                    indices_for_removal.push(index);
2568                }
2569            }
2570            for &index in indices_for_removal.iter() {
2571                params.remove(index);
2572            }
2573        }
2574
2575        let url = hyper::Url::parse_with_params(&url, params).unwrap();
2576
2577
2578
2579        loop {
2580            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
2581                Ok(token) => token,
2582                Err(err) => {
2583                    match  dlg.token(&*err) {
2584                        Some(token) => token,
2585                        None => {
2586                            dlg.finished(false);
2587                            return Err(Error::MissingToken(err))
2588                        }
2589                    }
2590                }
2591            };
2592            let auth_header = Authorization(Bearer { token: token.access_token });
2593            let mut req_result = {
2594                let mut client = &mut *self.hub.client.borrow_mut();
2595                let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
2596                    .header(UserAgent(self.hub._user_agent.clone()))
2597                    .header(auth_header.clone());
2598
2599                dlg.pre_request();
2600                req.send()
2601            };
2602
2603            match req_result {
2604                Err(err) => {
2605                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
2606                        sleep(d);
2607                        continue;
2608                    }
2609                    dlg.finished(false);
2610                    return Err(Error::HttpError(err))
2611                }
2612                Ok(mut res) => {
2613                    if !res.status.is_success() {
2614                        let mut json_err = String::new();
2615                        res.read_to_string(&mut json_err).unwrap();
2616                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
2617                                                              json::from_str(&json_err).ok(),
2618                                                              json::from_str(&json_err).ok()) {
2619                            sleep(d);
2620                            continue;
2621                        }
2622                        dlg.finished(false);
2623                        return match json::from_str::<ErrorResponse>(&json_err){
2624                            Err(_) => Err(Error::Failure(res)),
2625                            Ok(serr) => Err(Error::BadRequest(serr))
2626                        }
2627                    }
2628                    let result_value = {
2629                        let mut json_response = String::new();
2630                        res.read_to_string(&mut json_response).unwrap();
2631                        match json::from_str(&json_response) {
2632                            Ok(decoded) => (res, decoded),
2633                            Err(err) => {
2634                                dlg.response_json_decode_error(&json_response, &err);
2635                                return Err(Error::JsonDecodeError(json_response, err));
2636                            }
2637                        }
2638                    };
2639
2640                    dlg.finished(true);
2641                    return Ok(result_value)
2642                }
2643            }
2644        }
2645    }
2646
2647
2648    /// Represents the date in yyyy-mm-dd format for which the data is to be fetched.
2649    ///
2650    /// Sets the *date* path property to the given value.
2651    ///
2652    /// Even though the property as already been set when instantiating this call,
2653    /// we provide this method for API completeness.
2654    pub fn date(mut self, new_value: &str) -> CustomerUsageReportGetCall<'a, C, A> {
2655        self._date = new_value.to_string();
2656        self
2657    }
2658    /// Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.
2659    ///
2660    /// Sets the *parameters* query property to the given value.
2661    pub fn parameters(mut self, new_value: &str) -> CustomerUsageReportGetCall<'a, C, A> {
2662        self._parameters = Some(new_value.to_string());
2663        self
2664    }
2665    /// Token to specify next page.
2666    ///
2667    /// Sets the *page token* query property to the given value.
2668    pub fn page_token(mut self, new_value: &str) -> CustomerUsageReportGetCall<'a, C, A> {
2669        self._page_token = Some(new_value.to_string());
2670        self
2671    }
2672    /// Represents the customer for which the data is to be fetched.
2673    ///
2674    /// Sets the *customer id* query property to the given value.
2675    pub fn customer_id(mut self, new_value: &str) -> CustomerUsageReportGetCall<'a, C, A> {
2676        self._customer_id = Some(new_value.to_string());
2677        self
2678    }
2679    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2680    /// while executing the actual API request.
2681    /// 
2682    /// It should be used to handle progress information, and to implement a certain level of resilience.
2683    ///
2684    /// Sets the *delegate* property to the given value.
2685    pub fn delegate(mut self, new_value: &'a mut Delegate) -> CustomerUsageReportGetCall<'a, C, A> {
2686        self._delegate = Some(new_value);
2687        self
2688    }
2689
2690    /// Set any additional parameter of the query string used in the request.
2691    /// It should be used to set parameters which are not yet available through their own
2692    /// setters.
2693    ///
2694    /// Please note that this method must not be used to set any of the known parameters
2695    /// which have their own setter method. If done anyway, the request will fail.
2696    ///
2697    /// # Additional Parameters
2698    ///
2699    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
2700    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2701    /// * *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.
2702    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2703    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
2704    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2705    /// * *alt* (query-string) - Data format for the response.
2706    pub fn param<T>(mut self, name: T, value: T) -> CustomerUsageReportGetCall<'a, C, A>
2707                                                        where T: AsRef<str> {
2708        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2709        self
2710    }
2711
2712    /// Identifies the authorization scope for the method you are building.
2713    ///
2714    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
2715    /// `Scope::ReportUsageReadonly`.
2716    ///
2717    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2718    /// tokens for more than one scope.
2719    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
2720    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
2721    /// function for details).
2722    ///
2723    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2724    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2725    /// sufficient, a read-write scope will do as well.
2726    pub fn add_scope<T, S>(mut self, scope: T) -> CustomerUsageReportGetCall<'a, C, A>
2727                                                        where T: Into<Option<S>>,
2728                                                              S: AsRef<str> {
2729        match scope.into() {
2730          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
2731          None => None,
2732        };
2733        self
2734    }
2735}
2736
2737
2738/// Retrieves a report which is a collection of properties / statistics for a set of users.
2739///
2740/// A builder for the *get* method supported by a *userUsageReport* resource.
2741/// It is not used directly, but through a `UserUsageReportMethods` instance.
2742///
2743/// # Example
2744///
2745/// Instantiate a resource method builder
2746///
2747/// ```test_harness,no_run
2748/// # extern crate hyper;
2749/// # extern crate hyper_rustls;
2750/// # extern crate yup_oauth2 as oauth2;
2751/// # extern crate google_admin1_reports as admin1_reports;
2752/// # #[test] fn egal() {
2753/// # use std::default::Default;
2754/// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
2755/// # use admin1_reports::Reports;
2756/// 
2757/// # let secret: ApplicationSecret = Default::default();
2758/// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
2759/// #                               hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
2760/// #                               <MemoryStorage as Default>::default(), None);
2761/// # let mut hub = Reports::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
2762/// // You can configure optional parameters by calling the respective setters at will, and
2763/// // execute the final call using `doit()`.
2764/// // Values shown here are possibly random and not representative !
2765/// let result = hub.user_usage_report().get("userKey", "date")
2766///              .parameters("sed")
2767///              .page_token("dolor")
2768///              .org_unit_id("dolor")
2769///              .max_results(53)
2770///              .filters("et")
2771///              .customer_id("consetetur")
2772///              .doit();
2773/// # }
2774/// ```
2775pub struct UserUsageReportGetCall<'a, C, A>
2776    where C: 'a, A: 'a {
2777
2778    hub: &'a Reports<C, A>,
2779    _user_key: String,
2780    _date: String,
2781    _parameters: Option<String>,
2782    _page_token: Option<String>,
2783    _org_unit_id: Option<String>,
2784    _max_results: Option<u32>,
2785    _filters: Option<String>,
2786    _customer_id: Option<String>,
2787    _delegate: Option<&'a mut Delegate>,
2788    _additional_params: HashMap<String, String>,
2789    _scopes: BTreeMap<String, ()>
2790}
2791
2792impl<'a, C, A> CallBuilder for UserUsageReportGetCall<'a, C, A> {}
2793
2794impl<'a, C, A> UserUsageReportGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
2795
2796
2797    /// Perform the operation you have build so far.
2798    pub fn doit(mut self) -> Result<(hyper::client::Response, UsageReports)> {
2799        use std::io::{Read, Seek};
2800        use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
2801        let mut dd = DefaultDelegate;
2802        let mut dlg: &mut Delegate = match self._delegate {
2803            Some(d) => d,
2804            None => &mut dd
2805        };
2806        dlg.begin(MethodInfo { id: "reports.userUsageReport.get",
2807                               http_method: hyper::method::Method::Get });
2808        let mut params: Vec<(&str, String)> = Vec::with_capacity(10 + self._additional_params.len());
2809        params.push(("userKey", self._user_key.to_string()));
2810        params.push(("date", self._date.to_string()));
2811        if let Some(value) = self._parameters {
2812            params.push(("parameters", value.to_string()));
2813        }
2814        if let Some(value) = self._page_token {
2815            params.push(("pageToken", value.to_string()));
2816        }
2817        if let Some(value) = self._org_unit_id {
2818            params.push(("orgUnitID", value.to_string()));
2819        }
2820        if let Some(value) = self._max_results {
2821            params.push(("maxResults", value.to_string()));
2822        }
2823        if let Some(value) = self._filters {
2824            params.push(("filters", value.to_string()));
2825        }
2826        if let Some(value) = self._customer_id {
2827            params.push(("customerId", value.to_string()));
2828        }
2829        for &field in ["alt", "userKey", "date", "parameters", "pageToken", "orgUnitID", "maxResults", "filters", "customerId"].iter() {
2830            if self._additional_params.contains_key(field) {
2831                dlg.finished(false);
2832                return Err(Error::FieldClash(field));
2833            }
2834        }
2835        for (name, value) in self._additional_params.iter() {
2836            params.push((&name, value.clone()));
2837        }
2838
2839        params.push(("alt", "json".to_string()));
2840
2841        let mut url = self.hub._base_url.clone() + "usage/users/{userKey}/dates/{date}";
2842        if self._scopes.len() == 0 {
2843            self._scopes.insert(Scope::ReportUsageReadonly.as_ref().to_string(), ());
2844        }
2845
2846        for &(find_this, param_name) in [("{userKey}", "userKey"), ("{date}", "date")].iter() {
2847            let mut replace_with: Option<&str> = None;
2848            for &(name, ref value) in params.iter() {
2849                if name == param_name {
2850                    replace_with = Some(value);
2851                    break;
2852                }
2853            }
2854            url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
2855        }
2856        {
2857            let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
2858            for param_name in ["date", "userKey"].iter() {
2859                if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
2860                    indices_for_removal.push(index);
2861                }
2862            }
2863            for &index in indices_for_removal.iter() {
2864                params.remove(index);
2865            }
2866        }
2867
2868        let url = hyper::Url::parse_with_params(&url, params).unwrap();
2869
2870
2871
2872        loop {
2873            let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
2874                Ok(token) => token,
2875                Err(err) => {
2876                    match  dlg.token(&*err) {
2877                        Some(token) => token,
2878                        None => {
2879                            dlg.finished(false);
2880                            return Err(Error::MissingToken(err))
2881                        }
2882                    }
2883                }
2884            };
2885            let auth_header = Authorization(Bearer { token: token.access_token });
2886            let mut req_result = {
2887                let mut client = &mut *self.hub.client.borrow_mut();
2888                let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
2889                    .header(UserAgent(self.hub._user_agent.clone()))
2890                    .header(auth_header.clone());
2891
2892                dlg.pre_request();
2893                req.send()
2894            };
2895
2896            match req_result {
2897                Err(err) => {
2898                    if let oauth2::Retry::After(d) = dlg.http_error(&err) {
2899                        sleep(d);
2900                        continue;
2901                    }
2902                    dlg.finished(false);
2903                    return Err(Error::HttpError(err))
2904                }
2905                Ok(mut res) => {
2906                    if !res.status.is_success() {
2907                        let mut json_err = String::new();
2908                        res.read_to_string(&mut json_err).unwrap();
2909                        if let oauth2::Retry::After(d) = dlg.http_failure(&res,
2910                                                              json::from_str(&json_err).ok(),
2911                                                              json::from_str(&json_err).ok()) {
2912                            sleep(d);
2913                            continue;
2914                        }
2915                        dlg.finished(false);
2916                        return match json::from_str::<ErrorResponse>(&json_err){
2917                            Err(_) => Err(Error::Failure(res)),
2918                            Ok(serr) => Err(Error::BadRequest(serr))
2919                        }
2920                    }
2921                    let result_value = {
2922                        let mut json_response = String::new();
2923                        res.read_to_string(&mut json_response).unwrap();
2924                        match json::from_str(&json_response) {
2925                            Ok(decoded) => (res, decoded),
2926                            Err(err) => {
2927                                dlg.response_json_decode_error(&json_response, &err);
2928                                return Err(Error::JsonDecodeError(json_response, err));
2929                            }
2930                        }
2931                    };
2932
2933                    dlg.finished(true);
2934                    return Ok(result_value)
2935                }
2936            }
2937        }
2938    }
2939
2940
2941    /// Represents the profile id or the user email for which the data should be filtered.
2942    ///
2943    /// Sets the *user key* path property to the given value.
2944    ///
2945    /// Even though the property as already been set when instantiating this call,
2946    /// we provide this method for API completeness.
2947    pub fn user_key(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2948        self._user_key = new_value.to_string();
2949        self
2950    }
2951    /// Represents the date in yyyy-mm-dd format for which the data is to be fetched.
2952    ///
2953    /// Sets the *date* path property to the given value.
2954    ///
2955    /// Even though the property as already been set when instantiating this call,
2956    /// we provide this method for API completeness.
2957    pub fn date(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2958        self._date = new_value.to_string();
2959        self
2960    }
2961    /// Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.
2962    ///
2963    /// Sets the *parameters* query property to the given value.
2964    pub fn parameters(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2965        self._parameters = Some(new_value.to_string());
2966        self
2967    }
2968    /// Token to specify next page.
2969    ///
2970    /// Sets the *page token* query property to the given value.
2971    pub fn page_token(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2972        self._page_token = Some(new_value.to_string());
2973        self
2974    }
2975    /// the organizational unit's ID to filter usage parameters from users belonging to a specific OU or one of its sub-OU(s).
2976    ///
2977    /// Sets the *org unit id* query property to the given value.
2978    pub fn org_unit_id(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2979        self._org_unit_id = Some(new_value.to_string());
2980        self
2981    }
2982    /// Maximum number of results to return. Maximum allowed is 1000
2983    ///
2984    /// Sets the *max results* query property to the given value.
2985    pub fn max_results(mut self, new_value: u32) -> UserUsageReportGetCall<'a, C, A> {
2986        self._max_results = Some(new_value);
2987        self
2988    }
2989    /// Represents the set of filters including parameter operator value.
2990    ///
2991    /// Sets the *filters* query property to the given value.
2992    pub fn filters(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
2993        self._filters = Some(new_value.to_string());
2994        self
2995    }
2996    /// Represents the customer for which the data is to be fetched.
2997    ///
2998    /// Sets the *customer id* query property to the given value.
2999    pub fn customer_id(mut self, new_value: &str) -> UserUsageReportGetCall<'a, C, A> {
3000        self._customer_id = Some(new_value.to_string());
3001        self
3002    }
3003    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3004    /// while executing the actual API request.
3005    /// 
3006    /// It should be used to handle progress information, and to implement a certain level of resilience.
3007    ///
3008    /// Sets the *delegate* property to the given value.
3009    pub fn delegate(mut self, new_value: &'a mut Delegate) -> UserUsageReportGetCall<'a, C, A> {
3010        self._delegate = Some(new_value);
3011        self
3012    }
3013
3014    /// Set any additional parameter of the query string used in the request.
3015    /// It should be used to set parameters which are not yet available through their own
3016    /// setters.
3017    ///
3018    /// Please note that this method must not be used to set any of the known parameters
3019    /// which have their own setter method. If done anyway, the request will fail.
3020    ///
3021    /// # Additional Parameters
3022    ///
3023    /// * *quotaUser* (query-string) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
3024    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3025    /// * *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.
3026    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3027    /// * *userIp* (query-string) - Deprecated. Please use quotaUser instead.
3028    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3029    /// * *alt* (query-string) - Data format for the response.
3030    pub fn param<T>(mut self, name: T, value: T) -> UserUsageReportGetCall<'a, C, A>
3031                                                        where T: AsRef<str> {
3032        self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3033        self
3034    }
3035
3036    /// Identifies the authorization scope for the method you are building.
3037    ///
3038    /// Use this method to actively specify which scope should be used, instead the default `Scope` variant
3039    /// `Scope::ReportUsageReadonly`.
3040    ///
3041    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3042    /// tokens for more than one scope.
3043    /// If `None` is specified, then all scopes will be removed and no default scope will be used either.
3044    /// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
3045    /// function for details).
3046    ///
3047    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3048    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3049    /// sufficient, a read-write scope will do as well.
3050    pub fn add_scope<T, S>(mut self, scope: T) -> UserUsageReportGetCall<'a, C, A>
3051                                                        where T: Into<Option<S>>,
3052                                                              S: AsRef<str> {
3053        match scope.into() {
3054          Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
3055          None => None,
3056        };
3057        self
3058    }
3059}
3060
3061