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