google_testing1/
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    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18
19    /// View your data across Google Cloud services and see the email address of your Google Account
20    CloudPlatformReadOnly,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::CloudPlatformReadOnly => {
28                "https://www.googleapis.com/auth/cloud-platform.read-only"
29            }
30        }
31    }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36    fn default() -> Scope {
37        Scope::CloudPlatform
38    }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all Testing related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_testing1 as testing1;
55/// use testing1::api::DeviceSession;
56/// use testing1::{Result, Error};
57/// # async fn dox() {
58/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace  `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
69///     .with_native_roots()
70///     .unwrap()
71///     .https_only()
72///     .enable_http2()
73///     .build();
74///
75/// let executor = hyper_util::rt::TokioExecutor::new();
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
77///     secret,
78///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79///     yup_oauth2::client::CustomHyperClientBuilder::from(
80///         hyper_util::client::legacy::Client::builder(executor).build(connector),
81///     ),
82/// ).build().await.unwrap();
83///
84/// let client = hyper_util::client::legacy::Client::builder(
85///     hyper_util::rt::TokioExecutor::new()
86/// )
87/// .build(
88///     hyper_rustls::HttpsConnectorBuilder::new()
89///         .with_native_roots()
90///         .unwrap()
91///         .https_or_http()
92///         .enable_http2()
93///         .build()
94/// );
95/// let mut hub = Testing::new(client, auth);
96/// // As the method needs a request, you would usually fill it with the desired information
97/// // into the respective structure. Some of the parts shown here might not be applicable !
98/// // Values shown here are possibly random and not representative !
99/// let mut req = DeviceSession::default();
100///
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.projects().device_sessions_patch(req, "name")
105///              .update_mask(FieldMask::new::<&str>(&[]))
106///              .doit().await;
107///
108/// match result {
109///     Err(e) => match e {
110///         // The Error enum provides details about what exactly happened.
111///         // You can also just use its `Debug`, `Display` or `Error` traits
112///          Error::HttpError(_)
113///         |Error::Io(_)
114///         |Error::MissingAPIKey
115///         |Error::MissingToken(_)
116///         |Error::Cancelled
117///         |Error::UploadSizeLimitExceeded(_, _)
118///         |Error::Failure(_)
119///         |Error::BadRequest(_)
120///         |Error::FieldClash(_)
121///         |Error::JsonDecodeError(_, _) => println!("{}", e),
122///     },
123///     Ok(res) => println!("Success: {:?}", res),
124/// }
125/// # }
126/// ```
127#[derive(Clone)]
128pub struct Testing<C> {
129    pub client: common::Client<C>,
130    pub auth: Box<dyn common::GetToken>,
131    _user_agent: String,
132    _base_url: String,
133    _root_url: String,
134}
135
136impl<C> common::Hub for Testing<C> {}
137
138impl<'a, C> Testing<C> {
139    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Testing<C> {
140        Testing {
141            client,
142            auth: Box::new(auth),
143            _user_agent: "google-api-rust-client/7.0.0".to_string(),
144            _base_url: "https://testing.googleapis.com/".to_string(),
145            _root_url: "https://testing.googleapis.com/".to_string(),
146        }
147    }
148
149    pub fn application_detail_service(&'a self) -> ApplicationDetailServiceMethods<'a, C> {
150        ApplicationDetailServiceMethods { hub: self }
151    }
152    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
153        ProjectMethods { hub: self }
154    }
155    pub fn test_environment_catalog(&'a self) -> TestEnvironmentCatalogMethods<'a, C> {
156        TestEnvironmentCatalogMethods { hub: self }
157    }
158
159    /// Set the user-agent header field to use in all requests to the server.
160    /// It defaults to `google-api-rust-client/7.0.0`.
161    ///
162    /// Returns the previously set user-agent.
163    pub fn user_agent(&mut self, agent_name: String) -> String {
164        std::mem::replace(&mut self._user_agent, agent_name)
165    }
166
167    /// Set the base url to use in all requests to the server.
168    /// It defaults to `https://testing.googleapis.com/`.
169    ///
170    /// Returns the previously set base url.
171    pub fn base_url(&mut self, new_base_url: String) -> String {
172        std::mem::replace(&mut self._base_url, new_base_url)
173    }
174
175    /// Set the root url to use in all requests to the server.
176    /// It defaults to `https://testing.googleapis.com/`.
177    ///
178    /// Returns the previously set root url.
179    pub fn root_url(&mut self, new_root_url: String) -> String {
180        std::mem::replace(&mut self._root_url, new_root_url)
181    }
182}
183
184// ############
185// SCHEMAS ###
186// ##########
187/// Identifies an account and how to log into it.
188///
189/// This type is not used in any activity, and only used as *part* of another schema.
190///
191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
192#[serde_with::serde_as]
193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
194pub struct Account {
195    /// An automatic google login account.
196    #[serde(rename = "googleAuto")]
197    pub google_auto: Option<GoogleAuto>,
198}
199
200impl common::Part for Account {}
201
202/// A single Android device.
203///
204/// This type is not used in any activity, and only used as *part* of another schema.
205///
206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
207#[serde_with::serde_as]
208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct AndroidDevice {
210    /// Required. The id of the Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
211    #[serde(rename = "androidModelId")]
212    pub android_model_id: Option<String>,
213    /// Required. The id of the Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
214    #[serde(rename = "androidVersionId")]
215    pub android_version_id: Option<String>,
216    /// Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
217    pub locale: Option<String>,
218    /// Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
219    pub orientation: Option<String>,
220}
221
222impl common::Part for AndroidDevice {}
223
224/// The currently supported Android devices.
225///
226/// This type is not used in any activity, and only used as *part* of another schema.
227///
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct AndroidDeviceCatalog {
232    /// The set of supported Android device models.
233    pub models: Option<Vec<AndroidModel>>,
234    /// The set of supported runtime configurations.
235    #[serde(rename = "runtimeConfiguration")]
236    pub runtime_configuration: Option<AndroidRuntimeConfiguration>,
237    /// The set of supported Android OS versions.
238    pub versions: Option<Vec<AndroidVersion>>,
239}
240
241impl common::Part for AndroidDeviceCatalog {}
242
243/// A list of Android device configurations in which the test is to be executed.
244///
245/// This type is not used in any activity, and only used as *part* of another schema.
246///
247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
248#[serde_with::serde_as]
249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
250pub struct AndroidDeviceList {
251    /// Required. A list of Android devices.
252    #[serde(rename = "androidDevices")]
253    pub android_devices: Option<Vec<AndroidDevice>>,
254}
255
256impl common::Part for AndroidDeviceList {}
257
258/// A test of an Android application that can control an Android component independently of its normal lifecycle. Android instrumentation tests run an application APK and test APK inside the same process on a virtual or physical AndroidDevice. They also specify a test runner class, such as com.google.GoogleTestRunner, which can vary on the specific instrumentation framework chosen. See for more information on types of Android tests.
259///
260/// This type is not used in any activity, and only used as *part* of another schema.
261///
262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
263#[serde_with::serde_as]
264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
265pub struct AndroidInstrumentationTest {
266    /// The APK for the application under test.
267    #[serde(rename = "appApk")]
268    pub app_apk: Option<FileReference>,
269    /// A multi-apk app bundle for the application under test.
270    #[serde(rename = "appBundle")]
271    pub app_bundle: Option<AppBundle>,
272    /// The java package for the application under test. The default value is determined by examining the application's manifest.
273    #[serde(rename = "appPackageId")]
274    pub app_package_id: Option<String>,
275    /// The option of whether running each test within its own invocation of instrumentation with Android Test Orchestrator or not. ** Orchestrator is only compatible with AndroidJUnitRunner version 1.1 or higher! ** Orchestrator offers the following benefits: - No shared state - Crashes are isolated - Logs are scoped per test See for more information about Android Test Orchestrator. If not set, the test will be run without the orchestrator.
276    #[serde(rename = "orchestratorOption")]
277    pub orchestrator_option: Option<String>,
278    /// The option to run tests in multiple shards in parallel.
279    #[serde(rename = "shardingOption")]
280    pub sharding_option: Option<ShardingOption>,
281    /// Required. The APK containing the test code to be executed.
282    #[serde(rename = "testApk")]
283    pub test_apk: Option<FileReference>,
284    /// The java package for the test to be executed. The default value is determined by examining the application's manifest.
285    #[serde(rename = "testPackageId")]
286    pub test_package_id: Option<String>,
287    /// The InstrumentationTestRunner class. The default value is determined by examining the application's manifest.
288    #[serde(rename = "testRunnerClass")]
289    pub test_runner_class: Option<String>,
290    /// Each target must be fully qualified with the package name or class name, in one of these formats: - "package package_name" - "class package_name.class_name" - "class package_name.class_name#method_name" If empty, all targets in the module will be run.
291    #[serde(rename = "testTargets")]
292    pub test_targets: Option<Vec<String>>,
293}
294
295impl common::Part for AndroidInstrumentationTest {}
296
297/// A set of Android device configuration permutations is defined by the the cross-product of the given axes. Internally, the given AndroidMatrix will be expanded into a set of AndroidDevices. Only supported permutations will be instantiated. Invalid permutations (e.g., incompatible models/versions) are ignored.
298///
299/// This type is not used in any activity, and only used as *part* of another schema.
300///
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct AndroidMatrix {
305    /// Required. The ids of the set of Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
306    #[serde(rename = "androidModelIds")]
307    pub android_model_ids: Option<Vec<String>>,
308    /// Required. The ids of the set of Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
309    #[serde(rename = "androidVersionIds")]
310    pub android_version_ids: Option<Vec<String>>,
311    /// Required. The set of locales the test device will enable for testing. Use the TestEnvironmentDiscoveryService to get supported options.
312    pub locales: Option<Vec<String>>,
313    /// Required. The set of orientations to test with. Use the TestEnvironmentDiscoveryService to get supported options.
314    pub orientations: Option<Vec<String>>,
315}
316
317impl common::Part for AndroidMatrix {}
318
319/// A description of an Android device tests may be run on.
320///
321/// This type is not used in any activity, and only used as *part* of another schema.
322///
323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
324#[serde_with::serde_as]
325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
326pub struct AndroidModel {
327    /// Reasons for access denial. This model is accessible if this list is empty, otherwise the model is viewable only.
328    #[serde(rename = "accessDeniedReasons")]
329    pub access_denied_reasons: Option<Vec<String>>,
330    /// The company that this device is branded with. Example: "Google", "Samsung".
331    pub brand: Option<String>,
332    /// The name of the industrial design. This corresponds to android.os.Build.DEVICE.
333    pub codename: Option<String>,
334    /// Whether this device is virtual or physical.
335    pub form: Option<String>,
336    /// Whether this device is a phone, tablet, wearable, etc.
337    #[serde(rename = "formFactor")]
338    pub form_factor: Option<String>,
339    /// The unique opaque id for this model. Use this for invoking the TestExecutionService.
340    pub id: Option<String>,
341    /// Output only. Lab info of this device.
342    #[serde(rename = "labInfo")]
343    pub lab_info: Option<LabInfo>,
344    /// True if and only if tests with this model are recorded by stitching together screenshots. See use_low_spec_video_recording in device config.
345    #[serde(rename = "lowFpsVideoRecording")]
346    pub low_fps_video_recording: Option<bool>,
347    /// The manufacturer of this device.
348    pub manufacturer: Option<String>,
349    /// The human-readable marketing name for this device model. Examples: "Nexus 5", "Galaxy S5".
350    pub name: Option<String>,
351    /// Version-specific information of an Android model.
352    #[serde(rename = "perVersionInfo")]
353    pub per_version_info: Option<Vec<PerAndroidVersionInfo>>,
354    /// Screen density in DPI. This corresponds to ro.sf.lcd_density
355    #[serde(rename = "screenDensity")]
356    pub screen_density: Option<i32>,
357    /// Screen size in the horizontal (X) dimension measured in pixels.
358    #[serde(rename = "screenX")]
359    pub screen_x: Option<i32>,
360    /// Screen size in the vertical (Y) dimension measured in pixels.
361    #[serde(rename = "screenY")]
362    pub screen_y: Option<i32>,
363    /// The list of supported ABIs for this device. This corresponds to either android.os.Build.SUPPORTED_ABIS (for API level 21 and above) or android.os.Build.CPU_ABI/CPU_ABI2. The most preferred ABI is the first element in the list. Elements are optionally prefixed by "version_id:" (where version_id is the id of an AndroidVersion), denoting an ABI that is supported only on a particular version.
364    #[serde(rename = "supportedAbis")]
365    pub supported_abis: Option<Vec<String>>,
366    /// The set of Android versions this device supports.
367    #[serde(rename = "supportedVersionIds")]
368    pub supported_version_ids: Option<Vec<String>>,
369    /// Tags for this dimension. Examples: "default", "preview", "deprecated".
370    pub tags: Option<Vec<String>>,
371    /// URL of a thumbnail image (photo) of the device.
372    #[serde(rename = "thumbnailUrl")]
373    pub thumbnail_url: Option<String>,
374}
375
376impl common::Part for AndroidModel {}
377
378/// A test of an android application that explores the application on a virtual or physical Android Device, finding culprits and crashes as it goes.
379///
380/// This type is not used in any activity, and only used as *part* of another schema.
381///
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct AndroidRoboTest {
386    /// The APK for the application under test.
387    #[serde(rename = "appApk")]
388    pub app_apk: Option<FileReference>,
389    /// A multi-apk app bundle for the application under test.
390    #[serde(rename = "appBundle")]
391    pub app_bundle: Option<AppBundle>,
392    /// The initial activity that should be used to start the app.
393    #[serde(rename = "appInitialActivity")]
394    pub app_initial_activity: Option<String>,
395    /// The java package for the application under test. The default value is determined by examining the application's manifest.
396    #[serde(rename = "appPackageId")]
397    pub app_package_id: Option<String>,
398    /// The max depth of the traversal stack Robo can explore. Needs to be at least 2 to make Robo explore the app beyond the first activity. Default is 50.
399    #[serde(rename = "maxDepth")]
400    pub max_depth: Option<i32>,
401    /// The max number of steps Robo can execute. Default is no limit.
402    #[serde(rename = "maxSteps")]
403    pub max_steps: Option<i32>,
404    /// A set of directives Robo should apply during the crawl. This allows users to customize the crawl. For example, the username and password for a test account can be provided.
405    #[serde(rename = "roboDirectives")]
406    pub robo_directives: Option<Vec<RoboDirective>>,
407    /// The mode in which Robo should run. Most clients should allow the server to populate this field automatically.
408    #[serde(rename = "roboMode")]
409    pub robo_mode: Option<String>,
410    /// A JSON file with a sequence of actions Robo should perform as a prologue for the crawl.
411    #[serde(rename = "roboScript")]
412    pub robo_script: Option<FileReference>,
413    /// The intents used to launch the app for the crawl. If none are provided, then the main launcher activity is launched. If some are provided, then only those provided are launched (the main launcher activity must be provided explicitly).
414    #[serde(rename = "startingIntents")]
415    pub starting_intents: Option<Vec<RoboStartingIntent>>,
416}
417
418impl common::Part for AndroidRoboTest {}
419
420/// Android configuration that can be selected at the time a test is run.
421///
422/// This type is not used in any activity, and only used as *part* of another schema.
423///
424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
425#[serde_with::serde_as]
426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
427pub struct AndroidRuntimeConfiguration {
428    /// The set of available locales.
429    pub locales: Option<Vec<Locale>>,
430    /// The set of available orientations.
431    pub orientations: Option<Vec<Orientation>>,
432}
433
434impl common::Part for AndroidRuntimeConfiguration {}
435
436/// A test of an Android Application with a Test Loop. The intent \ will be implicitly added, since Games is the only user of this api, for the time being.
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct AndroidTestLoop {
444    /// The APK for the application under test.
445    #[serde(rename = "appApk")]
446    pub app_apk: Option<FileReference>,
447    /// A multi-apk app bundle for the application under test.
448    #[serde(rename = "appBundle")]
449    pub app_bundle: Option<AppBundle>,
450    /// The java package for the application under test. The default is determined by examining the application's manifest.
451    #[serde(rename = "appPackageId")]
452    pub app_package_id: Option<String>,
453    /// The list of scenario labels that should be run during the test. The scenario labels should map to labels defined in the application's manifest. For example, player_experience and com.google.test.loops.player_experience add all of the loops labeled in the manifest with the com.google.test.loops.player_experience name to the execution. Scenarios can also be specified in the scenarios field.
454    #[serde(rename = "scenarioLabels")]
455    pub scenario_labels: Option<Vec<String>>,
456    /// The list of scenarios that should be run during the test. The default is all test loops, derived from the application's manifest.
457    pub scenarios: Option<Vec<i32>>,
458}
459
460impl common::Part for AndroidTestLoop {}
461
462/// A version of the Android OS.
463///
464/// This type is not used in any activity, and only used as *part* of another schema.
465///
466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
467#[serde_with::serde_as]
468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
469pub struct AndroidVersion {
470    /// The API level for this Android version. Examples: 18, 19.
471    #[serde(rename = "apiLevel")]
472    pub api_level: Option<i32>,
473    /// The code name for this Android version. Examples: "JellyBean", "KitKat".
474    #[serde(rename = "codeName")]
475    pub code_name: Option<String>,
476    /// Market share for this version.
477    pub distribution: Option<Distribution>,
478    /// An opaque id for this Android version. Use this id to invoke the TestExecutionService.
479    pub id: Option<String>,
480    /// The date this Android version became available in the market.
481    #[serde(rename = "releaseDate")]
482    pub release_date: Option<Date>,
483    /// Tags for this dimension. Examples: "default", "preview", "deprecated".
484    pub tags: Option<Vec<String>>,
485    /// A string representing this version of the Android OS. Examples: "4.3", "4.4".
486    #[serde(rename = "versionString")]
487    pub version_string: Option<String>,
488}
489
490impl common::Part for AndroidVersion {}
491
492/// An Android package file to install.
493///
494/// This type is not used in any activity, and only used as *part* of another schema.
495///
496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
497#[serde_with::serde_as]
498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
499pub struct Apk {
500    /// The path to an APK to be installed on the device before the test begins.
501    pub location: Option<FileReference>,
502    /// The java package for the APK to be installed. Value is determined by examining the application's manifest.
503    #[serde(rename = "packageName")]
504    pub package_name: Option<String>,
505}
506
507impl common::Part for Apk {}
508
509/// Android application details based on application manifest and archive contents.
510///
511/// This type is not used in any activity, and only used as *part* of another schema.
512///
513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
514#[serde_with::serde_as]
515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
516pub struct ApkDetail {
517    /// no description provided
518    #[serde(rename = "apkManifest")]
519    pub apk_manifest: Option<ApkManifest>,
520}
521
522impl common::Part for ApkDetail {}
523
524/// An Android app manifest. See http://developer.android.com/guide/topics/manifest/manifest-intro.html
525///
526/// This type is not used in any activity, and only used as *part* of another schema.
527///
528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
529#[serde_with::serde_as]
530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
531pub struct ApkManifest {
532    /// User-readable name for the application.
533    #[serde(rename = "applicationLabel")]
534    pub application_label: Option<String>,
535    /// no description provided
536    #[serde(rename = "intentFilters")]
537    pub intent_filters: Option<Vec<IntentFilter>>,
538    /// Maximum API level on which the application is designed to run.
539    #[serde(rename = "maxSdkVersion")]
540    pub max_sdk_version: Option<i32>,
541    /// Meta-data tags defined in the manifest.
542    pub metadata: Option<Vec<Metadata>>,
543    /// Minimum API level required for the application to run.
544    #[serde(rename = "minSdkVersion")]
545    pub min_sdk_version: Option<i32>,
546    /// Full Java-style package name for this application, e.g. "com.example.foo".
547    #[serde(rename = "packageName")]
548    pub package_name: Option<String>,
549    /// Services contained in the tag.
550    pub services: Option<Vec<Service>>,
551    /// Specifies the API Level on which the application is designed to run.
552    #[serde(rename = "targetSdkVersion")]
553    pub target_sdk_version: Option<i32>,
554    /// Feature usage tags defined in the manifest.
555    #[serde(rename = "usesFeature")]
556    pub uses_feature: Option<Vec<UsesFeature>>,
557    /// no description provided
558    #[serde(rename = "usesPermission")]
559    pub uses_permission: Option<Vec<String>>,
560    /// Permissions declared to be used by the application
561    #[serde(rename = "usesPermissionTags")]
562    pub uses_permission_tags: Option<Vec<UsesPermissionTag>>,
563    /// Version number used internally by the app.
564    #[serde(rename = "versionCode")]
565    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
566    pub version_code: Option<i64>,
567    /// Version number shown to users.
568    #[serde(rename = "versionName")]
569    pub version_name: Option<String>,
570}
571
572impl common::Part for ApkManifest {}
573
574/// A single dynamic feature apk.
575///
576/// This type is not used in any activity, and only used as *part* of another schema.
577///
578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
579#[serde_with::serde_as]
580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
581pub struct ApkSplits {
582    /// A list of .apk files generated by bundletool to install to the device under test as a single android app with adb install-multiple. If specified, requires one or more bundle_splits. The first split specified represents the base APK, while subsequent splits represent feature apks.
583    #[serde(rename = "bundleSplits")]
584    pub bundle_splits: Option<Vec<FileReference>>,
585}
586
587impl common::Part for ApkSplits {}
588
589/// An Android App Bundle file format, containing a BundleConfig.pb file, a base module directory, zero or more dynamic feature module directories. See https://developer.android.com/guide/app-bundle/build for guidance on building App Bundles.
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct AppBundle {
597    /// .apk files generated by bundletool to install as a single android app.
598    pub apks: Option<ApkSplits>,
599    /// .aab file representing the app bundle under test.
600    #[serde(rename = "bundleLocation")]
601    pub bundle_location: Option<FileReference>,
602}
603
604impl common::Part for AppBundle {}
605
606/// The request object for cancelling a Device Session.
607///
608/// # Activities
609///
610/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
611/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
612///
613/// * [device sessions cancel projects](ProjectDeviceSessionCancelCall) (request)
614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
615#[serde_with::serde_as]
616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
617pub struct CancelDeviceSessionRequest {
618    _never_set: Option<bool>,
619}
620
621impl common::RequestValue for CancelDeviceSessionRequest {}
622
623/// Response containing the current state of the specified test matrix.
624///
625/// # Activities
626///
627/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
628/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
629///
630/// * [test matrices cancel projects](ProjectTestMatriceCancelCall) (response)
631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
632#[serde_with::serde_as]
633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
634pub struct CancelTestMatrixResponse {
635    /// The current rolled-up state of the test matrix. If this state is already final, then the cancelation request will have no effect.
636    #[serde(rename = "testState")]
637    pub test_state: Option<String>,
638}
639
640impl common::ResponseResult for CancelTestMatrixResponse {}
641
642/// Information about the client which invoked the test.
643///
644/// This type is not used in any activity, and only used as *part* of another schema.
645///
646#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
647#[serde_with::serde_as]
648#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
649pub struct ClientInfo {
650    /// The list of detailed information about client.
651    #[serde(rename = "clientInfoDetails")]
652    pub client_info_details: Option<Vec<ClientInfoDetail>>,
653    /// Required. Client name, such as gcloud.
654    pub name: Option<String>,
655}
656
657impl common::Part for ClientInfo {}
658
659/// Key-value pair of detailed information about the client which invoked the test. Examples: {'Version', '1.0'}, {'Release Track', 'BETA'}.
660///
661/// This type is not used in any activity, and only used as *part* of another schema.
662///
663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
664#[serde_with::serde_as]
665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
666pub struct ClientInfoDetail {
667    /// Required. The key of detailed client information.
668    pub key: Option<String>,
669    /// Required. The value of detailed client information.
670    pub value: Option<String>,
671}
672
673impl common::Part for ClientInfoDetail {}
674
675/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
676///
677/// This type is not used in any activity, and only used as *part* of another schema.
678///
679#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
680#[serde_with::serde_as]
681#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
682pub struct Date {
683    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
684    pub day: Option<i32>,
685    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
686    pub month: Option<i32>,
687    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
688    pub year: Option<i32>,
689}
690
691impl common::Part for Date {}
692
693/// A single device file description.
694///
695/// This type is not used in any activity, and only used as *part* of another schema.
696///
697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
698#[serde_with::serde_as]
699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
700pub struct DeviceFile {
701    /// A reference to an opaque binary blob file.
702    #[serde(rename = "obbFile")]
703    pub obb_file: Option<ObbFile>,
704    /// A reference to a regular file.
705    #[serde(rename = "regularFile")]
706    pub regular_file: Option<RegularFile>,
707}
708
709impl common::Part for DeviceFile {}
710
711/// A single device IP block
712///
713/// This type is not used in any activity, and only used as *part* of another schema.
714///
715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
716#[serde_with::serde_as]
717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
718pub struct DeviceIpBlock {
719    /// The date this block was added to Firebase Test Lab
720    #[serde(rename = "addedDate")]
721    pub added_date: Option<Date>,
722    /// An IP address block in CIDR notation eg: 34.68.194.64/29
723    pub block: Option<String>,
724    /// Whether this block is used by physical or virtual devices
725    pub form: Option<String>,
726}
727
728impl common::Part for DeviceIpBlock {}
729
730/// List of IP blocks used by the Firebase Test Lab
731///
732/// This type is not used in any activity, and only used as *part* of another schema.
733///
734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
735#[serde_with::serde_as]
736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
737pub struct DeviceIpBlockCatalog {
738    /// The device IP blocks used by Firebase Test Lab
739    #[serde(rename = "ipBlocks")]
740    pub ip_blocks: Option<Vec<DeviceIpBlock>>,
741}
742
743impl common::Part for DeviceIpBlockCatalog {}
744
745/// Protobuf message describing the device message, used from several RPCs.
746///
747/// # Activities
748///
749/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
750/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
751///
752/// * [device sessions create projects](ProjectDeviceSessionCreateCall) (request|response)
753/// * [device sessions get projects](ProjectDeviceSessionGetCall) (response)
754/// * [device sessions patch projects](ProjectDeviceSessionPatchCall) (request|response)
755#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
756#[serde_with::serde_as]
757#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
758pub struct DeviceSession {
759    /// Output only. The timestamp that the session first became ACTIVE.
760    #[serde(rename = "activeStartTime")]
761    pub active_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
762    /// Required. The requested device
763    #[serde(rename = "androidDevice")]
764    pub android_device: Option<AndroidDevice>,
765    /// Output only. The time that the Session was created.
766    #[serde(rename = "createTime")]
767    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
768    /// Output only. The title of the DeviceSession to be presented in the UI.
769    #[serde(rename = "displayName")]
770    pub display_name: Option<String>,
771    /// Optional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
772    #[serde(rename = "expireTime")]
773    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
774    /// Output only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
775    #[serde(rename = "inactivityTimeout")]
776    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
777    pub inactivity_timeout: Option<chrono::Duration>,
778    /// Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
779    pub name: Option<String>,
780    /// Output only. Current state of the DeviceSession.
781    pub state: Option<String>,
782    /// Output only. The historical state transitions of the session_state message including the current session state.
783    #[serde(rename = "stateHistories")]
784    pub state_histories: Option<Vec<SessionStateEvent>>,
785    /// Optional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.
786    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
787    pub ttl: Option<chrono::Duration>,
788}
789
790impl common::RequestValue for DeviceSession {}
791impl common::ResponseResult for DeviceSession {}
792
793/// Denotes whether Direct Access is supported, and by which client versions. DirectAccessService is currently available as a preview to select developers. You can register today on behalf of you and your team at https://developer.android.com/studio/preview/android-device-streaming
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct DirectAccessVersionInfo {
801    /// Whether direct access is supported at all. Clients are expected to filter down the device list to only android models and versions which support Direct Access when that is the user intent.
802    #[serde(rename = "directAccessSupported")]
803    pub direct_access_supported: Option<bool>,
804    /// Output only. Indicates client-device compatibility, where a device is known to work only with certain workarounds implemented in the Android Studio client. Expected format "major.minor.micro.patch", e.g. "5921.22.2211.8881706".
805    #[serde(rename = "minimumAndroidStudioVersion")]
806    pub minimum_android_studio_version: Option<String>,
807}
808
809impl common::Part for DirectAccessVersionInfo {}
810
811/// Data about the relative number of devices running a given configuration of the Android platform.
812///
813/// This type is not used in any activity, and only used as *part* of another schema.
814///
815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
816#[serde_with::serde_as]
817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
818pub struct Distribution {
819    /// Output only. The estimated fraction (0-1) of the total market with this configuration.
820    #[serde(rename = "marketShare")]
821    pub market_share: Option<f64>,
822    /// Output only. The time this distribution was measured.
823    #[serde(rename = "measurementTime")]
824    pub measurement_time: Option<chrono::DateTime<chrono::offset::Utc>>,
825}
826
827impl common::Part for Distribution {}
828
829/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
830///
831/// # Activities
832///
833/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
834/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
835///
836/// * [device sessions cancel projects](ProjectDeviceSessionCancelCall) (response)
837#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
838#[serde_with::serde_as]
839#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
840pub struct Empty {
841    _never_set: Option<bool>,
842}
843
844impl common::ResponseResult for Empty {}
845
846/// The environment in which the test is run.
847///
848/// This type is not used in any activity, and only used as *part* of another schema.
849///
850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
851#[serde_with::serde_as]
852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
853pub struct Environment {
854    /// An Android device which must be used with an Android test.
855    #[serde(rename = "androidDevice")]
856    pub android_device: Option<AndroidDevice>,
857    /// An iOS device which must be used with an iOS test.
858    #[serde(rename = "iosDevice")]
859    pub ios_device: Option<IosDevice>,
860}
861
862impl common::Part for Environment {}
863
864/// The matrix of environments in which the test is to be executed.
865///
866/// This type is not used in any activity, and only used as *part* of another schema.
867///
868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
869#[serde_with::serde_as]
870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
871pub struct EnvironmentMatrix {
872    /// A list of Android devices; the test will be run only on the specified devices.
873    #[serde(rename = "androidDeviceList")]
874    pub android_device_list: Option<AndroidDeviceList>,
875    /// A matrix of Android devices.
876    #[serde(rename = "androidMatrix")]
877    pub android_matrix: Option<AndroidMatrix>,
878    /// A list of iOS devices.
879    #[serde(rename = "iosDeviceList")]
880    pub ios_device_list: Option<IosDeviceList>,
881}
882
883impl common::Part for EnvironmentMatrix {}
884
885/// A key-value pair passed as an environment variable to the test.
886///
887/// This type is not used in any activity, and only used as *part* of another schema.
888///
889#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
890#[serde_with::serde_as]
891#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
892pub struct EnvironmentVariable {
893    /// Key for the environment variable.
894    pub key: Option<String>,
895    /// Value for the environment variable.
896    pub value: Option<String>,
897}
898
899impl common::Part for EnvironmentVariable {}
900
901/// A reference to a file, used for user inputs.
902///
903/// # Activities
904///
905/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
906/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
907///
908/// * [get apk details application detail service](ApplicationDetailServiceGetApkDetailCall) (request)
909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
910#[serde_with::serde_as]
911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
912pub struct FileReference {
913    /// A path to a file in Google Cloud Storage. Example: gs://build-app-1414623860166/app%40debug-unaligned.apk These paths are expected to be url encoded (percent encoding)
914    #[serde(rename = "gcsPath")]
915    pub gcs_path: Option<String>,
916}
917
918impl common::RequestValue for FileReference {}
919
920/// Response containing the details of the specified Android application.
921///
922/// # Activities
923///
924/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
925/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
926///
927/// * [get apk details application detail service](ApplicationDetailServiceGetApkDetailCall) (response)
928#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
929#[serde_with::serde_as]
930#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
931pub struct GetApkDetailsResponse {
932    /// Details of the Android App.
933    #[serde(rename = "apkDetail")]
934    pub apk_detail: Option<ApkDetail>,
935}
936
937impl common::ResponseResult for GetApkDetailsResponse {}
938
939/// Enables automatic Google account login. If set, the service automatically generates a Google test account and adds it to the device, before executing the test. Note that test accounts might be reused. Many applications show their full set of functionalities when an account is present on the device. Logging into the device with these generated accounts allows testing more functionalities.
940///
941/// This type is not used in any activity, and only used as *part* of another schema.
942///
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct GoogleAuto {
947    _never_set: Option<bool>,
948}
949
950impl common::Part for GoogleAuto {}
951
952/// A storage location within Google cloud storage (GCS).
953///
954/// This type is not used in any activity, and only used as *part* of another schema.
955///
956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
957#[serde_with::serde_as]
958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
959pub struct GoogleCloudStorage {
960    /// Required. The path to a directory in GCS that will eventually contain the results for this test. The requesting user must have write access on the bucket in the supplied path.
961    #[serde(rename = "gcsPath")]
962    pub gcs_path: Option<String>,
963}
964
965impl common::Part for GoogleCloudStorage {}
966
967/// The section of an tag. https://developer.android.com/guide/topics/manifest/intent-filter-element.html
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct IntentFilter {
975    /// The android:name value of the tag.
976    #[serde(rename = "actionNames")]
977    pub action_names: Option<Vec<String>>,
978    /// The android:name value of the tag.
979    #[serde(rename = "categoryNames")]
980    pub category_names: Option<Vec<String>>,
981    /// The android:mimeType value of the tag.
982    #[serde(rename = "mimeType")]
983    pub mime_type: Option<String>,
984}
985
986impl common::Part for IntentFilter {}
987
988/// A single iOS device.
989///
990/// This type is not used in any activity, and only used as *part* of another schema.
991///
992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
993#[serde_with::serde_as]
994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
995pub struct IosDevice {
996    /// Required. The id of the iOS device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
997    #[serde(rename = "iosModelId")]
998    pub ios_model_id: Option<String>,
999    /// Required. The id of the iOS major software version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
1000    #[serde(rename = "iosVersionId")]
1001    pub ios_version_id: Option<String>,
1002    /// Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
1003    pub locale: Option<String>,
1004    /// Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
1005    pub orientation: Option<String>,
1006}
1007
1008impl common::Part for IosDevice {}
1009
1010/// The currently supported iOS devices.
1011///
1012/// This type is not used in any activity, and only used as *part* of another schema.
1013///
1014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1015#[serde_with::serde_as]
1016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1017pub struct IosDeviceCatalog {
1018    /// The set of supported iOS device models.
1019    pub models: Option<Vec<IosModel>>,
1020    /// The set of supported runtime configurations.
1021    #[serde(rename = "runtimeConfiguration")]
1022    pub runtime_configuration: Option<IosRuntimeConfiguration>,
1023    /// The set of supported iOS software versions.
1024    pub versions: Option<Vec<IosVersion>>,
1025    /// The set of supported Xcode versions.
1026    #[serde(rename = "xcodeVersions")]
1027    pub xcode_versions: Option<Vec<XcodeVersion>>,
1028}
1029
1030impl common::Part for IosDeviceCatalog {}
1031
1032/// A file or directory to install on the device before the test starts.
1033///
1034/// This type is not used in any activity, and only used as *part* of another schema.
1035///
1036#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1037#[serde_with::serde_as]
1038#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1039pub struct IosDeviceFile {
1040    /// The bundle id of the app where this file lives. iOS apps sandbox their own filesystem, so app files must specify which app installed on the device.
1041    #[serde(rename = "bundleId")]
1042    pub bundle_id: Option<String>,
1043    /// The source file
1044    pub content: Option<FileReference>,
1045    /// Location of the file on the device, inside the app's sandboxed filesystem
1046    #[serde(rename = "devicePath")]
1047    pub device_path: Option<String>,
1048}
1049
1050impl common::Part for IosDeviceFile {}
1051
1052/// A list of iOS device configurations in which the test is to be executed.
1053///
1054/// This type is not used in any activity, and only used as *part* of another schema.
1055///
1056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1057#[serde_with::serde_as]
1058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1059pub struct IosDeviceList {
1060    /// Required. A list of iOS devices.
1061    #[serde(rename = "iosDevices")]
1062    pub ios_devices: Option<Vec<IosDevice>>,
1063}
1064
1065impl common::Part for IosDeviceList {}
1066
1067/// A description of an iOS device tests may be run on.
1068///
1069/// This type is not used in any activity, and only used as *part* of another schema.
1070///
1071#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1072#[serde_with::serde_as]
1073#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1074pub struct IosModel {
1075    /// Device capabilities. Copied from https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html
1076    #[serde(rename = "deviceCapabilities")]
1077    pub device_capabilities: Option<Vec<String>>,
1078    /// Whether this device is a phone, tablet, wearable, etc.
1079    #[serde(rename = "formFactor")]
1080    pub form_factor: Option<String>,
1081    /// The unique opaque id for this model. Use this for invoking the TestExecutionService.
1082    pub id: Option<String>,
1083    /// The human-readable name for this device model. Examples: "iPhone 4s", "iPad Mini 2".
1084    pub name: Option<String>,
1085    /// Version-specific information of an iOS model.
1086    #[serde(rename = "perVersionInfo")]
1087    pub per_version_info: Option<Vec<PerIosVersionInfo>>,
1088    /// Screen density in DPI.
1089    #[serde(rename = "screenDensity")]
1090    pub screen_density: Option<i32>,
1091    /// Screen size in the horizontal (X) dimension measured in pixels.
1092    #[serde(rename = "screenX")]
1093    pub screen_x: Option<i32>,
1094    /// Screen size in the vertical (Y) dimension measured in pixels.
1095    #[serde(rename = "screenY")]
1096    pub screen_y: Option<i32>,
1097    /// The set of iOS major software versions this device supports.
1098    #[serde(rename = "supportedVersionIds")]
1099    pub supported_version_ids: Option<Vec<String>>,
1100    /// Tags for this dimension. Examples: "default", "preview", "deprecated".
1101    pub tags: Option<Vec<String>>,
1102}
1103
1104impl common::Part for IosModel {}
1105
1106/// A test that explores an iOS application on an iOS device.
1107///
1108/// This type is not used in any activity, and only used as *part* of another schema.
1109///
1110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1111#[serde_with::serde_as]
1112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1113pub struct IosRoboTest {
1114    /// The bundle ID for the app-under-test. This is determined by examining the application's "Info.plist" file.
1115    #[serde(rename = "appBundleId")]
1116    pub app_bundle_id: Option<String>,
1117    /// Required. The ipa stored at this file should be used to run the test.
1118    #[serde(rename = "appIpa")]
1119    pub app_ipa: Option<FileReference>,
1120    /// An optional Roboscript to customize the crawl. See https://firebase.google.com/docs/test-lab/android/robo-scripts-reference for more information about Roboscripts. The maximum allowed file size of the roboscript is 10MiB.
1121    #[serde(rename = "roboScript")]
1122    pub robo_script: Option<FileReference>,
1123}
1124
1125impl common::Part for IosRoboTest {}
1126
1127/// iOS configuration that can be selected at the time a test is run.
1128///
1129/// This type is not used in any activity, and only used as *part* of another schema.
1130///
1131#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1132#[serde_with::serde_as]
1133#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1134pub struct IosRuntimeConfiguration {
1135    /// The set of available locales.
1136    pub locales: Option<Vec<Locale>>,
1137    /// The set of available orientations.
1138    pub orientations: Option<Vec<Orientation>>,
1139}
1140
1141impl common::Part for IosRuntimeConfiguration {}
1142
1143/// A test of an iOS application that implements one or more game loop scenarios. This test type accepts an archived application (.ipa file) and a list of integer scenarios that will be executed on the app sequentially.
1144///
1145/// This type is not used in any activity, and only used as *part* of another schema.
1146///
1147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1148#[serde_with::serde_as]
1149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1150pub struct IosTestLoop {
1151    /// Output only. The bundle id for the application under test.
1152    #[serde(rename = "appBundleId")]
1153    pub app_bundle_id: Option<String>,
1154    /// Required. The .ipa of the application to test.
1155    #[serde(rename = "appIpa")]
1156    pub app_ipa: Option<FileReference>,
1157    /// The list of scenarios that should be run during the test. Defaults to the single scenario 0 if unspecified.
1158    pub scenarios: Option<Vec<i32>>,
1159}
1160
1161impl common::Part for IosTestLoop {}
1162
1163/// A description of how to set up an iOS device prior to running the test.
1164///
1165/// This type is not used in any activity, and only used as *part* of another schema.
1166///
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct IosTestSetup {
1171    /// iOS apps to install in addition to those being directly tested.
1172    #[serde(rename = "additionalIpas")]
1173    pub additional_ipas: Option<Vec<FileReference>>,
1174    /// The network traffic profile used for running the test. Available network profiles can be queried by using the NETWORK_CONFIGURATION environment type when calling TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog.
1175    #[serde(rename = "networkProfile")]
1176    pub network_profile: Option<String>,
1177    /// List of directories on the device to upload to Cloud Storage at the end of the test. Directories should either be in a shared directory (such as /private/var/mobile/Media) or within an accessible directory inside the app's filesystem (such as /Documents) by specifying the bundle ID.
1178    #[serde(rename = "pullDirectories")]
1179    pub pull_directories: Option<Vec<IosDeviceFile>>,
1180    /// List of files to push to the device before starting the test.
1181    #[serde(rename = "pushFiles")]
1182    pub push_files: Option<Vec<IosDeviceFile>>,
1183}
1184
1185impl common::Part for IosTestSetup {}
1186
1187/// An iOS version.
1188///
1189/// This type is not used in any activity, and only used as *part* of another schema.
1190///
1191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1192#[serde_with::serde_as]
1193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1194pub struct IosVersion {
1195    /// An opaque id for this iOS version. Use this id to invoke the TestExecutionService.
1196    pub id: Option<String>,
1197    /// An integer representing the major iOS version. Examples: "8", "9".
1198    #[serde(rename = "majorVersion")]
1199    pub major_version: Option<i32>,
1200    /// An integer representing the minor iOS version. Examples: "1", "2".
1201    #[serde(rename = "minorVersion")]
1202    pub minor_version: Option<i32>,
1203    /// The available Xcode versions for this version.
1204    #[serde(rename = "supportedXcodeVersionIds")]
1205    pub supported_xcode_version_ids: Option<Vec<String>>,
1206    /// Tags for this dimension. Examples: "default", "preview", "deprecated".
1207    pub tags: Option<Vec<String>>,
1208}
1209
1210impl common::Part for IosVersion {}
1211
1212/// A test of an iOS application that uses the XCTest framework. Xcode supports the option to "build for testing", which generates an .xctestrun file that contains a test specification (arguments, test methods, etc). This test type accepts a zip file containing the .xctestrun file and the corresponding contents of the Build/Products directory that contains all the binaries needed to run the tests.
1213///
1214/// This type is not used in any activity, and only used as *part* of another schema.
1215///
1216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1217#[serde_with::serde_as]
1218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1219pub struct IosXcTest {
1220    /// Output only. The bundle id for the application under test.
1221    #[serde(rename = "appBundleId")]
1222    pub app_bundle_id: Option<String>,
1223    /// The option to test special app entitlements. Setting this would re-sign the app having special entitlements with an explicit application-identifier. Currently supports testing aps-environment entitlement.
1224    #[serde(rename = "testSpecialEntitlements")]
1225    pub test_special_entitlements: Option<bool>,
1226    /// Required. The .zip containing the .xctestrun file and the contents of the DerivedData/Build/Products directory. The .xctestrun file in this zip is ignored if the xctestrun field is specified.
1227    #[serde(rename = "testsZip")]
1228    pub tests_zip: Option<FileReference>,
1229    /// The Xcode version that should be used for the test. Use the TestEnvironmentDiscoveryService to get supported options. Defaults to the latest Xcode version Firebase Test Lab supports.
1230    #[serde(rename = "xcodeVersion")]
1231    pub xcode_version: Option<String>,
1232    /// An .xctestrun file that will override the .xctestrun file in the tests zip. Because the .xctestrun file contains environment variables along with test methods to run and/or ignore, this can be useful for sharding tests. Default is taken from the tests zip.
1233    pub xctestrun: Option<FileReference>,
1234}
1235
1236impl common::Part for IosXcTest {}
1237
1238/// Lab specific information for a device.
1239///
1240/// This type is not used in any activity, and only used as *part* of another schema.
1241///
1242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1243#[serde_with::serde_as]
1244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1245pub struct LabInfo {
1246    /// Lab name where the device is hosted. If empty, the device is hosted in a Google owned lab.
1247    pub name: Option<String>,
1248    /// The Unicode country/region code (CLDR) of the lab where the device is hosted. E.g. "US" for United States, "CH" for Switzerland.
1249    #[serde(rename = "regionCode")]
1250    pub region_code: Option<String>,
1251}
1252
1253impl common::Part for LabInfo {}
1254
1255/// Specifies an intent that starts the main launcher activity.
1256///
1257/// This type is not used in any activity, and only used as *part* of another schema.
1258///
1259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1260#[serde_with::serde_as]
1261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1262pub struct LauncherActivityIntent {
1263    _never_set: Option<bool>,
1264}
1265
1266impl common::Part for LauncherActivityIntent {}
1267
1268/// A list of device sessions.
1269///
1270/// # Activities
1271///
1272/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1273/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1274///
1275/// * [device sessions list projects](ProjectDeviceSessionListCall) (response)
1276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1277#[serde_with::serde_as]
1278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1279pub struct ListDeviceSessionsResponse {
1280    /// The sessions matching the specified filter in the given cloud project.
1281    #[serde(rename = "deviceSessions")]
1282    pub device_sessions: Option<Vec<DeviceSession>>,
1283    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1284    #[serde(rename = "nextPageToken")]
1285    pub next_page_token: Option<String>,
1286}
1287
1288impl common::ResponseResult for ListDeviceSessionsResponse {}
1289
1290/// A location/region designation for language.
1291///
1292/// This type is not used in any activity, and only used as *part* of another schema.
1293///
1294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1295#[serde_with::serde_as]
1296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1297pub struct Locale {
1298    /// The id for this locale. Example: "en_US".
1299    pub id: Option<String>,
1300    /// A human-friendly name for this language/locale. Example: "English".
1301    pub name: Option<String>,
1302    /// A human-friendly string representing the region for this locale. Example: "United States". Not present for every locale.
1303    pub region: Option<String>,
1304    /// Tags for this dimension. Example: "default".
1305    pub tags: Option<Vec<String>>,
1306}
1307
1308impl common::Part for Locale {}
1309
1310/// Shards test cases into the specified groups of packages, classes, and/or methods. With manual sharding enabled, specifying test targets via environment_variables or in InstrumentationTest is invalid.
1311///
1312/// This type is not used in any activity, and only used as *part* of another schema.
1313///
1314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1315#[serde_with::serde_as]
1316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1317pub struct ManualSharding {
1318    /// Required. Group of packages, classes, and/or test methods to be run for each manually-created shard. You must specify at least one shard if this field is present. When you select one or more physical devices, the number of repeated test_targets_for_shard must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500.
1319    #[serde(rename = "testTargetsForShard")]
1320    pub test_targets_for_shard: Option<Vec<TestTargetsForShard>>,
1321}
1322
1323impl common::Part for ManualSharding {}
1324
1325/// Describes a single error or issue with a matrix.
1326///
1327/// This type is not used in any activity, and only used as *part* of another schema.
1328///
1329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1330#[serde_with::serde_as]
1331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1332pub struct MatrixErrorDetail {
1333    /// Output only. A human-readable message about how the error in the TestMatrix. Expands on the `reason` field with additional details and possible options to fix the issue.
1334    pub message: Option<String>,
1335    /// Output only. The reason for the error. This is a constant value in UPPER_SNAKE_CASE that identifies the cause of the error.
1336    pub reason: Option<String>,
1337}
1338
1339impl common::Part for MatrixErrorDetail {}
1340
1341/// A tag within a manifest. https://developer.android.com/guide/topics/manifest/meta-data-element.html
1342///
1343/// This type is not used in any activity, and only used as *part* of another schema.
1344///
1345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1346#[serde_with::serde_as]
1347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1348pub struct Metadata {
1349    /// The android:name value
1350    pub name: Option<String>,
1351    /// The android:value value
1352    pub value: Option<String>,
1353}
1354
1355impl common::Part for Metadata {}
1356
1357/// There is no detailed description.
1358///
1359/// This type is not used in any activity, and only used as *part* of another schema.
1360///
1361#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1362#[serde_with::serde_as]
1363#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1364pub struct NetworkConfiguration {
1365    /// The emulation rule applying to the download traffic.
1366    #[serde(rename = "downRule")]
1367    pub down_rule: Option<TrafficRule>,
1368    /// The unique opaque id for this network traffic configuration.
1369    pub id: Option<String>,
1370    /// The emulation rule applying to the upload traffic.
1371    #[serde(rename = "upRule")]
1372    pub up_rule: Option<TrafficRule>,
1373}
1374
1375impl common::Part for NetworkConfiguration {}
1376
1377/// There is no detailed description.
1378///
1379/// This type is not used in any activity, and only used as *part* of another schema.
1380///
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct NetworkConfigurationCatalog {
1385    /// no description provided
1386    pub configurations: Option<Vec<NetworkConfiguration>>,
1387}
1388
1389impl common::Part for NetworkConfigurationCatalog {}
1390
1391/// Skips the starting activity
1392///
1393/// This type is not used in any activity, and only used as *part* of another schema.
1394///
1395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1396#[serde_with::serde_as]
1397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1398pub struct NoActivityIntent {
1399    _never_set: Option<bool>,
1400}
1401
1402impl common::Part for NoActivityIntent {}
1403
1404/// An opaque binary blob file to install on the device before the test starts.
1405///
1406/// This type is not used in any activity, and only used as *part* of another schema.
1407///
1408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1409#[serde_with::serde_as]
1410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1411pub struct ObbFile {
1412    /// Required. Opaque Binary Blob (OBB) file(s) to install on the device.
1413    pub obb: Option<FileReference>,
1414    /// Required. OBB file name which must conform to the format as specified by Android e.g. [main|patch].0300110.com.example.android.obb which will be installed into \/Android/obb/\/ on the device.
1415    #[serde(rename = "obbFileName")]
1416    pub obb_file_name: Option<String>,
1417}
1418
1419impl common::Part for ObbFile {}
1420
1421/// Screen orientation of the device.
1422///
1423/// This type is not used in any activity, and only used as *part* of another schema.
1424///
1425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1426#[serde_with::serde_as]
1427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1428pub struct Orientation {
1429    /// The id for this orientation. Example: "portrait".
1430    pub id: Option<String>,
1431    /// A human-friendly name for this orientation. Example: "portrait".
1432    pub name: Option<String>,
1433    /// Tags for this dimension. Example: "default".
1434    pub tags: Option<Vec<String>>,
1435}
1436
1437impl common::Part for Orientation {}
1438
1439/// A version-specific information of an Android model.
1440///
1441/// This type is not used in any activity, and only used as *part* of another schema.
1442///
1443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1444#[serde_with::serde_as]
1445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1446pub struct PerAndroidVersionInfo {
1447    /// The number of online devices for an Android version.
1448    #[serde(rename = "deviceCapacity")]
1449    pub device_capacity: Option<String>,
1450    /// Output only. Identifies supported clients for DirectAccess for this Android version.
1451    #[serde(rename = "directAccessVersionInfo")]
1452    pub direct_access_version_info: Option<DirectAccessVersionInfo>,
1453    /// Output only. The estimated wait time for a single interactive device session using Direct Access.
1454    #[serde(rename = "interactiveDeviceAvailabilityEstimate")]
1455    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1456    pub interactive_device_availability_estimate: Option<chrono::Duration>,
1457    /// An Android version.
1458    #[serde(rename = "versionId")]
1459    pub version_id: Option<String>,
1460}
1461
1462impl common::Part for PerAndroidVersionInfo {}
1463
1464/// A version-specific information of an iOS model.
1465///
1466/// This type is not used in any activity, and only used as *part* of another schema.
1467///
1468#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1469#[serde_with::serde_as]
1470#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1471pub struct PerIosVersionInfo {
1472    /// The number of online devices for an iOS version.
1473    #[serde(rename = "deviceCapacity")]
1474    pub device_capacity: Option<String>,
1475    /// An iOS version.
1476    #[serde(rename = "versionId")]
1477    pub version_id: Option<String>,
1478}
1479
1480impl common::Part for PerIosVersionInfo {}
1481
1482/// The currently provided software environment on the devices under test.
1483///
1484/// This type is not used in any activity, and only used as *part* of another schema.
1485///
1486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1487#[serde_with::serde_as]
1488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1489pub struct ProvidedSoftwareCatalog {
1490    /// A string representing the current version of AndroidX Test Orchestrator that is used in the environment. The package is available at https://maven.google.com/web/index.html#androidx.test:orchestrator.
1491    #[serde(rename = "androidxOrchestratorVersion")]
1492    pub androidx_orchestrator_version: Option<String>,
1493    /// Deprecated: Use AndroidX Test Orchestrator going forward. A string representing the current version of Android Test Orchestrator that is used in the environment. The package is available at https://maven.google.com/web/index.html#com.android.support.test:orchestrator.
1494    #[serde(rename = "orchestratorVersion")]
1495    pub orchestrator_version: Option<String>,
1496}
1497
1498impl common::Part for ProvidedSoftwareCatalog {}
1499
1500/// A file or directory to install on the device before the test starts.
1501///
1502/// This type is not used in any activity, and only used as *part* of another schema.
1503///
1504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1505#[serde_with::serde_as]
1506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1507pub struct RegularFile {
1508    /// Required. The source file.
1509    pub content: Option<FileReference>,
1510    /// Required. Where to put the content on the device. Must be an absolute, allowlisted path. If the file exists, it will be replaced. The following device-side directories and any of their subdirectories are allowlisted: ${EXTERNAL_STORAGE}, /sdcard ${ANDROID_DATA}/local/tmp, or /data/local/tmp Specifying a path outside of these directory trees is invalid. The paths /sdcard and /data will be made available and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external storage, the system will replace it with the external storage path prefix for that device and copy the file there. It is strongly advised to use the Environment API in app and test code to access files on the device in a portable way.
1511    #[serde(rename = "devicePath")]
1512    pub device_path: Option<String>,
1513}
1514
1515impl common::Part for RegularFile {}
1516
1517/// Locations where the results of running the test are stored.
1518///
1519/// This type is not used in any activity, and only used as *part* of another schema.
1520///
1521#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1522#[serde_with::serde_as]
1523#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1524pub struct ResultStorage {
1525    /// Required.
1526    #[serde(rename = "googleCloudStorage")]
1527    pub google_cloud_storage: Option<GoogleCloudStorage>,
1528    /// Output only. URL to the results in the Firebase Web Console.
1529    #[serde(rename = "resultsUrl")]
1530    pub results_url: Option<String>,
1531    /// Output only. The tool results execution that results are written to.
1532    #[serde(rename = "toolResultsExecution")]
1533    pub tool_results_execution: Option<ToolResultsExecution>,
1534    /// The tool results history that contains the tool results execution that results are written to. If not provided, the service will choose an appropriate value.
1535    #[serde(rename = "toolResultsHistory")]
1536    pub tool_results_history: Option<ToolResultsHistory>,
1537}
1538
1539impl common::Part for ResultStorage {}
1540
1541/// Directs Robo to interact with a specific UI element if it is encountered during the crawl. Currently, Robo can perform text entry or element click.
1542///
1543/// This type is not used in any activity, and only used as *part* of another schema.
1544///
1545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1546#[serde_with::serde_as]
1547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1548pub struct RoboDirective {
1549    /// Required. The type of action that Robo should perform on the specified element.
1550    #[serde(rename = "actionType")]
1551    pub action_type: Option<String>,
1552    /// The text that Robo is directed to set. If left empty, the directive will be treated as a CLICK on the element matching the resource_name.
1553    #[serde(rename = "inputText")]
1554    pub input_text: Option<String>,
1555    /// Required. The android resource name of the target UI element. For example, in Java: R.string.foo in xml: @string/foo Only the "foo" part is needed. Reference doc: https://developer.android.com/guide/topics/resources/accessing-resources.html
1556    #[serde(rename = "resourceName")]
1557    pub resource_name: Option<String>,
1558}
1559
1560impl common::Part for RoboDirective {}
1561
1562/// Message for specifying the start activities to crawl.
1563///
1564/// This type is not used in any activity, and only used as *part* of another schema.
1565///
1566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1567#[serde_with::serde_as]
1568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1569pub struct RoboStartingIntent {
1570    /// An intent that starts the main launcher activity.
1571    #[serde(rename = "launcherActivity")]
1572    pub launcher_activity: Option<LauncherActivityIntent>,
1573    /// Skips the starting activity
1574    #[serde(rename = "noActivity")]
1575    pub no_activity: Option<NoActivityIntent>,
1576    /// An intent that starts an activity with specific details.
1577    #[serde(rename = "startActivity")]
1578    pub start_activity: Option<StartActivityIntent>,
1579    /// Timeout in seconds for each intent.
1580    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1581    pub timeout: Option<chrono::Duration>,
1582}
1583
1584impl common::Part for RoboStartingIntent {}
1585
1586/// The section of an tag. https://developer.android.com/guide/topics/manifest/service-element
1587///
1588/// This type is not used in any activity, and only used as *part* of another schema.
1589///
1590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1591#[serde_with::serde_as]
1592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1593pub struct Service {
1594    /// Intent filters in the service
1595    #[serde(rename = "intentFilter")]
1596    pub intent_filter: Option<Vec<IntentFilter>>,
1597    /// The android:name value
1598    pub name: Option<String>,
1599}
1600
1601impl common::Part for Service {}
1602
1603/// A message encapsulating a series of Session states and the time that the DeviceSession first entered those states.
1604///
1605/// This type is not used in any activity, and only used as *part* of another schema.
1606///
1607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1608#[serde_with::serde_as]
1609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1610pub struct SessionStateEvent {
1611    /// Output only. The time that the session_state first encountered that state.
1612    #[serde(rename = "eventTime")]
1613    pub event_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1614    /// Output only. The session_state tracked by this event
1615    #[serde(rename = "sessionState")]
1616    pub session_state: Option<String>,
1617    /// Output only. A human-readable message to explain the state.
1618    #[serde(rename = "stateMessage")]
1619    pub state_message: Option<String>,
1620}
1621
1622impl common::Part for SessionStateEvent {}
1623
1624/// Output only. Details about the shard.
1625///
1626/// This type is not used in any activity, and only used as *part* of another schema.
1627///
1628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1629#[serde_with::serde_as]
1630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1631pub struct Shard {
1632    /// Output only. The estimated shard duration based on previous test case timing records, if available.
1633    #[serde(rename = "estimatedShardDuration")]
1634    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1635    pub estimated_shard_duration: Option<chrono::Duration>,
1636    /// Output only. The total number of shards.
1637    #[serde(rename = "numShards")]
1638    pub num_shards: Option<i32>,
1639    /// Output only. The index of the shard among all the shards.
1640    #[serde(rename = "shardIndex")]
1641    pub shard_index: Option<i32>,
1642    /// Output only. Test targets for each shard. Only set for manual sharding.
1643    #[serde(rename = "testTargetsForShard")]
1644    pub test_targets_for_shard: Option<TestTargetsForShard>,
1645}
1646
1647impl common::Part for Shard {}
1648
1649/// Options for enabling sharding.
1650///
1651/// This type is not used in any activity, and only used as *part* of another schema.
1652///
1653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1654#[serde_with::serde_as]
1655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1656pub struct ShardingOption {
1657    /// Shards test cases into the specified groups of packages, classes, and/or methods.
1658    #[serde(rename = "manualSharding")]
1659    pub manual_sharding: Option<ManualSharding>,
1660    /// Shards test based on previous test case timing records.
1661    #[serde(rename = "smartSharding")]
1662    pub smart_sharding: Option<SmartSharding>,
1663    /// Uniformly shards test cases given a total number of shards.
1664    #[serde(rename = "uniformSharding")]
1665    pub uniform_sharding: Option<UniformSharding>,
1666}
1667
1668impl common::Part for ShardingOption {}
1669
1670/// Shards test based on previous test case timing records.
1671///
1672/// This type is not used in any activity, and only used as *part* of another schema.
1673///
1674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1675#[serde_with::serde_as]
1676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1677pub struct SmartSharding {
1678    /// The amount of time tests within a shard should take. Default: 300 seconds (5 minutes). The minimum allowed: 120 seconds (2 minutes). The shard count is dynamically set based on time, up to the maximum shard limit (described below). To guarantee at least one test case for each shard, the number of shards will not exceed the number of test cases. Shard duration will be exceeded if: - The maximum shard limit is reached and there is more calculated test time remaining to allocate into shards. - Any individual test is estimated to be longer than the targeted shard duration. Shard duration is not guaranteed because smart sharding uses test case history and default durations which may not be accurate. The rules for finding the test case timing records are: - If the service has processed a test case in the last 30 days, the record of the latest successful test case will be used. - For new test cases, the average duration of other known test cases will be used. - If there are no previous test case timing records available, the default test case duration is 15 seconds. Because the actual shard duration can exceed the targeted shard duration, we recommend that you set the targeted value at least 5 minutes less than the maximum allowed test timeout (45 minutes for physical devices and 60 minutes for virtual), or that you use the custom test timeout value that you set. This approach avoids cancelling the shard before all tests can finish. Note that there is a limit for maximum number of shards. When you select one or more physical devices, the number of shards must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500. To guarantee at least one test case for per shard, the number of shards will not exceed the number of test cases. Each shard created counts toward daily test quota.
1679    #[serde(rename = "targetedShardDuration")]
1680    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1681    pub targeted_shard_duration: Option<chrono::Duration>,
1682}
1683
1684impl common::Part for SmartSharding {}
1685
1686/// A starting intent specified by an action, uri, and categories.
1687///
1688/// This type is not used in any activity, and only used as *part* of another schema.
1689///
1690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1691#[serde_with::serde_as]
1692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1693pub struct StartActivityIntent {
1694    /// Action name. Required for START_ACTIVITY.
1695    pub action: Option<String>,
1696    /// Intent categories to set on the intent.
1697    pub categories: Option<Vec<String>>,
1698    /// URI for the action.
1699    pub uri: Option<String>,
1700}
1701
1702impl common::Part for StartActivityIntent {}
1703
1704/// There is no detailed description.
1705///
1706/// This type is not used in any activity, and only used as *part* of another schema.
1707///
1708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1709#[serde_with::serde_as]
1710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1711pub struct SystraceSetup {
1712    /// Systrace duration in seconds. Should be between 1 and 30 seconds. 0 disables systrace.
1713    #[serde(rename = "durationSeconds")]
1714    pub duration_seconds: Option<i32>,
1715}
1716
1717impl common::Part for SystraceSetup {}
1718
1719/// Additional details about the progress of the running test.
1720///
1721/// This type is not used in any activity, and only used as *part* of another schema.
1722///
1723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1724#[serde_with::serde_as]
1725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1726pub struct TestDetails {
1727    /// Output only. If the TestState is ERROR, then this string will contain human-readable details about the error.
1728    #[serde(rename = "errorMessage")]
1729    pub error_message: Option<String>,
1730    /// Output only. Human-readable, detailed descriptions of the test's progress. For example: "Provisioning a device", "Starting Test". During the course of execution new data may be appended to the end of progress_messages.
1731    #[serde(rename = "progressMessages")]
1732    pub progress_messages: Option<Vec<String>>,
1733}
1734
1735impl common::Part for TestDetails {}
1736
1737/// A description of a test environment.
1738///
1739/// # Activities
1740///
1741/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1742/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1743///
1744/// * [get test environment catalog](TestEnvironmentCatalogGetCall) (response)
1745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1746#[serde_with::serde_as]
1747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1748pub struct TestEnvironmentCatalog {
1749    /// Supported Android devices.
1750    #[serde(rename = "androidDeviceCatalog")]
1751    pub android_device_catalog: Option<AndroidDeviceCatalog>,
1752    /// The IP blocks used by devices in the test environment.
1753    #[serde(rename = "deviceIpBlockCatalog")]
1754    pub device_ip_block_catalog: Option<DeviceIpBlockCatalog>,
1755    /// Supported iOS devices.
1756    #[serde(rename = "iosDeviceCatalog")]
1757    pub ios_device_catalog: Option<IosDeviceCatalog>,
1758    /// Supported network configurations.
1759    #[serde(rename = "networkConfigurationCatalog")]
1760    pub network_configuration_catalog: Option<NetworkConfigurationCatalog>,
1761    /// The software test environment provided by TestExecutionService.
1762    #[serde(rename = "softwareCatalog")]
1763    pub software_catalog: Option<ProvidedSoftwareCatalog>,
1764}
1765
1766impl common::ResponseResult for TestEnvironmentCatalog {}
1767
1768/// A single test executed in a single environment.
1769///
1770/// This type is not used in any activity, and only used as *part* of another schema.
1771///
1772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1773#[serde_with::serde_as]
1774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1775pub struct TestExecution {
1776    /// Output only. How the host machine(s) are configured.
1777    pub environment: Option<Environment>,
1778    /// Output only. Unique id set by the service.
1779    pub id: Option<String>,
1780    /// Output only. Id of the containing TestMatrix.
1781    #[serde(rename = "matrixId")]
1782    pub matrix_id: Option<String>,
1783    /// Output only. The cloud project that owns the test execution.
1784    #[serde(rename = "projectId")]
1785    pub project_id: Option<String>,
1786    /// Output only. Details about the shard.
1787    pub shard: Option<Shard>,
1788    /// Output only. Indicates the current progress of the test execution (e.g., FINISHED).
1789    pub state: Option<String>,
1790    /// Output only. Additional details about the running test.
1791    #[serde(rename = "testDetails")]
1792    pub test_details: Option<TestDetails>,
1793    /// Output only. How to run the test.
1794    #[serde(rename = "testSpecification")]
1795    pub test_specification: Option<TestSpecification>,
1796    /// Output only. The time this test execution was initially created.
1797    pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1798    /// Output only. Where the results for this execution are written.
1799    #[serde(rename = "toolResultsStep")]
1800    pub tool_results_step: Option<ToolResultsStep>,
1801}
1802
1803impl common::Part for TestExecution {}
1804
1805/// TestMatrix captures all details about a test. It contains the environment configuration, test specification, test executions and overall state and outcome.
1806///
1807/// # Activities
1808///
1809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1811///
1812/// * [test matrices create projects](ProjectTestMatriceCreateCall) (request|response)
1813/// * [test matrices get projects](ProjectTestMatriceGetCall) (response)
1814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1815#[serde_with::serde_as]
1816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1817pub struct TestMatrix {
1818    /// Information about the client which invoked the test.
1819    #[serde(rename = "clientInfo")]
1820    pub client_info: Option<ClientInfo>,
1821    /// Required. The devices the tests are being executed on.
1822    #[serde(rename = "environmentMatrix")]
1823    pub environment_matrix: Option<EnvironmentMatrix>,
1824    /// Output only. Details about why a matrix was deemed invalid. If multiple checks can be safely performed, they will be reported but no assumptions should be made about the length of this list.
1825    #[serde(rename = "extendedInvalidMatrixDetails")]
1826    pub extended_invalid_matrix_details: Option<Vec<MatrixErrorDetail>>,
1827    /// If true, only a single attempt at most will be made to run each execution/shard in the matrix. Flaky test attempts are not affected. Normally, 2 or more attempts are made if a potential infrastructure issue is detected. This feature is for latency sensitive workloads. The incidence of execution failures may be significantly greater for fail-fast matrices and support is more limited because of that expectation.
1828    #[serde(rename = "failFast")]
1829    pub fail_fast: Option<bool>,
1830    /// The number of times a TestExecution should be re-attempted if one or more of its test cases fail for any reason. The maximum number of reruns allowed is 10. Default is 0, which implies no reruns.
1831    #[serde(rename = "flakyTestAttempts")]
1832    pub flaky_test_attempts: Option<i32>,
1833    /// Output only. Describes why the matrix is considered invalid. Only useful for matrices in the INVALID state.
1834    #[serde(rename = "invalidMatrixDetails")]
1835    pub invalid_matrix_details: Option<String>,
1836    /// Output Only. The overall outcome of the test. Only set when the test matrix state is FINISHED.
1837    #[serde(rename = "outcomeSummary")]
1838    pub outcome_summary: Option<String>,
1839    /// The cloud project that owns the test matrix.
1840    #[serde(rename = "projectId")]
1841    pub project_id: Option<String>,
1842    /// Required. Where the results for the matrix are written.
1843    #[serde(rename = "resultStorage")]
1844    pub result_storage: Option<ResultStorage>,
1845    /// Output only. Indicates the current progress of the test matrix.
1846    pub state: Option<String>,
1847    /// Output only. The list of test executions that the service creates for this matrix.
1848    #[serde(rename = "testExecutions")]
1849    pub test_executions: Option<Vec<TestExecution>>,
1850    /// Output only. Unique id set by the service.
1851    #[serde(rename = "testMatrixId")]
1852    pub test_matrix_id: Option<String>,
1853    /// Required. How to run the test.
1854    #[serde(rename = "testSpecification")]
1855    pub test_specification: Option<TestSpecification>,
1856    /// Output only. The time this test matrix was initially created.
1857    pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1858}
1859
1860impl common::RequestValue for TestMatrix {}
1861impl common::ResponseResult for TestMatrix {}
1862
1863/// A description of how to set up the Android device prior to running the test.
1864///
1865/// This type is not used in any activity, and only used as *part* of another schema.
1866///
1867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1868#[serde_with::serde_as]
1869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1870pub struct TestSetup {
1871    /// The device will be logged in on this account for the duration of the test.
1872    pub account: Option<Account>,
1873    /// APKs to install in addition to those being directly tested. These will be installed after the app under test. Limited to a combined total of 100 initial setup and additional files.
1874    #[serde(rename = "additionalApks")]
1875    pub additional_apks: Option<Vec<Apk>>,
1876    /// List of directories on the device to upload to GCS at the end of the test; they must be absolute paths under /sdcard, /storage or /data/local/tmp. Path names are restricted to characters a-z A-Z 0-9 _ - . + and / Note: The paths /sdcard and /data will be made available and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external storage, the system will replace it with the external storage path prefix for that device.
1877    #[serde(rename = "directoriesToPull")]
1878    pub directories_to_pull: Option<Vec<String>>,
1879    /// Whether to prevent all runtime permissions to be granted at app install
1880    #[serde(rename = "dontAutograntPermissions")]
1881    pub dont_autogrant_permissions: Option<bool>,
1882    /// Environment variables to set for the test (only applicable for instrumentation tests).
1883    #[serde(rename = "environmentVariables")]
1884    pub environment_variables: Option<Vec<EnvironmentVariable>>,
1885    /// List of files to push to the device before starting the test.
1886    #[serde(rename = "filesToPush")]
1887    pub files_to_push: Option<Vec<DeviceFile>>,
1888    /// Optional. Initial setup APKs to install before the app under test is installed. Limited to a combined total of 100 initial setup and additional files.
1889    #[serde(rename = "initialSetupApks")]
1890    pub initial_setup_apks: Option<Vec<Apk>>,
1891    /// The network traffic profile used for running the test. Available network profiles can be queried by using the NETWORK_CONFIGURATION environment type when calling TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog.
1892    #[serde(rename = "networkProfile")]
1893    pub network_profile: Option<String>,
1894    /// Systrace configuration for the run. Deprecated: Systrace used Python 2 which was sunsetted on 2020-01-01. Systrace is no longer supported in the Cloud Testing API, and no Systrace file will be provided in the results.
1895    pub systrace: Option<SystraceSetup>,
1896}
1897
1898impl common::Part for TestSetup {}
1899
1900/// A description of how to run the test.
1901///
1902/// This type is not used in any activity, and only used as *part* of another schema.
1903///
1904#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1905#[serde_with::serde_as]
1906#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1907pub struct TestSpecification {
1908    /// An Android instrumentation test.
1909    #[serde(rename = "androidInstrumentationTest")]
1910    pub android_instrumentation_test: Option<AndroidInstrumentationTest>,
1911    /// An Android robo test.
1912    #[serde(rename = "androidRoboTest")]
1913    pub android_robo_test: Option<AndroidRoboTest>,
1914    /// An Android Application with a Test Loop.
1915    #[serde(rename = "androidTestLoop")]
1916    pub android_test_loop: Option<AndroidTestLoop>,
1917    /// Disables performance metrics recording. May reduce test latency.
1918    #[serde(rename = "disablePerformanceMetrics")]
1919    pub disable_performance_metrics: Option<bool>,
1920    /// Disables video recording. May reduce test latency.
1921    #[serde(rename = "disableVideoRecording")]
1922    pub disable_video_recording: Option<bool>,
1923    /// An iOS Robo test.
1924    #[serde(rename = "iosRoboTest")]
1925    pub ios_robo_test: Option<IosRoboTest>,
1926    /// An iOS application with a test loop.
1927    #[serde(rename = "iosTestLoop")]
1928    pub ios_test_loop: Option<IosTestLoop>,
1929    /// Test setup requirements for iOS.
1930    #[serde(rename = "iosTestSetup")]
1931    pub ios_test_setup: Option<IosTestSetup>,
1932    /// An iOS XCTest, via an .xctestrun file.
1933    #[serde(rename = "iosXcTest")]
1934    pub ios_xc_test: Option<IosXcTest>,
1935    /// Test setup requirements for Android e.g. files to install, bootstrap scripts.
1936    #[serde(rename = "testSetup")]
1937    pub test_setup: Option<TestSetup>,
1938    /// Max time a test execution is allowed to run before it is automatically cancelled. The default value is 5 min.
1939    #[serde(rename = "testTimeout")]
1940    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1941    pub test_timeout: Option<chrono::Duration>,
1942}
1943
1944impl common::Part for TestSpecification {}
1945
1946/// Test targets for a shard.
1947///
1948/// This type is not used in any activity, and only used as *part* of another schema.
1949///
1950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1951#[serde_with::serde_as]
1952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1953pub struct TestTargetsForShard {
1954    /// Group of packages, classes, and/or test methods to be run for each shard. The targets need to be specified in AndroidJUnitRunner argument format. For example, "package com.my.packages" "class com.my.package.MyClass". The number of test_targets must be greater than 0.
1955    #[serde(rename = "testTargets")]
1956    pub test_targets: Option<Vec<String>>,
1957}
1958
1959impl common::Part for TestTargetsForShard {}
1960
1961/// Represents a tool results execution resource. This has the results of a TestMatrix.
1962///
1963/// This type is not used in any activity, and only used as *part* of another schema.
1964///
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct ToolResultsExecution {
1969    /// Output only. A tool results execution ID.
1970    #[serde(rename = "executionId")]
1971    pub execution_id: Option<String>,
1972    /// Output only. A tool results history ID.
1973    #[serde(rename = "historyId")]
1974    pub history_id: Option<String>,
1975    /// Output only. The cloud project that owns the tool results execution.
1976    #[serde(rename = "projectId")]
1977    pub project_id: Option<String>,
1978}
1979
1980impl common::Part for ToolResultsExecution {}
1981
1982/// Represents a tool results history resource.
1983///
1984/// This type is not used in any activity, and only used as *part* of another schema.
1985///
1986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1987#[serde_with::serde_as]
1988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1989pub struct ToolResultsHistory {
1990    /// Required. A tool results history ID.
1991    #[serde(rename = "historyId")]
1992    pub history_id: Option<String>,
1993    /// Required. The cloud project that owns the tool results history.
1994    #[serde(rename = "projectId")]
1995    pub project_id: Option<String>,
1996}
1997
1998impl common::Part for ToolResultsHistory {}
1999
2000/// Represents a tool results step resource. This has the results of a TestExecution.
2001///
2002/// This type is not used in any activity, and only used as *part* of another schema.
2003///
2004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2005#[serde_with::serde_as]
2006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2007pub struct ToolResultsStep {
2008    /// Output only. A tool results execution ID.
2009    #[serde(rename = "executionId")]
2010    pub execution_id: Option<String>,
2011    /// Output only. A tool results history ID.
2012    #[serde(rename = "historyId")]
2013    pub history_id: Option<String>,
2014    /// Output only. The cloud project that owns the tool results step.
2015    #[serde(rename = "projectId")]
2016    pub project_id: Option<String>,
2017    /// Output only. A tool results step ID.
2018    #[serde(rename = "stepId")]
2019    pub step_id: Option<String>,
2020}
2021
2022impl common::Part for ToolResultsStep {}
2023
2024/// Network emulation parameters.
2025///
2026/// This type is not used in any activity, and only used as *part* of another schema.
2027///
2028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2029#[serde_with::serde_as]
2030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2031pub struct TrafficRule {
2032    /// Bandwidth in kbits/second.
2033    pub bandwidth: Option<f32>,
2034    /// Burst size in kbits.
2035    pub burst: Option<f32>,
2036    /// Packet delay, must be >= 0.
2037    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2038    pub delay: Option<chrono::Duration>,
2039    /// Packet duplication ratio (0.0 - 1.0).
2040    #[serde(rename = "packetDuplicationRatio")]
2041    pub packet_duplication_ratio: Option<f32>,
2042    /// Packet loss ratio (0.0 - 1.0).
2043    #[serde(rename = "packetLossRatio")]
2044    pub packet_loss_ratio: Option<f32>,
2045}
2046
2047impl common::Part for TrafficRule {}
2048
2049/// Uniformly shards test cases given a total number of shards. For instrumentation tests, it will be translated to "-e numShard" and "-e shardIndex" AndroidJUnitRunner arguments. With uniform sharding enabled, specifying either of these sharding arguments via `environment_variables` is invalid. Based on the sharding mechanism AndroidJUnitRunner uses, there is no guarantee that test cases will be distributed uniformly across all shards.
2050///
2051/// This type is not used in any activity, and only used as *part* of another schema.
2052///
2053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2054#[serde_with::serde_as]
2055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2056pub struct UniformSharding {
2057    /// Required. The total number of shards to create. This must always be a positive number that is no greater than the total number of test cases. When you select one or more physical devices, the number of shards must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500.
2058    #[serde(rename = "numShards")]
2059    pub num_shards: Option<i32>,
2060}
2061
2062impl common::Part for UniformSharding {}
2063
2064/// A tag within a manifest. https://developer.android.com/guide/topics/manifest/uses-feature-element.html
2065///
2066/// This type is not used in any activity, and only used as *part* of another schema.
2067///
2068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2069#[serde_with::serde_as]
2070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2071pub struct UsesFeature {
2072    /// The android:required value
2073    #[serde(rename = "isRequired")]
2074    pub is_required: Option<bool>,
2075    /// The android:name value
2076    pub name: Option<String>,
2077}
2078
2079impl common::Part for UsesFeature {}
2080
2081/// The tag within a manifest. https://developer.android.com/guide/topics/manifest/uses-permission-element.html
2082///
2083/// This type is not used in any activity, and only used as *part* of another schema.
2084///
2085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2086#[serde_with::serde_as]
2087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2088pub struct UsesPermissionTag {
2089    /// The android:name value
2090    #[serde(rename = "maxSdkVersion")]
2091    pub max_sdk_version: Option<i32>,
2092    /// The android:name value
2093    pub name: Option<String>,
2094}
2095
2096impl common::Part for UsesPermissionTag {}
2097
2098/// An Xcode version that an iOS version is compatible with.
2099///
2100/// This type is not used in any activity, and only used as *part* of another schema.
2101///
2102#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2103#[serde_with::serde_as]
2104#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2105pub struct XcodeVersion {
2106    /// Tags for this Xcode version. Example: "default".
2107    pub tags: Option<Vec<String>>,
2108    /// The id for this version. Example: "9.2".
2109    pub version: Option<String>,
2110}
2111
2112impl common::Part for XcodeVersion {}
2113
2114// ###################
2115// MethodBuilders ###
2116// #################
2117
2118/// A builder providing access to all methods supported on *applicationDetailService* resources.
2119/// It is not used directly, but through the [`Testing`] hub.
2120///
2121/// # Example
2122///
2123/// Instantiate a resource builder
2124///
2125/// ```test_harness,no_run
2126/// extern crate hyper;
2127/// extern crate hyper_rustls;
2128/// extern crate google_testing1 as testing1;
2129///
2130/// # async fn dox() {
2131/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2132///
2133/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2134/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2135///     .with_native_roots()
2136///     .unwrap()
2137///     .https_only()
2138///     .enable_http2()
2139///     .build();
2140///
2141/// let executor = hyper_util::rt::TokioExecutor::new();
2142/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2143///     secret,
2144///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2145///     yup_oauth2::client::CustomHyperClientBuilder::from(
2146///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2147///     ),
2148/// ).build().await.unwrap();
2149///
2150/// let client = hyper_util::client::legacy::Client::builder(
2151///     hyper_util::rt::TokioExecutor::new()
2152/// )
2153/// .build(
2154///     hyper_rustls::HttpsConnectorBuilder::new()
2155///         .with_native_roots()
2156///         .unwrap()
2157///         .https_or_http()
2158///         .enable_http2()
2159///         .build()
2160/// );
2161/// let mut hub = Testing::new(client, auth);
2162/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2163/// // like `get_apk_details(...)`
2164/// // to build up your call.
2165/// let rb = hub.application_detail_service();
2166/// # }
2167/// ```
2168pub struct ApplicationDetailServiceMethods<'a, C>
2169where
2170    C: 'a,
2171{
2172    hub: &'a Testing<C>,
2173}
2174
2175impl<'a, C> common::MethodsBuilder for ApplicationDetailServiceMethods<'a, C> {}
2176
2177impl<'a, C> ApplicationDetailServiceMethods<'a, C> {
2178    /// Create a builder to help you perform the following task:
2179    ///
2180    /// Gets the details of an Android application APK.
2181    ///
2182    /// # Arguments
2183    ///
2184    /// * `request` - No description provided.
2185    pub fn get_apk_details(
2186        &self,
2187        request: FileReference,
2188    ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2189        ApplicationDetailServiceGetApkDetailCall {
2190            hub: self.hub,
2191            _request: request,
2192            _bundle_location_gcs_path: Default::default(),
2193            _delegate: Default::default(),
2194            _additional_params: Default::default(),
2195            _scopes: Default::default(),
2196        }
2197    }
2198}
2199
2200/// A builder providing access to all methods supported on *project* resources.
2201/// It is not used directly, but through the [`Testing`] hub.
2202///
2203/// # Example
2204///
2205/// Instantiate a resource builder
2206///
2207/// ```test_harness,no_run
2208/// extern crate hyper;
2209/// extern crate hyper_rustls;
2210/// extern crate google_testing1 as testing1;
2211///
2212/// # async fn dox() {
2213/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2214///
2215/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2216/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2217///     .with_native_roots()
2218///     .unwrap()
2219///     .https_only()
2220///     .enable_http2()
2221///     .build();
2222///
2223/// let executor = hyper_util::rt::TokioExecutor::new();
2224/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2225///     secret,
2226///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2227///     yup_oauth2::client::CustomHyperClientBuilder::from(
2228///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2229///     ),
2230/// ).build().await.unwrap();
2231///
2232/// let client = hyper_util::client::legacy::Client::builder(
2233///     hyper_util::rt::TokioExecutor::new()
2234/// )
2235/// .build(
2236///     hyper_rustls::HttpsConnectorBuilder::new()
2237///         .with_native_roots()
2238///         .unwrap()
2239///         .https_or_http()
2240///         .enable_http2()
2241///         .build()
2242/// );
2243/// let mut hub = Testing::new(client, auth);
2244/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2245/// // like `device_sessions_cancel(...)`, `device_sessions_create(...)`, `device_sessions_get(...)`, `device_sessions_list(...)`, `device_sessions_patch(...)`, `test_matrices_cancel(...)`, `test_matrices_create(...)` and `test_matrices_get(...)`
2246/// // to build up your call.
2247/// let rb = hub.projects();
2248/// # }
2249/// ```
2250pub struct ProjectMethods<'a, C>
2251where
2252    C: 'a,
2253{
2254    hub: &'a Testing<C>,
2255}
2256
2257impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2258
2259impl<'a, C> ProjectMethods<'a, C> {
2260    /// Create a builder to help you perform the following task:
2261    ///
2262    /// POST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.
2263    ///
2264    /// # Arguments
2265    ///
2266    /// * `request` - No description provided.
2267    /// * `name` - Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2268    pub fn device_sessions_cancel(
2269        &self,
2270        request: CancelDeviceSessionRequest,
2271        name: &str,
2272    ) -> ProjectDeviceSessionCancelCall<'a, C> {
2273        ProjectDeviceSessionCancelCall {
2274            hub: self.hub,
2275            _request: request,
2276            _name: name.to_string(),
2277            _delegate: Default::default(),
2278            _additional_params: Default::default(),
2279            _scopes: Default::default(),
2280        }
2281    }
2282
2283    /// Create a builder to help you perform the following task:
2284    ///
2285    /// POST /v1/projects/{project_id}/deviceSessions
2286    ///
2287    /// # Arguments
2288    ///
2289    /// * `request` - No description provided.
2290    /// * `parent` - Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"
2291    pub fn device_sessions_create(
2292        &self,
2293        request: DeviceSession,
2294        parent: &str,
2295    ) -> ProjectDeviceSessionCreateCall<'a, C> {
2296        ProjectDeviceSessionCreateCall {
2297            hub: self.hub,
2298            _request: request,
2299            _parent: parent.to_string(),
2300            _delegate: Default::default(),
2301            _additional_params: Default::default(),
2302            _scopes: Default::default(),
2303        }
2304    }
2305
2306    /// Create a builder to help you perform the following task:
2307    ///
2308    /// GET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
2309    ///
2310    /// # Arguments
2311    ///
2312    /// * `name` - Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2313    pub fn device_sessions_get(&self, name: &str) -> ProjectDeviceSessionGetCall<'a, C> {
2314        ProjectDeviceSessionGetCall {
2315            hub: self.hub,
2316            _name: name.to_string(),
2317            _delegate: Default::default(),
2318            _additional_params: Default::default(),
2319            _scopes: Default::default(),
2320        }
2321    }
2322
2323    /// Create a builder to help you perform the following task:
2324    ///
2325    /// GET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
2326    ///
2327    /// # Arguments
2328    ///
2329    /// * `parent` - Required. The name of the parent to request, e.g. "projects/{project_id}"
2330    pub fn device_sessions_list(&self, parent: &str) -> ProjectDeviceSessionListCall<'a, C> {
2331        ProjectDeviceSessionListCall {
2332            hub: self.hub,
2333            _parent: parent.to_string(),
2334            _page_token: Default::default(),
2335            _page_size: Default::default(),
2336            _filter: Default::default(),
2337            _delegate: Default::default(),
2338            _additional_params: Default::default(),
2339            _scopes: Default::default(),
2340        }
2341    }
2342
2343    /// Create a builder to help you perform the following task:
2344    ///
2345    /// PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
2346    ///
2347    /// # Arguments
2348    ///
2349    /// * `request` - No description provided.
2350    /// * `name` - Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2351    pub fn device_sessions_patch(
2352        &self,
2353        request: DeviceSession,
2354        name: &str,
2355    ) -> ProjectDeviceSessionPatchCall<'a, C> {
2356        ProjectDeviceSessionPatchCall {
2357            hub: self.hub,
2358            _request: request,
2359            _name: name.to_string(),
2360            _update_mask: Default::default(),
2361            _delegate: Default::default(),
2362            _additional_params: Default::default(),
2363            _scopes: Default::default(),
2364        }
2365    }
2366
2367    /// Create a builder to help you perform the following task:
2368    ///
2369    /// Cancels unfinished test executions in a test matrix. This call returns immediately and cancellation proceeds asynchronously. If the matrix is already final, this operation will have no effect. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
2370    ///
2371    /// # Arguments
2372    ///
2373    /// * `projectId` - Cloud project that owns the test.
2374    /// * `testMatrixId` - Test matrix that will be canceled.
2375    pub fn test_matrices_cancel(
2376        &self,
2377        project_id: &str,
2378        test_matrix_id: &str,
2379    ) -> ProjectTestMatriceCancelCall<'a, C> {
2380        ProjectTestMatriceCancelCall {
2381            hub: self.hub,
2382            _project_id: project_id.to_string(),
2383            _test_matrix_id: test_matrix_id.to_string(),
2384            _delegate: Default::default(),
2385            _additional_params: Default::default(),
2386            _scopes: Default::default(),
2387        }
2388    }
2389
2390    /// Create a builder to help you perform the following task:
2391    ///
2392    /// Creates and runs a matrix of tests according to the given specifications. Unsupported environments will be returned in the state UNSUPPORTED. A test matrix is limited to use at most 2000 devices in parallel. The returned matrix will not yet contain the executions that will be created for this matrix. Execution creation happens later on and will require a call to GetTestMatrix. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to write to project - INVALID_ARGUMENT - if the request is malformed or if the matrix tries to use too many simultaneous devices.
2393    ///
2394    /// # Arguments
2395    ///
2396    /// * `request` - No description provided.
2397    /// * `projectId` - The GCE project under which this job will run.
2398    pub fn test_matrices_create(
2399        &self,
2400        request: TestMatrix,
2401        project_id: &str,
2402    ) -> ProjectTestMatriceCreateCall<'a, C> {
2403        ProjectTestMatriceCreateCall {
2404            hub: self.hub,
2405            _request: request,
2406            _project_id: project_id.to_string(),
2407            _request_id: Default::default(),
2408            _delegate: Default::default(),
2409            _additional_params: Default::default(),
2410            _scopes: Default::default(),
2411        }
2412    }
2413
2414    /// Create a builder to help you perform the following task:
2415    ///
2416    /// Checks the status of a test matrix and the executions once they are created. The test matrix will contain the list of test executions to run if and only if the resultStorage.toolResultsExecution fields have been populated. Note: Flaky test executions may be added to the matrix at a later stage. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
2417    ///
2418    /// # Arguments
2419    ///
2420    /// * `projectId` - Cloud project that owns the test matrix.
2421    /// * `testMatrixId` - Unique test matrix id which was assigned by the service.
2422    pub fn test_matrices_get(
2423        &self,
2424        project_id: &str,
2425        test_matrix_id: &str,
2426    ) -> ProjectTestMatriceGetCall<'a, C> {
2427        ProjectTestMatriceGetCall {
2428            hub: self.hub,
2429            _project_id: project_id.to_string(),
2430            _test_matrix_id: test_matrix_id.to_string(),
2431            _delegate: Default::default(),
2432            _additional_params: Default::default(),
2433            _scopes: Default::default(),
2434        }
2435    }
2436}
2437
2438/// A builder providing access to all methods supported on *testEnvironmentCatalog* resources.
2439/// It is not used directly, but through the [`Testing`] hub.
2440///
2441/// # Example
2442///
2443/// Instantiate a resource builder
2444///
2445/// ```test_harness,no_run
2446/// extern crate hyper;
2447/// extern crate hyper_rustls;
2448/// extern crate google_testing1 as testing1;
2449///
2450/// # async fn dox() {
2451/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2452///
2453/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2454/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2455///     .with_native_roots()
2456///     .unwrap()
2457///     .https_only()
2458///     .enable_http2()
2459///     .build();
2460///
2461/// let executor = hyper_util::rt::TokioExecutor::new();
2462/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2463///     secret,
2464///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2465///     yup_oauth2::client::CustomHyperClientBuilder::from(
2466///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2467///     ),
2468/// ).build().await.unwrap();
2469///
2470/// let client = hyper_util::client::legacy::Client::builder(
2471///     hyper_util::rt::TokioExecutor::new()
2472/// )
2473/// .build(
2474///     hyper_rustls::HttpsConnectorBuilder::new()
2475///         .with_native_roots()
2476///         .unwrap()
2477///         .https_or_http()
2478///         .enable_http2()
2479///         .build()
2480/// );
2481/// let mut hub = Testing::new(client, auth);
2482/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2483/// // like `get(...)`
2484/// // to build up your call.
2485/// let rb = hub.test_environment_catalog();
2486/// # }
2487/// ```
2488pub struct TestEnvironmentCatalogMethods<'a, C>
2489where
2490    C: 'a,
2491{
2492    hub: &'a Testing<C>,
2493}
2494
2495impl<'a, C> common::MethodsBuilder for TestEnvironmentCatalogMethods<'a, C> {}
2496
2497impl<'a, C> TestEnvironmentCatalogMethods<'a, C> {
2498    /// Create a builder to help you perform the following task:
2499    ///
2500    /// Gets the catalog of supported test environments. May return any of the following canonical error codes: - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the environment type does not exist - INTERNAL - if an internal error occurred
2501    ///
2502    /// # Arguments
2503    ///
2504    /// * `environmentType` - Required. The type of environment that should be listed.
2505    pub fn get(&self, environment_type: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
2506        TestEnvironmentCatalogGetCall {
2507            hub: self.hub,
2508            _environment_type: environment_type.to_string(),
2509            _project_id: Default::default(),
2510            _include_viewable_models: Default::default(),
2511            _delegate: Default::default(),
2512            _additional_params: Default::default(),
2513            _scopes: Default::default(),
2514        }
2515    }
2516}
2517
2518// ###################
2519// CallBuilders   ###
2520// #################
2521
2522/// Gets the details of an Android application APK.
2523///
2524/// A builder for the *getApkDetails* method supported by a *applicationDetailService* resource.
2525/// It is not used directly, but through a [`ApplicationDetailServiceMethods`] instance.
2526///
2527/// # Example
2528///
2529/// Instantiate a resource method builder
2530///
2531/// ```test_harness,no_run
2532/// # extern crate hyper;
2533/// # extern crate hyper_rustls;
2534/// # extern crate google_testing1 as testing1;
2535/// use testing1::api::FileReference;
2536/// # async fn dox() {
2537/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2538///
2539/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2540/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2541/// #     .with_native_roots()
2542/// #     .unwrap()
2543/// #     .https_only()
2544/// #     .enable_http2()
2545/// #     .build();
2546///
2547/// # let executor = hyper_util::rt::TokioExecutor::new();
2548/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2549/// #     secret,
2550/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2551/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2552/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2553/// #     ),
2554/// # ).build().await.unwrap();
2555///
2556/// # let client = hyper_util::client::legacy::Client::builder(
2557/// #     hyper_util::rt::TokioExecutor::new()
2558/// # )
2559/// # .build(
2560/// #     hyper_rustls::HttpsConnectorBuilder::new()
2561/// #         .with_native_roots()
2562/// #         .unwrap()
2563/// #         .https_or_http()
2564/// #         .enable_http2()
2565/// #         .build()
2566/// # );
2567/// # let mut hub = Testing::new(client, auth);
2568/// // As the method needs a request, you would usually fill it with the desired information
2569/// // into the respective structure. Some of the parts shown here might not be applicable !
2570/// // Values shown here are possibly random and not representative !
2571/// let mut req = FileReference::default();
2572///
2573/// // You can configure optional parameters by calling the respective setters at will, and
2574/// // execute the final call using `doit()`.
2575/// // Values shown here are possibly random and not representative !
2576/// let result = hub.application_detail_service().get_apk_details(req)
2577///              .bundle_location_gcs_path("ipsum")
2578///              .doit().await;
2579/// # }
2580/// ```
2581pub struct ApplicationDetailServiceGetApkDetailCall<'a, C>
2582where
2583    C: 'a,
2584{
2585    hub: &'a Testing<C>,
2586    _request: FileReference,
2587    _bundle_location_gcs_path: Option<String>,
2588    _delegate: Option<&'a mut dyn common::Delegate>,
2589    _additional_params: HashMap<String, String>,
2590    _scopes: BTreeSet<String>,
2591}
2592
2593impl<'a, C> common::CallBuilder for ApplicationDetailServiceGetApkDetailCall<'a, C> {}
2594
2595impl<'a, C> ApplicationDetailServiceGetApkDetailCall<'a, C>
2596where
2597    C: common::Connector,
2598{
2599    /// Perform the operation you have build so far.
2600    pub async fn doit(mut self) -> common::Result<(common::Response, GetApkDetailsResponse)> {
2601        use std::borrow::Cow;
2602        use std::io::{Read, Seek};
2603
2604        use common::{url::Params, ToParts};
2605        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2606
2607        let mut dd = common::DefaultDelegate;
2608        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2609        dlg.begin(common::MethodInfo {
2610            id: "testing.applicationDetailService.getApkDetails",
2611            http_method: hyper::Method::POST,
2612        });
2613
2614        for &field in ["alt", "bundleLocation.gcsPath"].iter() {
2615            if self._additional_params.contains_key(field) {
2616                dlg.finished(false);
2617                return Err(common::Error::FieldClash(field));
2618            }
2619        }
2620
2621        let mut params = Params::with_capacity(4 + self._additional_params.len());
2622        if let Some(value) = self._bundle_location_gcs_path.as_ref() {
2623            params.push("bundleLocation.gcsPath", value);
2624        }
2625
2626        params.extend(self._additional_params.iter());
2627
2628        params.push("alt", "json");
2629        let mut url = self.hub._base_url.clone() + "v1/applicationDetailService/getApkDetails";
2630        if self._scopes.is_empty() {
2631            self._scopes
2632                .insert(Scope::CloudPlatform.as_ref().to_string());
2633        }
2634
2635        let url = params.parse_with_url(&url);
2636
2637        let mut json_mime_type = mime::APPLICATION_JSON;
2638        let mut request_value_reader = {
2639            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2640            common::remove_json_null_values(&mut value);
2641            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2642            serde_json::to_writer(&mut dst, &value).unwrap();
2643            dst
2644        };
2645        let request_size = request_value_reader
2646            .seek(std::io::SeekFrom::End(0))
2647            .unwrap();
2648        request_value_reader
2649            .seek(std::io::SeekFrom::Start(0))
2650            .unwrap();
2651
2652        loop {
2653            let token = match self
2654                .hub
2655                .auth
2656                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2657                .await
2658            {
2659                Ok(token) => token,
2660                Err(e) => match dlg.token(e) {
2661                    Ok(token) => token,
2662                    Err(e) => {
2663                        dlg.finished(false);
2664                        return Err(common::Error::MissingToken(e));
2665                    }
2666                },
2667            };
2668            request_value_reader
2669                .seek(std::io::SeekFrom::Start(0))
2670                .unwrap();
2671            let mut req_result = {
2672                let client = &self.hub.client;
2673                dlg.pre_request();
2674                let mut req_builder = hyper::Request::builder()
2675                    .method(hyper::Method::POST)
2676                    .uri(url.as_str())
2677                    .header(USER_AGENT, self.hub._user_agent.clone());
2678
2679                if let Some(token) = token.as_ref() {
2680                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2681                }
2682
2683                let request = req_builder
2684                    .header(CONTENT_TYPE, json_mime_type.to_string())
2685                    .header(CONTENT_LENGTH, request_size as u64)
2686                    .body(common::to_body(
2687                        request_value_reader.get_ref().clone().into(),
2688                    ));
2689
2690                client.request(request.unwrap()).await
2691            };
2692
2693            match req_result {
2694                Err(err) => {
2695                    if let common::Retry::After(d) = dlg.http_error(&err) {
2696                        sleep(d).await;
2697                        continue;
2698                    }
2699                    dlg.finished(false);
2700                    return Err(common::Error::HttpError(err));
2701                }
2702                Ok(res) => {
2703                    let (mut parts, body) = res.into_parts();
2704                    let mut body = common::Body::new(body);
2705                    if !parts.status.is_success() {
2706                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2707                        let error = serde_json::from_str(&common::to_string(&bytes));
2708                        let response = common::to_response(parts, bytes.into());
2709
2710                        if let common::Retry::After(d) =
2711                            dlg.http_failure(&response, error.as_ref().ok())
2712                        {
2713                            sleep(d).await;
2714                            continue;
2715                        }
2716
2717                        dlg.finished(false);
2718
2719                        return Err(match error {
2720                            Ok(value) => common::Error::BadRequest(value),
2721                            _ => common::Error::Failure(response),
2722                        });
2723                    }
2724                    let response = {
2725                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2726                        let encoded = common::to_string(&bytes);
2727                        match serde_json::from_str(&encoded) {
2728                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2729                            Err(error) => {
2730                                dlg.response_json_decode_error(&encoded, &error);
2731                                return Err(common::Error::JsonDecodeError(
2732                                    encoded.to_string(),
2733                                    error,
2734                                ));
2735                            }
2736                        }
2737                    };
2738
2739                    dlg.finished(true);
2740                    return Ok(response);
2741                }
2742            }
2743        }
2744    }
2745
2746    ///
2747    /// Sets the *request* property to the given value.
2748    ///
2749    /// Even though the property as already been set when instantiating this call,
2750    /// we provide this method for API completeness.
2751    pub fn request(
2752        mut self,
2753        new_value: FileReference,
2754    ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2755        self._request = new_value;
2756        self
2757    }
2758    /// A path to a file in Google Cloud Storage. Example: gs://build-app-1414623860166/app%40debug-unaligned.apk These paths are expected to be url encoded (percent encoding)
2759    ///
2760    /// Sets the *bundle location.gcs path* query property to the given value.
2761    pub fn bundle_location_gcs_path(
2762        mut self,
2763        new_value: &str,
2764    ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2765        self._bundle_location_gcs_path = Some(new_value.to_string());
2766        self
2767    }
2768    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2769    /// while executing the actual API request.
2770    ///
2771    /// ````text
2772    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2773    /// ````
2774    ///
2775    /// Sets the *delegate* property to the given value.
2776    pub fn delegate(
2777        mut self,
2778        new_value: &'a mut dyn common::Delegate,
2779    ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2780        self._delegate = Some(new_value);
2781        self
2782    }
2783
2784    /// Set any additional parameter of the query string used in the request.
2785    /// It should be used to set parameters which are not yet available through their own
2786    /// setters.
2787    ///
2788    /// Please note that this method must not be used to set any of the known parameters
2789    /// which have their own setter method. If done anyway, the request will fail.
2790    ///
2791    /// # Additional Parameters
2792    ///
2793    /// * *$.xgafv* (query-string) - V1 error format.
2794    /// * *access_token* (query-string) - OAuth access token.
2795    /// * *alt* (query-string) - Data format for response.
2796    /// * *callback* (query-string) - JSONP
2797    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2798    /// * *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.
2799    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2800    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2801    /// * *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.
2802    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2803    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2804    pub fn param<T>(mut self, name: T, value: T) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2805    where
2806        T: AsRef<str>,
2807    {
2808        self._additional_params
2809            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2810        self
2811    }
2812
2813    /// Identifies the authorization scope for the method you are building.
2814    ///
2815    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2816    /// [`Scope::CloudPlatform`].
2817    ///
2818    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2819    /// tokens for more than one scope.
2820    ///
2821    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2822    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2823    /// sufficient, a read-write scope will do as well.
2824    pub fn add_scope<St>(mut self, scope: St) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2825    where
2826        St: AsRef<str>,
2827    {
2828        self._scopes.insert(String::from(scope.as_ref()));
2829        self
2830    }
2831    /// Identifies the authorization scope(s) for the method you are building.
2832    ///
2833    /// See [`Self::add_scope()`] for details.
2834    pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2835    where
2836        I: IntoIterator<Item = St>,
2837        St: AsRef<str>,
2838    {
2839        self._scopes
2840            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2841        self
2842    }
2843
2844    /// Removes all scopes, and no default scope will be used either.
2845    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2846    /// for details).
2847    pub fn clear_scopes(mut self) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2848        self._scopes.clear();
2849        self
2850    }
2851}
2852
2853/// POST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.
2854///
2855/// A builder for the *deviceSessions.cancel* method supported by a *project* resource.
2856/// It is not used directly, but through a [`ProjectMethods`] instance.
2857///
2858/// # Example
2859///
2860/// Instantiate a resource method builder
2861///
2862/// ```test_harness,no_run
2863/// # extern crate hyper;
2864/// # extern crate hyper_rustls;
2865/// # extern crate google_testing1 as testing1;
2866/// use testing1::api::CancelDeviceSessionRequest;
2867/// # async fn dox() {
2868/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2869///
2870/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2871/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2872/// #     .with_native_roots()
2873/// #     .unwrap()
2874/// #     .https_only()
2875/// #     .enable_http2()
2876/// #     .build();
2877///
2878/// # let executor = hyper_util::rt::TokioExecutor::new();
2879/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2880/// #     secret,
2881/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2882/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2883/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2884/// #     ),
2885/// # ).build().await.unwrap();
2886///
2887/// # let client = hyper_util::client::legacy::Client::builder(
2888/// #     hyper_util::rt::TokioExecutor::new()
2889/// # )
2890/// # .build(
2891/// #     hyper_rustls::HttpsConnectorBuilder::new()
2892/// #         .with_native_roots()
2893/// #         .unwrap()
2894/// #         .https_or_http()
2895/// #         .enable_http2()
2896/// #         .build()
2897/// # );
2898/// # let mut hub = Testing::new(client, auth);
2899/// // As the method needs a request, you would usually fill it with the desired information
2900/// // into the respective structure. Some of the parts shown here might not be applicable !
2901/// // Values shown here are possibly random and not representative !
2902/// let mut req = CancelDeviceSessionRequest::default();
2903///
2904/// // You can configure optional parameters by calling the respective setters at will, and
2905/// // execute the final call using `doit()`.
2906/// // Values shown here are possibly random and not representative !
2907/// let result = hub.projects().device_sessions_cancel(req, "name")
2908///              .doit().await;
2909/// # }
2910/// ```
2911pub struct ProjectDeviceSessionCancelCall<'a, C>
2912where
2913    C: 'a,
2914{
2915    hub: &'a Testing<C>,
2916    _request: CancelDeviceSessionRequest,
2917    _name: String,
2918    _delegate: Option<&'a mut dyn common::Delegate>,
2919    _additional_params: HashMap<String, String>,
2920    _scopes: BTreeSet<String>,
2921}
2922
2923impl<'a, C> common::CallBuilder for ProjectDeviceSessionCancelCall<'a, C> {}
2924
2925impl<'a, C> ProjectDeviceSessionCancelCall<'a, C>
2926where
2927    C: common::Connector,
2928{
2929    /// Perform the operation you have build so far.
2930    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2931        use std::borrow::Cow;
2932        use std::io::{Read, Seek};
2933
2934        use common::{url::Params, ToParts};
2935        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2936
2937        let mut dd = common::DefaultDelegate;
2938        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2939        dlg.begin(common::MethodInfo {
2940            id: "testing.projects.deviceSessions.cancel",
2941            http_method: hyper::Method::POST,
2942        });
2943
2944        for &field in ["alt", "name"].iter() {
2945            if self._additional_params.contains_key(field) {
2946                dlg.finished(false);
2947                return Err(common::Error::FieldClash(field));
2948            }
2949        }
2950
2951        let mut params = Params::with_capacity(4 + self._additional_params.len());
2952        params.push("name", self._name);
2953
2954        params.extend(self._additional_params.iter());
2955
2956        params.push("alt", "json");
2957        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
2958        if self._scopes.is_empty() {
2959            self._scopes
2960                .insert(Scope::CloudPlatform.as_ref().to_string());
2961        }
2962
2963        #[allow(clippy::single_element_loop)]
2964        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2965            url = params.uri_replacement(url, param_name, find_this, true);
2966        }
2967        {
2968            let to_remove = ["name"];
2969            params.remove_params(&to_remove);
2970        }
2971
2972        let url = params.parse_with_url(&url);
2973
2974        let mut json_mime_type = mime::APPLICATION_JSON;
2975        let mut request_value_reader = {
2976            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2977            common::remove_json_null_values(&mut value);
2978            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2979            serde_json::to_writer(&mut dst, &value).unwrap();
2980            dst
2981        };
2982        let request_size = request_value_reader
2983            .seek(std::io::SeekFrom::End(0))
2984            .unwrap();
2985        request_value_reader
2986            .seek(std::io::SeekFrom::Start(0))
2987            .unwrap();
2988
2989        loop {
2990            let token = match self
2991                .hub
2992                .auth
2993                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2994                .await
2995            {
2996                Ok(token) => token,
2997                Err(e) => match dlg.token(e) {
2998                    Ok(token) => token,
2999                    Err(e) => {
3000                        dlg.finished(false);
3001                        return Err(common::Error::MissingToken(e));
3002                    }
3003                },
3004            };
3005            request_value_reader
3006                .seek(std::io::SeekFrom::Start(0))
3007                .unwrap();
3008            let mut req_result = {
3009                let client = &self.hub.client;
3010                dlg.pre_request();
3011                let mut req_builder = hyper::Request::builder()
3012                    .method(hyper::Method::POST)
3013                    .uri(url.as_str())
3014                    .header(USER_AGENT, self.hub._user_agent.clone());
3015
3016                if let Some(token) = token.as_ref() {
3017                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3018                }
3019
3020                let request = req_builder
3021                    .header(CONTENT_TYPE, json_mime_type.to_string())
3022                    .header(CONTENT_LENGTH, request_size as u64)
3023                    .body(common::to_body(
3024                        request_value_reader.get_ref().clone().into(),
3025                    ));
3026
3027                client.request(request.unwrap()).await
3028            };
3029
3030            match req_result {
3031                Err(err) => {
3032                    if let common::Retry::After(d) = dlg.http_error(&err) {
3033                        sleep(d).await;
3034                        continue;
3035                    }
3036                    dlg.finished(false);
3037                    return Err(common::Error::HttpError(err));
3038                }
3039                Ok(res) => {
3040                    let (mut parts, body) = res.into_parts();
3041                    let mut body = common::Body::new(body);
3042                    if !parts.status.is_success() {
3043                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3044                        let error = serde_json::from_str(&common::to_string(&bytes));
3045                        let response = common::to_response(parts, bytes.into());
3046
3047                        if let common::Retry::After(d) =
3048                            dlg.http_failure(&response, error.as_ref().ok())
3049                        {
3050                            sleep(d).await;
3051                            continue;
3052                        }
3053
3054                        dlg.finished(false);
3055
3056                        return Err(match error {
3057                            Ok(value) => common::Error::BadRequest(value),
3058                            _ => common::Error::Failure(response),
3059                        });
3060                    }
3061                    let response = {
3062                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3063                        let encoded = common::to_string(&bytes);
3064                        match serde_json::from_str(&encoded) {
3065                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3066                            Err(error) => {
3067                                dlg.response_json_decode_error(&encoded, &error);
3068                                return Err(common::Error::JsonDecodeError(
3069                                    encoded.to_string(),
3070                                    error,
3071                                ));
3072                            }
3073                        }
3074                    };
3075
3076                    dlg.finished(true);
3077                    return Ok(response);
3078                }
3079            }
3080        }
3081    }
3082
3083    ///
3084    /// Sets the *request* property to the given value.
3085    ///
3086    /// Even though the property as already been set when instantiating this call,
3087    /// we provide this method for API completeness.
3088    pub fn request(
3089        mut self,
3090        new_value: CancelDeviceSessionRequest,
3091    ) -> ProjectDeviceSessionCancelCall<'a, C> {
3092        self._request = new_value;
3093        self
3094    }
3095    /// Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
3096    ///
3097    /// Sets the *name* path property to the given value.
3098    ///
3099    /// Even though the property as already been set when instantiating this call,
3100    /// we provide this method for API completeness.
3101    pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionCancelCall<'a, C> {
3102        self._name = new_value.to_string();
3103        self
3104    }
3105    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3106    /// while executing the actual API request.
3107    ///
3108    /// ````text
3109    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3110    /// ````
3111    ///
3112    /// Sets the *delegate* property to the given value.
3113    pub fn delegate(
3114        mut self,
3115        new_value: &'a mut dyn common::Delegate,
3116    ) -> ProjectDeviceSessionCancelCall<'a, C> {
3117        self._delegate = Some(new_value);
3118        self
3119    }
3120
3121    /// Set any additional parameter of the query string used in the request.
3122    /// It should be used to set parameters which are not yet available through their own
3123    /// setters.
3124    ///
3125    /// Please note that this method must not be used to set any of the known parameters
3126    /// which have their own setter method. If done anyway, the request will fail.
3127    ///
3128    /// # Additional Parameters
3129    ///
3130    /// * *$.xgafv* (query-string) - V1 error format.
3131    /// * *access_token* (query-string) - OAuth access token.
3132    /// * *alt* (query-string) - Data format for response.
3133    /// * *callback* (query-string) - JSONP
3134    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3135    /// * *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.
3136    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3137    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3138    /// * *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.
3139    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3140    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3141    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionCancelCall<'a, C>
3142    where
3143        T: AsRef<str>,
3144    {
3145        self._additional_params
3146            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3147        self
3148    }
3149
3150    /// Identifies the authorization scope for the method you are building.
3151    ///
3152    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3153    /// [`Scope::CloudPlatform`].
3154    ///
3155    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3156    /// tokens for more than one scope.
3157    ///
3158    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3159    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3160    /// sufficient, a read-write scope will do as well.
3161    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionCancelCall<'a, C>
3162    where
3163        St: AsRef<str>,
3164    {
3165        self._scopes.insert(String::from(scope.as_ref()));
3166        self
3167    }
3168    /// Identifies the authorization scope(s) for the method you are building.
3169    ///
3170    /// See [`Self::add_scope()`] for details.
3171    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionCancelCall<'a, C>
3172    where
3173        I: IntoIterator<Item = St>,
3174        St: AsRef<str>,
3175    {
3176        self._scopes
3177            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3178        self
3179    }
3180
3181    /// Removes all scopes, and no default scope will be used either.
3182    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3183    /// for details).
3184    pub fn clear_scopes(mut self) -> ProjectDeviceSessionCancelCall<'a, C> {
3185        self._scopes.clear();
3186        self
3187    }
3188}
3189
3190/// POST /v1/projects/{project_id}/deviceSessions
3191///
3192/// A builder for the *deviceSessions.create* method supported by a *project* resource.
3193/// It is not used directly, but through a [`ProjectMethods`] instance.
3194///
3195/// # Example
3196///
3197/// Instantiate a resource method builder
3198///
3199/// ```test_harness,no_run
3200/// # extern crate hyper;
3201/// # extern crate hyper_rustls;
3202/// # extern crate google_testing1 as testing1;
3203/// use testing1::api::DeviceSession;
3204/// # async fn dox() {
3205/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3206///
3207/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3208/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3209/// #     .with_native_roots()
3210/// #     .unwrap()
3211/// #     .https_only()
3212/// #     .enable_http2()
3213/// #     .build();
3214///
3215/// # let executor = hyper_util::rt::TokioExecutor::new();
3216/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3217/// #     secret,
3218/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3219/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3220/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3221/// #     ),
3222/// # ).build().await.unwrap();
3223///
3224/// # let client = hyper_util::client::legacy::Client::builder(
3225/// #     hyper_util::rt::TokioExecutor::new()
3226/// # )
3227/// # .build(
3228/// #     hyper_rustls::HttpsConnectorBuilder::new()
3229/// #         .with_native_roots()
3230/// #         .unwrap()
3231/// #         .https_or_http()
3232/// #         .enable_http2()
3233/// #         .build()
3234/// # );
3235/// # let mut hub = Testing::new(client, auth);
3236/// // As the method needs a request, you would usually fill it with the desired information
3237/// // into the respective structure. Some of the parts shown here might not be applicable !
3238/// // Values shown here are possibly random and not representative !
3239/// let mut req = DeviceSession::default();
3240///
3241/// // You can configure optional parameters by calling the respective setters at will, and
3242/// // execute the final call using `doit()`.
3243/// // Values shown here are possibly random and not representative !
3244/// let result = hub.projects().device_sessions_create(req, "parent")
3245///              .doit().await;
3246/// # }
3247/// ```
3248pub struct ProjectDeviceSessionCreateCall<'a, C>
3249where
3250    C: 'a,
3251{
3252    hub: &'a Testing<C>,
3253    _request: DeviceSession,
3254    _parent: String,
3255    _delegate: Option<&'a mut dyn common::Delegate>,
3256    _additional_params: HashMap<String, String>,
3257    _scopes: BTreeSet<String>,
3258}
3259
3260impl<'a, C> common::CallBuilder for ProjectDeviceSessionCreateCall<'a, C> {}
3261
3262impl<'a, C> ProjectDeviceSessionCreateCall<'a, C>
3263where
3264    C: common::Connector,
3265{
3266    /// Perform the operation you have build so far.
3267    pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
3268        use std::borrow::Cow;
3269        use std::io::{Read, Seek};
3270
3271        use common::{url::Params, ToParts};
3272        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3273
3274        let mut dd = common::DefaultDelegate;
3275        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3276        dlg.begin(common::MethodInfo {
3277            id: "testing.projects.deviceSessions.create",
3278            http_method: hyper::Method::POST,
3279        });
3280
3281        for &field in ["alt", "parent"].iter() {
3282            if self._additional_params.contains_key(field) {
3283                dlg.finished(false);
3284                return Err(common::Error::FieldClash(field));
3285            }
3286        }
3287
3288        let mut params = Params::with_capacity(4 + self._additional_params.len());
3289        params.push("parent", self._parent);
3290
3291        params.extend(self._additional_params.iter());
3292
3293        params.push("alt", "json");
3294        let mut url = self.hub._base_url.clone() + "v1/{+parent}/deviceSessions";
3295        if self._scopes.is_empty() {
3296            self._scopes
3297                .insert(Scope::CloudPlatform.as_ref().to_string());
3298        }
3299
3300        #[allow(clippy::single_element_loop)]
3301        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3302            url = params.uri_replacement(url, param_name, find_this, true);
3303        }
3304        {
3305            let to_remove = ["parent"];
3306            params.remove_params(&to_remove);
3307        }
3308
3309        let url = params.parse_with_url(&url);
3310
3311        let mut json_mime_type = mime::APPLICATION_JSON;
3312        let mut request_value_reader = {
3313            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3314            common::remove_json_null_values(&mut value);
3315            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3316            serde_json::to_writer(&mut dst, &value).unwrap();
3317            dst
3318        };
3319        let request_size = request_value_reader
3320            .seek(std::io::SeekFrom::End(0))
3321            .unwrap();
3322        request_value_reader
3323            .seek(std::io::SeekFrom::Start(0))
3324            .unwrap();
3325
3326        loop {
3327            let token = match self
3328                .hub
3329                .auth
3330                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3331                .await
3332            {
3333                Ok(token) => token,
3334                Err(e) => match dlg.token(e) {
3335                    Ok(token) => token,
3336                    Err(e) => {
3337                        dlg.finished(false);
3338                        return Err(common::Error::MissingToken(e));
3339                    }
3340                },
3341            };
3342            request_value_reader
3343                .seek(std::io::SeekFrom::Start(0))
3344                .unwrap();
3345            let mut req_result = {
3346                let client = &self.hub.client;
3347                dlg.pre_request();
3348                let mut req_builder = hyper::Request::builder()
3349                    .method(hyper::Method::POST)
3350                    .uri(url.as_str())
3351                    .header(USER_AGENT, self.hub._user_agent.clone());
3352
3353                if let Some(token) = token.as_ref() {
3354                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3355                }
3356
3357                let request = req_builder
3358                    .header(CONTENT_TYPE, json_mime_type.to_string())
3359                    .header(CONTENT_LENGTH, request_size as u64)
3360                    .body(common::to_body(
3361                        request_value_reader.get_ref().clone().into(),
3362                    ));
3363
3364                client.request(request.unwrap()).await
3365            };
3366
3367            match req_result {
3368                Err(err) => {
3369                    if let common::Retry::After(d) = dlg.http_error(&err) {
3370                        sleep(d).await;
3371                        continue;
3372                    }
3373                    dlg.finished(false);
3374                    return Err(common::Error::HttpError(err));
3375                }
3376                Ok(res) => {
3377                    let (mut parts, body) = res.into_parts();
3378                    let mut body = common::Body::new(body);
3379                    if !parts.status.is_success() {
3380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3381                        let error = serde_json::from_str(&common::to_string(&bytes));
3382                        let response = common::to_response(parts, bytes.into());
3383
3384                        if let common::Retry::After(d) =
3385                            dlg.http_failure(&response, error.as_ref().ok())
3386                        {
3387                            sleep(d).await;
3388                            continue;
3389                        }
3390
3391                        dlg.finished(false);
3392
3393                        return Err(match error {
3394                            Ok(value) => common::Error::BadRequest(value),
3395                            _ => common::Error::Failure(response),
3396                        });
3397                    }
3398                    let response = {
3399                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3400                        let encoded = common::to_string(&bytes);
3401                        match serde_json::from_str(&encoded) {
3402                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3403                            Err(error) => {
3404                                dlg.response_json_decode_error(&encoded, &error);
3405                                return Err(common::Error::JsonDecodeError(
3406                                    encoded.to_string(),
3407                                    error,
3408                                ));
3409                            }
3410                        }
3411                    };
3412
3413                    dlg.finished(true);
3414                    return Ok(response);
3415                }
3416            }
3417        }
3418    }
3419
3420    ///
3421    /// Sets the *request* property to the given value.
3422    ///
3423    /// Even though the property as already been set when instantiating this call,
3424    /// we provide this method for API completeness.
3425    pub fn request(mut self, new_value: DeviceSession) -> ProjectDeviceSessionCreateCall<'a, C> {
3426        self._request = new_value;
3427        self
3428    }
3429    /// Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"
3430    ///
3431    /// Sets the *parent* path property to the given value.
3432    ///
3433    /// Even though the property as already been set when instantiating this call,
3434    /// we provide this method for API completeness.
3435    pub fn parent(mut self, new_value: &str) -> ProjectDeviceSessionCreateCall<'a, C> {
3436        self._parent = new_value.to_string();
3437        self
3438    }
3439    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3440    /// while executing the actual API request.
3441    ///
3442    /// ````text
3443    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3444    /// ````
3445    ///
3446    /// Sets the *delegate* property to the given value.
3447    pub fn delegate(
3448        mut self,
3449        new_value: &'a mut dyn common::Delegate,
3450    ) -> ProjectDeviceSessionCreateCall<'a, C> {
3451        self._delegate = Some(new_value);
3452        self
3453    }
3454
3455    /// Set any additional parameter of the query string used in the request.
3456    /// It should be used to set parameters which are not yet available through their own
3457    /// setters.
3458    ///
3459    /// Please note that this method must not be used to set any of the known parameters
3460    /// which have their own setter method. If done anyway, the request will fail.
3461    ///
3462    /// # Additional Parameters
3463    ///
3464    /// * *$.xgafv* (query-string) - V1 error format.
3465    /// * *access_token* (query-string) - OAuth access token.
3466    /// * *alt* (query-string) - Data format for response.
3467    /// * *callback* (query-string) - JSONP
3468    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3469    /// * *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.
3470    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3471    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3472    /// * *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.
3473    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3474    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3475    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionCreateCall<'a, C>
3476    where
3477        T: AsRef<str>,
3478    {
3479        self._additional_params
3480            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3481        self
3482    }
3483
3484    /// Identifies the authorization scope for the method you are building.
3485    ///
3486    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3487    /// [`Scope::CloudPlatform`].
3488    ///
3489    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3490    /// tokens for more than one scope.
3491    ///
3492    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3493    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3494    /// sufficient, a read-write scope will do as well.
3495    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionCreateCall<'a, C>
3496    where
3497        St: AsRef<str>,
3498    {
3499        self._scopes.insert(String::from(scope.as_ref()));
3500        self
3501    }
3502    /// Identifies the authorization scope(s) for the method you are building.
3503    ///
3504    /// See [`Self::add_scope()`] for details.
3505    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionCreateCall<'a, C>
3506    where
3507        I: IntoIterator<Item = St>,
3508        St: AsRef<str>,
3509    {
3510        self._scopes
3511            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3512        self
3513    }
3514
3515    /// Removes all scopes, and no default scope will be used either.
3516    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3517    /// for details).
3518    pub fn clear_scopes(mut self) -> ProjectDeviceSessionCreateCall<'a, C> {
3519        self._scopes.clear();
3520        self
3521    }
3522}
3523
3524/// GET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
3525///
3526/// A builder for the *deviceSessions.get* method supported by a *project* resource.
3527/// It is not used directly, but through a [`ProjectMethods`] instance.
3528///
3529/// # Example
3530///
3531/// Instantiate a resource method builder
3532///
3533/// ```test_harness,no_run
3534/// # extern crate hyper;
3535/// # extern crate hyper_rustls;
3536/// # extern crate google_testing1 as testing1;
3537/// # async fn dox() {
3538/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3539///
3540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3541/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3542/// #     .with_native_roots()
3543/// #     .unwrap()
3544/// #     .https_only()
3545/// #     .enable_http2()
3546/// #     .build();
3547///
3548/// # let executor = hyper_util::rt::TokioExecutor::new();
3549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3550/// #     secret,
3551/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3552/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3553/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3554/// #     ),
3555/// # ).build().await.unwrap();
3556///
3557/// # let client = hyper_util::client::legacy::Client::builder(
3558/// #     hyper_util::rt::TokioExecutor::new()
3559/// # )
3560/// # .build(
3561/// #     hyper_rustls::HttpsConnectorBuilder::new()
3562/// #         .with_native_roots()
3563/// #         .unwrap()
3564/// #         .https_or_http()
3565/// #         .enable_http2()
3566/// #         .build()
3567/// # );
3568/// # let mut hub = Testing::new(client, auth);
3569/// // You can configure optional parameters by calling the respective setters at will, and
3570/// // execute the final call using `doit()`.
3571/// // Values shown here are possibly random and not representative !
3572/// let result = hub.projects().device_sessions_get("name")
3573///              .doit().await;
3574/// # }
3575/// ```
3576pub struct ProjectDeviceSessionGetCall<'a, C>
3577where
3578    C: 'a,
3579{
3580    hub: &'a Testing<C>,
3581    _name: String,
3582    _delegate: Option<&'a mut dyn common::Delegate>,
3583    _additional_params: HashMap<String, String>,
3584    _scopes: BTreeSet<String>,
3585}
3586
3587impl<'a, C> common::CallBuilder for ProjectDeviceSessionGetCall<'a, C> {}
3588
3589impl<'a, C> ProjectDeviceSessionGetCall<'a, C>
3590where
3591    C: common::Connector,
3592{
3593    /// Perform the operation you have build so far.
3594    pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
3595        use std::borrow::Cow;
3596        use std::io::{Read, Seek};
3597
3598        use common::{url::Params, ToParts};
3599        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3600
3601        let mut dd = common::DefaultDelegate;
3602        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3603        dlg.begin(common::MethodInfo {
3604            id: "testing.projects.deviceSessions.get",
3605            http_method: hyper::Method::GET,
3606        });
3607
3608        for &field in ["alt", "name"].iter() {
3609            if self._additional_params.contains_key(field) {
3610                dlg.finished(false);
3611                return Err(common::Error::FieldClash(field));
3612            }
3613        }
3614
3615        let mut params = Params::with_capacity(3 + self._additional_params.len());
3616        params.push("name", self._name);
3617
3618        params.extend(self._additional_params.iter());
3619
3620        params.push("alt", "json");
3621        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3622        if self._scopes.is_empty() {
3623            self._scopes
3624                .insert(Scope::CloudPlatform.as_ref().to_string());
3625        }
3626
3627        #[allow(clippy::single_element_loop)]
3628        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3629            url = params.uri_replacement(url, param_name, find_this, true);
3630        }
3631        {
3632            let to_remove = ["name"];
3633            params.remove_params(&to_remove);
3634        }
3635
3636        let url = params.parse_with_url(&url);
3637
3638        loop {
3639            let token = match self
3640                .hub
3641                .auth
3642                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3643                .await
3644            {
3645                Ok(token) => token,
3646                Err(e) => match dlg.token(e) {
3647                    Ok(token) => token,
3648                    Err(e) => {
3649                        dlg.finished(false);
3650                        return Err(common::Error::MissingToken(e));
3651                    }
3652                },
3653            };
3654            let mut req_result = {
3655                let client = &self.hub.client;
3656                dlg.pre_request();
3657                let mut req_builder = hyper::Request::builder()
3658                    .method(hyper::Method::GET)
3659                    .uri(url.as_str())
3660                    .header(USER_AGENT, self.hub._user_agent.clone());
3661
3662                if let Some(token) = token.as_ref() {
3663                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3664                }
3665
3666                let request = req_builder
3667                    .header(CONTENT_LENGTH, 0_u64)
3668                    .body(common::to_body::<String>(None));
3669
3670                client.request(request.unwrap()).await
3671            };
3672
3673            match req_result {
3674                Err(err) => {
3675                    if let common::Retry::After(d) = dlg.http_error(&err) {
3676                        sleep(d).await;
3677                        continue;
3678                    }
3679                    dlg.finished(false);
3680                    return Err(common::Error::HttpError(err));
3681                }
3682                Ok(res) => {
3683                    let (mut parts, body) = res.into_parts();
3684                    let mut body = common::Body::new(body);
3685                    if !parts.status.is_success() {
3686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3687                        let error = serde_json::from_str(&common::to_string(&bytes));
3688                        let response = common::to_response(parts, bytes.into());
3689
3690                        if let common::Retry::After(d) =
3691                            dlg.http_failure(&response, error.as_ref().ok())
3692                        {
3693                            sleep(d).await;
3694                            continue;
3695                        }
3696
3697                        dlg.finished(false);
3698
3699                        return Err(match error {
3700                            Ok(value) => common::Error::BadRequest(value),
3701                            _ => common::Error::Failure(response),
3702                        });
3703                    }
3704                    let response = {
3705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3706                        let encoded = common::to_string(&bytes);
3707                        match serde_json::from_str(&encoded) {
3708                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3709                            Err(error) => {
3710                                dlg.response_json_decode_error(&encoded, &error);
3711                                return Err(common::Error::JsonDecodeError(
3712                                    encoded.to_string(),
3713                                    error,
3714                                ));
3715                            }
3716                        }
3717                    };
3718
3719                    dlg.finished(true);
3720                    return Ok(response);
3721                }
3722            }
3723        }
3724    }
3725
3726    /// Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
3727    ///
3728    /// Sets the *name* path property to the given value.
3729    ///
3730    /// Even though the property as already been set when instantiating this call,
3731    /// we provide this method for API completeness.
3732    pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionGetCall<'a, C> {
3733        self._name = new_value.to_string();
3734        self
3735    }
3736    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3737    /// while executing the actual API request.
3738    ///
3739    /// ````text
3740    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3741    /// ````
3742    ///
3743    /// Sets the *delegate* property to the given value.
3744    pub fn delegate(
3745        mut self,
3746        new_value: &'a mut dyn common::Delegate,
3747    ) -> ProjectDeviceSessionGetCall<'a, C> {
3748        self._delegate = Some(new_value);
3749        self
3750    }
3751
3752    /// Set any additional parameter of the query string used in the request.
3753    /// It should be used to set parameters which are not yet available through their own
3754    /// setters.
3755    ///
3756    /// Please note that this method must not be used to set any of the known parameters
3757    /// which have their own setter method. If done anyway, the request will fail.
3758    ///
3759    /// # Additional Parameters
3760    ///
3761    /// * *$.xgafv* (query-string) - V1 error format.
3762    /// * *access_token* (query-string) - OAuth access token.
3763    /// * *alt* (query-string) - Data format for response.
3764    /// * *callback* (query-string) - JSONP
3765    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3766    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3767    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3768    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3769    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3770    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3771    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3772    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionGetCall<'a, C>
3773    where
3774        T: AsRef<str>,
3775    {
3776        self._additional_params
3777            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3778        self
3779    }
3780
3781    /// Identifies the authorization scope for the method you are building.
3782    ///
3783    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3784    /// [`Scope::CloudPlatform`].
3785    ///
3786    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3787    /// tokens for more than one scope.
3788    ///
3789    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3790    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3791    /// sufficient, a read-write scope will do as well.
3792    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionGetCall<'a, C>
3793    where
3794        St: AsRef<str>,
3795    {
3796        self._scopes.insert(String::from(scope.as_ref()));
3797        self
3798    }
3799    /// Identifies the authorization scope(s) for the method you are building.
3800    ///
3801    /// See [`Self::add_scope()`] for details.
3802    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionGetCall<'a, C>
3803    where
3804        I: IntoIterator<Item = St>,
3805        St: AsRef<str>,
3806    {
3807        self._scopes
3808            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3809        self
3810    }
3811
3812    /// Removes all scopes, and no default scope will be used either.
3813    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3814    /// for details).
3815    pub fn clear_scopes(mut self) -> ProjectDeviceSessionGetCall<'a, C> {
3816        self._scopes.clear();
3817        self
3818    }
3819}
3820
3821/// GET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
3822///
3823/// A builder for the *deviceSessions.list* method supported by a *project* resource.
3824/// It is not used directly, but through a [`ProjectMethods`] instance.
3825///
3826/// # Example
3827///
3828/// Instantiate a resource method builder
3829///
3830/// ```test_harness,no_run
3831/// # extern crate hyper;
3832/// # extern crate hyper_rustls;
3833/// # extern crate google_testing1 as testing1;
3834/// # async fn dox() {
3835/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3836///
3837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3838/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3839/// #     .with_native_roots()
3840/// #     .unwrap()
3841/// #     .https_only()
3842/// #     .enable_http2()
3843/// #     .build();
3844///
3845/// # let executor = hyper_util::rt::TokioExecutor::new();
3846/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3847/// #     secret,
3848/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3849/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3850/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3851/// #     ),
3852/// # ).build().await.unwrap();
3853///
3854/// # let client = hyper_util::client::legacy::Client::builder(
3855/// #     hyper_util::rt::TokioExecutor::new()
3856/// # )
3857/// # .build(
3858/// #     hyper_rustls::HttpsConnectorBuilder::new()
3859/// #         .with_native_roots()
3860/// #         .unwrap()
3861/// #         .https_or_http()
3862/// #         .enable_http2()
3863/// #         .build()
3864/// # );
3865/// # let mut hub = Testing::new(client, auth);
3866/// // You can configure optional parameters by calling the respective setters at will, and
3867/// // execute the final call using `doit()`.
3868/// // Values shown here are possibly random and not representative !
3869/// let result = hub.projects().device_sessions_list("parent")
3870///              .page_token("amet.")
3871///              .page_size(-59)
3872///              .filter("amet.")
3873///              .doit().await;
3874/// # }
3875/// ```
3876pub struct ProjectDeviceSessionListCall<'a, C>
3877where
3878    C: 'a,
3879{
3880    hub: &'a Testing<C>,
3881    _parent: String,
3882    _page_token: Option<String>,
3883    _page_size: Option<i32>,
3884    _filter: Option<String>,
3885    _delegate: Option<&'a mut dyn common::Delegate>,
3886    _additional_params: HashMap<String, String>,
3887    _scopes: BTreeSet<String>,
3888}
3889
3890impl<'a, C> common::CallBuilder for ProjectDeviceSessionListCall<'a, C> {}
3891
3892impl<'a, C> ProjectDeviceSessionListCall<'a, C>
3893where
3894    C: common::Connector,
3895{
3896    /// Perform the operation you have build so far.
3897    pub async fn doit(mut self) -> common::Result<(common::Response, ListDeviceSessionsResponse)> {
3898        use std::borrow::Cow;
3899        use std::io::{Read, Seek};
3900
3901        use common::{url::Params, ToParts};
3902        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3903
3904        let mut dd = common::DefaultDelegate;
3905        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3906        dlg.begin(common::MethodInfo {
3907            id: "testing.projects.deviceSessions.list",
3908            http_method: hyper::Method::GET,
3909        });
3910
3911        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
3912            if self._additional_params.contains_key(field) {
3913                dlg.finished(false);
3914                return Err(common::Error::FieldClash(field));
3915            }
3916        }
3917
3918        let mut params = Params::with_capacity(6 + self._additional_params.len());
3919        params.push("parent", self._parent);
3920        if let Some(value) = self._page_token.as_ref() {
3921            params.push("pageToken", value);
3922        }
3923        if let Some(value) = self._page_size.as_ref() {
3924            params.push("pageSize", value.to_string());
3925        }
3926        if let Some(value) = self._filter.as_ref() {
3927            params.push("filter", value);
3928        }
3929
3930        params.extend(self._additional_params.iter());
3931
3932        params.push("alt", "json");
3933        let mut url = self.hub._base_url.clone() + "v1/{+parent}/deviceSessions";
3934        if self._scopes.is_empty() {
3935            self._scopes
3936                .insert(Scope::CloudPlatform.as_ref().to_string());
3937        }
3938
3939        #[allow(clippy::single_element_loop)]
3940        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3941            url = params.uri_replacement(url, param_name, find_this, true);
3942        }
3943        {
3944            let to_remove = ["parent"];
3945            params.remove_params(&to_remove);
3946        }
3947
3948        let url = params.parse_with_url(&url);
3949
3950        loop {
3951            let token = match self
3952                .hub
3953                .auth
3954                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3955                .await
3956            {
3957                Ok(token) => token,
3958                Err(e) => match dlg.token(e) {
3959                    Ok(token) => token,
3960                    Err(e) => {
3961                        dlg.finished(false);
3962                        return Err(common::Error::MissingToken(e));
3963                    }
3964                },
3965            };
3966            let mut req_result = {
3967                let client = &self.hub.client;
3968                dlg.pre_request();
3969                let mut req_builder = hyper::Request::builder()
3970                    .method(hyper::Method::GET)
3971                    .uri(url.as_str())
3972                    .header(USER_AGENT, self.hub._user_agent.clone());
3973
3974                if let Some(token) = token.as_ref() {
3975                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3976                }
3977
3978                let request = req_builder
3979                    .header(CONTENT_LENGTH, 0_u64)
3980                    .body(common::to_body::<String>(None));
3981
3982                client.request(request.unwrap()).await
3983            };
3984
3985            match req_result {
3986                Err(err) => {
3987                    if let common::Retry::After(d) = dlg.http_error(&err) {
3988                        sleep(d).await;
3989                        continue;
3990                    }
3991                    dlg.finished(false);
3992                    return Err(common::Error::HttpError(err));
3993                }
3994                Ok(res) => {
3995                    let (mut parts, body) = res.into_parts();
3996                    let mut body = common::Body::new(body);
3997                    if !parts.status.is_success() {
3998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3999                        let error = serde_json::from_str(&common::to_string(&bytes));
4000                        let response = common::to_response(parts, bytes.into());
4001
4002                        if let common::Retry::After(d) =
4003                            dlg.http_failure(&response, error.as_ref().ok())
4004                        {
4005                            sleep(d).await;
4006                            continue;
4007                        }
4008
4009                        dlg.finished(false);
4010
4011                        return Err(match error {
4012                            Ok(value) => common::Error::BadRequest(value),
4013                            _ => common::Error::Failure(response),
4014                        });
4015                    }
4016                    let response = {
4017                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4018                        let encoded = common::to_string(&bytes);
4019                        match serde_json::from_str(&encoded) {
4020                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4021                            Err(error) => {
4022                                dlg.response_json_decode_error(&encoded, &error);
4023                                return Err(common::Error::JsonDecodeError(
4024                                    encoded.to_string(),
4025                                    error,
4026                                ));
4027                            }
4028                        }
4029                    };
4030
4031                    dlg.finished(true);
4032                    return Ok(response);
4033                }
4034            }
4035        }
4036    }
4037
4038    /// Required. The name of the parent to request, e.g. "projects/{project_id}"
4039    ///
4040    /// Sets the *parent* path property to the given value.
4041    ///
4042    /// Even though the property as already been set when instantiating this call,
4043    /// we provide this method for API completeness.
4044    pub fn parent(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
4045        self._parent = new_value.to_string();
4046        self
4047    }
4048    /// Optional. A continuation token for paging.
4049    ///
4050    /// Sets the *page token* query property to the given value.
4051    pub fn page_token(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
4052        self._page_token = Some(new_value.to_string());
4053        self
4054    }
4055    /// Optional. The maximum number of DeviceSessions to return.
4056    ///
4057    /// Sets the *page size* query property to the given value.
4058    pub fn page_size(mut self, new_value: i32) -> ProjectDeviceSessionListCall<'a, C> {
4059        self._page_size = Some(new_value);
4060        self
4061    }
4062    /// Optional. If specified, responses will be filtered by the given filter. Allowed fields are: session_state.
4063    ///
4064    /// Sets the *filter* query property to the given value.
4065    pub fn filter(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
4066        self._filter = Some(new_value.to_string());
4067        self
4068    }
4069    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4070    /// while executing the actual API request.
4071    ///
4072    /// ````text
4073    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4074    /// ````
4075    ///
4076    /// Sets the *delegate* property to the given value.
4077    pub fn delegate(
4078        mut self,
4079        new_value: &'a mut dyn common::Delegate,
4080    ) -> ProjectDeviceSessionListCall<'a, C> {
4081        self._delegate = Some(new_value);
4082        self
4083    }
4084
4085    /// Set any additional parameter of the query string used in the request.
4086    /// It should be used to set parameters which are not yet available through their own
4087    /// setters.
4088    ///
4089    /// Please note that this method must not be used to set any of the known parameters
4090    /// which have their own setter method. If done anyway, the request will fail.
4091    ///
4092    /// # Additional Parameters
4093    ///
4094    /// * *$.xgafv* (query-string) - V1 error format.
4095    /// * *access_token* (query-string) - OAuth access token.
4096    /// * *alt* (query-string) - Data format for response.
4097    /// * *callback* (query-string) - JSONP
4098    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4099    /// * *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.
4100    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4101    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4102    /// * *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.
4103    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4104    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4105    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionListCall<'a, C>
4106    where
4107        T: AsRef<str>,
4108    {
4109        self._additional_params
4110            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4111        self
4112    }
4113
4114    /// Identifies the authorization scope for the method you are building.
4115    ///
4116    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4117    /// [`Scope::CloudPlatform`].
4118    ///
4119    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4120    /// tokens for more than one scope.
4121    ///
4122    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4123    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4124    /// sufficient, a read-write scope will do as well.
4125    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionListCall<'a, C>
4126    where
4127        St: AsRef<str>,
4128    {
4129        self._scopes.insert(String::from(scope.as_ref()));
4130        self
4131    }
4132    /// Identifies the authorization scope(s) for the method you are building.
4133    ///
4134    /// See [`Self::add_scope()`] for details.
4135    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionListCall<'a, C>
4136    where
4137        I: IntoIterator<Item = St>,
4138        St: AsRef<str>,
4139    {
4140        self._scopes
4141            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4142        self
4143    }
4144
4145    /// Removes all scopes, and no default scope will be used either.
4146    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4147    /// for details).
4148    pub fn clear_scopes(mut self) -> ProjectDeviceSessionListCall<'a, C> {
4149        self._scopes.clear();
4150        self
4151    }
4152}
4153
4154/// PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
4155///
4156/// A builder for the *deviceSessions.patch* method supported by a *project* resource.
4157/// It is not used directly, but through a [`ProjectMethods`] instance.
4158///
4159/// # Example
4160///
4161/// Instantiate a resource method builder
4162///
4163/// ```test_harness,no_run
4164/// # extern crate hyper;
4165/// # extern crate hyper_rustls;
4166/// # extern crate google_testing1 as testing1;
4167/// use testing1::api::DeviceSession;
4168/// # async fn dox() {
4169/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4170///
4171/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4172/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4173/// #     .with_native_roots()
4174/// #     .unwrap()
4175/// #     .https_only()
4176/// #     .enable_http2()
4177/// #     .build();
4178///
4179/// # let executor = hyper_util::rt::TokioExecutor::new();
4180/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4181/// #     secret,
4182/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4183/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4184/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4185/// #     ),
4186/// # ).build().await.unwrap();
4187///
4188/// # let client = hyper_util::client::legacy::Client::builder(
4189/// #     hyper_util::rt::TokioExecutor::new()
4190/// # )
4191/// # .build(
4192/// #     hyper_rustls::HttpsConnectorBuilder::new()
4193/// #         .with_native_roots()
4194/// #         .unwrap()
4195/// #         .https_or_http()
4196/// #         .enable_http2()
4197/// #         .build()
4198/// # );
4199/// # let mut hub = Testing::new(client, auth);
4200/// // As the method needs a request, you would usually fill it with the desired information
4201/// // into the respective structure. Some of the parts shown here might not be applicable !
4202/// // Values shown here are possibly random and not representative !
4203/// let mut req = DeviceSession::default();
4204///
4205/// // You can configure optional parameters by calling the respective setters at will, and
4206/// // execute the final call using `doit()`.
4207/// // Values shown here are possibly random and not representative !
4208/// let result = hub.projects().device_sessions_patch(req, "name")
4209///              .update_mask(FieldMask::new::<&str>(&[]))
4210///              .doit().await;
4211/// # }
4212/// ```
4213pub struct ProjectDeviceSessionPatchCall<'a, C>
4214where
4215    C: 'a,
4216{
4217    hub: &'a Testing<C>,
4218    _request: DeviceSession,
4219    _name: String,
4220    _update_mask: Option<common::FieldMask>,
4221    _delegate: Option<&'a mut dyn common::Delegate>,
4222    _additional_params: HashMap<String, String>,
4223    _scopes: BTreeSet<String>,
4224}
4225
4226impl<'a, C> common::CallBuilder for ProjectDeviceSessionPatchCall<'a, C> {}
4227
4228impl<'a, C> ProjectDeviceSessionPatchCall<'a, C>
4229where
4230    C: common::Connector,
4231{
4232    /// Perform the operation you have build so far.
4233    pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
4234        use std::borrow::Cow;
4235        use std::io::{Read, Seek};
4236
4237        use common::{url::Params, ToParts};
4238        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4239
4240        let mut dd = common::DefaultDelegate;
4241        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4242        dlg.begin(common::MethodInfo {
4243            id: "testing.projects.deviceSessions.patch",
4244            http_method: hyper::Method::PATCH,
4245        });
4246
4247        for &field in ["alt", "name", "updateMask"].iter() {
4248            if self._additional_params.contains_key(field) {
4249                dlg.finished(false);
4250                return Err(common::Error::FieldClash(field));
4251            }
4252        }
4253
4254        let mut params = Params::with_capacity(5 + self._additional_params.len());
4255        params.push("name", self._name);
4256        if let Some(value) = self._update_mask.as_ref() {
4257            params.push("updateMask", value.to_string());
4258        }
4259
4260        params.extend(self._additional_params.iter());
4261
4262        params.push("alt", "json");
4263        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4264        if self._scopes.is_empty() {
4265            self._scopes
4266                .insert(Scope::CloudPlatform.as_ref().to_string());
4267        }
4268
4269        #[allow(clippy::single_element_loop)]
4270        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4271            url = params.uri_replacement(url, param_name, find_this, true);
4272        }
4273        {
4274            let to_remove = ["name"];
4275            params.remove_params(&to_remove);
4276        }
4277
4278        let url = params.parse_with_url(&url);
4279
4280        let mut json_mime_type = mime::APPLICATION_JSON;
4281        let mut request_value_reader = {
4282            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4283            common::remove_json_null_values(&mut value);
4284            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4285            serde_json::to_writer(&mut dst, &value).unwrap();
4286            dst
4287        };
4288        let request_size = request_value_reader
4289            .seek(std::io::SeekFrom::End(0))
4290            .unwrap();
4291        request_value_reader
4292            .seek(std::io::SeekFrom::Start(0))
4293            .unwrap();
4294
4295        loop {
4296            let token = match self
4297                .hub
4298                .auth
4299                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4300                .await
4301            {
4302                Ok(token) => token,
4303                Err(e) => match dlg.token(e) {
4304                    Ok(token) => token,
4305                    Err(e) => {
4306                        dlg.finished(false);
4307                        return Err(common::Error::MissingToken(e));
4308                    }
4309                },
4310            };
4311            request_value_reader
4312                .seek(std::io::SeekFrom::Start(0))
4313                .unwrap();
4314            let mut req_result = {
4315                let client = &self.hub.client;
4316                dlg.pre_request();
4317                let mut req_builder = hyper::Request::builder()
4318                    .method(hyper::Method::PATCH)
4319                    .uri(url.as_str())
4320                    .header(USER_AGENT, self.hub._user_agent.clone());
4321
4322                if let Some(token) = token.as_ref() {
4323                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4324                }
4325
4326                let request = req_builder
4327                    .header(CONTENT_TYPE, json_mime_type.to_string())
4328                    .header(CONTENT_LENGTH, request_size as u64)
4329                    .body(common::to_body(
4330                        request_value_reader.get_ref().clone().into(),
4331                    ));
4332
4333                client.request(request.unwrap()).await
4334            };
4335
4336            match req_result {
4337                Err(err) => {
4338                    if let common::Retry::After(d) = dlg.http_error(&err) {
4339                        sleep(d).await;
4340                        continue;
4341                    }
4342                    dlg.finished(false);
4343                    return Err(common::Error::HttpError(err));
4344                }
4345                Ok(res) => {
4346                    let (mut parts, body) = res.into_parts();
4347                    let mut body = common::Body::new(body);
4348                    if !parts.status.is_success() {
4349                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4350                        let error = serde_json::from_str(&common::to_string(&bytes));
4351                        let response = common::to_response(parts, bytes.into());
4352
4353                        if let common::Retry::After(d) =
4354                            dlg.http_failure(&response, error.as_ref().ok())
4355                        {
4356                            sleep(d).await;
4357                            continue;
4358                        }
4359
4360                        dlg.finished(false);
4361
4362                        return Err(match error {
4363                            Ok(value) => common::Error::BadRequest(value),
4364                            _ => common::Error::Failure(response),
4365                        });
4366                    }
4367                    let response = {
4368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4369                        let encoded = common::to_string(&bytes);
4370                        match serde_json::from_str(&encoded) {
4371                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4372                            Err(error) => {
4373                                dlg.response_json_decode_error(&encoded, &error);
4374                                return Err(common::Error::JsonDecodeError(
4375                                    encoded.to_string(),
4376                                    error,
4377                                ));
4378                            }
4379                        }
4380                    };
4381
4382                    dlg.finished(true);
4383                    return Ok(response);
4384                }
4385            }
4386        }
4387    }
4388
4389    ///
4390    /// Sets the *request* property to the given value.
4391    ///
4392    /// Even though the property as already been set when instantiating this call,
4393    /// we provide this method for API completeness.
4394    pub fn request(mut self, new_value: DeviceSession) -> ProjectDeviceSessionPatchCall<'a, C> {
4395        self._request = new_value;
4396        self
4397    }
4398    /// Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
4399    ///
4400    /// Sets the *name* path property to the given value.
4401    ///
4402    /// Even though the property as already been set when instantiating this call,
4403    /// we provide this method for API completeness.
4404    pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionPatchCall<'a, C> {
4405        self._name = new_value.to_string();
4406        self
4407    }
4408    /// Required. The list of fields to update.
4409    ///
4410    /// Sets the *update mask* query property to the given value.
4411    pub fn update_mask(
4412        mut self,
4413        new_value: common::FieldMask,
4414    ) -> ProjectDeviceSessionPatchCall<'a, C> {
4415        self._update_mask = Some(new_value);
4416        self
4417    }
4418    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4419    /// while executing the actual API request.
4420    ///
4421    /// ````text
4422    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4423    /// ````
4424    ///
4425    /// Sets the *delegate* property to the given value.
4426    pub fn delegate(
4427        mut self,
4428        new_value: &'a mut dyn common::Delegate,
4429    ) -> ProjectDeviceSessionPatchCall<'a, C> {
4430        self._delegate = Some(new_value);
4431        self
4432    }
4433
4434    /// Set any additional parameter of the query string used in the request.
4435    /// It should be used to set parameters which are not yet available through their own
4436    /// setters.
4437    ///
4438    /// Please note that this method must not be used to set any of the known parameters
4439    /// which have their own setter method. If done anyway, the request will fail.
4440    ///
4441    /// # Additional Parameters
4442    ///
4443    /// * *$.xgafv* (query-string) - V1 error format.
4444    /// * *access_token* (query-string) - OAuth access token.
4445    /// * *alt* (query-string) - Data format for response.
4446    /// * *callback* (query-string) - JSONP
4447    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4448    /// * *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.
4449    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4450    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4451    /// * *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.
4452    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4453    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4454    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionPatchCall<'a, C>
4455    where
4456        T: AsRef<str>,
4457    {
4458        self._additional_params
4459            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4460        self
4461    }
4462
4463    /// Identifies the authorization scope for the method you are building.
4464    ///
4465    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4466    /// [`Scope::CloudPlatform`].
4467    ///
4468    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4469    /// tokens for more than one scope.
4470    ///
4471    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4472    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4473    /// sufficient, a read-write scope will do as well.
4474    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionPatchCall<'a, C>
4475    where
4476        St: AsRef<str>,
4477    {
4478        self._scopes.insert(String::from(scope.as_ref()));
4479        self
4480    }
4481    /// Identifies the authorization scope(s) for the method you are building.
4482    ///
4483    /// See [`Self::add_scope()`] for details.
4484    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionPatchCall<'a, C>
4485    where
4486        I: IntoIterator<Item = St>,
4487        St: AsRef<str>,
4488    {
4489        self._scopes
4490            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4491        self
4492    }
4493
4494    /// Removes all scopes, and no default scope will be used either.
4495    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4496    /// for details).
4497    pub fn clear_scopes(mut self) -> ProjectDeviceSessionPatchCall<'a, C> {
4498        self._scopes.clear();
4499        self
4500    }
4501}
4502
4503/// Cancels unfinished test executions in a test matrix. This call returns immediately and cancellation proceeds asynchronously. If the matrix is already final, this operation will have no effect. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
4504///
4505/// A builder for the *testMatrices.cancel* method supported by a *project* resource.
4506/// It is not used directly, but through a [`ProjectMethods`] instance.
4507///
4508/// # Example
4509///
4510/// Instantiate a resource method builder
4511///
4512/// ```test_harness,no_run
4513/// # extern crate hyper;
4514/// # extern crate hyper_rustls;
4515/// # extern crate google_testing1 as testing1;
4516/// # async fn dox() {
4517/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4518///
4519/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4520/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4521/// #     .with_native_roots()
4522/// #     .unwrap()
4523/// #     .https_only()
4524/// #     .enable_http2()
4525/// #     .build();
4526///
4527/// # let executor = hyper_util::rt::TokioExecutor::new();
4528/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4529/// #     secret,
4530/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4531/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4532/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4533/// #     ),
4534/// # ).build().await.unwrap();
4535///
4536/// # let client = hyper_util::client::legacy::Client::builder(
4537/// #     hyper_util::rt::TokioExecutor::new()
4538/// # )
4539/// # .build(
4540/// #     hyper_rustls::HttpsConnectorBuilder::new()
4541/// #         .with_native_roots()
4542/// #         .unwrap()
4543/// #         .https_or_http()
4544/// #         .enable_http2()
4545/// #         .build()
4546/// # );
4547/// # let mut hub = Testing::new(client, auth);
4548/// // You can configure optional parameters by calling the respective setters at will, and
4549/// // execute the final call using `doit()`.
4550/// // Values shown here are possibly random and not representative !
4551/// let result = hub.projects().test_matrices_cancel("projectId", "testMatrixId")
4552///              .doit().await;
4553/// # }
4554/// ```
4555pub struct ProjectTestMatriceCancelCall<'a, C>
4556where
4557    C: 'a,
4558{
4559    hub: &'a Testing<C>,
4560    _project_id: String,
4561    _test_matrix_id: String,
4562    _delegate: Option<&'a mut dyn common::Delegate>,
4563    _additional_params: HashMap<String, String>,
4564    _scopes: BTreeSet<String>,
4565}
4566
4567impl<'a, C> common::CallBuilder for ProjectTestMatriceCancelCall<'a, C> {}
4568
4569impl<'a, C> ProjectTestMatriceCancelCall<'a, C>
4570where
4571    C: common::Connector,
4572{
4573    /// Perform the operation you have build so far.
4574    pub async fn doit(mut self) -> common::Result<(common::Response, CancelTestMatrixResponse)> {
4575        use std::borrow::Cow;
4576        use std::io::{Read, Seek};
4577
4578        use common::{url::Params, ToParts};
4579        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4580
4581        let mut dd = common::DefaultDelegate;
4582        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4583        dlg.begin(common::MethodInfo {
4584            id: "testing.projects.testMatrices.cancel",
4585            http_method: hyper::Method::POST,
4586        });
4587
4588        for &field in ["alt", "projectId", "testMatrixId"].iter() {
4589            if self._additional_params.contains_key(field) {
4590                dlg.finished(false);
4591                return Err(common::Error::FieldClash(field));
4592            }
4593        }
4594
4595        let mut params = Params::with_capacity(4 + self._additional_params.len());
4596        params.push("projectId", self._project_id);
4597        params.push("testMatrixId", self._test_matrix_id);
4598
4599        params.extend(self._additional_params.iter());
4600
4601        params.push("alt", "json");
4602        let mut url = self.hub._base_url.clone()
4603            + "v1/projects/{projectId}/testMatrices/{testMatrixId}:cancel";
4604        if self._scopes.is_empty() {
4605            self._scopes
4606                .insert(Scope::CloudPlatform.as_ref().to_string());
4607        }
4608
4609        #[allow(clippy::single_element_loop)]
4610        for &(find_this, param_name) in [
4611            ("{projectId}", "projectId"),
4612            ("{testMatrixId}", "testMatrixId"),
4613        ]
4614        .iter()
4615        {
4616            url = params.uri_replacement(url, param_name, find_this, false);
4617        }
4618        {
4619            let to_remove = ["testMatrixId", "projectId"];
4620            params.remove_params(&to_remove);
4621        }
4622
4623        let url = params.parse_with_url(&url);
4624
4625        loop {
4626            let token = match self
4627                .hub
4628                .auth
4629                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4630                .await
4631            {
4632                Ok(token) => token,
4633                Err(e) => match dlg.token(e) {
4634                    Ok(token) => token,
4635                    Err(e) => {
4636                        dlg.finished(false);
4637                        return Err(common::Error::MissingToken(e));
4638                    }
4639                },
4640            };
4641            let mut req_result = {
4642                let client = &self.hub.client;
4643                dlg.pre_request();
4644                let mut req_builder = hyper::Request::builder()
4645                    .method(hyper::Method::POST)
4646                    .uri(url.as_str())
4647                    .header(USER_AGENT, self.hub._user_agent.clone());
4648
4649                if let Some(token) = token.as_ref() {
4650                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4651                }
4652
4653                let request = req_builder
4654                    .header(CONTENT_LENGTH, 0_u64)
4655                    .body(common::to_body::<String>(None));
4656
4657                client.request(request.unwrap()).await
4658            };
4659
4660            match req_result {
4661                Err(err) => {
4662                    if let common::Retry::After(d) = dlg.http_error(&err) {
4663                        sleep(d).await;
4664                        continue;
4665                    }
4666                    dlg.finished(false);
4667                    return Err(common::Error::HttpError(err));
4668                }
4669                Ok(res) => {
4670                    let (mut parts, body) = res.into_parts();
4671                    let mut body = common::Body::new(body);
4672                    if !parts.status.is_success() {
4673                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4674                        let error = serde_json::from_str(&common::to_string(&bytes));
4675                        let response = common::to_response(parts, bytes.into());
4676
4677                        if let common::Retry::After(d) =
4678                            dlg.http_failure(&response, error.as_ref().ok())
4679                        {
4680                            sleep(d).await;
4681                            continue;
4682                        }
4683
4684                        dlg.finished(false);
4685
4686                        return Err(match error {
4687                            Ok(value) => common::Error::BadRequest(value),
4688                            _ => common::Error::Failure(response),
4689                        });
4690                    }
4691                    let response = {
4692                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4693                        let encoded = common::to_string(&bytes);
4694                        match serde_json::from_str(&encoded) {
4695                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4696                            Err(error) => {
4697                                dlg.response_json_decode_error(&encoded, &error);
4698                                return Err(common::Error::JsonDecodeError(
4699                                    encoded.to_string(),
4700                                    error,
4701                                ));
4702                            }
4703                        }
4704                    };
4705
4706                    dlg.finished(true);
4707                    return Ok(response);
4708                }
4709            }
4710        }
4711    }
4712
4713    /// Cloud project that owns the test.
4714    ///
4715    /// Sets the *project id* path property to the given value.
4716    ///
4717    /// Even though the property as already been set when instantiating this call,
4718    /// we provide this method for API completeness.
4719    pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C> {
4720        self._project_id = new_value.to_string();
4721        self
4722    }
4723    /// Test matrix that will be canceled.
4724    ///
4725    /// Sets the *test matrix id* path property to the given value.
4726    ///
4727    /// Even though the property as already been set when instantiating this call,
4728    /// we provide this method for API completeness.
4729    pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C> {
4730        self._test_matrix_id = new_value.to_string();
4731        self
4732    }
4733    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4734    /// while executing the actual API request.
4735    ///
4736    /// ````text
4737    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4738    /// ````
4739    ///
4740    /// Sets the *delegate* property to the given value.
4741    pub fn delegate(
4742        mut self,
4743        new_value: &'a mut dyn common::Delegate,
4744    ) -> ProjectTestMatriceCancelCall<'a, C> {
4745        self._delegate = Some(new_value);
4746        self
4747    }
4748
4749    /// Set any additional parameter of the query string used in the request.
4750    /// It should be used to set parameters which are not yet available through their own
4751    /// setters.
4752    ///
4753    /// Please note that this method must not be used to set any of the known parameters
4754    /// which have their own setter method. If done anyway, the request will fail.
4755    ///
4756    /// # Additional Parameters
4757    ///
4758    /// * *$.xgafv* (query-string) - V1 error format.
4759    /// * *access_token* (query-string) - OAuth access token.
4760    /// * *alt* (query-string) - Data format for response.
4761    /// * *callback* (query-string) - JSONP
4762    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4763    /// * *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.
4764    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4765    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4766    /// * *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.
4767    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4768    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4769    pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCancelCall<'a, C>
4770    where
4771        T: AsRef<str>,
4772    {
4773        self._additional_params
4774            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4775        self
4776    }
4777
4778    /// Identifies the authorization scope for the method you are building.
4779    ///
4780    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4781    /// [`Scope::CloudPlatform`].
4782    ///
4783    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4784    /// tokens for more than one scope.
4785    ///
4786    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4787    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4788    /// sufficient, a read-write scope will do as well.
4789    pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceCancelCall<'a, C>
4790    where
4791        St: AsRef<str>,
4792    {
4793        self._scopes.insert(String::from(scope.as_ref()));
4794        self
4795    }
4796    /// Identifies the authorization scope(s) for the method you are building.
4797    ///
4798    /// See [`Self::add_scope()`] for details.
4799    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceCancelCall<'a, C>
4800    where
4801        I: IntoIterator<Item = St>,
4802        St: AsRef<str>,
4803    {
4804        self._scopes
4805            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4806        self
4807    }
4808
4809    /// Removes all scopes, and no default scope will be used either.
4810    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4811    /// for details).
4812    pub fn clear_scopes(mut self) -> ProjectTestMatriceCancelCall<'a, C> {
4813        self._scopes.clear();
4814        self
4815    }
4816}
4817
4818/// Creates and runs a matrix of tests according to the given specifications. Unsupported environments will be returned in the state UNSUPPORTED. A test matrix is limited to use at most 2000 devices in parallel. The returned matrix will not yet contain the executions that will be created for this matrix. Execution creation happens later on and will require a call to GetTestMatrix. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to write to project - INVALID_ARGUMENT - if the request is malformed or if the matrix tries to use too many simultaneous devices.
4819///
4820/// A builder for the *testMatrices.create* method supported by a *project* resource.
4821/// It is not used directly, but through a [`ProjectMethods`] instance.
4822///
4823/// # Example
4824///
4825/// Instantiate a resource method builder
4826///
4827/// ```test_harness,no_run
4828/// # extern crate hyper;
4829/// # extern crate hyper_rustls;
4830/// # extern crate google_testing1 as testing1;
4831/// use testing1::api::TestMatrix;
4832/// # async fn dox() {
4833/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4834///
4835/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4836/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4837/// #     .with_native_roots()
4838/// #     .unwrap()
4839/// #     .https_only()
4840/// #     .enable_http2()
4841/// #     .build();
4842///
4843/// # let executor = hyper_util::rt::TokioExecutor::new();
4844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4845/// #     secret,
4846/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4847/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4848/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4849/// #     ),
4850/// # ).build().await.unwrap();
4851///
4852/// # let client = hyper_util::client::legacy::Client::builder(
4853/// #     hyper_util::rt::TokioExecutor::new()
4854/// # )
4855/// # .build(
4856/// #     hyper_rustls::HttpsConnectorBuilder::new()
4857/// #         .with_native_roots()
4858/// #         .unwrap()
4859/// #         .https_or_http()
4860/// #         .enable_http2()
4861/// #         .build()
4862/// # );
4863/// # let mut hub = Testing::new(client, auth);
4864/// // As the method needs a request, you would usually fill it with the desired information
4865/// // into the respective structure. Some of the parts shown here might not be applicable !
4866/// // Values shown here are possibly random and not representative !
4867/// let mut req = TestMatrix::default();
4868///
4869/// // You can configure optional parameters by calling the respective setters at will, and
4870/// // execute the final call using `doit()`.
4871/// // Values shown here are possibly random and not representative !
4872/// let result = hub.projects().test_matrices_create(req, "projectId")
4873///              .request_id("gubergren")
4874///              .doit().await;
4875/// # }
4876/// ```
4877pub struct ProjectTestMatriceCreateCall<'a, C>
4878where
4879    C: 'a,
4880{
4881    hub: &'a Testing<C>,
4882    _request: TestMatrix,
4883    _project_id: String,
4884    _request_id: Option<String>,
4885    _delegate: Option<&'a mut dyn common::Delegate>,
4886    _additional_params: HashMap<String, String>,
4887    _scopes: BTreeSet<String>,
4888}
4889
4890impl<'a, C> common::CallBuilder for ProjectTestMatriceCreateCall<'a, C> {}
4891
4892impl<'a, C> ProjectTestMatriceCreateCall<'a, C>
4893where
4894    C: common::Connector,
4895{
4896    /// Perform the operation you have build so far.
4897    pub async fn doit(mut self) -> common::Result<(common::Response, TestMatrix)> {
4898        use std::borrow::Cow;
4899        use std::io::{Read, Seek};
4900
4901        use common::{url::Params, ToParts};
4902        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4903
4904        let mut dd = common::DefaultDelegate;
4905        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4906        dlg.begin(common::MethodInfo {
4907            id: "testing.projects.testMatrices.create",
4908            http_method: hyper::Method::POST,
4909        });
4910
4911        for &field in ["alt", "projectId", "requestId"].iter() {
4912            if self._additional_params.contains_key(field) {
4913                dlg.finished(false);
4914                return Err(common::Error::FieldClash(field));
4915            }
4916        }
4917
4918        let mut params = Params::with_capacity(5 + self._additional_params.len());
4919        params.push("projectId", self._project_id);
4920        if let Some(value) = self._request_id.as_ref() {
4921            params.push("requestId", value);
4922        }
4923
4924        params.extend(self._additional_params.iter());
4925
4926        params.push("alt", "json");
4927        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices";
4928        if self._scopes.is_empty() {
4929            self._scopes
4930                .insert(Scope::CloudPlatform.as_ref().to_string());
4931        }
4932
4933        #[allow(clippy::single_element_loop)]
4934        for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
4935            url = params.uri_replacement(url, param_name, find_this, false);
4936        }
4937        {
4938            let to_remove = ["projectId"];
4939            params.remove_params(&to_remove);
4940        }
4941
4942        let url = params.parse_with_url(&url);
4943
4944        let mut json_mime_type = mime::APPLICATION_JSON;
4945        let mut request_value_reader = {
4946            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4947            common::remove_json_null_values(&mut value);
4948            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4949            serde_json::to_writer(&mut dst, &value).unwrap();
4950            dst
4951        };
4952        let request_size = request_value_reader
4953            .seek(std::io::SeekFrom::End(0))
4954            .unwrap();
4955        request_value_reader
4956            .seek(std::io::SeekFrom::Start(0))
4957            .unwrap();
4958
4959        loop {
4960            let token = match self
4961                .hub
4962                .auth
4963                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4964                .await
4965            {
4966                Ok(token) => token,
4967                Err(e) => match dlg.token(e) {
4968                    Ok(token) => token,
4969                    Err(e) => {
4970                        dlg.finished(false);
4971                        return Err(common::Error::MissingToken(e));
4972                    }
4973                },
4974            };
4975            request_value_reader
4976                .seek(std::io::SeekFrom::Start(0))
4977                .unwrap();
4978            let mut req_result = {
4979                let client = &self.hub.client;
4980                dlg.pre_request();
4981                let mut req_builder = hyper::Request::builder()
4982                    .method(hyper::Method::POST)
4983                    .uri(url.as_str())
4984                    .header(USER_AGENT, self.hub._user_agent.clone());
4985
4986                if let Some(token) = token.as_ref() {
4987                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4988                }
4989
4990                let request = req_builder
4991                    .header(CONTENT_TYPE, json_mime_type.to_string())
4992                    .header(CONTENT_LENGTH, request_size as u64)
4993                    .body(common::to_body(
4994                        request_value_reader.get_ref().clone().into(),
4995                    ));
4996
4997                client.request(request.unwrap()).await
4998            };
4999
5000            match req_result {
5001                Err(err) => {
5002                    if let common::Retry::After(d) = dlg.http_error(&err) {
5003                        sleep(d).await;
5004                        continue;
5005                    }
5006                    dlg.finished(false);
5007                    return Err(common::Error::HttpError(err));
5008                }
5009                Ok(res) => {
5010                    let (mut parts, body) = res.into_parts();
5011                    let mut body = common::Body::new(body);
5012                    if !parts.status.is_success() {
5013                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5014                        let error = serde_json::from_str(&common::to_string(&bytes));
5015                        let response = common::to_response(parts, bytes.into());
5016
5017                        if let common::Retry::After(d) =
5018                            dlg.http_failure(&response, error.as_ref().ok())
5019                        {
5020                            sleep(d).await;
5021                            continue;
5022                        }
5023
5024                        dlg.finished(false);
5025
5026                        return Err(match error {
5027                            Ok(value) => common::Error::BadRequest(value),
5028                            _ => common::Error::Failure(response),
5029                        });
5030                    }
5031                    let response = {
5032                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5033                        let encoded = common::to_string(&bytes);
5034                        match serde_json::from_str(&encoded) {
5035                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5036                            Err(error) => {
5037                                dlg.response_json_decode_error(&encoded, &error);
5038                                return Err(common::Error::JsonDecodeError(
5039                                    encoded.to_string(),
5040                                    error,
5041                                ));
5042                            }
5043                        }
5044                    };
5045
5046                    dlg.finished(true);
5047                    return Ok(response);
5048                }
5049            }
5050        }
5051    }
5052
5053    ///
5054    /// Sets the *request* property to the given value.
5055    ///
5056    /// Even though the property as already been set when instantiating this call,
5057    /// we provide this method for API completeness.
5058    pub fn request(mut self, new_value: TestMatrix) -> ProjectTestMatriceCreateCall<'a, C> {
5059        self._request = new_value;
5060        self
5061    }
5062    /// The GCE project under which this job will run.
5063    ///
5064    /// Sets the *project id* path property to the given value.
5065    ///
5066    /// Even though the property as already been set when instantiating this call,
5067    /// we provide this method for API completeness.
5068    pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C> {
5069        self._project_id = new_value.to_string();
5070        self
5071    }
5072    /// A string id used to detect duplicated requests. Ids are automatically scoped to a project, so users should ensure the ID is unique per-project. A UUID is recommended. Optional, but strongly recommended.
5073    ///
5074    /// Sets the *request id* query property to the given value.
5075    pub fn request_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C> {
5076        self._request_id = Some(new_value.to_string());
5077        self
5078    }
5079    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5080    /// while executing the actual API request.
5081    ///
5082    /// ````text
5083    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5084    /// ````
5085    ///
5086    /// Sets the *delegate* property to the given value.
5087    pub fn delegate(
5088        mut self,
5089        new_value: &'a mut dyn common::Delegate,
5090    ) -> ProjectTestMatriceCreateCall<'a, C> {
5091        self._delegate = Some(new_value);
5092        self
5093    }
5094
5095    /// Set any additional parameter of the query string used in the request.
5096    /// It should be used to set parameters which are not yet available through their own
5097    /// setters.
5098    ///
5099    /// Please note that this method must not be used to set any of the known parameters
5100    /// which have their own setter method. If done anyway, the request will fail.
5101    ///
5102    /// # Additional Parameters
5103    ///
5104    /// * *$.xgafv* (query-string) - V1 error format.
5105    /// * *access_token* (query-string) - OAuth access token.
5106    /// * *alt* (query-string) - Data format for response.
5107    /// * *callback* (query-string) - JSONP
5108    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5109    /// * *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.
5110    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5111    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5112    /// * *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.
5113    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5114    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5115    pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCreateCall<'a, C>
5116    where
5117        T: AsRef<str>,
5118    {
5119        self._additional_params
5120            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5121        self
5122    }
5123
5124    /// Identifies the authorization scope for the method you are building.
5125    ///
5126    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5127    /// [`Scope::CloudPlatform`].
5128    ///
5129    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5130    /// tokens for more than one scope.
5131    ///
5132    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5133    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5134    /// sufficient, a read-write scope will do as well.
5135    pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceCreateCall<'a, C>
5136    where
5137        St: AsRef<str>,
5138    {
5139        self._scopes.insert(String::from(scope.as_ref()));
5140        self
5141    }
5142    /// Identifies the authorization scope(s) for the method you are building.
5143    ///
5144    /// See [`Self::add_scope()`] for details.
5145    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceCreateCall<'a, C>
5146    where
5147        I: IntoIterator<Item = St>,
5148        St: AsRef<str>,
5149    {
5150        self._scopes
5151            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5152        self
5153    }
5154
5155    /// Removes all scopes, and no default scope will be used either.
5156    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5157    /// for details).
5158    pub fn clear_scopes(mut self) -> ProjectTestMatriceCreateCall<'a, C> {
5159        self._scopes.clear();
5160        self
5161    }
5162}
5163
5164/// Checks the status of a test matrix and the executions once they are created. The test matrix will contain the list of test executions to run if and only if the resultStorage.toolResultsExecution fields have been populated. Note: Flaky test executions may be added to the matrix at a later stage. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
5165///
5166/// A builder for the *testMatrices.get* method supported by a *project* resource.
5167/// It is not used directly, but through a [`ProjectMethods`] instance.
5168///
5169/// # Example
5170///
5171/// Instantiate a resource method builder
5172///
5173/// ```test_harness,no_run
5174/// # extern crate hyper;
5175/// # extern crate hyper_rustls;
5176/// # extern crate google_testing1 as testing1;
5177/// # async fn dox() {
5178/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5179///
5180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5181/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5182/// #     .with_native_roots()
5183/// #     .unwrap()
5184/// #     .https_only()
5185/// #     .enable_http2()
5186/// #     .build();
5187///
5188/// # let executor = hyper_util::rt::TokioExecutor::new();
5189/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5190/// #     secret,
5191/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5192/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5193/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5194/// #     ),
5195/// # ).build().await.unwrap();
5196///
5197/// # let client = hyper_util::client::legacy::Client::builder(
5198/// #     hyper_util::rt::TokioExecutor::new()
5199/// # )
5200/// # .build(
5201/// #     hyper_rustls::HttpsConnectorBuilder::new()
5202/// #         .with_native_roots()
5203/// #         .unwrap()
5204/// #         .https_or_http()
5205/// #         .enable_http2()
5206/// #         .build()
5207/// # );
5208/// # let mut hub = Testing::new(client, auth);
5209/// // You can configure optional parameters by calling the respective setters at will, and
5210/// // execute the final call using `doit()`.
5211/// // Values shown here are possibly random and not representative !
5212/// let result = hub.projects().test_matrices_get("projectId", "testMatrixId")
5213///              .doit().await;
5214/// # }
5215/// ```
5216pub struct ProjectTestMatriceGetCall<'a, C>
5217where
5218    C: 'a,
5219{
5220    hub: &'a Testing<C>,
5221    _project_id: String,
5222    _test_matrix_id: String,
5223    _delegate: Option<&'a mut dyn common::Delegate>,
5224    _additional_params: HashMap<String, String>,
5225    _scopes: BTreeSet<String>,
5226}
5227
5228impl<'a, C> common::CallBuilder for ProjectTestMatriceGetCall<'a, C> {}
5229
5230impl<'a, C> ProjectTestMatriceGetCall<'a, C>
5231where
5232    C: common::Connector,
5233{
5234    /// Perform the operation you have build so far.
5235    pub async fn doit(mut self) -> common::Result<(common::Response, TestMatrix)> {
5236        use std::borrow::Cow;
5237        use std::io::{Read, Seek};
5238
5239        use common::{url::Params, ToParts};
5240        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5241
5242        let mut dd = common::DefaultDelegate;
5243        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5244        dlg.begin(common::MethodInfo {
5245            id: "testing.projects.testMatrices.get",
5246            http_method: hyper::Method::GET,
5247        });
5248
5249        for &field in ["alt", "projectId", "testMatrixId"].iter() {
5250            if self._additional_params.contains_key(field) {
5251                dlg.finished(false);
5252                return Err(common::Error::FieldClash(field));
5253            }
5254        }
5255
5256        let mut params = Params::with_capacity(4 + self._additional_params.len());
5257        params.push("projectId", self._project_id);
5258        params.push("testMatrixId", self._test_matrix_id);
5259
5260        params.extend(self._additional_params.iter());
5261
5262        params.push("alt", "json");
5263        let mut url =
5264            self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices/{testMatrixId}";
5265        if self._scopes.is_empty() {
5266            self._scopes
5267                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5268        }
5269
5270        #[allow(clippy::single_element_loop)]
5271        for &(find_this, param_name) in [
5272            ("{projectId}", "projectId"),
5273            ("{testMatrixId}", "testMatrixId"),
5274        ]
5275        .iter()
5276        {
5277            url = params.uri_replacement(url, param_name, find_this, false);
5278        }
5279        {
5280            let to_remove = ["testMatrixId", "projectId"];
5281            params.remove_params(&to_remove);
5282        }
5283
5284        let url = params.parse_with_url(&url);
5285
5286        loop {
5287            let token = match self
5288                .hub
5289                .auth
5290                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5291                .await
5292            {
5293                Ok(token) => token,
5294                Err(e) => match dlg.token(e) {
5295                    Ok(token) => token,
5296                    Err(e) => {
5297                        dlg.finished(false);
5298                        return Err(common::Error::MissingToken(e));
5299                    }
5300                },
5301            };
5302            let mut req_result = {
5303                let client = &self.hub.client;
5304                dlg.pre_request();
5305                let mut req_builder = hyper::Request::builder()
5306                    .method(hyper::Method::GET)
5307                    .uri(url.as_str())
5308                    .header(USER_AGENT, self.hub._user_agent.clone());
5309
5310                if let Some(token) = token.as_ref() {
5311                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5312                }
5313
5314                let request = req_builder
5315                    .header(CONTENT_LENGTH, 0_u64)
5316                    .body(common::to_body::<String>(None));
5317
5318                client.request(request.unwrap()).await
5319            };
5320
5321            match req_result {
5322                Err(err) => {
5323                    if let common::Retry::After(d) = dlg.http_error(&err) {
5324                        sleep(d).await;
5325                        continue;
5326                    }
5327                    dlg.finished(false);
5328                    return Err(common::Error::HttpError(err));
5329                }
5330                Ok(res) => {
5331                    let (mut parts, body) = res.into_parts();
5332                    let mut body = common::Body::new(body);
5333                    if !parts.status.is_success() {
5334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5335                        let error = serde_json::from_str(&common::to_string(&bytes));
5336                        let response = common::to_response(parts, bytes.into());
5337
5338                        if let common::Retry::After(d) =
5339                            dlg.http_failure(&response, error.as_ref().ok())
5340                        {
5341                            sleep(d).await;
5342                            continue;
5343                        }
5344
5345                        dlg.finished(false);
5346
5347                        return Err(match error {
5348                            Ok(value) => common::Error::BadRequest(value),
5349                            _ => common::Error::Failure(response),
5350                        });
5351                    }
5352                    let response = {
5353                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5354                        let encoded = common::to_string(&bytes);
5355                        match serde_json::from_str(&encoded) {
5356                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5357                            Err(error) => {
5358                                dlg.response_json_decode_error(&encoded, &error);
5359                                return Err(common::Error::JsonDecodeError(
5360                                    encoded.to_string(),
5361                                    error,
5362                                ));
5363                            }
5364                        }
5365                    };
5366
5367                    dlg.finished(true);
5368                    return Ok(response);
5369                }
5370            }
5371        }
5372    }
5373
5374    /// Cloud project that owns the test matrix.
5375    ///
5376    /// Sets the *project id* path property to the given value.
5377    ///
5378    /// Even though the property as already been set when instantiating this call,
5379    /// we provide this method for API completeness.
5380    pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C> {
5381        self._project_id = new_value.to_string();
5382        self
5383    }
5384    /// Unique test matrix id which was assigned by the service.
5385    ///
5386    /// Sets the *test matrix id* path property to the given value.
5387    ///
5388    /// Even though the property as already been set when instantiating this call,
5389    /// we provide this method for API completeness.
5390    pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C> {
5391        self._test_matrix_id = new_value.to_string();
5392        self
5393    }
5394    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5395    /// while executing the actual API request.
5396    ///
5397    /// ````text
5398    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5399    /// ````
5400    ///
5401    /// Sets the *delegate* property to the given value.
5402    pub fn delegate(
5403        mut self,
5404        new_value: &'a mut dyn common::Delegate,
5405    ) -> ProjectTestMatriceGetCall<'a, C> {
5406        self._delegate = Some(new_value);
5407        self
5408    }
5409
5410    /// Set any additional parameter of the query string used in the request.
5411    /// It should be used to set parameters which are not yet available through their own
5412    /// setters.
5413    ///
5414    /// Please note that this method must not be used to set any of the known parameters
5415    /// which have their own setter method. If done anyway, the request will fail.
5416    ///
5417    /// # Additional Parameters
5418    ///
5419    /// * *$.xgafv* (query-string) - V1 error format.
5420    /// * *access_token* (query-string) - OAuth access token.
5421    /// * *alt* (query-string) - Data format for response.
5422    /// * *callback* (query-string) - JSONP
5423    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5424    /// * *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.
5425    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5426    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5427    /// * *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.
5428    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5429    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5430    pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceGetCall<'a, C>
5431    where
5432        T: AsRef<str>,
5433    {
5434        self._additional_params
5435            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5436        self
5437    }
5438
5439    /// Identifies the authorization scope for the method you are building.
5440    ///
5441    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5442    /// [`Scope::CloudPlatformReadOnly`].
5443    ///
5444    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5445    /// tokens for more than one scope.
5446    ///
5447    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5448    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5449    /// sufficient, a read-write scope will do as well.
5450    pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceGetCall<'a, C>
5451    where
5452        St: AsRef<str>,
5453    {
5454        self._scopes.insert(String::from(scope.as_ref()));
5455        self
5456    }
5457    /// Identifies the authorization scope(s) for the method you are building.
5458    ///
5459    /// See [`Self::add_scope()`] for details.
5460    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceGetCall<'a, C>
5461    where
5462        I: IntoIterator<Item = St>,
5463        St: AsRef<str>,
5464    {
5465        self._scopes
5466            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5467        self
5468    }
5469
5470    /// Removes all scopes, and no default scope will be used either.
5471    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5472    /// for details).
5473    pub fn clear_scopes(mut self) -> ProjectTestMatriceGetCall<'a, C> {
5474        self._scopes.clear();
5475        self
5476    }
5477}
5478
5479/// Gets the catalog of supported test environments. May return any of the following canonical error codes: - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the environment type does not exist - INTERNAL - if an internal error occurred
5480///
5481/// A builder for the *get* method supported by a *testEnvironmentCatalog* resource.
5482/// It is not used directly, but through a [`TestEnvironmentCatalogMethods`] instance.
5483///
5484/// # Example
5485///
5486/// Instantiate a resource method builder
5487///
5488/// ```test_harness,no_run
5489/// # extern crate hyper;
5490/// # extern crate hyper_rustls;
5491/// # extern crate google_testing1 as testing1;
5492/// # async fn dox() {
5493/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5494///
5495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5496/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5497/// #     .with_native_roots()
5498/// #     .unwrap()
5499/// #     .https_only()
5500/// #     .enable_http2()
5501/// #     .build();
5502///
5503/// # let executor = hyper_util::rt::TokioExecutor::new();
5504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5505/// #     secret,
5506/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5507/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5508/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5509/// #     ),
5510/// # ).build().await.unwrap();
5511///
5512/// # let client = hyper_util::client::legacy::Client::builder(
5513/// #     hyper_util::rt::TokioExecutor::new()
5514/// # )
5515/// # .build(
5516/// #     hyper_rustls::HttpsConnectorBuilder::new()
5517/// #         .with_native_roots()
5518/// #         .unwrap()
5519/// #         .https_or_http()
5520/// #         .enable_http2()
5521/// #         .build()
5522/// # );
5523/// # let mut hub = Testing::new(client, auth);
5524/// // You can configure optional parameters by calling the respective setters at will, and
5525/// // execute the final call using `doit()`.
5526/// // Values shown here are possibly random and not representative !
5527/// let result = hub.test_environment_catalog().get("environmentType")
5528///              .project_id("ipsum")
5529///              .include_viewable_models(false)
5530///              .doit().await;
5531/// # }
5532/// ```
5533pub struct TestEnvironmentCatalogGetCall<'a, C>
5534where
5535    C: 'a,
5536{
5537    hub: &'a Testing<C>,
5538    _environment_type: String,
5539    _project_id: Option<String>,
5540    _include_viewable_models: Option<bool>,
5541    _delegate: Option<&'a mut dyn common::Delegate>,
5542    _additional_params: HashMap<String, String>,
5543    _scopes: BTreeSet<String>,
5544}
5545
5546impl<'a, C> common::CallBuilder for TestEnvironmentCatalogGetCall<'a, C> {}
5547
5548impl<'a, C> TestEnvironmentCatalogGetCall<'a, C>
5549where
5550    C: common::Connector,
5551{
5552    /// Perform the operation you have build so far.
5553    pub async fn doit(mut self) -> common::Result<(common::Response, TestEnvironmentCatalog)> {
5554        use std::borrow::Cow;
5555        use std::io::{Read, Seek};
5556
5557        use common::{url::Params, ToParts};
5558        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5559
5560        let mut dd = common::DefaultDelegate;
5561        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5562        dlg.begin(common::MethodInfo {
5563            id: "testing.testEnvironmentCatalog.get",
5564            http_method: hyper::Method::GET,
5565        });
5566
5567        for &field in [
5568            "alt",
5569            "environmentType",
5570            "projectId",
5571            "includeViewableModels",
5572        ]
5573        .iter()
5574        {
5575            if self._additional_params.contains_key(field) {
5576                dlg.finished(false);
5577                return Err(common::Error::FieldClash(field));
5578            }
5579        }
5580
5581        let mut params = Params::with_capacity(5 + self._additional_params.len());
5582        params.push("environmentType", self._environment_type);
5583        if let Some(value) = self._project_id.as_ref() {
5584            params.push("projectId", value);
5585        }
5586        if let Some(value) = self._include_viewable_models.as_ref() {
5587            params.push("includeViewableModels", value.to_string());
5588        }
5589
5590        params.extend(self._additional_params.iter());
5591
5592        params.push("alt", "json");
5593        let mut url = self.hub._base_url.clone() + "v1/testEnvironmentCatalog/{environmentType}";
5594        if self._scopes.is_empty() {
5595            self._scopes
5596                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5597        }
5598
5599        #[allow(clippy::single_element_loop)]
5600        for &(find_this, param_name) in [("{environmentType}", "environmentType")].iter() {
5601            url = params.uri_replacement(url, param_name, find_this, false);
5602        }
5603        {
5604            let to_remove = ["environmentType"];
5605            params.remove_params(&to_remove);
5606        }
5607
5608        let url = params.parse_with_url(&url);
5609
5610        loop {
5611            let token = match self
5612                .hub
5613                .auth
5614                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5615                .await
5616            {
5617                Ok(token) => token,
5618                Err(e) => match dlg.token(e) {
5619                    Ok(token) => token,
5620                    Err(e) => {
5621                        dlg.finished(false);
5622                        return Err(common::Error::MissingToken(e));
5623                    }
5624                },
5625            };
5626            let mut req_result = {
5627                let client = &self.hub.client;
5628                dlg.pre_request();
5629                let mut req_builder = hyper::Request::builder()
5630                    .method(hyper::Method::GET)
5631                    .uri(url.as_str())
5632                    .header(USER_AGENT, self.hub._user_agent.clone());
5633
5634                if let Some(token) = token.as_ref() {
5635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5636                }
5637
5638                let request = req_builder
5639                    .header(CONTENT_LENGTH, 0_u64)
5640                    .body(common::to_body::<String>(None));
5641
5642                client.request(request.unwrap()).await
5643            };
5644
5645            match req_result {
5646                Err(err) => {
5647                    if let common::Retry::After(d) = dlg.http_error(&err) {
5648                        sleep(d).await;
5649                        continue;
5650                    }
5651                    dlg.finished(false);
5652                    return Err(common::Error::HttpError(err));
5653                }
5654                Ok(res) => {
5655                    let (mut parts, body) = res.into_parts();
5656                    let mut body = common::Body::new(body);
5657                    if !parts.status.is_success() {
5658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5659                        let error = serde_json::from_str(&common::to_string(&bytes));
5660                        let response = common::to_response(parts, bytes.into());
5661
5662                        if let common::Retry::After(d) =
5663                            dlg.http_failure(&response, error.as_ref().ok())
5664                        {
5665                            sleep(d).await;
5666                            continue;
5667                        }
5668
5669                        dlg.finished(false);
5670
5671                        return Err(match error {
5672                            Ok(value) => common::Error::BadRequest(value),
5673                            _ => common::Error::Failure(response),
5674                        });
5675                    }
5676                    let response = {
5677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5678                        let encoded = common::to_string(&bytes);
5679                        match serde_json::from_str(&encoded) {
5680                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5681                            Err(error) => {
5682                                dlg.response_json_decode_error(&encoded, &error);
5683                                return Err(common::Error::JsonDecodeError(
5684                                    encoded.to_string(),
5685                                    error,
5686                                ));
5687                            }
5688                        }
5689                    };
5690
5691                    dlg.finished(true);
5692                    return Ok(response);
5693                }
5694            }
5695        }
5696    }
5697
5698    /// Required. The type of environment that should be listed.
5699    ///
5700    /// Sets the *environment type* path property to the given value.
5701    ///
5702    /// Even though the property as already been set when instantiating this call,
5703    /// we provide this method for API completeness.
5704    pub fn environment_type(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
5705        self._environment_type = new_value.to_string();
5706        self
5707    }
5708    /// For authorization, the cloud project requesting the TestEnvironmentCatalog.
5709    ///
5710    /// Sets the *project id* query property to the given value.
5711    pub fn project_id(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
5712        self._project_id = Some(new_value.to_string());
5713        self
5714    }
5715    /// Optional. Whether to include viewable only models in the response. This is only applicable for Android models.
5716    ///
5717    /// Sets the *include viewable models* query property to the given value.
5718    pub fn include_viewable_models(
5719        mut self,
5720        new_value: bool,
5721    ) -> TestEnvironmentCatalogGetCall<'a, C> {
5722        self._include_viewable_models = Some(new_value);
5723        self
5724    }
5725    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5726    /// while executing the actual API request.
5727    ///
5728    /// ````text
5729    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5730    /// ````
5731    ///
5732    /// Sets the *delegate* property to the given value.
5733    pub fn delegate(
5734        mut self,
5735        new_value: &'a mut dyn common::Delegate,
5736    ) -> TestEnvironmentCatalogGetCall<'a, C> {
5737        self._delegate = Some(new_value);
5738        self
5739    }
5740
5741    /// Set any additional parameter of the query string used in the request.
5742    /// It should be used to set parameters which are not yet available through their own
5743    /// setters.
5744    ///
5745    /// Please note that this method must not be used to set any of the known parameters
5746    /// which have their own setter method. If done anyway, the request will fail.
5747    ///
5748    /// # Additional Parameters
5749    ///
5750    /// * *$.xgafv* (query-string) - V1 error format.
5751    /// * *access_token* (query-string) - OAuth access token.
5752    /// * *alt* (query-string) - Data format for response.
5753    /// * *callback* (query-string) - JSONP
5754    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5755    /// * *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.
5756    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5757    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5758    /// * *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.
5759    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5760    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5761    pub fn param<T>(mut self, name: T, value: T) -> TestEnvironmentCatalogGetCall<'a, C>
5762    where
5763        T: AsRef<str>,
5764    {
5765        self._additional_params
5766            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5767        self
5768    }
5769
5770    /// Identifies the authorization scope for the method you are building.
5771    ///
5772    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5773    /// [`Scope::CloudPlatformReadOnly`].
5774    ///
5775    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5776    /// tokens for more than one scope.
5777    ///
5778    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5779    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5780    /// sufficient, a read-write scope will do as well.
5781    pub fn add_scope<St>(mut self, scope: St) -> TestEnvironmentCatalogGetCall<'a, C>
5782    where
5783        St: AsRef<str>,
5784    {
5785        self._scopes.insert(String::from(scope.as_ref()));
5786        self
5787    }
5788    /// Identifies the authorization scope(s) for the method you are building.
5789    ///
5790    /// See [`Self::add_scope()`] for details.
5791    pub fn add_scopes<I, St>(mut self, scopes: I) -> TestEnvironmentCatalogGetCall<'a, C>
5792    where
5793        I: IntoIterator<Item = St>,
5794        St: AsRef<str>,
5795    {
5796        self._scopes
5797            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5798        self
5799    }
5800
5801    /// Removes all scopes, and no default scope will be used either.
5802    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5803    /// for details).
5804    pub fn clear_scopes(mut self) -> TestEnvironmentCatalogGetCall<'a, C> {
5805        self._scopes.clear();
5806        self
5807    }
5808}