#![allow(unused_imports, unused_mut, dead_code)]
#[macro_use]
extern crate serde_derive;
extern crate hyper;
extern crate serde;
extern crate serde_json;
extern crate yup_oauth2 as oauth2;
extern crate mime;
extern crate url;
mod cmn;
use std::collections::HashMap;
use std::cell::RefCell;
use std::borrow::BorrowMut;
use std::default::Default;
use std::collections::BTreeMap;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use std::thread::sleep;
use std::time::Duration;
pub use cmn::*;
#[derive(PartialEq, Eq, Hash)]
pub enum Scope {
CloudPlatform,
CloudPlatformReadOnly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}
pub struct Testing<C, A> {
client: RefCell<C>,
auth: RefCell<A>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, C, A> Hub for Testing<C, A> {}
impl<'a, C, A> Testing<C, A>
where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn new(client: C, authenticator: A) -> Testing<C, A> {
Testing {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/1.0.14".to_string(),
_base_url: "https://testing.googleapis.com/".to_string(),
_root_url: "https://testing.googleapis.com/".to_string(),
}
}
pub fn application_detail_service(&'a self) -> ApplicationDetailServiceMethods<'a, C, A> {
ApplicationDetailServiceMethods { hub: &self }
}
pub fn projects(&'a self) -> ProjectMethods<'a, C, A> {
ProjectMethods { hub: &self }
}
pub fn test_environment_catalog(&'a self) -> TestEnvironmentCatalogMethods<'a, C, A> {
TestEnvironmentCatalogMethods { hub: &self }
}
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestTargetsForShard {
#[serde(rename="testTargets")]
pub test_targets: Option<Vec<String>>,
}
impl Part for TestTargetsForShard {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IntentFilter {
#[serde(rename="mimeType")]
pub mime_type: Option<String>,
#[serde(rename="actionNames")]
pub action_names: Option<Vec<String>>,
#[serde(rename="categoryNames")]
pub category_names: Option<Vec<String>>,
}
impl Part for IntentFilter {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Environment {
#[serde(rename="iosDevice")]
pub ios_device: Option<IosDevice>,
#[serde(rename="androidDevice")]
pub android_device: Option<AndroidDevice>,
}
impl Part for Environment {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApkDetail {
#[serde(rename="apkManifest")]
pub apk_manifest: Option<ApkManifest>,
}
impl Part for ApkDetail {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct XcodeVersion {
pub version: Option<String>,
pub tags: Option<Vec<String>>,
}
impl Part for XcodeVersion {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TrafficRule {
pub delay: Option<String>,
#[serde(rename="packetLossRatio")]
pub packet_loss_ratio: Option<f32>,
pub bandwidth: Option<f32>,
pub burst: Option<f32>,
#[serde(rename="packetDuplicationRatio")]
pub packet_duplication_ratio: Option<f32>,
}
impl Part for TrafficRule {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidDeviceList {
#[serde(rename="androidDevices")]
pub android_devices: Option<Vec<AndroidDevice>>,
}
impl Part for AndroidDeviceList {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ToolResultsExecution {
#[serde(rename="projectId")]
pub project_id: Option<String>,
#[serde(rename="executionId")]
pub execution_id: Option<String>,
#[serde(rename="historyId")]
pub history_id: Option<String>,
}
impl Part for ToolResultsExecution {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GetApkDetailsResponse {
#[serde(rename="apkDetail")]
pub apk_detail: Option<ApkDetail>,
}
impl ResponseResult for GetApkDetailsResponse {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AppBundle {
#[serde(rename="bundleLocation")]
pub bundle_location: Option<FileReference>,
}
impl Part for AppBundle {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestExecution {
#[serde(rename="projectId")]
pub project_id: Option<String>,
#[serde(rename="matrixId")]
pub matrix_id: Option<String>,
pub shard: Option<Shard>,
pub id: Option<String>,
pub environment: Option<Environment>,
pub state: Option<String>,
#[serde(rename="testSpecification")]
pub test_specification: Option<TestSpecification>,
pub timestamp: Option<String>,
#[serde(rename="toolResultsStep")]
pub tool_results_step: Option<ToolResultsStep>,
#[serde(rename="testDetails")]
pub test_details: Option<TestDetails>,
}
impl Part for TestExecution {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApkManifest {
#[serde(rename="maxSdkVersion")]
pub max_sdk_version: Option<i32>,
#[serde(rename="minSdkVersion")]
pub min_sdk_version: Option<i32>,
#[serde(rename="packageName")]
pub package_name: Option<String>,
#[serde(rename="targetSdkVersion")]
pub target_sdk_version: Option<i32>,
#[serde(rename="applicationLabel")]
pub application_label: Option<String>,
#[serde(rename="intentFilters")]
pub intent_filters: Option<Vec<IntentFilter>>,
}
impl Part for ApkManifest {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestSetup {
pub account: Option<Account>,
pub systrace: Option<SystraceSetup>,
#[serde(rename="networkProfile")]
pub network_profile: Option<String>,
#[serde(rename="directoriesToPull")]
pub directories_to_pull: Option<Vec<String>>,
#[serde(rename="environmentVariables")]
pub environment_variables: Option<Vec<EnvironmentVariable>>,
#[serde(rename="additionalApks")]
pub additional_apks: Option<Vec<Apk>>,
#[serde(rename="dontAutograntPermissions")]
pub dont_autogrant_permissions: Option<bool>,
#[serde(rename="filesToPush")]
pub files_to_push: Option<Vec<DeviceFile>>,
}
impl Part for TestSetup {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidTestLoop {
#[serde(rename="appBundle")]
pub app_bundle: Option<AppBundle>,
#[serde(rename="appPackageId")]
pub app_package_id: Option<String>,
#[serde(rename="appApk")]
pub app_apk: Option<FileReference>,
#[serde(rename="scenarioLabels")]
pub scenario_labels: Option<Vec<String>>,
pub scenarios: Option<Vec<i32>>,
}
impl Part for AndroidTestLoop {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosRuntimeConfiguration {
pub orientations: Option<Vec<Orientation>>,
pub locales: Option<Vec<Locale>>,
}
impl Part for IosRuntimeConfiguration {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Date {
pub month: Option<i32>,
pub day: Option<i32>,
pub year: Option<i32>,
}
impl Part for Date {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidDeviceCatalog {
pub models: Option<Vec<AndroidModel>>,
#[serde(rename="runtimeConfiguration")]
pub runtime_configuration: Option<AndroidRuntimeConfiguration>,
pub versions: Option<Vec<AndroidVersion>>,
}
impl Part for AndroidDeviceCatalog {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestDetails {
#[serde(rename="progressMessages")]
pub progress_messages: Option<Vec<String>>,
#[serde(rename="errorMessage")]
pub error_message: Option<String>,
}
impl Part for TestDetails {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosModel {
#[serde(rename="formFactor")]
pub form_factor: Option<String>,
pub name: Option<String>,
pub tags: Option<Vec<String>>,
#[serde(rename="screenDensity")]
pub screen_density: Option<i32>,
#[serde(rename="supportedVersionIds")]
pub supported_version_ids: Option<Vec<String>>,
#[serde(rename="screenY")]
pub screen_y: Option<i32>,
#[serde(rename="screenX")]
pub screen_x: Option<i32>,
pub id: Option<String>,
#[serde(rename="deviceCapabilities")]
pub device_capabilities: Option<Vec<String>>,
}
impl Part for IosModel {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosDevice {
pub locale: Option<String>,
#[serde(rename="iosVersionId")]
pub ios_version_id: Option<String>,
pub orientation: Option<String>,
#[serde(rename="iosModelId")]
pub ios_model_id: Option<String>,
}
impl Part for IosDevice {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
#[serde(rename="googleAuto")]
pub google_auto: Option<GoogleAuto>,
}
impl Part for Account {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosTestLoop {
pub scenarios: Option<Vec<i32>>,
#[serde(rename="appBundleId")]
pub app_bundle_id: Option<String>,
#[serde(rename="appIpa")]
pub app_ipa: Option<FileReference>,
}
impl Part for IosTestLoop {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ProvidedSoftwareCatalog {
#[serde(rename="orchestratorVersion")]
pub orchestrator_version: Option<String>,
}
impl Part for ProvidedSoftwareCatalog {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidRoboTest {
#[serde(rename="appBundle")]
pub app_bundle: Option<AppBundle>,
#[serde(rename="roboDirectives")]
pub robo_directives: Option<Vec<RoboDirective>>,
#[serde(rename="roboScript")]
pub robo_script: Option<FileReference>,
#[serde(rename="maxSteps")]
pub max_steps: Option<i32>,
#[serde(rename="maxDepth")]
pub max_depth: Option<i32>,
#[serde(rename="startingIntents")]
pub starting_intents: Option<Vec<RoboStartingIntent>>,
#[serde(rename="appApk")]
pub app_apk: Option<FileReference>,
#[serde(rename="appPackageId")]
pub app_package_id: Option<String>,
#[serde(rename="appInitialActivity")]
pub app_initial_activity: Option<String>,
}
impl Part for AndroidRoboTest {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct FileReference {
#[serde(rename="gcsPath")]
pub gcs_path: Option<String>,
}
impl RequestValue for FileReference {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ShardingOption {
#[serde(rename="manualSharding")]
pub manual_sharding: Option<ManualSharding>,
#[serde(rename="uniformSharding")]
pub uniform_sharding: Option<UniformSharding>,
}
impl Part for ShardingOption {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct RoboDirective {
#[serde(rename="inputText")]
pub input_text: Option<String>,
#[serde(rename="resourceName")]
pub resource_name: Option<String>,
#[serde(rename="actionType")]
pub action_type: Option<String>,
}
impl Part for RoboDirective {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidInstrumentationTest {
#[serde(rename="appBundle")]
pub app_bundle: Option<AppBundle>,
#[serde(rename="testApk")]
pub test_apk: Option<FileReference>,
#[serde(rename="testRunnerClass")]
pub test_runner_class: Option<String>,
#[serde(rename="testPackageId")]
pub test_package_id: Option<String>,
#[serde(rename="appApk")]
pub app_apk: Option<FileReference>,
#[serde(rename="appPackageId")]
pub app_package_id: Option<String>,
#[serde(rename="orchestratorOption")]
pub orchestrator_option: Option<String>,
#[serde(rename="shardingOption")]
pub sharding_option: Option<ShardingOption>,
#[serde(rename="testTargets")]
pub test_targets: Option<Vec<String>>,
}
impl Part for AndroidInstrumentationTest {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct NetworkConfiguration {
pub id: Option<String>,
#[serde(rename="downRule")]
pub down_rule: Option<TrafficRule>,
#[serde(rename="upRule")]
pub up_rule: Option<TrafficRule>,
}
impl Part for NetworkConfiguration {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Orientation {
pub id: Option<String>,
pub name: Option<String>,
pub tags: Option<Vec<String>>,
}
impl Part for Orientation {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Shard {
#[serde(rename="numShards")]
pub num_shards: Option<i32>,
#[serde(rename="shardIndex")]
pub shard_index: Option<i32>,
#[serde(rename="testTargetsForShard")]
pub test_targets_for_shard: Option<TestTargetsForShard>,
}
impl Part for Shard {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct EnvironmentVariable {
pub key: Option<String>,
pub value: Option<String>,
}
impl Part for EnvironmentVariable {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleCloudStorage {
#[serde(rename="gcsPath")]
pub gcs_path: Option<String>,
}
impl Part for GoogleCloudStorage {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CancelTestMatrixResponse {
#[serde(rename="testState")]
pub test_state: Option<String>,
}
impl ResponseResult for CancelTestMatrixResponse {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct NetworkConfigurationCatalog {
pub configurations: Option<Vec<NetworkConfiguration>>,
}
impl Part for NetworkConfigurationCatalog {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidDevice {
pub locale: Option<String>,
#[serde(rename="androidVersionId")]
pub android_version_id: Option<String>,
#[serde(rename="androidModelId")]
pub android_model_id: Option<String>,
pub orientation: Option<String>,
}
impl Part for AndroidDevice {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosTestSetup {
#[serde(rename="networkProfile")]
pub network_profile: Option<String>,
}
impl Part for IosTestSetup {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SystraceSetup {
#[serde(rename="durationSeconds")]
pub duration_seconds: Option<i32>,
}
impl Part for SystraceSetup {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidMatrix {
#[serde(rename="androidVersionIds")]
pub android_version_ids: Option<Vec<String>>,
#[serde(rename="androidModelIds")]
pub android_model_ids: Option<Vec<String>>,
pub locales: Option<Vec<String>>,
pub orientations: Option<Vec<String>>,
}
impl Part for AndroidMatrix {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ManualSharding {
#[serde(rename="testTargetsForShard")]
pub test_targets_for_shard: Option<Vec<TestTargetsForShard>>,
}
impl Part for ManualSharding {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct StartActivityIntent {
pub action: Option<String>,
pub uri: Option<String>,
pub categories: Option<Vec<String>>,
}
impl Part for StartActivityIntent {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ToolResultsStep {
#[serde(rename="projectId")]
pub project_id: Option<String>,
#[serde(rename="executionId")]
pub execution_id: Option<String>,
#[serde(rename="stepId")]
pub step_id: Option<String>,
#[serde(rename="historyId")]
pub history_id: Option<String>,
}
impl Part for ToolResultsStep {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ObbFile {
#[serde(rename="obbFileName")]
pub obb_file_name: Option<String>,
pub obb: Option<FileReference>,
}
impl Part for ObbFile {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ClientInfo {
#[serde(rename="clientInfoDetails")]
pub client_info_details: Option<Vec<ClientInfoDetail>>,
pub name: Option<String>,
}
impl Part for ClientInfo {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosXcTest {
#[serde(rename="appBundleId")]
pub app_bundle_id: Option<String>,
#[serde(rename="testSpecialEntitlements")]
pub test_special_entitlements: Option<bool>,
pub xctestrun: Option<FileReference>,
#[serde(rename="testsZip")]
pub tests_zip: Option<FileReference>,
#[serde(rename="xcodeVersion")]
pub xcode_version: Option<String>,
}
impl Part for IosXcTest {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ToolResultsHistory {
#[serde(rename="projectId")]
pub project_id: Option<String>,
#[serde(rename="historyId")]
pub history_id: Option<String>,
}
impl Part for ToolResultsHistory {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ResultStorage {
#[serde(rename="toolResultsHistory")]
pub tool_results_history: Option<ToolResultsHistory>,
#[serde(rename="googleCloudStorage")]
pub google_cloud_storage: Option<GoogleCloudStorage>,
#[serde(rename="toolResultsExecution")]
pub tool_results_execution: Option<ToolResultsExecution>,
#[serde(rename="resultsUrl")]
pub results_url: Option<String>,
}
impl Part for ResultStorage {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct EnvironmentMatrix {
#[serde(rename="androidDeviceList")]
pub android_device_list: Option<AndroidDeviceList>,
#[serde(rename="androidMatrix")]
pub android_matrix: Option<AndroidMatrix>,
#[serde(rename="iosDeviceList")]
pub ios_device_list: Option<IosDeviceList>,
}
impl Part for EnvironmentMatrix {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosDeviceList {
#[serde(rename="iosDevices")]
pub ios_devices: Option<Vec<IosDevice>>,
}
impl Part for IosDeviceList {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ClientInfoDetail {
pub key: Option<String>,
pub value: Option<String>,
}
impl Part for ClientInfoDetail {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestMatrix {
#[serde(rename="clientInfo")]
pub client_info: Option<ClientInfo>,
#[serde(rename="projectId")]
pub project_id: Option<String>,
#[serde(rename="resultStorage")]
pub result_storage: Option<ResultStorage>,
#[serde(rename="flakyTestAttempts")]
pub flaky_test_attempts: Option<i32>,
pub state: Option<String>,
#[serde(rename="testExecutions")]
pub test_executions: Option<Vec<TestExecution>>,
#[serde(rename="testSpecification")]
pub test_specification: Option<TestSpecification>,
#[serde(rename="testMatrixId")]
pub test_matrix_id: Option<String>,
pub timestamp: Option<String>,
#[serde(rename="invalidMatrixDetails")]
pub invalid_matrix_details: Option<String>,
#[serde(rename="environmentMatrix")]
pub environment_matrix: Option<EnvironmentMatrix>,
#[serde(rename="outcomeSummary")]
pub outcome_summary: Option<String>,
}
impl RequestValue for TestMatrix {}
impl ResponseResult for TestMatrix {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestSpecification {
#[serde(rename="iosTestSetup")]
pub ios_test_setup: Option<IosTestSetup>,
#[serde(rename="iosXcTest")]
pub ios_xc_test: Option<IosXcTest>,
#[serde(rename="iosTestLoop")]
pub ios_test_loop: Option<IosTestLoop>,
#[serde(rename="testTimeout")]
pub test_timeout: Option<String>,
#[serde(rename="testSetup")]
pub test_setup: Option<TestSetup>,
#[serde(rename="disableVideoRecording")]
pub disable_video_recording: Option<bool>,
#[serde(rename="disablePerformanceMetrics")]
pub disable_performance_metrics: Option<bool>,
#[serde(rename="androidTestLoop")]
pub android_test_loop: Option<AndroidTestLoop>,
#[serde(rename="androidRoboTest")]
pub android_robo_test: Option<AndroidRoboTest>,
#[serde(rename="androidInstrumentationTest")]
pub android_instrumentation_test: Option<AndroidInstrumentationTest>,
}
impl Part for TestSpecification {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct RoboStartingIntent {
#[serde(rename="startActivity")]
pub start_activity: Option<StartActivityIntent>,
pub timeout: Option<String>,
#[serde(rename="launcherActivity")]
pub launcher_activity: Option<LauncherActivityIntent>,
}
impl Part for RoboStartingIntent {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Distribution {
#[serde(rename="measurementTime")]
pub measurement_time: Option<String>,
#[serde(rename="marketShare")]
pub market_share: Option<f64>,
}
impl Part for Distribution {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidVersion {
#[serde(rename="releaseDate")]
pub release_date: Option<Date>,
#[serde(rename="versionString")]
pub version_string: Option<String>,
pub tags: Option<Vec<String>>,
pub distribution: Option<Distribution>,
#[serde(rename="apiLevel")]
pub api_level: Option<i32>,
#[serde(rename="codeName")]
pub code_name: Option<String>,
pub id: Option<String>,
}
impl Part for AndroidVersion {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DeviceFile {
#[serde(rename="regularFile")]
pub regular_file: Option<RegularFile>,
#[serde(rename="obbFile")]
pub obb_file: Option<ObbFile>,
}
impl Part for DeviceFile {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosVersion {
#[serde(rename="majorVersion")]
pub major_version: Option<i32>,
pub tags: Option<Vec<String>>,
#[serde(rename="minorVersion")]
pub minor_version: Option<i32>,
pub id: Option<String>,
#[serde(rename="supportedXcodeVersionIds")]
pub supported_xcode_version_ids: Option<Vec<String>>,
}
impl Part for IosVersion {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct RegularFile {
pub content: Option<FileReference>,
#[serde(rename="devicePath")]
pub device_path: Option<String>,
}
impl Part for RegularFile {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UniformSharding {
#[serde(rename="numShards")]
pub num_shards: Option<i32>,
}
impl Part for UniformSharding {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Locale {
pub region: Option<String>,
pub id: Option<String>,
pub name: Option<String>,
pub tags: Option<Vec<String>>,
}
impl Part for Locale {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidRuntimeConfiguration {
pub orientations: Option<Vec<Orientation>>,
pub locales: Option<Vec<Locale>>,
}
impl Part for AndroidRuntimeConfiguration {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TestEnvironmentCatalog {
#[serde(rename="iosDeviceCatalog")]
pub ios_device_catalog: Option<IosDeviceCatalog>,
#[serde(rename="androidDeviceCatalog")]
pub android_device_catalog: Option<AndroidDeviceCatalog>,
#[serde(rename="networkConfigurationCatalog")]
pub network_configuration_catalog: Option<NetworkConfigurationCatalog>,
#[serde(rename="softwareCatalog")]
pub software_catalog: Option<ProvidedSoftwareCatalog>,
}
impl ResponseResult for TestEnvironmentCatalog {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AndroidModel {
#[serde(rename="formFactor")]
pub form_factor: Option<String>,
#[serde(rename="screenX")]
pub screen_x: Option<i32>,
pub name: Option<String>,
pub form: Option<String>,
pub tags: Option<Vec<String>>,
#[serde(rename="lowFpsVideoRecording")]
pub low_fps_video_recording: Option<bool>,
pub brand: Option<String>,
pub id: Option<String>,
#[serde(rename="supportedVersionIds")]
pub supported_version_ids: Option<Vec<String>>,
#[serde(rename="screenDensity")]
pub screen_density: Option<i32>,
#[serde(rename="screenY")]
pub screen_y: Option<i32>,
#[serde(rename="thumbnailUrl")]
pub thumbnail_url: Option<String>,
#[serde(rename="supportedAbis")]
pub supported_abis: Option<Vec<String>>,
pub manufacturer: Option<String>,
pub codename: Option<String>,
}
impl Part for AndroidModel {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Apk {
#[serde(rename="packageName")]
pub package_name: Option<String>,
pub location: Option<FileReference>,
}
impl Part for Apk {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct IosDeviceCatalog {
pub models: Option<Vec<IosModel>>,
#[serde(rename="xcodeVersions")]
pub xcode_versions: Option<Vec<XcodeVersion>>,
#[serde(rename="runtimeConfiguration")]
pub runtime_configuration: Option<IosRuntimeConfiguration>,
pub versions: Option<Vec<IosVersion>>,
}
impl Part for IosDeviceCatalog {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct LauncherActivityIntent { _never_set: Option<bool> }
impl Part for LauncherActivityIntent {}
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleAuto { _never_set: Option<bool> }
impl Part for GoogleAuto {}
pub struct TestEnvironmentCatalogMethods<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
}
impl<'a, C, A> MethodsBuilder for TestEnvironmentCatalogMethods<'a, C, A> {}
impl<'a, C, A> TestEnvironmentCatalogMethods<'a, C, A> {
pub fn get(&self, environment_type: &str) -> TestEnvironmentCatalogGetCall<'a, C, A> {
TestEnvironmentCatalogGetCall {
hub: self.hub,
_environment_type: environment_type.to_string(),
_project_id: Default::default(),
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
}
pub struct ApplicationDetailServiceMethods<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
}
impl<'a, C, A> MethodsBuilder for ApplicationDetailServiceMethods<'a, C, A> {}
impl<'a, C, A> ApplicationDetailServiceMethods<'a, C, A> {
pub fn get_apk_details(&self, request: FileReference) -> ApplicationDetailServiceGetApkDetailCall<'a, C, A> {
ApplicationDetailServiceGetApkDetailCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
}
pub struct ProjectMethods<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
}
impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {}
impl<'a, C, A> ProjectMethods<'a, C, A> {
pub fn test_matrices_create(&self, request: TestMatrix, project_id: &str) -> ProjectTestMatriceCreateCall<'a, C, A> {
ProjectTestMatriceCreateCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_request_id: Default::default(),
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
pub fn test_matrices_cancel(&self, project_id: &str, test_matrix_id: &str) -> ProjectTestMatriceCancelCall<'a, C, A> {
ProjectTestMatriceCancelCall {
hub: self.hub,
_project_id: project_id.to_string(),
_test_matrix_id: test_matrix_id.to_string(),
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
pub fn test_matrices_get(&self, project_id: &str, test_matrix_id: &str) -> ProjectTestMatriceGetCall<'a, C, A> {
ProjectTestMatriceGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_test_matrix_id: test_matrix_id.to_string(),
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
}
}
}
pub struct TestEnvironmentCatalogGetCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
_environment_type: String,
_project_id: Option<String>,
_delegate: Option<&'a mut dyn Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for TestEnvironmentCatalogGetCall<'a, C, A> {}
impl<'a, C, A> TestEnvironmentCatalogGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn doit(mut self) -> Result<(hyper::client::Response, TestEnvironmentCatalog)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut dyn Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "testing.testEnvironmentCatalog.get",
http_method: hyper::method::Method::Get });
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
params.push(("environmentType", self._environment_type.to_string()));
if let Some(value) = self._project_id {
params.push(("projectId", value.to_string()));
}
for &field in ["alt", "environmentType", "projectId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = self.hub._base_url.clone() + "v1/testEnvironmentCatalog/{environmentType}";
if self._scopes.len() == 0 {
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
}
for &(find_this, param_name) in [("{environmentType}", "environmentType")].iter() {
let mut replace_with: Option<&str> = None;
for &(name, ref value) in params.iter() {
if name == param_name {
replace_with = Some(value);
break;
}
}
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
}
{
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
for param_name in ["environmentType"].iter() {
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
indices_for_removal.push(index);
}
}
for &index in indices_for_removal.iter() {
params.remove(index);
}
}
let url = hyper::Url::parse_with_params(&url, params).unwrap();
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(Bearer { token: token.access_token });
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone());
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep(d);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
let server_error = json::from_str::<ServerError>(&json_err)
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
.ok();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json_server_error,
server_error) {
sleep(d);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
pub fn environment_type(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C, A> {
self._environment_type = new_value.to_string();
self
}
pub fn project_id(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C, A> {
self._project_id = Some(new_value.to_string());
self
}
pub fn delegate(mut self, new_value: &'a mut dyn Delegate) -> TestEnvironmentCatalogGetCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
pub fn param<T>(mut self, name: T, value: T) -> TestEnvironmentCatalogGetCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
pub fn add_scope<T, S>(mut self, scope: T) -> TestEnvironmentCatalogGetCall<'a, C, A>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
};
self
}
}
pub struct ApplicationDetailServiceGetApkDetailCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
_request: FileReference,
_delegate: Option<&'a mut dyn Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for ApplicationDetailServiceGetApkDetailCall<'a, C, A> {}
impl<'a, C, A> ApplicationDetailServiceGetApkDetailCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn doit(mut self) -> Result<(hyper::client::Response, GetApkDetailsResponse)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut dyn Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "testing.applicationDetailService.getApkDetails",
http_method: hyper::method::Method::Post });
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = self.hub._base_url.clone() + "v1/applicationDetailService/getApkDetails";
if self._scopes.len() == 0 {
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
}
let url = hyper::Url::parse_with_params(&url, params).unwrap();
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
let mut request_value_reader =
{
let mut value = json::value::to_value(&self._request).expect("serde to work");
remove_json_null_values(&mut value);
let mut dst = io::Cursor::new(Vec::with_capacity(128));
json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(Bearer { token: token.access_token });
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone())
.header(ContentType(json_mime_type.clone()))
.header(ContentLength(request_size as u64))
.body(&mut request_value_reader);
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep(d);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
let server_error = json::from_str::<ServerError>(&json_err)
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
.ok();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json_server_error,
server_error) {
sleep(d);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
pub fn request(mut self, new_value: FileReference) -> ApplicationDetailServiceGetApkDetailCall<'a, C, A> {
self._request = new_value;
self
}
pub fn delegate(mut self, new_value: &'a mut dyn Delegate) -> ApplicationDetailServiceGetApkDetailCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
pub fn param<T>(mut self, name: T, value: T) -> ApplicationDetailServiceGetApkDetailCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
pub fn add_scope<T, S>(mut self, scope: T) -> ApplicationDetailServiceGetApkDetailCall<'a, C, A>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
};
self
}
}
pub struct ProjectTestMatriceCreateCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
_request: TestMatrix,
_project_id: String,
_request_id: Option<String>,
_delegate: Option<&'a mut dyn Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for ProjectTestMatriceCreateCall<'a, C, A> {}
impl<'a, C, A> ProjectTestMatriceCreateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn doit(mut self) -> Result<(hyper::client::Response, TestMatrix)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut dyn Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "testing.projects.testMatrices.create",
http_method: hyper::method::Method::Post });
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
params.push(("projectId", self._project_id.to_string()));
if let Some(value) = self._request_id {
params.push(("requestId", value.to_string()));
}
for &field in ["alt", "projectId", "requestId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices";
if self._scopes.len() == 0 {
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
}
for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
let mut replace_with: Option<&str> = None;
for &(name, ref value) in params.iter() {
if name == param_name {
replace_with = Some(value);
break;
}
}
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
}
{
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
for param_name in ["projectId"].iter() {
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
indices_for_removal.push(index);
}
}
for &index in indices_for_removal.iter() {
params.remove(index);
}
}
let url = hyper::Url::parse_with_params(&url, params).unwrap();
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
let mut request_value_reader =
{
let mut value = json::value::to_value(&self._request).expect("serde to work");
remove_json_null_values(&mut value);
let mut dst = io::Cursor::new(Vec::with_capacity(128));
json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(Bearer { token: token.access_token });
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone())
.header(ContentType(json_mime_type.clone()))
.header(ContentLength(request_size as u64))
.body(&mut request_value_reader);
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep(d);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
let server_error = json::from_str::<ServerError>(&json_err)
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
.ok();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json_server_error,
server_error) {
sleep(d);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
pub fn request(mut self, new_value: TestMatrix) -> ProjectTestMatriceCreateCall<'a, C, A> {
self._request = new_value;
self
}
pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C, A> {
self._project_id = new_value.to_string();
self
}
pub fn request_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C, A> {
self._request_id = Some(new_value.to_string());
self
}
pub fn delegate(mut self, new_value: &'a mut dyn Delegate) -> ProjectTestMatriceCreateCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCreateCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectTestMatriceCreateCall<'a, C, A>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
};
self
}
}
pub struct ProjectTestMatriceCancelCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
_project_id: String,
_test_matrix_id: String,
_delegate: Option<&'a mut dyn Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for ProjectTestMatriceCancelCall<'a, C, A> {}
impl<'a, C, A> ProjectTestMatriceCancelCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn doit(mut self) -> Result<(hyper::client::Response, CancelTestMatrixResponse)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut dyn Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "testing.projects.testMatrices.cancel",
http_method: hyper::method::Method::Post });
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
params.push(("projectId", self._project_id.to_string()));
params.push(("testMatrixId", self._test_matrix_id.to_string()));
for &field in ["alt", "projectId", "testMatrixId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices/{testMatrixId}:cancel";
if self._scopes.len() == 0 {
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
}
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{testMatrixId}", "testMatrixId")].iter() {
let mut replace_with: Option<&str> = None;
for &(name, ref value) in params.iter() {
if name == param_name {
replace_with = Some(value);
break;
}
}
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
}
{
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
for param_name in ["testMatrixId", "projectId"].iter() {
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
indices_for_removal.push(index);
}
}
for &index in indices_for_removal.iter() {
params.remove(index);
}
}
let url = hyper::Url::parse_with_params(&url, params).unwrap();
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(Bearer { token: token.access_token });
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.clone())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone());
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep(d);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
let server_error = json::from_str::<ServerError>(&json_err)
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
.ok();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json_server_error,
server_error) {
sleep(d);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C, A> {
self._project_id = new_value.to_string();
self
}
pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C, A> {
self._test_matrix_id = new_value.to_string();
self
}
pub fn delegate(mut self, new_value: &'a mut dyn Delegate) -> ProjectTestMatriceCancelCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCancelCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectTestMatriceCancelCall<'a, C, A>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
};
self
}
}
pub struct ProjectTestMatriceGetCall<'a, C, A>
where C: 'a, A: 'a {
hub: &'a Testing<C, A>,
_project_id: String,
_test_matrix_id: String,
_delegate: Option<&'a mut dyn Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeMap<String, ()>
}
impl<'a, C, A> CallBuilder for ProjectTestMatriceGetCall<'a, C, A> {}
impl<'a, C, A> ProjectTestMatriceGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2::GetToken {
pub fn doit(mut self) -> Result<(hyper::client::Response, TestMatrix)> {
use std::io::{Read, Seek};
use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location};
let mut dd = DefaultDelegate;
let mut dlg: &mut dyn Delegate = match self._delegate {
Some(d) => d,
None => &mut dd
};
dlg.begin(MethodInfo { id: "testing.projects.testMatrices.get",
http_method: hyper::method::Method::Get });
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
params.push(("projectId", self._project_id.to_string()));
params.push(("testMatrixId", self._test_matrix_id.to_string()));
for &field in ["alt", "projectId", "testMatrixId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(Error::FieldClash(field));
}
}
for (name, value) in self._additional_params.iter() {
params.push((&name, value.clone()));
}
params.push(("alt", "json".to_string()));
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices/{testMatrixId}";
if self._scopes.len() == 0 {
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
}
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{testMatrixId}", "testMatrixId")].iter() {
let mut replace_with: Option<&str> = None;
for &(name, ref value) in params.iter() {
if name == param_name {
replace_with = Some(value);
break;
}
}
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
}
{
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
for param_name in ["testMatrixId", "projectId"].iter() {
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
indices_for_removal.push(index);
}
}
for &index in indices_for_removal.iter() {
params.remove(index);
}
}
let url = hyper::Url::parse_with_params(&url, params).unwrap();
loop {
let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) {
Ok(token) => token,
Err(err) => {
match dlg.token(&*err) {
Some(token) => token,
None => {
dlg.finished(false);
return Err(Error::MissingToken(err))
}
}
}
};
let auth_header = Authorization(Bearer { token: token.access_token });
let mut req_result = {
let mut client = &mut *self.hub.client.borrow_mut();
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.clone())
.header(UserAgent(self.hub._user_agent.clone()))
.header(auth_header.clone());
dlg.pre_request();
req.send()
};
match req_result {
Err(err) => {
if let oauth2::Retry::After(d) = dlg.http_error(&err) {
sleep(d);
continue;
}
dlg.finished(false);
return Err(Error::HttpError(err))
}
Ok(mut res) => {
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
let json_server_error = json::from_str::<JsonServerError>(&json_err).ok();
let server_error = json::from_str::<ServerError>(&json_err)
.or_else(|_| json::from_str::<ErrorResponse>(&json_err).map(|r| r.error))
.ok();
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json_server_error,
server_error) {
sleep(d);
continue;
}
dlg.finished(false);
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
res.read_to_string(&mut json_response).unwrap();
match json::from_str(&json_response) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C, A> {
self._project_id = new_value.to_string();
self
}
pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C, A> {
self._test_matrix_id = new_value.to_string();
self
}
pub fn delegate(mut self, new_value: &'a mut dyn Delegate) -> ProjectTestMatriceGetCall<'a, C, A> {
self._delegate = Some(new_value);
self
}
pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceGetCall<'a, C, A>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
pub fn add_scope<T, S>(mut self, scope: T) -> ProjectTestMatriceGetCall<'a, C, A>
where T: Into<Option<S>>,
S: AsRef<str> {
match scope.into() {
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
None => None,
};
self
}
}