google_transcoder1_beta1/
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 Platform data
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Transcoder related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_transcoder1_beta1 as transcoder1_beta1;
49/// use transcoder1_beta1::api::Job;
50/// use transcoder1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = Transcoder::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Job::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_jobs_create(req, "parent")
88///              .doit().await;
89///
90/// match result {
91///     Err(e) => match e {
92///         // The Error enum provides details about what exactly happened.
93///         // You can also just use its `Debug`, `Display` or `Error` traits
94///          Error::HttpError(_)
95///         |Error::Io(_)
96///         |Error::MissingAPIKey
97///         |Error::MissingToken(_)
98///         |Error::Cancelled
99///         |Error::UploadSizeLimitExceeded(_, _)
100///         |Error::Failure(_)
101///         |Error::BadRequest(_)
102///         |Error::FieldClash(_)
103///         |Error::JsonDecodeError(_, _) => println!("{}", e),
104///     },
105///     Ok(res) => println!("Success: {:?}", res),
106/// }
107/// # }
108/// ```
109#[derive(Clone)]
110pub struct Transcoder<C> {
111    pub client: common::Client<C>,
112    pub auth: Box<dyn common::GetToken>,
113    _user_agent: String,
114    _base_url: String,
115    _root_url: String,
116}
117
118impl<C> common::Hub for Transcoder<C> {}
119
120impl<'a, C> Transcoder<C> {
121    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Transcoder<C> {
122        Transcoder {
123            client,
124            auth: Box::new(auth),
125            _user_agent: "google-api-rust-client/6.0.0".to_string(),
126            _base_url: "https://transcoder.googleapis.com/".to_string(),
127            _root_url: "https://transcoder.googleapis.com/".to_string(),
128        }
129    }
130
131    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
132        ProjectMethods { hub: self }
133    }
134
135    /// Set the user-agent header field to use in all requests to the server.
136    /// It defaults to `google-api-rust-client/6.0.0`.
137    ///
138    /// Returns the previously set user-agent.
139    pub fn user_agent(&mut self, agent_name: String) -> String {
140        std::mem::replace(&mut self._user_agent, agent_name)
141    }
142
143    /// Set the base url to use in all requests to the server.
144    /// It defaults to `https://transcoder.googleapis.com/`.
145    ///
146    /// Returns the previously set base url.
147    pub fn base_url(&mut self, new_base_url: String) -> String {
148        std::mem::replace(&mut self._base_url, new_base_url)
149    }
150
151    /// Set the root url to use in all requests to the server.
152    /// It defaults to `https://transcoder.googleapis.com/`.
153    ///
154    /// Returns the previously set root url.
155    pub fn root_url(&mut self, new_root_url: String) -> String {
156        std::mem::replace(&mut self._root_url, new_root_url)
157    }
158}
159
160// ############
161// SCHEMAS ###
162// ##########
163/// Ad break.
164///
165/// This type is not used in any activity, and only used as *part* of another schema.
166///
167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
168#[serde_with::serde_as]
169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
170pub struct AdBreak {
171    /// Start time in seconds for the ad break, relative to the output file timeline. The default is `0s`.
172    #[serde(rename = "startTimeOffset")]
173    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
174    pub start_time_offset: Option<chrono::Duration>,
175}
176
177impl common::Part for AdBreak {}
178
179/// Configuration for AES-128 encryption.
180///
181/// This type is not used in any activity, and only used as *part* of another schema.
182///
183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
184#[serde_with::serde_as]
185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
186pub struct Aes128Encryption {
187    /// Required. URI of the key delivery service. This URI is inserted into the M3U8 header.
188    #[serde(rename = "keyUri")]
189    pub key_uri: Option<String>,
190}
191
192impl common::Part for Aes128Encryption {}
193
194/// Animation types.
195///
196/// This type is not used in any activity, and only used as *part* of another schema.
197///
198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
199#[serde_with::serde_as]
200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
201pub struct Animation {
202    /// End previous animation.
203    #[serde(rename = "animationEnd")]
204    pub animation_end: Option<AnimationEnd>,
205    /// Display overlay object with fade animation.
206    #[serde(rename = "animationFade")]
207    pub animation_fade: Option<AnimationFade>,
208    /// Display static overlay object.
209    #[serde(rename = "animationStatic")]
210    pub animation_static: Option<AnimationStatic>,
211}
212
213impl common::Part for Animation {}
214
215/// End previous overlay animation from the video. Without AnimationEnd, the overlay object will keep the state of previous animation until the end of the video.
216///
217/// This type is not used in any activity, and only used as *part* of another schema.
218///
219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
220#[serde_with::serde_as]
221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
222pub struct AnimationEnd {
223    /// The time to end overlay object, in seconds. Default: 0
224    #[serde(rename = "startTimeOffset")]
225    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
226    pub start_time_offset: Option<chrono::Duration>,
227}
228
229impl common::Part for AnimationEnd {}
230
231/// Display overlay object with fade animation.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct AnimationFade {
239    /// The time to end the fade animation, in seconds. Default: `start_time_offset` + 1s
240    #[serde(rename = "endTimeOffset")]
241    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
242    pub end_time_offset: Option<chrono::Duration>,
243    /// Required. Type of fade animation: `FADE_IN` or `FADE_OUT`.
244    #[serde(rename = "fadeType")]
245    pub fade_type: Option<String>,
246    /// The time to start the fade animation, in seconds. Default: 0
247    #[serde(rename = "startTimeOffset")]
248    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
249    pub start_time_offset: Option<chrono::Duration>,
250    /// Normalized coordinates based on output video resolution. Valid values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay object. For example, use the x and y coordinates {0,0} to position the top-left corner of the overlay animation in the top-left corner of the output video.
251    pub xy: Option<NormalizedCoordinate>,
252}
253
254impl common::Part for AnimationFade {}
255
256/// Display static overlay object.
257///
258/// This type is not used in any activity, and only used as *part* of another schema.
259///
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct AnimationStatic {
264    /// The time to start displaying the overlay object, in seconds. Default: 0
265    #[serde(rename = "startTimeOffset")]
266    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
267    pub start_time_offset: Option<chrono::Duration>,
268    /// Normalized coordinates based on output video resolution. Valid values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay object. For example, use the x and y coordinates {0,0} to position the top-left corner of the overlay animation in the top-left corner of the output video.
269    pub xy: Option<NormalizedCoordinate>,
270}
271
272impl common::Part for AnimationStatic {}
273
274/// Audio preprocessing configuration.
275///
276/// This type is not used in any activity, and only used as *part* of another schema.
277///
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct Audio {
282    /// Enable boosting high frequency components. The default is `false`.
283    #[serde(rename = "highBoost")]
284    pub high_boost: Option<bool>,
285    /// Enable boosting low frequency components. The default is `false`.
286    #[serde(rename = "lowBoost")]
287    pub low_boost: Option<bool>,
288    /// Specify audio loudness normalization in loudness units relative to full scale (LUFS). Enter a value between -24 and 0 (the default), where: * -24 is the Advanced Television Systems Committee (ATSC A/85) standard * -23 is the EU R128 broadcast standard * -19 is the prior standard for online mono audio * -18 is the ReplayGain standard * -16 is the prior standard for stereo audio * -14 is the new online audio standard recommended by Spotify, as well as Amazon Echo * 0 disables normalization
289    pub lufs: Option<f64>,
290}
291
292impl common::Part for Audio {}
293
294/// The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`.
295///
296/// This type is not used in any activity, and only used as *part* of another schema.
297///
298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
299#[serde_with::serde_as]
300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
301pub struct AudioAtom {
302    /// List of `Channel`s for this audio stream. for in-depth explanation.
303    pub channels: Option<Vec<AudioChannel>>,
304    /// Required. The `EditAtom.key` that references the atom with audio inputs in the `Job.edit_list`.
305    pub key: Option<String>,
306}
307
308impl common::Part for AudioAtom {}
309
310/// The audio channel.
311///
312/// This type is not used in any activity, and only used as *part* of another schema.
313///
314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
315#[serde_with::serde_as]
316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
317pub struct AudioChannel {
318    /// List of `Job.inputs` for this audio channel.
319    pub inputs: Option<Vec<AudioChannelInput>>,
320}
321
322impl common::Part for AudioChannel {}
323
324/// Identifies which input file, track, and channel should be used.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct AudioChannelInput {
332    /// Required. The zero-based index of the channel in the input file.
333    pub channel: Option<i32>,
334    /// Audio volume control in dB. Negative values decrease volume, positive values increase. The default is 0.
335    #[serde(rename = "gainDb")]
336    pub gain_db: Option<f64>,
337    /// Required. The `Input.key` that identifies the input file.
338    pub key: Option<String>,
339    /// Required. The zero-based index of the track in the input file.
340    pub track: Option<i32>,
341}
342
343impl common::Part for AudioChannelInput {}
344
345/// Audio stream resource.
346///
347/// This type is not used in any activity, and only used as *part* of another schema.
348///
349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
350#[serde_with::serde_as]
351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
352pub struct AudioStream {
353    /// Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000.
354    #[serde(rename = "bitrateBps")]
355    pub bitrate_bps: Option<i32>,
356    /// Number of audio channels. Must be between 1 and 6. The default is 2.
357    #[serde(rename = "channelCount")]
358    pub channel_count: Option<i32>,
359    /// A list of channel names specifying layout of the audio channels. This only affects the metadata embedded in the container headers, if supported by the specified format. The default is `["fl", "fr"]`. Supported channel names: - 'fl' - Front left channel - 'fr' - Front right channel - 'sl' - Side left channel - 'sr' - Side right channel - 'fc' - Front center channel - 'lfe' - Low frequency
360    #[serde(rename = "channelLayout")]
361    pub channel_layout: Option<Vec<String>>,
362    /// The codec for this audio stream. The default is `"aac"`. Supported audio codecs: - 'aac' - 'aac-he' - 'aac-he-v2' - 'mp3' - 'ac3' - 'eac3'
363    pub codec: Option<String>,
364    /// The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`.
365    pub mapping: Option<Vec<AudioAtom>>,
366    /// The audio sample rate in Hertz. The default is 48000 Hertz.
367    #[serde(rename = "sampleRateHertz")]
368    pub sample_rate_hertz: Option<i32>,
369}
370
371impl common::Part for AudioStream {}
372
373/// Color preprocessing configuration.
374///
375/// This type is not used in any activity, and only used as *part* of another schema.
376///
377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
378#[serde_with::serde_as]
379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
380pub struct Color {
381    /// Control brightness of the video. Enter a value between -1 and 1, where -1 is minimum brightness and 1 is maximum brightness. 0 is no change. The default is 0.
382    pub brightness: Option<f64>,
383    /// Control black and white contrast of the video. Enter a value between -1 and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no change. The default is 0.
384    pub contrast: Option<f64>,
385    /// Control color saturation of the video. Enter a value between -1 and 1, where -1 is fully desaturated and 1 is maximum saturation. 0 is no change. The default is 0.
386    pub saturation: Option<f64>,
387}
388
389impl common::Part for Color {}
390
391/// Video cropping configuration for the input video. The cropped input video is scaled to match the output resolution.
392///
393/// This type is not used in any activity, and only used as *part* of another schema.
394///
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct Crop {
399    /// The number of pixels to crop from the bottom. The default is 0.
400    #[serde(rename = "bottomPixels")]
401    pub bottom_pixels: Option<i32>,
402    /// The number of pixels to crop from the left. The default is 0.
403    #[serde(rename = "leftPixels")]
404    pub left_pixels: Option<i32>,
405    /// The number of pixels to crop from the right. The default is 0.
406    #[serde(rename = "rightPixels")]
407    pub right_pixels: Option<i32>,
408    /// The number of pixels to crop from the top. The default is 0.
409    #[serde(rename = "topPixels")]
410    pub top_pixels: Option<i32>,
411}
412
413impl common::Part for Crop {}
414
415/// Deblock preprocessing configuration.
416///
417/// This type is not used in any activity, and only used as *part* of another schema.
418///
419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
420#[serde_with::serde_as]
421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
422pub struct Deblock {
423    /// Enable deblocker. The default is `false`.
424    pub enabled: Option<bool>,
425    /// Set strength of the deblocker. Enter a value between 0 and 1. The higher the value, the stronger the block removal. 0 is no deblocking. The default is 0.
426    pub strength: Option<f64>,
427}
428
429impl common::Part for Deblock {}
430
431/// Denoise preprocessing configuration.
432///
433/// This type is not used in any activity, and only used as *part* of another schema.
434///
435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
436#[serde_with::serde_as]
437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
438pub struct Denoise {
439    /// Set strength of the denoise. Enter a value between 0 and 1. The higher the value, the smoother the image. 0 is no denoising. The default is 0.
440    pub strength: Option<f64>,
441    /// Set the denoiser mode. The default is `"standard"`. Supported denoiser modes: - 'standard' - 'grain'
442    pub tune: Option<String>,
443}
444
445impl common::Part for Denoise {}
446
447/// Edit atom.
448///
449/// This type is not used in any activity, and only used as *part* of another schema.
450///
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct EditAtom {
455    /// End time in seconds for the atom, relative to the input file timeline. When `end_time_offset` is not specified, the `inputs` are used until the end of the atom.
456    #[serde(rename = "endTimeOffset")]
457    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
458    pub end_time_offset: Option<chrono::Duration>,
459    /// List of `Input.key`s identifying files that should be used in this atom. The listed `inputs` must have the same timeline.
460    pub inputs: Option<Vec<String>>,
461    /// A unique key for this atom. Must be specified when using advanced mapping.
462    pub key: Option<String>,
463    /// Start time in seconds for the atom, relative to the input file timeline. The default is `0s`.
464    #[serde(rename = "startTimeOffset")]
465    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
466    pub start_time_offset: Option<chrono::Duration>,
467}
468
469impl common::Part for EditAtom {}
470
471/// Encoding of an input file such as an audio, video, or text track. Elementary streams must be packaged before mapping and sharing between different output formats.
472///
473/// This type is not used in any activity, and only used as *part* of another schema.
474///
475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
476#[serde_with::serde_as]
477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
478pub struct ElementaryStream {
479    /// Encoding of an audio stream.
480    #[serde(rename = "audioStream")]
481    pub audio_stream: Option<AudioStream>,
482    /// A unique key for this elementary stream.
483    pub key: Option<String>,
484    /// Encoding of a text stream. For example, closed captions or subtitles.
485    #[serde(rename = "textStream")]
486    pub text_stream: Option<TextStream>,
487    /// Encoding of a video stream.
488    #[serde(rename = "videoStream")]
489    pub video_stream: Option<VideoStream>,
490}
491
492impl common::Part for ElementaryStream {}
493
494/// 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); } The JSON representation for `Empty` is empty JSON object `{}`.
495///
496/// # Activities
497///
498/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
499/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
500///
501/// * [locations job templates delete projects](ProjectLocationJobTemplateDeleteCall) (response)
502/// * [locations jobs delete projects](ProjectLocationJobDeleteCall) (response)
503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
504#[serde_with::serde_as]
505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
506pub struct Empty {
507    _never_set: Option<bool>,
508}
509
510impl common::ResponseResult for Empty {}
511
512/// Encryption settings.
513///
514/// This type is not used in any activity, and only used as *part* of another schema.
515///
516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
517#[serde_with::serde_as]
518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
519pub struct Encryption {
520    /// Configuration for AES-128 encryption.
521    pub aes128: Option<Aes128Encryption>,
522    /// Required. 128 bit Initialization Vector (IV) represented as lowercase hexadecimal digits.
523    pub iv: Option<String>,
524    /// Required. 128 bit encryption key represented as lowercase hexadecimal digits.
525    pub key: Option<String>,
526    /// Configuration for MPEG Common Encryption (MPEG-CENC).
527    #[serde(rename = "mpegCenc")]
528    pub mpeg_cenc: Option<MpegCommonEncryption>,
529    /// Configuration for SAMPLE-AES encryption.
530    #[serde(rename = "sampleAes")]
531    pub sample_aes: Option<SampleAesEncryption>,
532}
533
534impl common::Part for Encryption {}
535
536/// Additional information about the reasons for the failure.
537///
538/// This type is not used in any activity, and only used as *part* of another schema.
539///
540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
541#[serde_with::serde_as]
542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
543pub struct FailureDetail {
544    /// A description of the failure.
545    pub description: Option<String>,
546}
547
548impl common::Part for FailureDetail {}
549
550/// Overlaid jpeg image.
551///
552/// This type is not used in any activity, and only used as *part* of another schema.
553///
554#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
555#[serde_with::serde_as]
556#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
557pub struct Image {
558    /// Target image opacity. Valid values: `1.0` (solid, default) to `0.0` (transparent).
559    pub alpha: Option<f64>,
560    /// Normalized image resolution, based on output video resolution. Valid values: `0.0`–`1.0`. To respect the original image aspect ratio, set either `x` or `y` to `0.0`. To use the original image resolution, set both `x` and `y` to `0.0`.
561    pub resolution: Option<NormalizedCoordinate>,
562    /// Required. URI of the JPEG image in Cloud Storage. For example, `gs://bucket/inputs/image.jpeg`. JPEG is the only supported image type.
563    pub uri: Option<String>,
564}
565
566impl common::Part for Image {}
567
568/// Input asset.
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct Input {
576    /// A unique key for this input. Must be specified when using advanced mapping and edit lists.
577    pub key: Option<String>,
578    /// Preprocessing configurations.
579    #[serde(rename = "preprocessingConfig")]
580    pub preprocessing_config: Option<PreprocessingConfig>,
581    /// URI of the media. Input files must be at least 5 seconds in duration and stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). If empty, the value will be populated from `Job.input_uri`.
582    pub uri: Option<String>,
583}
584
585impl common::Part for Input {}
586
587/// Transcoding job resource.
588///
589/// # Activities
590///
591/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
592/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
593///
594/// * [locations jobs create projects](ProjectLocationJobCreateCall) (request|response)
595/// * [locations jobs get projects](ProjectLocationJobGetCall) (response)
596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
597#[serde_with::serde_as]
598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
599pub struct Job {
600    /// The configuration for this job.
601    pub config: Option<JobConfig>,
602    /// Output only. The time the job was created.
603    #[serde(rename = "createTime")]
604    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
605    /// Output only. The time the transcoding finished.
606    #[serde(rename = "endTime")]
607    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
608    /// Output only. List of failure details. This property may contain additional information about the failure when `failure_reason` is present. *Note*: This feature is not yet available.
609    #[serde(rename = "failureDetails")]
610    pub failure_details: Option<Vec<FailureDetail>>,
611    /// Output only. A description of the reason for the failure. This property is always present when `state` is `FAILED`.
612    #[serde(rename = "failureReason")]
613    pub failure_reason: Option<String>,
614    /// Input only. Specify the `input_uri` to populate empty `uri` fields in each element of `Job.config.inputs` or `JobTemplate.config.inputs` when using template. URI of the media. Input files must be at least 5 seconds in duration and stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`).
615    #[serde(rename = "inputUri")]
616    pub input_uri: Option<String>,
617    /// The resource name of the job. Format: `projects/{project}/locations/{location}/jobs/{job}`
618    pub name: Option<String>,
619    /// Output only. The origin URI. *Note*: This feature is not yet available.
620    #[serde(rename = "originUri")]
621    pub origin_uri: Option<OriginUri>,
622    /// Input only. Specify the `output_uri` to populate an empty `Job.config.output.uri` or `JobTemplate.config.output.uri` when using template. URI for the output file(s). For example, `gs://my-bucket/outputs/`.
623    #[serde(rename = "outputUri")]
624    pub output_uri: Option<String>,
625    /// Specify the priority of the job. Enter a value between 0 and 100, where 0 is the lowest priority and 100 is the highest priority. The default is 0.
626    pub priority: Option<i32>,
627    /// Output only. Estimated fractional progress, from `0` to `1` for each step. *Note*: This feature is not yet available.
628    pub progress: Option<Progress>,
629    /// Output only. The time the transcoding started.
630    #[serde(rename = "startTime")]
631    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
632    /// Output only. The current state of the job.
633    pub state: Option<String>,
634    /// Input only. Specify the `template_id` to use for populating `Job.config`. The default is `preset/web-hd`. Preset Transcoder templates: - `preset/{preset_id}` - User defined JobTemplate: `{job_template_id}`
635    #[serde(rename = "templateId")]
636    pub template_id: Option<String>,
637    /// Job time to live value in days, which will be effective after job completion. Job should be deleted automatically after the given TTL. Enter a value between 1 and 90. The default is 30.
638    #[serde(rename = "ttlAfterCompletionDays")]
639    pub ttl_after_completion_days: Option<i32>,
640}
641
642impl common::RequestValue for Job {}
643impl common::ResponseResult for Job {}
644
645/// Job configuration
646///
647/// This type is not used in any activity, and only used as *part* of another schema.
648///
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct JobConfig {
653    /// List of ad breaks. Specifies where to insert ad break tags in the output manifests.
654    #[serde(rename = "adBreaks")]
655    pub ad_breaks: Option<Vec<AdBreak>>,
656    /// List of `Edit atom`s. Defines the ultimate timeline of the resulting file or manifest.
657    #[serde(rename = "editList")]
658    pub edit_list: Option<Vec<EditAtom>>,
659    /// List of elementary streams.
660    #[serde(rename = "elementaryStreams")]
661    pub elementary_streams: Option<Vec<ElementaryStream>>,
662    /// List of input assets stored in Cloud Storage.
663    pub inputs: Option<Vec<Input>>,
664    /// List of output manifests.
665    pub manifests: Option<Vec<Manifest>>,
666    /// List of multiplexing settings for output streams.
667    #[serde(rename = "muxStreams")]
668    pub mux_streams: Option<Vec<MuxStream>>,
669    /// Output configuration.
670    pub output: Option<Output>,
671    /// List of overlays on the output video, in descending Z-order.
672    pub overlays: Option<Vec<Overlay>>,
673    /// Destination on Pub/Sub.
674    #[serde(rename = "pubsubDestination")]
675    pub pubsub_destination: Option<PubsubDestination>,
676    /// List of output sprite sheets.
677    #[serde(rename = "spriteSheets")]
678    pub sprite_sheets: Option<Vec<SpriteSheet>>,
679}
680
681impl common::Part for JobConfig {}
682
683/// Transcoding job template resource.
684///
685/// # Activities
686///
687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
689///
690/// * [locations job templates create projects](ProjectLocationJobTemplateCreateCall) (request|response)
691/// * [locations job templates get projects](ProjectLocationJobTemplateGetCall) (response)
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct JobTemplate {
696    /// The configuration for this template.
697    pub config: Option<JobConfig>,
698    /// The resource name of the job template. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
699    pub name: Option<String>,
700}
701
702impl common::RequestValue for JobTemplate {}
703impl common::ResponseResult for JobTemplate {}
704
705/// Response message for `TranscoderService.ListJobTemplates`.
706///
707/// # Activities
708///
709/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
710/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
711///
712/// * [locations job templates list projects](ProjectLocationJobTemplateListCall) (response)
713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
714#[serde_with::serde_as]
715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
716pub struct ListJobTemplatesResponse {
717    /// List of job templates in the specified region.
718    #[serde(rename = "jobTemplates")]
719    pub job_templates: Option<Vec<JobTemplate>>,
720    /// The pagination token.
721    #[serde(rename = "nextPageToken")]
722    pub next_page_token: Option<String>,
723}
724
725impl common::ResponseResult for ListJobTemplatesResponse {}
726
727/// Response message for `TranscoderService.ListJobs`.
728///
729/// # Activities
730///
731/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
732/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
733///
734/// * [locations jobs list projects](ProjectLocationJobListCall) (response)
735#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
736#[serde_with::serde_as]
737#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
738pub struct ListJobsResponse {
739    /// List of jobs in the specified region.
740    pub jobs: Option<Vec<Job>>,
741    /// The pagination token.
742    #[serde(rename = "nextPageToken")]
743    pub next_page_token: Option<String>,
744}
745
746impl common::ResponseResult for ListJobsResponse {}
747
748/// Manifest configuration.
749///
750/// This type is not used in any activity, and only used as *part* of another schema.
751///
752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
753#[serde_with::serde_as]
754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
755pub struct Manifest {
756    /// The name of the generated file. The default is `"manifest"` with the extension suffix corresponding to the `Manifest.type`.
757    #[serde(rename = "fileName")]
758    pub file_name: Option<String>,
759    /// Required. List of user given `MuxStream.key`s that should appear in this manifest. When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` and `.m3u8` extension is generated for each element of the `Manifest.mux_streams`.
760    #[serde(rename = "muxStreams")]
761    pub mux_streams: Option<Vec<String>>,
762    /// Required. Type of the manifest, can be "HLS" or "DASH".
763    #[serde(rename = "type")]
764    pub type_: Option<String>,
765}
766
767impl common::Part for Manifest {}
768
769/// Configuration for MPEG Common Encryption (MPEG-CENC).
770///
771/// This type is not used in any activity, and only used as *part* of another schema.
772///
773#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
774#[serde_with::serde_as]
775#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
776pub struct MpegCommonEncryption {
777    /// Required. 128 bit Key ID represented as lowercase hexadecimal digits for use with common encryption.
778    #[serde(rename = "keyId")]
779    pub key_id: Option<String>,
780    /// Required. Specify the encryption scheme. Supported encryption schemes: - 'cenc' - 'cbcs'
781    pub scheme: Option<String>,
782}
783
784impl common::Part for MpegCommonEncryption {}
785
786/// Multiplexing settings for output stream.
787///
788/// This type is not used in any activity, and only used as *part* of another schema.
789///
790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
791#[serde_with::serde_as]
792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
793pub struct MuxStream {
794    /// The container format. The default is `"mp4"` Supported container formats: - 'ts' - 'fmp4'- the corresponding file extension is `".m4s"` - 'mp4' - 'vtt'
795    pub container: Option<String>,
796    /// List of `ElementaryStream.key`s multiplexed in this stream.
797    #[serde(rename = "elementaryStreams")]
798    pub elementary_streams: Option<Vec<String>>,
799    /// Encryption settings.
800    pub encryption: Option<Encryption>,
801    /// The name of the generated file. The default is `MuxStream.key` with the extension suffix corresponding to the `MuxStream.container`. Individual segments also have an incremental 10-digit zero-padded suffix starting from 0 before the extension, such as `"mux_stream0000000123.ts"`.
802    #[serde(rename = "fileName")]
803    pub file_name: Option<String>,
804    /// A unique key for this multiplexed stream. HLS media manifests will be named `MuxStream.key` with the `".m3u8"` extension suffix.
805    pub key: Option<String>,
806    /// Segment settings for `"ts"`, `"fmp4"` and `"vtt"`.
807    #[serde(rename = "segmentSettings")]
808    pub segment_settings: Option<SegmentSettings>,
809}
810
811impl common::Part for MuxStream {}
812
813/// 2D normalized coordinates. Default: `{0.0, 0.0}`
814///
815/// This type is not used in any activity, and only used as *part* of another schema.
816///
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct NormalizedCoordinate {
821    /// Normalized x coordinate.
822    pub x: Option<f64>,
823    /// Normalized y coordinate.
824    pub y: Option<f64>,
825}
826
827impl common::Part for NormalizedCoordinate {}
828
829/// The origin URI.
830///
831/// This type is not used in any activity, and only used as *part* of another schema.
832///
833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
834#[serde_with::serde_as]
835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
836pub struct OriginUri {
837    /// Dash manifest URI. If multiple Dash manifests are created, only the first one is listed.
838    pub dash: Option<String>,
839    /// HLS manifest URI per https://tools.ietf.org/html/rfc8216#section-4.3.4. If multiple HLS manifests are created, only the first one is listed.
840    pub hls: Option<String>,
841}
842
843impl common::Part for OriginUri {}
844
845/// Location of output file(s) in a Cloud Storage bucket.
846///
847/// This type is not used in any activity, and only used as *part* of another schema.
848///
849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
850#[serde_with::serde_as]
851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
852pub struct Output {
853    /// URI for the output file(s). For example, `gs://my-bucket/outputs/`. If empty the value is populated from `Job.output_uri`.
854    pub uri: Option<String>,
855}
856
857impl common::Part for Output {}
858
859/// Overlay configuration.
860///
861/// This type is not used in any activity, and only used as *part* of another schema.
862///
863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
864#[serde_with::serde_as]
865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
866pub struct Overlay {
867    /// List of Animations. The list should be chronological, without any time overlap.
868    pub animations: Option<Vec<Animation>>,
869    /// Image overlay.
870    pub image: Option<Image>,
871}
872
873impl common::Part for Overlay {}
874
875/// Pad filter configuration for the input video. The padded input video is scaled after padding with black to match the output resolution.
876///
877/// This type is not used in any activity, and only used as *part* of another schema.
878///
879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
880#[serde_with::serde_as]
881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
882pub struct Pad {
883    /// The number of pixels to add to the bottom. The default is 0.
884    #[serde(rename = "bottomPixels")]
885    pub bottom_pixels: Option<i32>,
886    /// The number of pixels to add to the left. The default is 0.
887    #[serde(rename = "leftPixels")]
888    pub left_pixels: Option<i32>,
889    /// The number of pixels to add to the right. The default is 0.
890    #[serde(rename = "rightPixels")]
891    pub right_pixels: Option<i32>,
892    /// The number of pixels to add to the top. The default is 0.
893    #[serde(rename = "topPixels")]
894    pub top_pixels: Option<i32>,
895}
896
897impl common::Part for Pad {}
898
899/// Preprocessing configurations.
900///
901/// This type is not used in any activity, and only used as *part* of another schema.
902///
903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
904#[serde_with::serde_as]
905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
906pub struct PreprocessingConfig {
907    /// Audio preprocessing configuration.
908    pub audio: Option<Audio>,
909    /// Color preprocessing configuration.
910    pub color: Option<Color>,
911    /// Specify the video cropping configuration.
912    pub crop: Option<Crop>,
913    /// Deblock preprocessing configuration.
914    pub deblock: Option<Deblock>,
915    /// Denoise preprocessing configuration.
916    pub denoise: Option<Denoise>,
917    /// Specify the video pad filter configuration.
918    pub pad: Option<Pad>,
919}
920
921impl common::Part for PreprocessingConfig {}
922
923/// Estimated fractional progress for each step, from `0` to `1`.
924///
925/// This type is not used in any activity, and only used as *part* of another schema.
926///
927#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
928#[serde_with::serde_as]
929#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
930pub struct Progress {
931    /// Estimated fractional progress for `analyzing` step.
932    pub analyzed: Option<f64>,
933    /// Estimated fractional progress for `encoding` step.
934    pub encoded: Option<f64>,
935    /// Estimated fractional progress for `notifying` step.
936    pub notified: Option<f64>,
937    /// Estimated fractional progress for `uploading` step.
938    pub uploaded: Option<f64>,
939}
940
941impl common::Part for Progress {}
942
943/// A Pub/Sub destination.
944///
945/// This type is not used in any activity, and only used as *part* of another schema.
946///
947#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
948#[serde_with::serde_as]
949#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
950pub struct PubsubDestination {
951    /// The name of the Pub/Sub topic to publish job completion notification to. For example: `projects/{project}/topics/{topic}`.
952    pub topic: Option<String>,
953}
954
955impl common::Part for PubsubDestination {}
956
957/// Configuration for SAMPLE-AES encryption.
958///
959/// This type is not used in any activity, and only used as *part* of another schema.
960///
961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
962#[serde_with::serde_as]
963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
964pub struct SampleAesEncryption {
965    /// Required. URI of the key delivery service. This URI is inserted into the M3U8 header.
966    #[serde(rename = "keyUri")]
967    pub key_uri: Option<String>,
968}
969
970impl common::Part for SampleAesEncryption {}
971
972/// Segment settings for `"ts"`, `"fmp4"` and `"vtt"`.
973///
974/// This type is not used in any activity, and only used as *part* of another schema.
975///
976#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
977#[serde_with::serde_as]
978#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
979pub struct SegmentSettings {
980    /// Required. Create an individual segment file. The default is `false`.
981    #[serde(rename = "individualSegments")]
982    pub individual_segments: Option<bool>,
983    /// Duration of the segments in seconds. The default is `"6.0s"`. Note that `segmentDuration` must be greater than or equal to [`gopDuration`](#videostream), and `segmentDuration` must be divisible by [`gopDuration`](#videostream).
984    #[serde(rename = "segmentDuration")]
985    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
986    pub segment_duration: Option<chrono::Duration>,
987}
988
989impl common::Part for SegmentSettings {}
990
991/// Sprite sheet configuration.
992///
993/// This type is not used in any activity, and only used as *part* of another schema.
994///
995#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
996#[serde_with::serde_as]
997#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
998pub struct SpriteSheet {
999    /// The maximum number of sprites per row in a sprite sheet. The default is 0, which indicates no maximum limit.
1000    #[serde(rename = "columnCount")]
1001    pub column_count: Option<i32>,
1002    /// End time in seconds, relative to the output file timeline. When `end_time_offset` is not specified, the sprites are generated until the end of the output file.
1003    #[serde(rename = "endTimeOffset")]
1004    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1005    pub end_time_offset: Option<chrono::Duration>,
1006    /// Required. File name prefix for the generated sprite sheets. Each sprite sheet has an incremental 10-digit zero-padded suffix starting from 0 before the extension, such as `"sprite_sheet0000000123.jpeg"`.
1007    #[serde(rename = "filePrefix")]
1008    pub file_prefix: Option<String>,
1009    /// Format type. The default is `"jpeg"`. Supported formats: - 'jpeg'
1010    pub format: Option<String>,
1011    /// Starting from `0s`, create sprites at regular intervals. Specify the interval value in seconds.
1012    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1013    pub interval: Option<chrono::Duration>,
1014    /// The quality of the generated sprite sheet. Enter a value between 1 and 100, where 1 is the lowest quality and 100 is the highest quality. The default is 100. A high quality value corresponds to a low image data compression ratio.
1015    pub quality: Option<i32>,
1016    /// The maximum number of rows per sprite sheet. When the sprite sheet is full, a new sprite sheet is created. The default is 0, which indicates no maximum limit.
1017    #[serde(rename = "rowCount")]
1018    pub row_count: Option<i32>,
1019    /// Required. The height of sprite in pixels. Must be an even integer. To preserve the source aspect ratio, set the SpriteSheet.sprite_height_pixels field or the SpriteSheet.sprite_width_pixels field, but not both (the API will automatically calculate the missing field).
1020    #[serde(rename = "spriteHeightPixels")]
1021    pub sprite_height_pixels: Option<i32>,
1022    /// Required. The width of sprite in pixels. Must be an even integer. To preserve the source aspect ratio, set the SpriteSheet.sprite_width_pixels field or the SpriteSheet.sprite_height_pixels field, but not both (the API will automatically calculate the missing field).
1023    #[serde(rename = "spriteWidthPixels")]
1024    pub sprite_width_pixels: Option<i32>,
1025    /// Start time in seconds, relative to the output file timeline. Determines the first sprite to pick. The default is `0s`.
1026    #[serde(rename = "startTimeOffset")]
1027    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1028    pub start_time_offset: Option<chrono::Duration>,
1029    /// Total number of sprites. Create the specified number of sprites distributed evenly across the timeline of the output media. The default is 100.
1030    #[serde(rename = "totalCount")]
1031    pub total_count: Option<i32>,
1032}
1033
1034impl common::Part for SpriteSheet {}
1035
1036/// The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`.
1037///
1038/// This type is not used in any activity, and only used as *part* of another schema.
1039///
1040#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1041#[serde_with::serde_as]
1042#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1043pub struct TextAtom {
1044    /// List of `Job.inputs` that should be embedded in this atom. Only one input is supported.
1045    pub inputs: Option<Vec<TextInput>>,
1046    /// Required. The `EditAtom.key` that references atom with text inputs in the `Job.edit_list`.
1047    pub key: Option<String>,
1048}
1049
1050impl common::Part for TextAtom {}
1051
1052/// Identifies which input file and track should be used.
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 TextInput {
1060    /// Required. The `Input.key` that identifies the input file.
1061    pub key: Option<String>,
1062    /// Required. The zero-based index of the track in the input file.
1063    pub track: Option<i32>,
1064}
1065
1066impl common::Part for TextInput {}
1067
1068/// Encoding of a text stream. For example, closed captions or subtitles.
1069///
1070/// This type is not used in any activity, and only used as *part* of another schema.
1071///
1072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1073#[serde_with::serde_as]
1074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1075pub struct TextStream {
1076    /// The codec for this text stream. The default is `"webvtt"`. Supported text codecs: - 'srt' - 'ttml' - 'cea608' - 'cea708' - 'webvtt'
1077    pub codec: Option<String>,
1078    /// Required. The BCP-47 language code, such as `"en-US"` or `"sr-Latn"`. For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
1079    #[serde(rename = "languageCode")]
1080    pub language_code: Option<String>,
1081    /// The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`.
1082    pub mapping: Option<Vec<TextAtom>>,
1083}
1084
1085impl common::Part for TextStream {}
1086
1087/// Video stream resource.
1088///
1089/// This type is not used in any activity, and only used as *part* of another schema.
1090///
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct VideoStream {
1095    /// Specifies whether an open Group of Pictures (GOP) structure should be allowed or not. The default is `false`.
1096    #[serde(rename = "allowOpenGop")]
1097    pub allow_open_gop: Option<bool>,
1098    /// Specify the intensity of the adaptive quantizer (AQ). Must be between 0 and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A higher value equals a lower bitrate but smoother image. The default is 0.
1099    #[serde(rename = "aqStrength")]
1100    pub aq_strength: Option<f64>,
1101    /// The number of consecutive B-frames. Must be greater than or equal to zero. Must be less than `VideoStream.gop_frame_count` if set. The default is 0.
1102    #[serde(rename = "bFrameCount")]
1103    pub b_frame_count: Option<i32>,
1104    /// Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is `false`.
1105    #[serde(rename = "bPyramid")]
1106    pub b_pyramid: Option<bool>,
1107    /// Required. The video bitrate in bits per second. Must be between 1 and 1,000,000,000.
1108    #[serde(rename = "bitrateBps")]
1109    pub bitrate_bps: Option<i32>,
1110    /// Codec type. The following codecs are supported: * `h264` (default) * `h265` * `vp9`
1111    pub codec: Option<String>,
1112    /// Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the most efficient compression. The default is 21.
1113    #[serde(rename = "crfLevel")]
1114    pub crf_level: Option<i32>,
1115    /// Use two-pass encoding strategy to achieve better video quality. `VideoStream.rate_control_mode` must be `"vbr"`. The default is `false`.
1116    #[serde(rename = "enableTwoPass")]
1117    pub enable_two_pass: Option<bool>,
1118    /// The entropy coder to use. The default is `"cabac"`. Supported entropy coders: - 'cavlc' - 'cabac'
1119    #[serde(rename = "entropyCoder")]
1120    pub entropy_coder: Option<String>,
1121    /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120. Will default to the input frame rate if larger than the input frame rate. The API will generate an output FPS that is divisible by the input FPS, and smaller or equal to the target FPS. The following table shows the computed video FPS given the target FPS (in parenthesis) and input FPS (in the first column): ``` | | (30) | (60) | (25) | (50) | |--------|--------|--------|------|------| | 240 | Fail | Fail | Fail | Fail | | 120 | 30 | 60 | 20 | 30 | | 100 | 25 | 50 | 20 | 30 | | 50 | 25 | 50 | 20 | 30 | | 60 | 30 | 60 | 20 | 30 | | 59.94 | 29.97 | 59.94 | 20 | 30 | | 48 | 24 | 48 | 20 | 30 | | 30 | 30 | 30 | 20 | 30 | | 25 | 25 | 25 | 20 | 30 | | 24 | 24 | 24 | 20 | 30 | | 23.976 | 23.976 | 23.976 | 20 | 30 | | 15 | 15 | 15 | 20 | 30 | | 12 | 12 | 12 | 20 | 30 | | 10 | 10 | 10 | 20 | 30 | ```
1122    #[serde(rename = "frameRate")]
1123    pub frame_rate: Option<f64>,
1124    /// Select the GOP size based on the specified duration. The default is `"3s"`. Note that `gopDuration` must be less than or equal to [`segmentDuration`](#SegmentSettings), and [`segmentDuration`](#SegmentSettings) must be divisible by `gopDuration`.
1125    #[serde(rename = "gopDuration")]
1126    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1127    pub gop_duration: Option<chrono::Duration>,
1128    /// Select the GOP size based on the specified frame count. Must be greater than zero.
1129    #[serde(rename = "gopFrameCount")]
1130    pub gop_frame_count: Option<i32>,
1131    /// The height of the video in pixels. Must be an even integer. When not specified, the height is adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used.
1132    #[serde(rename = "heightPixels")]
1133    pub height_pixels: Option<i32>,
1134    /// Pixel format to use. The default is `"yuv420p"`. Supported pixel formats: - 'yuv420p' pixel format. - 'yuv422p' pixel format. - 'yuv444p' pixel format. - 'yuv420p10' 10-bit HDR pixel format. - 'yuv422p10' 10-bit HDR pixel format. - 'yuv444p10' 10-bit HDR pixel format. - 'yuv420p12' 12-bit HDR pixel format. - 'yuv422p12' 12-bit HDR pixel format. - 'yuv444p12' 12-bit HDR pixel format.
1135    #[serde(rename = "pixelFormat")]
1136    pub pixel_format: Option<String>,
1137    /// Enforces the specified codec preset. The default is `veryfast`. The available options are FFmpeg-compatible. Note that certain values for this field may cause the transcoder to override other fields you set in the `VideoStream` message.
1138    pub preset: Option<String>,
1139    /// Enforces the specified codec profile. The following profiles are supported: * `baseline` * `main` * `high` (default) The available options are FFmpeg-compatible. Note that certain values for this field may cause the transcoder to override other fields you set in the `VideoStream` message.
1140    pub profile: Option<String>,
1141    /// Specify the `rate_control_mode`. The default is `"vbr"`. Supported rate control modes: - 'vbr' - variable bitrate - 'crf' - constant rate factor
1142    #[serde(rename = "rateControlMode")]
1143    pub rate_control_mode: Option<String>,
1144    /// Enforces the specified codec tune. The available options are FFmpeg-compatible. Note that certain values for this field may cause the transcoder to override other fields you set in the `VideoStream` message.
1145    pub tune: Option<String>,
1146    /// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to 90% of `VideoStream.vbv_size_bits`.
1147    #[serde(rename = "vbvFullnessBits")]
1148    pub vbv_fullness_bits: Option<i32>,
1149    /// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to `VideoStream.bitrate_bps`.
1150    #[serde(rename = "vbvSizeBits")]
1151    pub vbv_size_bits: Option<i32>,
1152    /// The width of the video in pixels. Must be an even integer. When not specified, the width is adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used.
1153    #[serde(rename = "widthPixels")]
1154    pub width_pixels: Option<i32>,
1155}
1156
1157impl common::Part for VideoStream {}
1158
1159// ###################
1160// MethodBuilders ###
1161// #################
1162
1163/// A builder providing access to all methods supported on *project* resources.
1164/// It is not used directly, but through the [`Transcoder`] hub.
1165///
1166/// # Example
1167///
1168/// Instantiate a resource builder
1169///
1170/// ```test_harness,no_run
1171/// extern crate hyper;
1172/// extern crate hyper_rustls;
1173/// extern crate google_transcoder1_beta1 as transcoder1_beta1;
1174///
1175/// # async fn dox() {
1176/// use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1177///
1178/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1179/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1180///     secret,
1181///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1182/// ).build().await.unwrap();
1183///
1184/// let client = hyper_util::client::legacy::Client::builder(
1185///     hyper_util::rt::TokioExecutor::new()
1186/// )
1187/// .build(
1188///     hyper_rustls::HttpsConnectorBuilder::new()
1189///         .with_native_roots()
1190///         .unwrap()
1191///         .https_or_http()
1192///         .enable_http1()
1193///         .build()
1194/// );
1195/// let mut hub = Transcoder::new(client, auth);
1196/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1197/// // like `locations_job_templates_create(...)`, `locations_job_templates_delete(...)`, `locations_job_templates_get(...)`, `locations_job_templates_list(...)`, `locations_jobs_create(...)`, `locations_jobs_delete(...)`, `locations_jobs_get(...)` and `locations_jobs_list(...)`
1198/// // to build up your call.
1199/// let rb = hub.projects();
1200/// # }
1201/// ```
1202pub struct ProjectMethods<'a, C>
1203where
1204    C: 'a,
1205{
1206    hub: &'a Transcoder<C>,
1207}
1208
1209impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1210
1211impl<'a, C> ProjectMethods<'a, C> {
1212    /// Create a builder to help you perform the following task:
1213    ///
1214    /// Creates a job template in the specified region.
1215    ///
1216    /// # Arguments
1217    ///
1218    /// * `request` - No description provided.
1219    /// * `parent` - Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
1220    pub fn locations_job_templates_create(
1221        &self,
1222        request: JobTemplate,
1223        parent: &str,
1224    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1225        ProjectLocationJobTemplateCreateCall {
1226            hub: self.hub,
1227            _request: request,
1228            _parent: parent.to_string(),
1229            _job_template_id: Default::default(),
1230            _delegate: Default::default(),
1231            _additional_params: Default::default(),
1232            _scopes: Default::default(),
1233        }
1234    }
1235
1236    /// Create a builder to help you perform the following task:
1237    ///
1238    /// Deletes a job template.
1239    ///
1240    /// # Arguments
1241    ///
1242    /// * `name` - Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1243    pub fn locations_job_templates_delete(
1244        &self,
1245        name: &str,
1246    ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
1247        ProjectLocationJobTemplateDeleteCall {
1248            hub: self.hub,
1249            _name: name.to_string(),
1250            _delegate: Default::default(),
1251            _additional_params: Default::default(),
1252            _scopes: Default::default(),
1253        }
1254    }
1255
1256    /// Create a builder to help you perform the following task:
1257    ///
1258    /// Returns the job template data.
1259    ///
1260    /// # Arguments
1261    ///
1262    /// * `name` - Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1263    pub fn locations_job_templates_get(
1264        &self,
1265        name: &str,
1266    ) -> ProjectLocationJobTemplateGetCall<'a, C> {
1267        ProjectLocationJobTemplateGetCall {
1268            hub: self.hub,
1269            _name: name.to_string(),
1270            _delegate: Default::default(),
1271            _additional_params: Default::default(),
1272            _scopes: Default::default(),
1273        }
1274    }
1275
1276    /// Create a builder to help you perform the following task:
1277    ///
1278    /// Lists job templates in the specified region.
1279    ///
1280    /// # Arguments
1281    ///
1282    /// * `parent` - Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
1283    pub fn locations_job_templates_list(
1284        &self,
1285        parent: &str,
1286    ) -> ProjectLocationJobTemplateListCall<'a, C> {
1287        ProjectLocationJobTemplateListCall {
1288            hub: self.hub,
1289            _parent: parent.to_string(),
1290            _page_token: Default::default(),
1291            _page_size: Default::default(),
1292            _delegate: Default::default(),
1293            _additional_params: Default::default(),
1294            _scopes: Default::default(),
1295        }
1296    }
1297
1298    /// Create a builder to help you perform the following task:
1299    ///
1300    /// Creates a job in the specified region.
1301    ///
1302    /// # Arguments
1303    ///
1304    /// * `request` - No description provided.
1305    /// * `parent` - Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
1306    pub fn locations_jobs_create(
1307        &self,
1308        request: Job,
1309        parent: &str,
1310    ) -> ProjectLocationJobCreateCall<'a, C> {
1311        ProjectLocationJobCreateCall {
1312            hub: self.hub,
1313            _request: request,
1314            _parent: parent.to_string(),
1315            _delegate: Default::default(),
1316            _additional_params: Default::default(),
1317            _scopes: Default::default(),
1318        }
1319    }
1320
1321    /// Create a builder to help you perform the following task:
1322    ///
1323    /// Deletes a job.
1324    ///
1325    /// # Arguments
1326    ///
1327    /// * `name` - Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
1328    pub fn locations_jobs_delete(&self, name: &str) -> ProjectLocationJobDeleteCall<'a, C> {
1329        ProjectLocationJobDeleteCall {
1330            hub: self.hub,
1331            _name: name.to_string(),
1332            _delegate: Default::default(),
1333            _additional_params: Default::default(),
1334            _scopes: Default::default(),
1335        }
1336    }
1337
1338    /// Create a builder to help you perform the following task:
1339    ///
1340    /// Returns the job data.
1341    ///
1342    /// # Arguments
1343    ///
1344    /// * `name` - Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
1345    pub fn locations_jobs_get(&self, name: &str) -> ProjectLocationJobGetCall<'a, C> {
1346        ProjectLocationJobGetCall {
1347            hub: self.hub,
1348            _name: name.to_string(),
1349            _delegate: Default::default(),
1350            _additional_params: Default::default(),
1351            _scopes: Default::default(),
1352        }
1353    }
1354
1355    /// Create a builder to help you perform the following task:
1356    ///
1357    /// Lists jobs in the specified region.
1358    ///
1359    /// # Arguments
1360    ///
1361    /// * `parent` - Required. Format: `projects/{project}/locations/{location}`
1362    pub fn locations_jobs_list(&self, parent: &str) -> ProjectLocationJobListCall<'a, C> {
1363        ProjectLocationJobListCall {
1364            hub: self.hub,
1365            _parent: parent.to_string(),
1366            _page_token: Default::default(),
1367            _page_size: Default::default(),
1368            _delegate: Default::default(),
1369            _additional_params: Default::default(),
1370            _scopes: Default::default(),
1371        }
1372    }
1373}
1374
1375// ###################
1376// CallBuilders   ###
1377// #################
1378
1379/// Creates a job template in the specified region.
1380///
1381/// A builder for the *locations.jobTemplates.create* method supported by a *project* resource.
1382/// It is not used directly, but through a [`ProjectMethods`] instance.
1383///
1384/// # Example
1385///
1386/// Instantiate a resource method builder
1387///
1388/// ```test_harness,no_run
1389/// # extern crate hyper;
1390/// # extern crate hyper_rustls;
1391/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
1392/// use transcoder1_beta1::api::JobTemplate;
1393/// # async fn dox() {
1394/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1395///
1396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1398/// #     secret,
1399/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1400/// # ).build().await.unwrap();
1401///
1402/// # let client = hyper_util::client::legacy::Client::builder(
1403/// #     hyper_util::rt::TokioExecutor::new()
1404/// # )
1405/// # .build(
1406/// #     hyper_rustls::HttpsConnectorBuilder::new()
1407/// #         .with_native_roots()
1408/// #         .unwrap()
1409/// #         .https_or_http()
1410/// #         .enable_http1()
1411/// #         .build()
1412/// # );
1413/// # let mut hub = Transcoder::new(client, auth);
1414/// // As the method needs a request, you would usually fill it with the desired information
1415/// // into the respective structure. Some of the parts shown here might not be applicable !
1416/// // Values shown here are possibly random and not representative !
1417/// let mut req = JobTemplate::default();
1418///
1419/// // You can configure optional parameters by calling the respective setters at will, and
1420/// // execute the final call using `doit()`.
1421/// // Values shown here are possibly random and not representative !
1422/// let result = hub.projects().locations_job_templates_create(req, "parent")
1423///              .job_template_id("voluptua.")
1424///              .doit().await;
1425/// # }
1426/// ```
1427pub struct ProjectLocationJobTemplateCreateCall<'a, C>
1428where
1429    C: 'a,
1430{
1431    hub: &'a Transcoder<C>,
1432    _request: JobTemplate,
1433    _parent: String,
1434    _job_template_id: Option<String>,
1435    _delegate: Option<&'a mut dyn common::Delegate>,
1436    _additional_params: HashMap<String, String>,
1437    _scopes: BTreeSet<String>,
1438}
1439
1440impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateCreateCall<'a, C> {}
1441
1442impl<'a, C> ProjectLocationJobTemplateCreateCall<'a, C>
1443where
1444    C: common::Connector,
1445{
1446    /// Perform the operation you have build so far.
1447    pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
1448        use std::borrow::Cow;
1449        use std::io::{Read, Seek};
1450
1451        use common::{url::Params, ToParts};
1452        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1453
1454        let mut dd = common::DefaultDelegate;
1455        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1456        dlg.begin(common::MethodInfo {
1457            id: "transcoder.projects.locations.jobTemplates.create",
1458            http_method: hyper::Method::POST,
1459        });
1460
1461        for &field in ["alt", "parent", "jobTemplateId"].iter() {
1462            if self._additional_params.contains_key(field) {
1463                dlg.finished(false);
1464                return Err(common::Error::FieldClash(field));
1465            }
1466        }
1467
1468        let mut params = Params::with_capacity(5 + self._additional_params.len());
1469        params.push("parent", self._parent);
1470        if let Some(value) = self._job_template_id.as_ref() {
1471            params.push("jobTemplateId", value);
1472        }
1473
1474        params.extend(self._additional_params.iter());
1475
1476        params.push("alt", "json");
1477        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobTemplates";
1478        if self._scopes.is_empty() {
1479            self._scopes
1480                .insert(Scope::CloudPlatform.as_ref().to_string());
1481        }
1482
1483        #[allow(clippy::single_element_loop)]
1484        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1485            url = params.uri_replacement(url, param_name, find_this, true);
1486        }
1487        {
1488            let to_remove = ["parent"];
1489            params.remove_params(&to_remove);
1490        }
1491
1492        let url = params.parse_with_url(&url);
1493
1494        let mut json_mime_type = mime::APPLICATION_JSON;
1495        let mut request_value_reader = {
1496            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1497            common::remove_json_null_values(&mut value);
1498            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1499            serde_json::to_writer(&mut dst, &value).unwrap();
1500            dst
1501        };
1502        let request_size = request_value_reader
1503            .seek(std::io::SeekFrom::End(0))
1504            .unwrap();
1505        request_value_reader
1506            .seek(std::io::SeekFrom::Start(0))
1507            .unwrap();
1508
1509        loop {
1510            let token = match self
1511                .hub
1512                .auth
1513                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1514                .await
1515            {
1516                Ok(token) => token,
1517                Err(e) => match dlg.token(e) {
1518                    Ok(token) => token,
1519                    Err(e) => {
1520                        dlg.finished(false);
1521                        return Err(common::Error::MissingToken(e));
1522                    }
1523                },
1524            };
1525            request_value_reader
1526                .seek(std::io::SeekFrom::Start(0))
1527                .unwrap();
1528            let mut req_result = {
1529                let client = &self.hub.client;
1530                dlg.pre_request();
1531                let mut req_builder = hyper::Request::builder()
1532                    .method(hyper::Method::POST)
1533                    .uri(url.as_str())
1534                    .header(USER_AGENT, self.hub._user_agent.clone());
1535
1536                if let Some(token) = token.as_ref() {
1537                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1538                }
1539
1540                let request = req_builder
1541                    .header(CONTENT_TYPE, json_mime_type.to_string())
1542                    .header(CONTENT_LENGTH, request_size as u64)
1543                    .body(common::to_body(
1544                        request_value_reader.get_ref().clone().into(),
1545                    ));
1546
1547                client.request(request.unwrap()).await
1548            };
1549
1550            match req_result {
1551                Err(err) => {
1552                    if let common::Retry::After(d) = dlg.http_error(&err) {
1553                        sleep(d).await;
1554                        continue;
1555                    }
1556                    dlg.finished(false);
1557                    return Err(common::Error::HttpError(err));
1558                }
1559                Ok(res) => {
1560                    let (mut parts, body) = res.into_parts();
1561                    let mut body = common::Body::new(body);
1562                    if !parts.status.is_success() {
1563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1564                        let error = serde_json::from_str(&common::to_string(&bytes));
1565                        let response = common::to_response(parts, bytes.into());
1566
1567                        if let common::Retry::After(d) =
1568                            dlg.http_failure(&response, error.as_ref().ok())
1569                        {
1570                            sleep(d).await;
1571                            continue;
1572                        }
1573
1574                        dlg.finished(false);
1575
1576                        return Err(match error {
1577                            Ok(value) => common::Error::BadRequest(value),
1578                            _ => common::Error::Failure(response),
1579                        });
1580                    }
1581                    let response = {
1582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1583                        let encoded = common::to_string(&bytes);
1584                        match serde_json::from_str(&encoded) {
1585                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1586                            Err(error) => {
1587                                dlg.response_json_decode_error(&encoded, &error);
1588                                return Err(common::Error::JsonDecodeError(
1589                                    encoded.to_string(),
1590                                    error,
1591                                ));
1592                            }
1593                        }
1594                    };
1595
1596                    dlg.finished(true);
1597                    return Ok(response);
1598                }
1599            }
1600        }
1601    }
1602
1603    ///
1604    /// Sets the *request* property to the given value.
1605    ///
1606    /// Even though the property as already been set when instantiating this call,
1607    /// we provide this method for API completeness.
1608    pub fn request(
1609        mut self,
1610        new_value: JobTemplate,
1611    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1612        self._request = new_value;
1613        self
1614    }
1615    /// Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
1616    ///
1617    /// Sets the *parent* path property to the given value.
1618    ///
1619    /// Even though the property as already been set when instantiating this call,
1620    /// we provide this method for API completeness.
1621    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1622        self._parent = new_value.to_string();
1623        self
1624    }
1625    /// Required. The ID to use for the job template, which will become the final component of the job template's resource name. This value should be 4-63 characters, and valid characters must match the regular expression `a-zA-Z*`.
1626    ///
1627    /// Sets the *job template id* query property to the given value.
1628    pub fn job_template_id(
1629        mut self,
1630        new_value: &str,
1631    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1632        self._job_template_id = Some(new_value.to_string());
1633        self
1634    }
1635    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1636    /// while executing the actual API request.
1637    ///
1638    /// ````text
1639    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1640    /// ````
1641    ///
1642    /// Sets the *delegate* property to the given value.
1643    pub fn delegate(
1644        mut self,
1645        new_value: &'a mut dyn common::Delegate,
1646    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1647        self._delegate = Some(new_value);
1648        self
1649    }
1650
1651    /// Set any additional parameter of the query string used in the request.
1652    /// It should be used to set parameters which are not yet available through their own
1653    /// setters.
1654    ///
1655    /// Please note that this method must not be used to set any of the known parameters
1656    /// which have their own setter method. If done anyway, the request will fail.
1657    ///
1658    /// # Additional Parameters
1659    ///
1660    /// * *$.xgafv* (query-string) - V1 error format.
1661    /// * *access_token* (query-string) - OAuth access token.
1662    /// * *alt* (query-string) - Data format for response.
1663    /// * *callback* (query-string) - JSONP
1664    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1665    /// * *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.
1666    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1667    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1668    /// * *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.
1669    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1670    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1671    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateCreateCall<'a, C>
1672    where
1673        T: AsRef<str>,
1674    {
1675        self._additional_params
1676            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1677        self
1678    }
1679
1680    /// Identifies the authorization scope for the method you are building.
1681    ///
1682    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1683    /// [`Scope::CloudPlatform`].
1684    ///
1685    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1686    /// tokens for more than one scope.
1687    ///
1688    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1689    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1690    /// sufficient, a read-write scope will do as well.
1691    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateCreateCall<'a, C>
1692    where
1693        St: AsRef<str>,
1694    {
1695        self._scopes.insert(String::from(scope.as_ref()));
1696        self
1697    }
1698    /// Identifies the authorization scope(s) for the method you are building.
1699    ///
1700    /// See [`Self::add_scope()`] for details.
1701    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateCreateCall<'a, C>
1702    where
1703        I: IntoIterator<Item = St>,
1704        St: AsRef<str>,
1705    {
1706        self._scopes
1707            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1708        self
1709    }
1710
1711    /// Removes all scopes, and no default scope will be used either.
1712    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1713    /// for details).
1714    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1715        self._scopes.clear();
1716        self
1717    }
1718}
1719
1720/// Deletes a job template.
1721///
1722/// A builder for the *locations.jobTemplates.delete* method supported by a *project* resource.
1723/// It is not used directly, but through a [`ProjectMethods`] instance.
1724///
1725/// # Example
1726///
1727/// Instantiate a resource method builder
1728///
1729/// ```test_harness,no_run
1730/// # extern crate hyper;
1731/// # extern crate hyper_rustls;
1732/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
1733/// # async fn dox() {
1734/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1735///
1736/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1737/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1738/// #     secret,
1739/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1740/// # ).build().await.unwrap();
1741///
1742/// # let client = hyper_util::client::legacy::Client::builder(
1743/// #     hyper_util::rt::TokioExecutor::new()
1744/// # )
1745/// # .build(
1746/// #     hyper_rustls::HttpsConnectorBuilder::new()
1747/// #         .with_native_roots()
1748/// #         .unwrap()
1749/// #         .https_or_http()
1750/// #         .enable_http1()
1751/// #         .build()
1752/// # );
1753/// # let mut hub = Transcoder::new(client, auth);
1754/// // You can configure optional parameters by calling the respective setters at will, and
1755/// // execute the final call using `doit()`.
1756/// // Values shown here are possibly random and not representative !
1757/// let result = hub.projects().locations_job_templates_delete("name")
1758///              .doit().await;
1759/// # }
1760/// ```
1761pub struct ProjectLocationJobTemplateDeleteCall<'a, C>
1762where
1763    C: 'a,
1764{
1765    hub: &'a Transcoder<C>,
1766    _name: String,
1767    _delegate: Option<&'a mut dyn common::Delegate>,
1768    _additional_params: HashMap<String, String>,
1769    _scopes: BTreeSet<String>,
1770}
1771
1772impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateDeleteCall<'a, C> {}
1773
1774impl<'a, C> ProjectLocationJobTemplateDeleteCall<'a, C>
1775where
1776    C: common::Connector,
1777{
1778    /// Perform the operation you have build so far.
1779    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
1780        use std::borrow::Cow;
1781        use std::io::{Read, Seek};
1782
1783        use common::{url::Params, ToParts};
1784        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1785
1786        let mut dd = common::DefaultDelegate;
1787        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1788        dlg.begin(common::MethodInfo {
1789            id: "transcoder.projects.locations.jobTemplates.delete",
1790            http_method: hyper::Method::DELETE,
1791        });
1792
1793        for &field in ["alt", "name"].iter() {
1794            if self._additional_params.contains_key(field) {
1795                dlg.finished(false);
1796                return Err(common::Error::FieldClash(field));
1797            }
1798        }
1799
1800        let mut params = Params::with_capacity(3 + self._additional_params.len());
1801        params.push("name", self._name);
1802
1803        params.extend(self._additional_params.iter());
1804
1805        params.push("alt", "json");
1806        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1807        if self._scopes.is_empty() {
1808            self._scopes
1809                .insert(Scope::CloudPlatform.as_ref().to_string());
1810        }
1811
1812        #[allow(clippy::single_element_loop)]
1813        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1814            url = params.uri_replacement(url, param_name, find_this, true);
1815        }
1816        {
1817            let to_remove = ["name"];
1818            params.remove_params(&to_remove);
1819        }
1820
1821        let url = params.parse_with_url(&url);
1822
1823        loop {
1824            let token = match self
1825                .hub
1826                .auth
1827                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1828                .await
1829            {
1830                Ok(token) => token,
1831                Err(e) => match dlg.token(e) {
1832                    Ok(token) => token,
1833                    Err(e) => {
1834                        dlg.finished(false);
1835                        return Err(common::Error::MissingToken(e));
1836                    }
1837                },
1838            };
1839            let mut req_result = {
1840                let client = &self.hub.client;
1841                dlg.pre_request();
1842                let mut req_builder = hyper::Request::builder()
1843                    .method(hyper::Method::DELETE)
1844                    .uri(url.as_str())
1845                    .header(USER_AGENT, self.hub._user_agent.clone());
1846
1847                if let Some(token) = token.as_ref() {
1848                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1849                }
1850
1851                let request = req_builder
1852                    .header(CONTENT_LENGTH, 0_u64)
1853                    .body(common::to_body::<String>(None));
1854
1855                client.request(request.unwrap()).await
1856            };
1857
1858            match req_result {
1859                Err(err) => {
1860                    if let common::Retry::After(d) = dlg.http_error(&err) {
1861                        sleep(d).await;
1862                        continue;
1863                    }
1864                    dlg.finished(false);
1865                    return Err(common::Error::HttpError(err));
1866                }
1867                Ok(res) => {
1868                    let (mut parts, body) = res.into_parts();
1869                    let mut body = common::Body::new(body);
1870                    if !parts.status.is_success() {
1871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1872                        let error = serde_json::from_str(&common::to_string(&bytes));
1873                        let response = common::to_response(parts, bytes.into());
1874
1875                        if let common::Retry::After(d) =
1876                            dlg.http_failure(&response, error.as_ref().ok())
1877                        {
1878                            sleep(d).await;
1879                            continue;
1880                        }
1881
1882                        dlg.finished(false);
1883
1884                        return Err(match error {
1885                            Ok(value) => common::Error::BadRequest(value),
1886                            _ => common::Error::Failure(response),
1887                        });
1888                    }
1889                    let response = {
1890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1891                        let encoded = common::to_string(&bytes);
1892                        match serde_json::from_str(&encoded) {
1893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1894                            Err(error) => {
1895                                dlg.response_json_decode_error(&encoded, &error);
1896                                return Err(common::Error::JsonDecodeError(
1897                                    encoded.to_string(),
1898                                    error,
1899                                ));
1900                            }
1901                        }
1902                    };
1903
1904                    dlg.finished(true);
1905                    return Ok(response);
1906                }
1907            }
1908        }
1909    }
1910
1911    /// Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1912    ///
1913    /// Sets the *name* path property to the given value.
1914    ///
1915    /// Even though the property as already been set when instantiating this call,
1916    /// we provide this method for API completeness.
1917    pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
1918        self._name = new_value.to_string();
1919        self
1920    }
1921    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1922    /// while executing the actual API request.
1923    ///
1924    /// ````text
1925    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1926    /// ````
1927    ///
1928    /// Sets the *delegate* property to the given value.
1929    pub fn delegate(
1930        mut self,
1931        new_value: &'a mut dyn common::Delegate,
1932    ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
1933        self._delegate = Some(new_value);
1934        self
1935    }
1936
1937    /// Set any additional parameter of the query string used in the request.
1938    /// It should be used to set parameters which are not yet available through their own
1939    /// setters.
1940    ///
1941    /// Please note that this method must not be used to set any of the known parameters
1942    /// which have their own setter method. If done anyway, the request will fail.
1943    ///
1944    /// # Additional Parameters
1945    ///
1946    /// * *$.xgafv* (query-string) - V1 error format.
1947    /// * *access_token* (query-string) - OAuth access token.
1948    /// * *alt* (query-string) - Data format for response.
1949    /// * *callback* (query-string) - JSONP
1950    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1951    /// * *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.
1952    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1953    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1954    /// * *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.
1955    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1956    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1957    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateDeleteCall<'a, C>
1958    where
1959        T: AsRef<str>,
1960    {
1961        self._additional_params
1962            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1963        self
1964    }
1965
1966    /// Identifies the authorization scope for the method you are building.
1967    ///
1968    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1969    /// [`Scope::CloudPlatform`].
1970    ///
1971    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1972    /// tokens for more than one scope.
1973    ///
1974    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1975    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1976    /// sufficient, a read-write scope will do as well.
1977    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateDeleteCall<'a, C>
1978    where
1979        St: AsRef<str>,
1980    {
1981        self._scopes.insert(String::from(scope.as_ref()));
1982        self
1983    }
1984    /// Identifies the authorization scope(s) for the method you are building.
1985    ///
1986    /// See [`Self::add_scope()`] for details.
1987    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateDeleteCall<'a, C>
1988    where
1989        I: IntoIterator<Item = St>,
1990        St: AsRef<str>,
1991    {
1992        self._scopes
1993            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1994        self
1995    }
1996
1997    /// Removes all scopes, and no default scope will be used either.
1998    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1999    /// for details).
2000    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2001        self._scopes.clear();
2002        self
2003    }
2004}
2005
2006/// Returns the job template data.
2007///
2008/// A builder for the *locations.jobTemplates.get* method supported by a *project* resource.
2009/// It is not used directly, but through a [`ProjectMethods`] instance.
2010///
2011/// # Example
2012///
2013/// Instantiate a resource method builder
2014///
2015/// ```test_harness,no_run
2016/// # extern crate hyper;
2017/// # extern crate hyper_rustls;
2018/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
2019/// # async fn dox() {
2020/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2021///
2022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2024/// #     secret,
2025/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2026/// # ).build().await.unwrap();
2027///
2028/// # let client = hyper_util::client::legacy::Client::builder(
2029/// #     hyper_util::rt::TokioExecutor::new()
2030/// # )
2031/// # .build(
2032/// #     hyper_rustls::HttpsConnectorBuilder::new()
2033/// #         .with_native_roots()
2034/// #         .unwrap()
2035/// #         .https_or_http()
2036/// #         .enable_http1()
2037/// #         .build()
2038/// # );
2039/// # let mut hub = Transcoder::new(client, auth);
2040/// // You can configure optional parameters by calling the respective setters at will, and
2041/// // execute the final call using `doit()`.
2042/// // Values shown here are possibly random and not representative !
2043/// let result = hub.projects().locations_job_templates_get("name")
2044///              .doit().await;
2045/// # }
2046/// ```
2047pub struct ProjectLocationJobTemplateGetCall<'a, C>
2048where
2049    C: 'a,
2050{
2051    hub: &'a Transcoder<C>,
2052    _name: String,
2053    _delegate: Option<&'a mut dyn common::Delegate>,
2054    _additional_params: HashMap<String, String>,
2055    _scopes: BTreeSet<String>,
2056}
2057
2058impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateGetCall<'a, C> {}
2059
2060impl<'a, C> ProjectLocationJobTemplateGetCall<'a, C>
2061where
2062    C: common::Connector,
2063{
2064    /// Perform the operation you have build so far.
2065    pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
2066        use std::borrow::Cow;
2067        use std::io::{Read, Seek};
2068
2069        use common::{url::Params, ToParts};
2070        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2071
2072        let mut dd = common::DefaultDelegate;
2073        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2074        dlg.begin(common::MethodInfo {
2075            id: "transcoder.projects.locations.jobTemplates.get",
2076            http_method: hyper::Method::GET,
2077        });
2078
2079        for &field in ["alt", "name"].iter() {
2080            if self._additional_params.contains_key(field) {
2081                dlg.finished(false);
2082                return Err(common::Error::FieldClash(field));
2083            }
2084        }
2085
2086        let mut params = Params::with_capacity(3 + self._additional_params.len());
2087        params.push("name", self._name);
2088
2089        params.extend(self._additional_params.iter());
2090
2091        params.push("alt", "json");
2092        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2093        if self._scopes.is_empty() {
2094            self._scopes
2095                .insert(Scope::CloudPlatform.as_ref().to_string());
2096        }
2097
2098        #[allow(clippy::single_element_loop)]
2099        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2100            url = params.uri_replacement(url, param_name, find_this, true);
2101        }
2102        {
2103            let to_remove = ["name"];
2104            params.remove_params(&to_remove);
2105        }
2106
2107        let url = params.parse_with_url(&url);
2108
2109        loop {
2110            let token = match self
2111                .hub
2112                .auth
2113                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2114                .await
2115            {
2116                Ok(token) => token,
2117                Err(e) => match dlg.token(e) {
2118                    Ok(token) => token,
2119                    Err(e) => {
2120                        dlg.finished(false);
2121                        return Err(common::Error::MissingToken(e));
2122                    }
2123                },
2124            };
2125            let mut req_result = {
2126                let client = &self.hub.client;
2127                dlg.pre_request();
2128                let mut req_builder = hyper::Request::builder()
2129                    .method(hyper::Method::GET)
2130                    .uri(url.as_str())
2131                    .header(USER_AGENT, self.hub._user_agent.clone());
2132
2133                if let Some(token) = token.as_ref() {
2134                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2135                }
2136
2137                let request = req_builder
2138                    .header(CONTENT_LENGTH, 0_u64)
2139                    .body(common::to_body::<String>(None));
2140
2141                client.request(request.unwrap()).await
2142            };
2143
2144            match req_result {
2145                Err(err) => {
2146                    if let common::Retry::After(d) = dlg.http_error(&err) {
2147                        sleep(d).await;
2148                        continue;
2149                    }
2150                    dlg.finished(false);
2151                    return Err(common::Error::HttpError(err));
2152                }
2153                Ok(res) => {
2154                    let (mut parts, body) = res.into_parts();
2155                    let mut body = common::Body::new(body);
2156                    if !parts.status.is_success() {
2157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2158                        let error = serde_json::from_str(&common::to_string(&bytes));
2159                        let response = common::to_response(parts, bytes.into());
2160
2161                        if let common::Retry::After(d) =
2162                            dlg.http_failure(&response, error.as_ref().ok())
2163                        {
2164                            sleep(d).await;
2165                            continue;
2166                        }
2167
2168                        dlg.finished(false);
2169
2170                        return Err(match error {
2171                            Ok(value) => common::Error::BadRequest(value),
2172                            _ => common::Error::Failure(response),
2173                        });
2174                    }
2175                    let response = {
2176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2177                        let encoded = common::to_string(&bytes);
2178                        match serde_json::from_str(&encoded) {
2179                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2180                            Err(error) => {
2181                                dlg.response_json_decode_error(&encoded, &error);
2182                                return Err(common::Error::JsonDecodeError(
2183                                    encoded.to_string(),
2184                                    error,
2185                                ));
2186                            }
2187                        }
2188                    };
2189
2190                    dlg.finished(true);
2191                    return Ok(response);
2192                }
2193            }
2194        }
2195    }
2196
2197    /// Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
2198    ///
2199    /// Sets the *name* path property to the given value.
2200    ///
2201    /// Even though the property as already been set when instantiating this call,
2202    /// we provide this method for API completeness.
2203    pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateGetCall<'a, C> {
2204        self._name = new_value.to_string();
2205        self
2206    }
2207    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2208    /// while executing the actual API request.
2209    ///
2210    /// ````text
2211    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2212    /// ````
2213    ///
2214    /// Sets the *delegate* property to the given value.
2215    pub fn delegate(
2216        mut self,
2217        new_value: &'a mut dyn common::Delegate,
2218    ) -> ProjectLocationJobTemplateGetCall<'a, C> {
2219        self._delegate = Some(new_value);
2220        self
2221    }
2222
2223    /// Set any additional parameter of the query string used in the request.
2224    /// It should be used to set parameters which are not yet available through their own
2225    /// setters.
2226    ///
2227    /// Please note that this method must not be used to set any of the known parameters
2228    /// which have their own setter method. If done anyway, the request will fail.
2229    ///
2230    /// # Additional Parameters
2231    ///
2232    /// * *$.xgafv* (query-string) - V1 error format.
2233    /// * *access_token* (query-string) - OAuth access token.
2234    /// * *alt* (query-string) - Data format for response.
2235    /// * *callback* (query-string) - JSONP
2236    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2237    /// * *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.
2238    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2239    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2240    /// * *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.
2241    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2242    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2243    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateGetCall<'a, C>
2244    where
2245        T: AsRef<str>,
2246    {
2247        self._additional_params
2248            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2249        self
2250    }
2251
2252    /// Identifies the authorization scope for the method you are building.
2253    ///
2254    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2255    /// [`Scope::CloudPlatform`].
2256    ///
2257    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2258    /// tokens for more than one scope.
2259    ///
2260    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2261    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2262    /// sufficient, a read-write scope will do as well.
2263    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateGetCall<'a, C>
2264    where
2265        St: AsRef<str>,
2266    {
2267        self._scopes.insert(String::from(scope.as_ref()));
2268        self
2269    }
2270    /// Identifies the authorization scope(s) for the method you are building.
2271    ///
2272    /// See [`Self::add_scope()`] for details.
2273    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateGetCall<'a, C>
2274    where
2275        I: IntoIterator<Item = St>,
2276        St: AsRef<str>,
2277    {
2278        self._scopes
2279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2280        self
2281    }
2282
2283    /// Removes all scopes, and no default scope will be used either.
2284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2285    /// for details).
2286    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateGetCall<'a, C> {
2287        self._scopes.clear();
2288        self
2289    }
2290}
2291
2292/// Lists job templates in the specified region.
2293///
2294/// A builder for the *locations.jobTemplates.list* method supported by a *project* resource.
2295/// It is not used directly, but through a [`ProjectMethods`] instance.
2296///
2297/// # Example
2298///
2299/// Instantiate a resource method builder
2300///
2301/// ```test_harness,no_run
2302/// # extern crate hyper;
2303/// # extern crate hyper_rustls;
2304/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
2305/// # async fn dox() {
2306/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2307///
2308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2309/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2310/// #     secret,
2311/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2312/// # ).build().await.unwrap();
2313///
2314/// # let client = hyper_util::client::legacy::Client::builder(
2315/// #     hyper_util::rt::TokioExecutor::new()
2316/// # )
2317/// # .build(
2318/// #     hyper_rustls::HttpsConnectorBuilder::new()
2319/// #         .with_native_roots()
2320/// #         .unwrap()
2321/// #         .https_or_http()
2322/// #         .enable_http1()
2323/// #         .build()
2324/// # );
2325/// # let mut hub = Transcoder::new(client, auth);
2326/// // You can configure optional parameters by calling the respective setters at will, and
2327/// // execute the final call using `doit()`.
2328/// // Values shown here are possibly random and not representative !
2329/// let result = hub.projects().locations_job_templates_list("parent")
2330///              .page_token("amet.")
2331///              .page_size(-59)
2332///              .doit().await;
2333/// # }
2334/// ```
2335pub struct ProjectLocationJobTemplateListCall<'a, C>
2336where
2337    C: 'a,
2338{
2339    hub: &'a Transcoder<C>,
2340    _parent: String,
2341    _page_token: Option<String>,
2342    _page_size: Option<i32>,
2343    _delegate: Option<&'a mut dyn common::Delegate>,
2344    _additional_params: HashMap<String, String>,
2345    _scopes: BTreeSet<String>,
2346}
2347
2348impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateListCall<'a, C> {}
2349
2350impl<'a, C> ProjectLocationJobTemplateListCall<'a, C>
2351where
2352    C: common::Connector,
2353{
2354    /// Perform the operation you have build so far.
2355    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobTemplatesResponse)> {
2356        use std::borrow::Cow;
2357        use std::io::{Read, Seek};
2358
2359        use common::{url::Params, ToParts};
2360        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2361
2362        let mut dd = common::DefaultDelegate;
2363        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2364        dlg.begin(common::MethodInfo {
2365            id: "transcoder.projects.locations.jobTemplates.list",
2366            http_method: hyper::Method::GET,
2367        });
2368
2369        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2370            if self._additional_params.contains_key(field) {
2371                dlg.finished(false);
2372                return Err(common::Error::FieldClash(field));
2373            }
2374        }
2375
2376        let mut params = Params::with_capacity(5 + self._additional_params.len());
2377        params.push("parent", self._parent);
2378        if let Some(value) = self._page_token.as_ref() {
2379            params.push("pageToken", value);
2380        }
2381        if let Some(value) = self._page_size.as_ref() {
2382            params.push("pageSize", value.to_string());
2383        }
2384
2385        params.extend(self._additional_params.iter());
2386
2387        params.push("alt", "json");
2388        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobTemplates";
2389        if self._scopes.is_empty() {
2390            self._scopes
2391                .insert(Scope::CloudPlatform.as_ref().to_string());
2392        }
2393
2394        #[allow(clippy::single_element_loop)]
2395        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2396            url = params.uri_replacement(url, param_name, find_this, true);
2397        }
2398        {
2399            let to_remove = ["parent"];
2400            params.remove_params(&to_remove);
2401        }
2402
2403        let url = params.parse_with_url(&url);
2404
2405        loop {
2406            let token = match self
2407                .hub
2408                .auth
2409                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2410                .await
2411            {
2412                Ok(token) => token,
2413                Err(e) => match dlg.token(e) {
2414                    Ok(token) => token,
2415                    Err(e) => {
2416                        dlg.finished(false);
2417                        return Err(common::Error::MissingToken(e));
2418                    }
2419                },
2420            };
2421            let mut req_result = {
2422                let client = &self.hub.client;
2423                dlg.pre_request();
2424                let mut req_builder = hyper::Request::builder()
2425                    .method(hyper::Method::GET)
2426                    .uri(url.as_str())
2427                    .header(USER_AGENT, self.hub._user_agent.clone());
2428
2429                if let Some(token) = token.as_ref() {
2430                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2431                }
2432
2433                let request = req_builder
2434                    .header(CONTENT_LENGTH, 0_u64)
2435                    .body(common::to_body::<String>(None));
2436
2437                client.request(request.unwrap()).await
2438            };
2439
2440            match req_result {
2441                Err(err) => {
2442                    if let common::Retry::After(d) = dlg.http_error(&err) {
2443                        sleep(d).await;
2444                        continue;
2445                    }
2446                    dlg.finished(false);
2447                    return Err(common::Error::HttpError(err));
2448                }
2449                Ok(res) => {
2450                    let (mut parts, body) = res.into_parts();
2451                    let mut body = common::Body::new(body);
2452                    if !parts.status.is_success() {
2453                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2454                        let error = serde_json::from_str(&common::to_string(&bytes));
2455                        let response = common::to_response(parts, bytes.into());
2456
2457                        if let common::Retry::After(d) =
2458                            dlg.http_failure(&response, error.as_ref().ok())
2459                        {
2460                            sleep(d).await;
2461                            continue;
2462                        }
2463
2464                        dlg.finished(false);
2465
2466                        return Err(match error {
2467                            Ok(value) => common::Error::BadRequest(value),
2468                            _ => common::Error::Failure(response),
2469                        });
2470                    }
2471                    let response = {
2472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2473                        let encoded = common::to_string(&bytes);
2474                        match serde_json::from_str(&encoded) {
2475                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2476                            Err(error) => {
2477                                dlg.response_json_decode_error(&encoded, &error);
2478                                return Err(common::Error::JsonDecodeError(
2479                                    encoded.to_string(),
2480                                    error,
2481                                ));
2482                            }
2483                        }
2484                    };
2485
2486                    dlg.finished(true);
2487                    return Ok(response);
2488                }
2489            }
2490        }
2491    }
2492
2493    /// Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
2494    ///
2495    /// Sets the *parent* path property to the given value.
2496    ///
2497    /// Even though the property as already been set when instantiating this call,
2498    /// we provide this method for API completeness.
2499    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2500        self._parent = new_value.to_string();
2501        self
2502    }
2503    /// The `next_page_token` value returned from a previous List request, if any.
2504    ///
2505    /// Sets the *page token* query property to the given value.
2506    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2507        self._page_token = Some(new_value.to_string());
2508        self
2509    }
2510    /// The maximum number of items to return.
2511    ///
2512    /// Sets the *page size* query property to the given value.
2513    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobTemplateListCall<'a, C> {
2514        self._page_size = Some(new_value);
2515        self
2516    }
2517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2518    /// while executing the actual API request.
2519    ///
2520    /// ````text
2521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2522    /// ````
2523    ///
2524    /// Sets the *delegate* property to the given value.
2525    pub fn delegate(
2526        mut self,
2527        new_value: &'a mut dyn common::Delegate,
2528    ) -> ProjectLocationJobTemplateListCall<'a, C> {
2529        self._delegate = Some(new_value);
2530        self
2531    }
2532
2533    /// Set any additional parameter of the query string used in the request.
2534    /// It should be used to set parameters which are not yet available through their own
2535    /// setters.
2536    ///
2537    /// Please note that this method must not be used to set any of the known parameters
2538    /// which have their own setter method. If done anyway, the request will fail.
2539    ///
2540    /// # Additional Parameters
2541    ///
2542    /// * *$.xgafv* (query-string) - V1 error format.
2543    /// * *access_token* (query-string) - OAuth access token.
2544    /// * *alt* (query-string) - Data format for response.
2545    /// * *callback* (query-string) - JSONP
2546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2547    /// * *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.
2548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2550    /// * *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.
2551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2553    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateListCall<'a, C>
2554    where
2555        T: AsRef<str>,
2556    {
2557        self._additional_params
2558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2559        self
2560    }
2561
2562    /// Identifies the authorization scope for the method you are building.
2563    ///
2564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2565    /// [`Scope::CloudPlatform`].
2566    ///
2567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2568    /// tokens for more than one scope.
2569    ///
2570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2572    /// sufficient, a read-write scope will do as well.
2573    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateListCall<'a, C>
2574    where
2575        St: AsRef<str>,
2576    {
2577        self._scopes.insert(String::from(scope.as_ref()));
2578        self
2579    }
2580    /// Identifies the authorization scope(s) for the method you are building.
2581    ///
2582    /// See [`Self::add_scope()`] for details.
2583    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateListCall<'a, C>
2584    where
2585        I: IntoIterator<Item = St>,
2586        St: AsRef<str>,
2587    {
2588        self._scopes
2589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2590        self
2591    }
2592
2593    /// Removes all scopes, and no default scope will be used either.
2594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2595    /// for details).
2596    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateListCall<'a, C> {
2597        self._scopes.clear();
2598        self
2599    }
2600}
2601
2602/// Creates a job in the specified region.
2603///
2604/// A builder for the *locations.jobs.create* method supported by a *project* resource.
2605/// It is not used directly, but through a [`ProjectMethods`] instance.
2606///
2607/// # Example
2608///
2609/// Instantiate a resource method builder
2610///
2611/// ```test_harness,no_run
2612/// # extern crate hyper;
2613/// # extern crate hyper_rustls;
2614/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
2615/// use transcoder1_beta1::api::Job;
2616/// # async fn dox() {
2617/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2618///
2619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2620/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2621/// #     secret,
2622/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2623/// # ).build().await.unwrap();
2624///
2625/// # let client = hyper_util::client::legacy::Client::builder(
2626/// #     hyper_util::rt::TokioExecutor::new()
2627/// # )
2628/// # .build(
2629/// #     hyper_rustls::HttpsConnectorBuilder::new()
2630/// #         .with_native_roots()
2631/// #         .unwrap()
2632/// #         .https_or_http()
2633/// #         .enable_http1()
2634/// #         .build()
2635/// # );
2636/// # let mut hub = Transcoder::new(client, auth);
2637/// // As the method needs a request, you would usually fill it with the desired information
2638/// // into the respective structure. Some of the parts shown here might not be applicable !
2639/// // Values shown here are possibly random and not representative !
2640/// let mut req = Job::default();
2641///
2642/// // You can configure optional parameters by calling the respective setters at will, and
2643/// // execute the final call using `doit()`.
2644/// // Values shown here are possibly random and not representative !
2645/// let result = hub.projects().locations_jobs_create(req, "parent")
2646///              .doit().await;
2647/// # }
2648/// ```
2649pub struct ProjectLocationJobCreateCall<'a, C>
2650where
2651    C: 'a,
2652{
2653    hub: &'a Transcoder<C>,
2654    _request: Job,
2655    _parent: String,
2656    _delegate: Option<&'a mut dyn common::Delegate>,
2657    _additional_params: HashMap<String, String>,
2658    _scopes: BTreeSet<String>,
2659}
2660
2661impl<'a, C> common::CallBuilder for ProjectLocationJobCreateCall<'a, C> {}
2662
2663impl<'a, C> ProjectLocationJobCreateCall<'a, C>
2664where
2665    C: common::Connector,
2666{
2667    /// Perform the operation you have build so far.
2668    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
2669        use std::borrow::Cow;
2670        use std::io::{Read, Seek};
2671
2672        use common::{url::Params, ToParts};
2673        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2674
2675        let mut dd = common::DefaultDelegate;
2676        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2677        dlg.begin(common::MethodInfo {
2678            id: "transcoder.projects.locations.jobs.create",
2679            http_method: hyper::Method::POST,
2680        });
2681
2682        for &field in ["alt", "parent"].iter() {
2683            if self._additional_params.contains_key(field) {
2684                dlg.finished(false);
2685                return Err(common::Error::FieldClash(field));
2686            }
2687        }
2688
2689        let mut params = Params::with_capacity(4 + self._additional_params.len());
2690        params.push("parent", self._parent);
2691
2692        params.extend(self._additional_params.iter());
2693
2694        params.push("alt", "json");
2695        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobs";
2696        if self._scopes.is_empty() {
2697            self._scopes
2698                .insert(Scope::CloudPlatform.as_ref().to_string());
2699        }
2700
2701        #[allow(clippy::single_element_loop)]
2702        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2703            url = params.uri_replacement(url, param_name, find_this, true);
2704        }
2705        {
2706            let to_remove = ["parent"];
2707            params.remove_params(&to_remove);
2708        }
2709
2710        let url = params.parse_with_url(&url);
2711
2712        let mut json_mime_type = mime::APPLICATION_JSON;
2713        let mut request_value_reader = {
2714            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2715            common::remove_json_null_values(&mut value);
2716            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2717            serde_json::to_writer(&mut dst, &value).unwrap();
2718            dst
2719        };
2720        let request_size = request_value_reader
2721            .seek(std::io::SeekFrom::End(0))
2722            .unwrap();
2723        request_value_reader
2724            .seek(std::io::SeekFrom::Start(0))
2725            .unwrap();
2726
2727        loop {
2728            let token = match self
2729                .hub
2730                .auth
2731                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2732                .await
2733            {
2734                Ok(token) => token,
2735                Err(e) => match dlg.token(e) {
2736                    Ok(token) => token,
2737                    Err(e) => {
2738                        dlg.finished(false);
2739                        return Err(common::Error::MissingToken(e));
2740                    }
2741                },
2742            };
2743            request_value_reader
2744                .seek(std::io::SeekFrom::Start(0))
2745                .unwrap();
2746            let mut req_result = {
2747                let client = &self.hub.client;
2748                dlg.pre_request();
2749                let mut req_builder = hyper::Request::builder()
2750                    .method(hyper::Method::POST)
2751                    .uri(url.as_str())
2752                    .header(USER_AGENT, self.hub._user_agent.clone());
2753
2754                if let Some(token) = token.as_ref() {
2755                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2756                }
2757
2758                let request = req_builder
2759                    .header(CONTENT_TYPE, json_mime_type.to_string())
2760                    .header(CONTENT_LENGTH, request_size as u64)
2761                    .body(common::to_body(
2762                        request_value_reader.get_ref().clone().into(),
2763                    ));
2764
2765                client.request(request.unwrap()).await
2766            };
2767
2768            match req_result {
2769                Err(err) => {
2770                    if let common::Retry::After(d) = dlg.http_error(&err) {
2771                        sleep(d).await;
2772                        continue;
2773                    }
2774                    dlg.finished(false);
2775                    return Err(common::Error::HttpError(err));
2776                }
2777                Ok(res) => {
2778                    let (mut parts, body) = res.into_parts();
2779                    let mut body = common::Body::new(body);
2780                    if !parts.status.is_success() {
2781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2782                        let error = serde_json::from_str(&common::to_string(&bytes));
2783                        let response = common::to_response(parts, bytes.into());
2784
2785                        if let common::Retry::After(d) =
2786                            dlg.http_failure(&response, error.as_ref().ok())
2787                        {
2788                            sleep(d).await;
2789                            continue;
2790                        }
2791
2792                        dlg.finished(false);
2793
2794                        return Err(match error {
2795                            Ok(value) => common::Error::BadRequest(value),
2796                            _ => common::Error::Failure(response),
2797                        });
2798                    }
2799                    let response = {
2800                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2801                        let encoded = common::to_string(&bytes);
2802                        match serde_json::from_str(&encoded) {
2803                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2804                            Err(error) => {
2805                                dlg.response_json_decode_error(&encoded, &error);
2806                                return Err(common::Error::JsonDecodeError(
2807                                    encoded.to_string(),
2808                                    error,
2809                                ));
2810                            }
2811                        }
2812                    };
2813
2814                    dlg.finished(true);
2815                    return Ok(response);
2816                }
2817            }
2818        }
2819    }
2820
2821    ///
2822    /// Sets the *request* property to the given value.
2823    ///
2824    /// Even though the property as already been set when instantiating this call,
2825    /// we provide this method for API completeness.
2826    pub fn request(mut self, new_value: Job) -> ProjectLocationJobCreateCall<'a, C> {
2827        self._request = new_value;
2828        self
2829    }
2830    /// Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
2831    ///
2832    /// Sets the *parent* path property to the given value.
2833    ///
2834    /// Even though the property as already been set when instantiating this call,
2835    /// we provide this method for API completeness.
2836    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C> {
2837        self._parent = new_value.to_string();
2838        self
2839    }
2840    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2841    /// while executing the actual API request.
2842    ///
2843    /// ````text
2844    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2845    /// ````
2846    ///
2847    /// Sets the *delegate* property to the given value.
2848    pub fn delegate(
2849        mut self,
2850        new_value: &'a mut dyn common::Delegate,
2851    ) -> ProjectLocationJobCreateCall<'a, C> {
2852        self._delegate = Some(new_value);
2853        self
2854    }
2855
2856    /// Set any additional parameter of the query string used in the request.
2857    /// It should be used to set parameters which are not yet available through their own
2858    /// setters.
2859    ///
2860    /// Please note that this method must not be used to set any of the known parameters
2861    /// which have their own setter method. If done anyway, the request will fail.
2862    ///
2863    /// # Additional Parameters
2864    ///
2865    /// * *$.xgafv* (query-string) - V1 error format.
2866    /// * *access_token* (query-string) - OAuth access token.
2867    /// * *alt* (query-string) - Data format for response.
2868    /// * *callback* (query-string) - JSONP
2869    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2870    /// * *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.
2871    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2872    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2873    /// * *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.
2874    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2875    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2876    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobCreateCall<'a, C>
2877    where
2878        T: AsRef<str>,
2879    {
2880        self._additional_params
2881            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2882        self
2883    }
2884
2885    /// Identifies the authorization scope for the method you are building.
2886    ///
2887    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2888    /// [`Scope::CloudPlatform`].
2889    ///
2890    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2891    /// tokens for more than one scope.
2892    ///
2893    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2894    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2895    /// sufficient, a read-write scope will do as well.
2896    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobCreateCall<'a, C>
2897    where
2898        St: AsRef<str>,
2899    {
2900        self._scopes.insert(String::from(scope.as_ref()));
2901        self
2902    }
2903    /// Identifies the authorization scope(s) for the method you are building.
2904    ///
2905    /// See [`Self::add_scope()`] for details.
2906    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobCreateCall<'a, C>
2907    where
2908        I: IntoIterator<Item = St>,
2909        St: AsRef<str>,
2910    {
2911        self._scopes
2912            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2913        self
2914    }
2915
2916    /// Removes all scopes, and no default scope will be used either.
2917    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2918    /// for details).
2919    pub fn clear_scopes(mut self) -> ProjectLocationJobCreateCall<'a, C> {
2920        self._scopes.clear();
2921        self
2922    }
2923}
2924
2925/// Deletes a job.
2926///
2927/// A builder for the *locations.jobs.delete* method supported by a *project* resource.
2928/// It is not used directly, but through a [`ProjectMethods`] instance.
2929///
2930/// # Example
2931///
2932/// Instantiate a resource method builder
2933///
2934/// ```test_harness,no_run
2935/// # extern crate hyper;
2936/// # extern crate hyper_rustls;
2937/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
2938/// # async fn dox() {
2939/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2940///
2941/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2942/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2943/// #     secret,
2944/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2945/// # ).build().await.unwrap();
2946///
2947/// # let client = hyper_util::client::legacy::Client::builder(
2948/// #     hyper_util::rt::TokioExecutor::new()
2949/// # )
2950/// # .build(
2951/// #     hyper_rustls::HttpsConnectorBuilder::new()
2952/// #         .with_native_roots()
2953/// #         .unwrap()
2954/// #         .https_or_http()
2955/// #         .enable_http1()
2956/// #         .build()
2957/// # );
2958/// # let mut hub = Transcoder::new(client, auth);
2959/// // You can configure optional parameters by calling the respective setters at will, and
2960/// // execute the final call using `doit()`.
2961/// // Values shown here are possibly random and not representative !
2962/// let result = hub.projects().locations_jobs_delete("name")
2963///              .doit().await;
2964/// # }
2965/// ```
2966pub struct ProjectLocationJobDeleteCall<'a, C>
2967where
2968    C: 'a,
2969{
2970    hub: &'a Transcoder<C>,
2971    _name: String,
2972    _delegate: Option<&'a mut dyn common::Delegate>,
2973    _additional_params: HashMap<String, String>,
2974    _scopes: BTreeSet<String>,
2975}
2976
2977impl<'a, C> common::CallBuilder for ProjectLocationJobDeleteCall<'a, C> {}
2978
2979impl<'a, C> ProjectLocationJobDeleteCall<'a, C>
2980where
2981    C: common::Connector,
2982{
2983    /// Perform the operation you have build so far.
2984    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2985        use std::borrow::Cow;
2986        use std::io::{Read, Seek};
2987
2988        use common::{url::Params, ToParts};
2989        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2990
2991        let mut dd = common::DefaultDelegate;
2992        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2993        dlg.begin(common::MethodInfo {
2994            id: "transcoder.projects.locations.jobs.delete",
2995            http_method: hyper::Method::DELETE,
2996        });
2997
2998        for &field in ["alt", "name"].iter() {
2999            if self._additional_params.contains_key(field) {
3000                dlg.finished(false);
3001                return Err(common::Error::FieldClash(field));
3002            }
3003        }
3004
3005        let mut params = Params::with_capacity(3 + self._additional_params.len());
3006        params.push("name", self._name);
3007
3008        params.extend(self._additional_params.iter());
3009
3010        params.push("alt", "json");
3011        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3012        if self._scopes.is_empty() {
3013            self._scopes
3014                .insert(Scope::CloudPlatform.as_ref().to_string());
3015        }
3016
3017        #[allow(clippy::single_element_loop)]
3018        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3019            url = params.uri_replacement(url, param_name, find_this, true);
3020        }
3021        {
3022            let to_remove = ["name"];
3023            params.remove_params(&to_remove);
3024        }
3025
3026        let url = params.parse_with_url(&url);
3027
3028        loop {
3029            let token = match self
3030                .hub
3031                .auth
3032                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3033                .await
3034            {
3035                Ok(token) => token,
3036                Err(e) => match dlg.token(e) {
3037                    Ok(token) => token,
3038                    Err(e) => {
3039                        dlg.finished(false);
3040                        return Err(common::Error::MissingToken(e));
3041                    }
3042                },
3043            };
3044            let mut req_result = {
3045                let client = &self.hub.client;
3046                dlg.pre_request();
3047                let mut req_builder = hyper::Request::builder()
3048                    .method(hyper::Method::DELETE)
3049                    .uri(url.as_str())
3050                    .header(USER_AGENT, self.hub._user_agent.clone());
3051
3052                if let Some(token) = token.as_ref() {
3053                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3054                }
3055
3056                let request = req_builder
3057                    .header(CONTENT_LENGTH, 0_u64)
3058                    .body(common::to_body::<String>(None));
3059
3060                client.request(request.unwrap()).await
3061            };
3062
3063            match req_result {
3064                Err(err) => {
3065                    if let common::Retry::After(d) = dlg.http_error(&err) {
3066                        sleep(d).await;
3067                        continue;
3068                    }
3069                    dlg.finished(false);
3070                    return Err(common::Error::HttpError(err));
3071                }
3072                Ok(res) => {
3073                    let (mut parts, body) = res.into_parts();
3074                    let mut body = common::Body::new(body);
3075                    if !parts.status.is_success() {
3076                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3077                        let error = serde_json::from_str(&common::to_string(&bytes));
3078                        let response = common::to_response(parts, bytes.into());
3079
3080                        if let common::Retry::After(d) =
3081                            dlg.http_failure(&response, error.as_ref().ok())
3082                        {
3083                            sleep(d).await;
3084                            continue;
3085                        }
3086
3087                        dlg.finished(false);
3088
3089                        return Err(match error {
3090                            Ok(value) => common::Error::BadRequest(value),
3091                            _ => common::Error::Failure(response),
3092                        });
3093                    }
3094                    let response = {
3095                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3096                        let encoded = common::to_string(&bytes);
3097                        match serde_json::from_str(&encoded) {
3098                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3099                            Err(error) => {
3100                                dlg.response_json_decode_error(&encoded, &error);
3101                                return Err(common::Error::JsonDecodeError(
3102                                    encoded.to_string(),
3103                                    error,
3104                                ));
3105                            }
3106                        }
3107                    };
3108
3109                    dlg.finished(true);
3110                    return Ok(response);
3111                }
3112            }
3113        }
3114    }
3115
3116    /// Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
3117    ///
3118    /// Sets the *name* path property to the given value.
3119    ///
3120    /// Even though the property as already been set when instantiating this call,
3121    /// we provide this method for API completeness.
3122    pub fn name(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C> {
3123        self._name = new_value.to_string();
3124        self
3125    }
3126    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3127    /// while executing the actual API request.
3128    ///
3129    /// ````text
3130    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3131    /// ````
3132    ///
3133    /// Sets the *delegate* property to the given value.
3134    pub fn delegate(
3135        mut self,
3136        new_value: &'a mut dyn common::Delegate,
3137    ) -> ProjectLocationJobDeleteCall<'a, C> {
3138        self._delegate = Some(new_value);
3139        self
3140    }
3141
3142    /// Set any additional parameter of the query string used in the request.
3143    /// It should be used to set parameters which are not yet available through their own
3144    /// setters.
3145    ///
3146    /// Please note that this method must not be used to set any of the known parameters
3147    /// which have their own setter method. If done anyway, the request will fail.
3148    ///
3149    /// # Additional Parameters
3150    ///
3151    /// * *$.xgafv* (query-string) - V1 error format.
3152    /// * *access_token* (query-string) - OAuth access token.
3153    /// * *alt* (query-string) - Data format for response.
3154    /// * *callback* (query-string) - JSONP
3155    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3156    /// * *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.
3157    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3158    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3159    /// * *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.
3160    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3161    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3162    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobDeleteCall<'a, C>
3163    where
3164        T: AsRef<str>,
3165    {
3166        self._additional_params
3167            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3168        self
3169    }
3170
3171    /// Identifies the authorization scope for the method you are building.
3172    ///
3173    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3174    /// [`Scope::CloudPlatform`].
3175    ///
3176    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3177    /// tokens for more than one scope.
3178    ///
3179    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3180    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3181    /// sufficient, a read-write scope will do as well.
3182    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobDeleteCall<'a, C>
3183    where
3184        St: AsRef<str>,
3185    {
3186        self._scopes.insert(String::from(scope.as_ref()));
3187        self
3188    }
3189    /// Identifies the authorization scope(s) for the method you are building.
3190    ///
3191    /// See [`Self::add_scope()`] for details.
3192    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobDeleteCall<'a, C>
3193    where
3194        I: IntoIterator<Item = St>,
3195        St: AsRef<str>,
3196    {
3197        self._scopes
3198            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3199        self
3200    }
3201
3202    /// Removes all scopes, and no default scope will be used either.
3203    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3204    /// for details).
3205    pub fn clear_scopes(mut self) -> ProjectLocationJobDeleteCall<'a, C> {
3206        self._scopes.clear();
3207        self
3208    }
3209}
3210
3211/// Returns the job data.
3212///
3213/// A builder for the *locations.jobs.get* method supported by a *project* resource.
3214/// It is not used directly, but through a [`ProjectMethods`] instance.
3215///
3216/// # Example
3217///
3218/// Instantiate a resource method builder
3219///
3220/// ```test_harness,no_run
3221/// # extern crate hyper;
3222/// # extern crate hyper_rustls;
3223/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
3224/// # async fn dox() {
3225/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3226///
3227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3228/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3229/// #     secret,
3230/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3231/// # ).build().await.unwrap();
3232///
3233/// # let client = hyper_util::client::legacy::Client::builder(
3234/// #     hyper_util::rt::TokioExecutor::new()
3235/// # )
3236/// # .build(
3237/// #     hyper_rustls::HttpsConnectorBuilder::new()
3238/// #         .with_native_roots()
3239/// #         .unwrap()
3240/// #         .https_or_http()
3241/// #         .enable_http1()
3242/// #         .build()
3243/// # );
3244/// # let mut hub = Transcoder::new(client, auth);
3245/// // You can configure optional parameters by calling the respective setters at will, and
3246/// // execute the final call using `doit()`.
3247/// // Values shown here are possibly random and not representative !
3248/// let result = hub.projects().locations_jobs_get("name")
3249///              .doit().await;
3250/// # }
3251/// ```
3252pub struct ProjectLocationJobGetCall<'a, C>
3253where
3254    C: 'a,
3255{
3256    hub: &'a Transcoder<C>,
3257    _name: String,
3258    _delegate: Option<&'a mut dyn common::Delegate>,
3259    _additional_params: HashMap<String, String>,
3260    _scopes: BTreeSet<String>,
3261}
3262
3263impl<'a, C> common::CallBuilder for ProjectLocationJobGetCall<'a, C> {}
3264
3265impl<'a, C> ProjectLocationJobGetCall<'a, C>
3266where
3267    C: common::Connector,
3268{
3269    /// Perform the operation you have build so far.
3270    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
3271        use std::borrow::Cow;
3272        use std::io::{Read, Seek};
3273
3274        use common::{url::Params, ToParts};
3275        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3276
3277        let mut dd = common::DefaultDelegate;
3278        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3279        dlg.begin(common::MethodInfo {
3280            id: "transcoder.projects.locations.jobs.get",
3281            http_method: hyper::Method::GET,
3282        });
3283
3284        for &field in ["alt", "name"].iter() {
3285            if self._additional_params.contains_key(field) {
3286                dlg.finished(false);
3287                return Err(common::Error::FieldClash(field));
3288            }
3289        }
3290
3291        let mut params = Params::with_capacity(3 + self._additional_params.len());
3292        params.push("name", self._name);
3293
3294        params.extend(self._additional_params.iter());
3295
3296        params.push("alt", "json");
3297        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3298        if self._scopes.is_empty() {
3299            self._scopes
3300                .insert(Scope::CloudPlatform.as_ref().to_string());
3301        }
3302
3303        #[allow(clippy::single_element_loop)]
3304        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3305            url = params.uri_replacement(url, param_name, find_this, true);
3306        }
3307        {
3308            let to_remove = ["name"];
3309            params.remove_params(&to_remove);
3310        }
3311
3312        let url = params.parse_with_url(&url);
3313
3314        loop {
3315            let token = match self
3316                .hub
3317                .auth
3318                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3319                .await
3320            {
3321                Ok(token) => token,
3322                Err(e) => match dlg.token(e) {
3323                    Ok(token) => token,
3324                    Err(e) => {
3325                        dlg.finished(false);
3326                        return Err(common::Error::MissingToken(e));
3327                    }
3328                },
3329            };
3330            let mut req_result = {
3331                let client = &self.hub.client;
3332                dlg.pre_request();
3333                let mut req_builder = hyper::Request::builder()
3334                    .method(hyper::Method::GET)
3335                    .uri(url.as_str())
3336                    .header(USER_AGENT, self.hub._user_agent.clone());
3337
3338                if let Some(token) = token.as_ref() {
3339                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3340                }
3341
3342                let request = req_builder
3343                    .header(CONTENT_LENGTH, 0_u64)
3344                    .body(common::to_body::<String>(None));
3345
3346                client.request(request.unwrap()).await
3347            };
3348
3349            match req_result {
3350                Err(err) => {
3351                    if let common::Retry::After(d) = dlg.http_error(&err) {
3352                        sleep(d).await;
3353                        continue;
3354                    }
3355                    dlg.finished(false);
3356                    return Err(common::Error::HttpError(err));
3357                }
3358                Ok(res) => {
3359                    let (mut parts, body) = res.into_parts();
3360                    let mut body = common::Body::new(body);
3361                    if !parts.status.is_success() {
3362                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3363                        let error = serde_json::from_str(&common::to_string(&bytes));
3364                        let response = common::to_response(parts, bytes.into());
3365
3366                        if let common::Retry::After(d) =
3367                            dlg.http_failure(&response, error.as_ref().ok())
3368                        {
3369                            sleep(d).await;
3370                            continue;
3371                        }
3372
3373                        dlg.finished(false);
3374
3375                        return Err(match error {
3376                            Ok(value) => common::Error::BadRequest(value),
3377                            _ => common::Error::Failure(response),
3378                        });
3379                    }
3380                    let response = {
3381                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3382                        let encoded = common::to_string(&bytes);
3383                        match serde_json::from_str(&encoded) {
3384                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3385                            Err(error) => {
3386                                dlg.response_json_decode_error(&encoded, &error);
3387                                return Err(common::Error::JsonDecodeError(
3388                                    encoded.to_string(),
3389                                    error,
3390                                ));
3391                            }
3392                        }
3393                    };
3394
3395                    dlg.finished(true);
3396                    return Ok(response);
3397                }
3398            }
3399        }
3400    }
3401
3402    /// Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
3403    ///
3404    /// Sets the *name* path property to the given value.
3405    ///
3406    /// Even though the property as already been set when instantiating this call,
3407    /// we provide this method for API completeness.
3408    pub fn name(mut self, new_value: &str) -> ProjectLocationJobGetCall<'a, C> {
3409        self._name = new_value.to_string();
3410        self
3411    }
3412    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3413    /// while executing the actual API request.
3414    ///
3415    /// ````text
3416    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3417    /// ````
3418    ///
3419    /// Sets the *delegate* property to the given value.
3420    pub fn delegate(
3421        mut self,
3422        new_value: &'a mut dyn common::Delegate,
3423    ) -> ProjectLocationJobGetCall<'a, C> {
3424        self._delegate = Some(new_value);
3425        self
3426    }
3427
3428    /// Set any additional parameter of the query string used in the request.
3429    /// It should be used to set parameters which are not yet available through their own
3430    /// setters.
3431    ///
3432    /// Please note that this method must not be used to set any of the known parameters
3433    /// which have their own setter method. If done anyway, the request will fail.
3434    ///
3435    /// # Additional Parameters
3436    ///
3437    /// * *$.xgafv* (query-string) - V1 error format.
3438    /// * *access_token* (query-string) - OAuth access token.
3439    /// * *alt* (query-string) - Data format for response.
3440    /// * *callback* (query-string) - JSONP
3441    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3442    /// * *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.
3443    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3444    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3445    /// * *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.
3446    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3447    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3448    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetCall<'a, C>
3449    where
3450        T: AsRef<str>,
3451    {
3452        self._additional_params
3453            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3454        self
3455    }
3456
3457    /// Identifies the authorization scope for the method you are building.
3458    ///
3459    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3460    /// [`Scope::CloudPlatform`].
3461    ///
3462    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3463    /// tokens for more than one scope.
3464    ///
3465    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3466    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3467    /// sufficient, a read-write scope will do as well.
3468    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetCall<'a, C>
3469    where
3470        St: AsRef<str>,
3471    {
3472        self._scopes.insert(String::from(scope.as_ref()));
3473        self
3474    }
3475    /// Identifies the authorization scope(s) for the method you are building.
3476    ///
3477    /// See [`Self::add_scope()`] for details.
3478    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetCall<'a, C>
3479    where
3480        I: IntoIterator<Item = St>,
3481        St: AsRef<str>,
3482    {
3483        self._scopes
3484            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3485        self
3486    }
3487
3488    /// Removes all scopes, and no default scope will be used either.
3489    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3490    /// for details).
3491    pub fn clear_scopes(mut self) -> ProjectLocationJobGetCall<'a, C> {
3492        self._scopes.clear();
3493        self
3494    }
3495}
3496
3497/// Lists jobs in the specified region.
3498///
3499/// A builder for the *locations.jobs.list* method supported by a *project* resource.
3500/// It is not used directly, but through a [`ProjectMethods`] instance.
3501///
3502/// # Example
3503///
3504/// Instantiate a resource method builder
3505///
3506/// ```test_harness,no_run
3507/// # extern crate hyper;
3508/// # extern crate hyper_rustls;
3509/// # extern crate google_transcoder1_beta1 as transcoder1_beta1;
3510/// # async fn dox() {
3511/// # use transcoder1_beta1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3512///
3513/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3514/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3515/// #     secret,
3516/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3517/// # ).build().await.unwrap();
3518///
3519/// # let client = hyper_util::client::legacy::Client::builder(
3520/// #     hyper_util::rt::TokioExecutor::new()
3521/// # )
3522/// # .build(
3523/// #     hyper_rustls::HttpsConnectorBuilder::new()
3524/// #         .with_native_roots()
3525/// #         .unwrap()
3526/// #         .https_or_http()
3527/// #         .enable_http1()
3528/// #         .build()
3529/// # );
3530/// # let mut hub = Transcoder::new(client, auth);
3531/// // You can configure optional parameters by calling the respective setters at will, and
3532/// // execute the final call using `doit()`.
3533/// // Values shown here are possibly random and not representative !
3534/// let result = hub.projects().locations_jobs_list("parent")
3535///              .page_token("Lorem")
3536///              .page_size(-12)
3537///              .doit().await;
3538/// # }
3539/// ```
3540pub struct ProjectLocationJobListCall<'a, C>
3541where
3542    C: 'a,
3543{
3544    hub: &'a Transcoder<C>,
3545    _parent: String,
3546    _page_token: Option<String>,
3547    _page_size: Option<i32>,
3548    _delegate: Option<&'a mut dyn common::Delegate>,
3549    _additional_params: HashMap<String, String>,
3550    _scopes: BTreeSet<String>,
3551}
3552
3553impl<'a, C> common::CallBuilder for ProjectLocationJobListCall<'a, C> {}
3554
3555impl<'a, C> ProjectLocationJobListCall<'a, C>
3556where
3557    C: common::Connector,
3558{
3559    /// Perform the operation you have build so far.
3560    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
3561        use std::borrow::Cow;
3562        use std::io::{Read, Seek};
3563
3564        use common::{url::Params, ToParts};
3565        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3566
3567        let mut dd = common::DefaultDelegate;
3568        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3569        dlg.begin(common::MethodInfo {
3570            id: "transcoder.projects.locations.jobs.list",
3571            http_method: hyper::Method::GET,
3572        });
3573
3574        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3575            if self._additional_params.contains_key(field) {
3576                dlg.finished(false);
3577                return Err(common::Error::FieldClash(field));
3578            }
3579        }
3580
3581        let mut params = Params::with_capacity(5 + self._additional_params.len());
3582        params.push("parent", self._parent);
3583        if let Some(value) = self._page_token.as_ref() {
3584            params.push("pageToken", value);
3585        }
3586        if let Some(value) = self._page_size.as_ref() {
3587            params.push("pageSize", value.to_string());
3588        }
3589
3590        params.extend(self._additional_params.iter());
3591
3592        params.push("alt", "json");
3593        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/jobs";
3594        if self._scopes.is_empty() {
3595            self._scopes
3596                .insert(Scope::CloudPlatform.as_ref().to_string());
3597        }
3598
3599        #[allow(clippy::single_element_loop)]
3600        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3601            url = params.uri_replacement(url, param_name, find_this, true);
3602        }
3603        {
3604            let to_remove = ["parent"];
3605            params.remove_params(&to_remove);
3606        }
3607
3608        let url = params.parse_with_url(&url);
3609
3610        loop {
3611            let token = match self
3612                .hub
3613                .auth
3614                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3615                .await
3616            {
3617                Ok(token) => token,
3618                Err(e) => match dlg.token(e) {
3619                    Ok(token) => token,
3620                    Err(e) => {
3621                        dlg.finished(false);
3622                        return Err(common::Error::MissingToken(e));
3623                    }
3624                },
3625            };
3626            let mut req_result = {
3627                let client = &self.hub.client;
3628                dlg.pre_request();
3629                let mut req_builder = hyper::Request::builder()
3630                    .method(hyper::Method::GET)
3631                    .uri(url.as_str())
3632                    .header(USER_AGENT, self.hub._user_agent.clone());
3633
3634                if let Some(token) = token.as_ref() {
3635                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3636                }
3637
3638                let request = req_builder
3639                    .header(CONTENT_LENGTH, 0_u64)
3640                    .body(common::to_body::<String>(None));
3641
3642                client.request(request.unwrap()).await
3643            };
3644
3645            match req_result {
3646                Err(err) => {
3647                    if let common::Retry::After(d) = dlg.http_error(&err) {
3648                        sleep(d).await;
3649                        continue;
3650                    }
3651                    dlg.finished(false);
3652                    return Err(common::Error::HttpError(err));
3653                }
3654                Ok(res) => {
3655                    let (mut parts, body) = res.into_parts();
3656                    let mut body = common::Body::new(body);
3657                    if !parts.status.is_success() {
3658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3659                        let error = serde_json::from_str(&common::to_string(&bytes));
3660                        let response = common::to_response(parts, bytes.into());
3661
3662                        if let common::Retry::After(d) =
3663                            dlg.http_failure(&response, error.as_ref().ok())
3664                        {
3665                            sleep(d).await;
3666                            continue;
3667                        }
3668
3669                        dlg.finished(false);
3670
3671                        return Err(match error {
3672                            Ok(value) => common::Error::BadRequest(value),
3673                            _ => common::Error::Failure(response),
3674                        });
3675                    }
3676                    let response = {
3677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3678                        let encoded = common::to_string(&bytes);
3679                        match serde_json::from_str(&encoded) {
3680                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3681                            Err(error) => {
3682                                dlg.response_json_decode_error(&encoded, &error);
3683                                return Err(common::Error::JsonDecodeError(
3684                                    encoded.to_string(),
3685                                    error,
3686                                ));
3687                            }
3688                        }
3689                    };
3690
3691                    dlg.finished(true);
3692                    return Ok(response);
3693                }
3694            }
3695        }
3696    }
3697
3698    /// Required. Format: `projects/{project}/locations/{location}`
3699    ///
3700    /// Sets the *parent* path property to the given value.
3701    ///
3702    /// Even though the property as already been set when instantiating this call,
3703    /// we provide this method for API completeness.
3704    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
3705        self._parent = new_value.to_string();
3706        self
3707    }
3708    /// The `next_page_token` value returned from a previous List request, if any.
3709    ///
3710    /// Sets the *page token* query property to the given value.
3711    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
3712        self._page_token = Some(new_value.to_string());
3713        self
3714    }
3715    /// The maximum number of items to return.
3716    ///
3717    /// Sets the *page size* query property to the given value.
3718    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobListCall<'a, C> {
3719        self._page_size = Some(new_value);
3720        self
3721    }
3722    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3723    /// while executing the actual API request.
3724    ///
3725    /// ````text
3726    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3727    /// ````
3728    ///
3729    /// Sets the *delegate* property to the given value.
3730    pub fn delegate(
3731        mut self,
3732        new_value: &'a mut dyn common::Delegate,
3733    ) -> ProjectLocationJobListCall<'a, C> {
3734        self._delegate = Some(new_value);
3735        self
3736    }
3737
3738    /// Set any additional parameter of the query string used in the request.
3739    /// It should be used to set parameters which are not yet available through their own
3740    /// setters.
3741    ///
3742    /// Please note that this method must not be used to set any of the known parameters
3743    /// which have their own setter method. If done anyway, the request will fail.
3744    ///
3745    /// # Additional Parameters
3746    ///
3747    /// * *$.xgafv* (query-string) - V1 error format.
3748    /// * *access_token* (query-string) - OAuth access token.
3749    /// * *alt* (query-string) - Data format for response.
3750    /// * *callback* (query-string) - JSONP
3751    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3752    /// * *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.
3753    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3754    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3755    /// * *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.
3756    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3757    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3758    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobListCall<'a, C>
3759    where
3760        T: AsRef<str>,
3761    {
3762        self._additional_params
3763            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3764        self
3765    }
3766
3767    /// Identifies the authorization scope for the method you are building.
3768    ///
3769    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3770    /// [`Scope::CloudPlatform`].
3771    ///
3772    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3773    /// tokens for more than one scope.
3774    ///
3775    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3776    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3777    /// sufficient, a read-write scope will do as well.
3778    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobListCall<'a, C>
3779    where
3780        St: AsRef<str>,
3781    {
3782        self._scopes.insert(String::from(scope.as_ref()));
3783        self
3784    }
3785    /// Identifies the authorization scope(s) for the method you are building.
3786    ///
3787    /// See [`Self::add_scope()`] for details.
3788    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobListCall<'a, C>
3789    where
3790        I: IntoIterator<Item = St>,
3791        St: AsRef<str>,
3792    {
3793        self._scopes
3794            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3795        self
3796    }
3797
3798    /// Removes all scopes, and no default scope will be used either.
3799    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3800    /// for details).
3801    pub fn clear_scopes(mut self) -> ProjectLocationJobListCall<'a, C> {
3802        self._scopes.clear();
3803        self
3804    }
3805}