google_playcustomapp1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// View and manage your Google Play Developer account
17    Androidpublisher,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::Androidpublisher => "https://www.googleapis.com/auth/androidpublisher",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::Androidpublisher
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Playcustomapp related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_playcustomapp1 as playcustomapp1;
49/// use playcustomapp1::api::CustomApp;
50/// use playcustomapp1::{Result, Error};
51/// use std::fs;
52/// # async fn dox() {
53/// use playcustomapp1::{Playcustomapp, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54///
55/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
56/// // `client_secret`, among other things.
57/// let secret: yup_oauth2::ApplicationSecret = Default::default();
58/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
59/// // unless you replace  `None` with the desired Flow.
60/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
61/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
62/// // retrieve them from storage.
63/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
64///     .with_native_roots()
65///     .unwrap()
66///     .https_only()
67///     .enable_http2()
68///     .build();
69///
70/// let executor = hyper_util::rt::TokioExecutor::new();
71/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
72///     secret,
73///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
74///     yup_oauth2::client::CustomHyperClientBuilder::from(
75///         hyper_util::client::legacy::Client::builder(executor).build(connector),
76///     ),
77/// ).build().await.unwrap();
78///
79/// let client = hyper_util::client::legacy::Client::builder(
80///     hyper_util::rt::TokioExecutor::new()
81/// )
82/// .build(
83///     hyper_rustls::HttpsConnectorBuilder::new()
84///         .with_native_roots()
85///         .unwrap()
86///         .https_or_http()
87///         .enable_http2()
88///         .build()
89/// );
90/// let mut hub = Playcustomapp::new(client, auth);
91/// // As the method needs a request, you would usually fill it with the desired information
92/// // into the respective structure. Some of the parts shown here might not be applicable !
93/// // Values shown here are possibly random and not representative !
94/// let mut req = CustomApp::default();
95///
96/// // You can configure optional parameters by calling the respective setters at will, and
97/// // execute the final call using `upload(...)`.
98/// // Values shown here are possibly random and not representative !
99/// let result = hub.accounts().custom_apps_create(req, -11)
100///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct Playcustomapp<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for Playcustomapp<C> {}
131
132impl<'a, C> Playcustomapp<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> Playcustomapp<C> {
137        Playcustomapp {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://playcustomapp.googleapis.com/".to_string(),
142            _root_url: "https://playcustomapp.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
147        AccountMethods { hub: self }
148    }
149
150    /// Set the user-agent header field to use in all requests to the server.
151    /// It defaults to `google-api-rust-client/7.0.0`.
152    ///
153    /// Returns the previously set user-agent.
154    pub fn user_agent(&mut self, agent_name: String) -> String {
155        std::mem::replace(&mut self._user_agent, agent_name)
156    }
157
158    /// Set the base url to use in all requests to the server.
159    /// It defaults to `https://playcustomapp.googleapis.com/`.
160    ///
161    /// Returns the previously set base url.
162    pub fn base_url(&mut self, new_base_url: String) -> String {
163        std::mem::replace(&mut self._base_url, new_base_url)
164    }
165
166    /// Set the root url to use in all requests to the server.
167    /// It defaults to `https://playcustomapp.googleapis.com/`.
168    ///
169    /// Returns the previously set root url.
170    pub fn root_url(&mut self, new_root_url: String) -> String {
171        std::mem::replace(&mut self._root_url, new_root_url)
172    }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// This resource represents a custom app.
179///
180/// # Activities
181///
182/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
183/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
184///
185/// * [custom apps create accounts](AccountCustomAppCreateCall) (request|response)
186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
187#[serde_with::serde_as]
188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
189pub struct CustomApp {
190    /// Default listing language in BCP 47 format.
191    #[serde(rename = "languageCode")]
192    pub language_code: Option<String>,
193    /// Organizations to which the custom app should be made available. If the request contains any organizations, then the app will be restricted to only these organizations. To support the organization linked to the developer account, the organization ID should be provided explicitly together with other organizations. If no organizations are provided, then the app is only available to the organization linked to the developer account.
194    pub organizations: Option<Vec<Organization>>,
195    /// Output only. Package name of the created Android app. Only present in the API response.
196    #[serde(rename = "packageName")]
197    pub package_name: Option<String>,
198    /// Title for the Android app.
199    pub title: Option<String>,
200}
201
202impl common::RequestValue for CustomApp {}
203impl common::ResponseResult for CustomApp {}
204
205/// Represents an organization that can access a custom app.
206///
207/// This type is not used in any activity, and only used as *part* of another schema.
208///
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct Organization {
213    /// Required. ID of the organization.
214    #[serde(rename = "organizationId")]
215    pub organization_id: Option<String>,
216    /// Optional. A human-readable name of the organization, to help recognize the organization.
217    #[serde(rename = "organizationName")]
218    pub organization_name: Option<String>,
219}
220
221impl common::Part for Organization {}
222
223// ###################
224// MethodBuilders ###
225// #################
226
227/// A builder providing access to all methods supported on *account* resources.
228/// It is not used directly, but through the [`Playcustomapp`] hub.
229///
230/// # Example
231///
232/// Instantiate a resource builder
233///
234/// ```test_harness,no_run
235/// extern crate hyper;
236/// extern crate hyper_rustls;
237/// extern crate google_playcustomapp1 as playcustomapp1;
238///
239/// # async fn dox() {
240/// use playcustomapp1::{Playcustomapp, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
241///
242/// let secret: yup_oauth2::ApplicationSecret = Default::default();
243/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
244///     .with_native_roots()
245///     .unwrap()
246///     .https_only()
247///     .enable_http2()
248///     .build();
249///
250/// let executor = hyper_util::rt::TokioExecutor::new();
251/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
252///     secret,
253///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
254///     yup_oauth2::client::CustomHyperClientBuilder::from(
255///         hyper_util::client::legacy::Client::builder(executor).build(connector),
256///     ),
257/// ).build().await.unwrap();
258///
259/// let client = hyper_util::client::legacy::Client::builder(
260///     hyper_util::rt::TokioExecutor::new()
261/// )
262/// .build(
263///     hyper_rustls::HttpsConnectorBuilder::new()
264///         .with_native_roots()
265///         .unwrap()
266///         .https_or_http()
267///         .enable_http2()
268///         .build()
269/// );
270/// let mut hub = Playcustomapp::new(client, auth);
271/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
272/// // like `custom_apps_create(...)`
273/// // to build up your call.
274/// let rb = hub.accounts();
275/// # }
276/// ```
277pub struct AccountMethods<'a, C>
278where
279    C: 'a,
280{
281    hub: &'a Playcustomapp<C>,
282}
283
284impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
285
286impl<'a, C> AccountMethods<'a, C> {
287    /// Create a builder to help you perform the following task:
288    ///
289    /// Creates a new custom app.
290    ///
291    /// # Arguments
292    ///
293    /// * `request` - No description provided.
294    /// * `account` - Developer account ID.
295    pub fn custom_apps_create(
296        &self,
297        request: CustomApp,
298        account: i64,
299    ) -> AccountCustomAppCreateCall<'a, C> {
300        AccountCustomAppCreateCall {
301            hub: self.hub,
302            _request: request,
303            _account: account,
304            _delegate: Default::default(),
305            _additional_params: Default::default(),
306            _scopes: Default::default(),
307        }
308    }
309}
310
311// ###################
312// CallBuilders   ###
313// #################
314
315/// Creates a new custom app.
316///
317/// A builder for the *customApps.create* method supported by a *account* resource.
318/// It is not used directly, but through a [`AccountMethods`] instance.
319///
320/// # Example
321///
322/// Instantiate a resource method builder
323///
324/// ```test_harness,no_run
325/// # extern crate hyper;
326/// # extern crate hyper_rustls;
327/// # extern crate google_playcustomapp1 as playcustomapp1;
328/// use playcustomapp1::api::CustomApp;
329/// use std::fs;
330/// # async fn dox() {
331/// # use playcustomapp1::{Playcustomapp, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
332///
333/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
334/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
335/// #     .with_native_roots()
336/// #     .unwrap()
337/// #     .https_only()
338/// #     .enable_http2()
339/// #     .build();
340///
341/// # let executor = hyper_util::rt::TokioExecutor::new();
342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
343/// #     secret,
344/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
345/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
346/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
347/// #     ),
348/// # ).build().await.unwrap();
349///
350/// # let client = hyper_util::client::legacy::Client::builder(
351/// #     hyper_util::rt::TokioExecutor::new()
352/// # )
353/// # .build(
354/// #     hyper_rustls::HttpsConnectorBuilder::new()
355/// #         .with_native_roots()
356/// #         .unwrap()
357/// #         .https_or_http()
358/// #         .enable_http2()
359/// #         .build()
360/// # );
361/// # let mut hub = Playcustomapp::new(client, auth);
362/// // As the method needs a request, you would usually fill it with the desired information
363/// // into the respective structure. Some of the parts shown here might not be applicable !
364/// // Values shown here are possibly random and not representative !
365/// let mut req = CustomApp::default();
366///
367/// // You can configure optional parameters by calling the respective setters at will, and
368/// // execute the final call using `upload(...)`.
369/// // Values shown here are possibly random and not representative !
370/// let result = hub.accounts().custom_apps_create(req, -55)
371///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
372/// # }
373/// ```
374pub struct AccountCustomAppCreateCall<'a, C>
375where
376    C: 'a,
377{
378    hub: &'a Playcustomapp<C>,
379    _request: CustomApp,
380    _account: i64,
381    _delegate: Option<&'a mut dyn common::Delegate>,
382    _additional_params: HashMap<String, String>,
383    _scopes: BTreeSet<String>,
384}
385
386impl<'a, C> common::CallBuilder for AccountCustomAppCreateCall<'a, C> {}
387
388impl<'a, C> AccountCustomAppCreateCall<'a, C>
389where
390    C: common::Connector,
391{
392    /// Perform the operation you have build so far.
393    async fn doit<RS>(
394        mut self,
395        mut reader: RS,
396        reader_mime_type: mime::Mime,
397        protocol: common::UploadProtocol,
398    ) -> common::Result<(common::Response, CustomApp)>
399    where
400        RS: common::ReadSeek,
401    {
402        use std::borrow::Cow;
403        use std::io::{Read, Seek};
404
405        use common::{url::Params, ToParts};
406        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
407
408        let mut dd = common::DefaultDelegate;
409        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
410        dlg.begin(common::MethodInfo {
411            id: "playcustomapp.accounts.customApps.create",
412            http_method: hyper::Method::POST,
413        });
414
415        for &field in ["alt", "account"].iter() {
416            if self._additional_params.contains_key(field) {
417                dlg.finished(false);
418                return Err(common::Error::FieldClash(field));
419            }
420        }
421
422        let mut params = Params::with_capacity(4 + self._additional_params.len());
423        params.push("account", self._account.to_string());
424
425        params.extend(self._additional_params.iter());
426
427        params.push("alt", "json");
428        let (mut url, upload_type) = if protocol == common::UploadProtocol::Resumable {
429            (
430                self.hub._root_url.clone()
431                    + "resumable/upload/playcustomapp/v1/accounts/{account}/customApps",
432                "resumable",
433            )
434        } else if protocol == common::UploadProtocol::Simple {
435            (
436                self.hub._root_url.clone()
437                    + "upload/playcustomapp/v1/accounts/{account}/customApps",
438                "multipart",
439            )
440        } else {
441            unreachable!()
442        };
443        params.push("uploadType", upload_type);
444        if self._scopes.is_empty() {
445            self._scopes
446                .insert(Scope::Androidpublisher.as_ref().to_string());
447        }
448
449        #[allow(clippy::single_element_loop)]
450        for &(find_this, param_name) in [("{account}", "account")].iter() {
451            url = params.uri_replacement(url, param_name, find_this, false);
452        }
453        {
454            let to_remove = ["account"];
455            params.remove_params(&to_remove);
456        }
457
458        let url = params.parse_with_url(&url);
459
460        let mut json_mime_type = mime::APPLICATION_JSON;
461        let mut request_value_reader = {
462            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
463            common::remove_json_null_values(&mut value);
464            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
465            serde_json::to_writer(&mut dst, &value).unwrap();
466            dst
467        };
468        let request_size = request_value_reader
469            .seek(std::io::SeekFrom::End(0))
470            .unwrap();
471        request_value_reader
472            .seek(std::io::SeekFrom::Start(0))
473            .unwrap();
474
475        let mut upload_url_from_server;
476
477        loop {
478            let token = match self
479                .hub
480                .auth
481                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
482                .await
483            {
484                Ok(token) => token,
485                Err(e) => match dlg.token(e) {
486                    Ok(token) => token,
487                    Err(e) => {
488                        dlg.finished(false);
489                        return Err(common::Error::MissingToken(e));
490                    }
491                },
492            };
493            request_value_reader
494                .seek(std::io::SeekFrom::Start(0))
495                .unwrap();
496            let mut req_result = {
497                let mut mp_reader: common::MultiPartReader = Default::default();
498                let (mut body_reader, content_type) = match protocol {
499                    common::UploadProtocol::Simple => {
500                        mp_reader.reserve_exact(2);
501                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
502                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
503                        if size > 10737418240 {
504                            return Err(common::Error::UploadSizeLimitExceeded(size, 10737418240));
505                        }
506                        mp_reader
507                            .add_part(
508                                &mut request_value_reader,
509                                request_size,
510                                json_mime_type.clone(),
511                            )
512                            .add_part(&mut reader, size, reader_mime_type.clone());
513                        (
514                            &mut mp_reader as &mut (dyn std::io::Read + Send),
515                            common::MultiPartReader::mime_type(),
516                        )
517                    }
518                    _ => (
519                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
520                        json_mime_type.clone(),
521                    ),
522                };
523                let client = &self.hub.client;
524                dlg.pre_request();
525                let mut req_builder = hyper::Request::builder()
526                    .method(hyper::Method::POST)
527                    .uri(url.as_str())
528                    .header(USER_AGENT, self.hub._user_agent.clone());
529
530                if let Some(token) = token.as_ref() {
531                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
532                }
533
534                upload_url_from_server = true;
535                if protocol == common::UploadProtocol::Resumable {
536                    req_builder = req_builder
537                        .header("X-Upload-Content-Type", format!("{}", reader_mime_type));
538                }
539
540                let mut body_reader_bytes = vec![];
541                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
542                let request = req_builder
543                    .header(CONTENT_TYPE, content_type.to_string())
544                    .body(common::to_body(body_reader_bytes.into()));
545
546                client.request(request.unwrap()).await
547            };
548
549            match req_result {
550                Err(err) => {
551                    if let common::Retry::After(d) = dlg.http_error(&err) {
552                        sleep(d).await;
553                        continue;
554                    }
555                    dlg.finished(false);
556                    return Err(common::Error::HttpError(err));
557                }
558                Ok(res) => {
559                    let (mut parts, body) = res.into_parts();
560                    let mut body = common::Body::new(body);
561                    if !parts.status.is_success() {
562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
563                        let error = serde_json::from_str(&common::to_string(&bytes));
564                        let response = common::to_response(parts, bytes.into());
565
566                        if let common::Retry::After(d) =
567                            dlg.http_failure(&response, error.as_ref().ok())
568                        {
569                            sleep(d).await;
570                            continue;
571                        }
572
573                        dlg.finished(false);
574
575                        return Err(match error {
576                            Ok(value) => common::Error::BadRequest(value),
577                            _ => common::Error::Failure(response),
578                        });
579                    }
580                    if protocol == common::UploadProtocol::Resumable {
581                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
582                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
583                        if size > 10737418240 {
584                            return Err(common::Error::UploadSizeLimitExceeded(size, 10737418240));
585                        }
586                        let upload_result = {
587                            let url_str = &parts
588                                .headers
589                                .get("Location")
590                                .expect("LOCATION header is part of protocol")
591                                .to_str()
592                                .unwrap();
593                            if upload_url_from_server {
594                                dlg.store_upload_url(Some(url_str));
595                            }
596
597                            common::ResumableUploadHelper {
598                                client: &self.hub.client,
599                                delegate: dlg,
600                                start_at: if upload_url_from_server {
601                                    Some(0)
602                                } else {
603                                    None
604                                },
605                                auth: &self.hub.auth,
606                                user_agent: &self.hub._user_agent,
607                                // TODO: Check this assumption
608                                auth_header: format!(
609                                    "Bearer {}",
610                                    token
611                                        .ok_or_else(|| common::Error::MissingToken(
612                                            "resumable upload requires token".into()
613                                        ))?
614                                        .as_str()
615                                ),
616                                url: url_str,
617                                reader: &mut reader,
618                                media_type: reader_mime_type.clone(),
619                                content_length: size,
620                            }
621                            .upload()
622                            .await
623                        };
624                        match upload_result {
625                            None => {
626                                dlg.finished(false);
627                                return Err(common::Error::Cancelled);
628                            }
629                            Some(Err(err)) => {
630                                dlg.finished(false);
631                                return Err(common::Error::HttpError(err));
632                            }
633                            Some(Ok(response)) => {
634                                (parts, body) = response.into_parts();
635                                if !parts.status.is_success() {
636                                    dlg.store_upload_url(None);
637                                    dlg.finished(false);
638                                    return Err(common::Error::Failure(
639                                        common::Response::from_parts(parts, body),
640                                    ));
641                                }
642                            }
643                        }
644                    }
645                    let response = {
646                        let bytes = common::to_bytes(body).await.unwrap_or_default();
647                        let encoded = common::to_string(&bytes);
648                        match serde_json::from_str(&encoded) {
649                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
650                            Err(error) => {
651                                dlg.response_json_decode_error(&encoded, &error);
652                                return Err(common::Error::JsonDecodeError(
653                                    encoded.to_string(),
654                                    error,
655                                ));
656                            }
657                        }
658                    };
659
660                    dlg.finished(true);
661                    return Ok(response);
662                }
663            }
664        }
665    }
666
667    /// Upload media in a resumable fashion.
668    /// Even if the upload fails or is interrupted, it can be resumed for a
669    /// certain amount of time as the server maintains state temporarily.
670    ///
671    /// The delegate will be asked for an `upload_url()`, and if not provided, will be asked to store an upload URL
672    /// that was provided by the server, using `store_upload_url(...)`. The upload will be done in chunks, the delegate
673    /// may specify the `chunk_size()` and may cancel the operation before each chunk is uploaded, using
674    /// `cancel_chunk_upload(...)`.
675    ///
676    /// * *multipart*: yes
677    /// * *max size*: 10737418240
678    /// * *valid mime types*: '*/*'
679    pub async fn upload_resumable<RS>(
680        self,
681        resumeable_stream: RS,
682        mime_type: mime::Mime,
683    ) -> common::Result<(common::Response, CustomApp)>
684    where
685        RS: common::ReadSeek,
686    {
687        self.doit(
688            resumeable_stream,
689            mime_type,
690            common::UploadProtocol::Resumable,
691        )
692        .await
693    }
694    /// Upload media all at once.
695    /// If the upload fails for whichever reason, all progress is lost.
696    ///
697    /// * *multipart*: yes
698    /// * *max size*: 10737418240
699    /// * *valid mime types*: '*/*'
700    pub async fn upload<RS>(
701        self,
702        stream: RS,
703        mime_type: mime::Mime,
704    ) -> common::Result<(common::Response, CustomApp)>
705    where
706        RS: common::ReadSeek,
707    {
708        self.doit(stream, mime_type, common::UploadProtocol::Simple)
709            .await
710    }
711
712    ///
713    /// Sets the *request* property to the given value.
714    ///
715    /// Even though the property as already been set when instantiating this call,
716    /// we provide this method for API completeness.
717    pub fn request(mut self, new_value: CustomApp) -> AccountCustomAppCreateCall<'a, C> {
718        self._request = new_value;
719        self
720    }
721    /// Developer account ID.
722    ///
723    /// Sets the *account* path property to the given value.
724    ///
725    /// Even though the property as already been set when instantiating this call,
726    /// we provide this method for API completeness.
727    pub fn account(mut self, new_value: i64) -> AccountCustomAppCreateCall<'a, C> {
728        self._account = new_value;
729        self
730    }
731    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
732    /// while executing the actual API request.
733    ///
734    /// ````text
735    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
736    /// ````
737    ///
738    /// Sets the *delegate* property to the given value.
739    pub fn delegate(
740        mut self,
741        new_value: &'a mut dyn common::Delegate,
742    ) -> AccountCustomAppCreateCall<'a, C> {
743        self._delegate = Some(new_value);
744        self
745    }
746
747    /// Set any additional parameter of the query string used in the request.
748    /// It should be used to set parameters which are not yet available through their own
749    /// setters.
750    ///
751    /// Please note that this method must not be used to set any of the known parameters
752    /// which have their own setter method. If done anyway, the request will fail.
753    ///
754    /// # Additional Parameters
755    ///
756    /// * *$.xgafv* (query-string) - V1 error format.
757    /// * *access_token* (query-string) - OAuth access token.
758    /// * *alt* (query-string) - Data format for response.
759    /// * *callback* (query-string) - JSONP
760    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
761    /// * *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.
762    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
763    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
764    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
765    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
766    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
767    pub fn param<T>(mut self, name: T, value: T) -> AccountCustomAppCreateCall<'a, C>
768    where
769        T: AsRef<str>,
770    {
771        self._additional_params
772            .insert(name.as_ref().to_string(), value.as_ref().to_string());
773        self
774    }
775
776    /// Identifies the authorization scope for the method you are building.
777    ///
778    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
779    /// [`Scope::Androidpublisher`].
780    ///
781    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
782    /// tokens for more than one scope.
783    ///
784    /// Usually there is more than one suitable scope to authorize an operation, some of which may
785    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
786    /// sufficient, a read-write scope will do as well.
787    pub fn add_scope<St>(mut self, scope: St) -> AccountCustomAppCreateCall<'a, C>
788    where
789        St: AsRef<str>,
790    {
791        self._scopes.insert(String::from(scope.as_ref()));
792        self
793    }
794    /// Identifies the authorization scope(s) for the method you are building.
795    ///
796    /// See [`Self::add_scope()`] for details.
797    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountCustomAppCreateCall<'a, C>
798    where
799        I: IntoIterator<Item = St>,
800        St: AsRef<str>,
801    {
802        self._scopes
803            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
804        self
805    }
806
807    /// Removes all scopes, and no default scope will be used either.
808    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
809    /// for details).
810    pub fn clear_scopes(mut self) -> AccountCustomAppCreateCall<'a, C> {
811        self._scopes.clear();
812        self
813    }
814}