google_transcoder1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
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 as transcoder1;
49/// use transcoder1::api::Job;
50/// use transcoder1::{Result, Error};
51/// # async fn dox() {
52/// use transcoder1::{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    _never_set: Option<bool>,
188}
189
190impl common::Part for Aes128Encryption {}
191
192/// Animation types.
193///
194/// This type is not used in any activity, and only used as *part* of another schema.
195///
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct Animation {
200    /// End previous animation.
201    #[serde(rename = "animationEnd")]
202    pub animation_end: Option<AnimationEnd>,
203    /// Display overlay object with fade animation.
204    #[serde(rename = "animationFade")]
205    pub animation_fade: Option<AnimationFade>,
206    /// Display static overlay object.
207    #[serde(rename = "animationStatic")]
208    pub animation_static: Option<AnimationStatic>,
209}
210
211impl common::Part for Animation {}
212
213/// 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.
214///
215/// This type is not used in any activity, and only used as *part* of another schema.
216///
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct AnimationEnd {
221    /// The time to end overlay object, in seconds. Default: 0
222    #[serde(rename = "startTimeOffset")]
223    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
224    pub start_time_offset: Option<chrono::Duration>,
225}
226
227impl common::Part for AnimationEnd {}
228
229/// Display overlay object with fade animation.
230///
231/// This type is not used in any activity, and only used as *part* of another schema.
232///
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct AnimationFade {
237    /// The time to end the fade animation, in seconds. Default: `start_time_offset` + 1s
238    #[serde(rename = "endTimeOffset")]
239    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
240    pub end_time_offset: Option<chrono::Duration>,
241    /// Required. Type of fade animation: `FADE_IN` or `FADE_OUT`.
242    #[serde(rename = "fadeType")]
243    pub fade_type: Option<String>,
244    /// The time to start the fade animation, in seconds. Default: 0
245    #[serde(rename = "startTimeOffset")]
246    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
247    pub start_time_offset: Option<chrono::Duration>,
248    /// 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.
249    pub xy: Option<NormalizedCoordinate>,
250}
251
252impl common::Part for AnimationFade {}
253
254/// Display static overlay object.
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct AnimationStatic {
262    /// The time to start displaying the overlay object, in seconds. Default: 0
263    #[serde(rename = "startTimeOffset")]
264    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
265    pub start_time_offset: Option<chrono::Duration>,
266    /// 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.
267    pub xy: Option<NormalizedCoordinate>,
268}
269
270impl common::Part for AnimationStatic {}
271
272/// Audio preprocessing configuration.
273///
274/// This type is not used in any activity, and only used as *part* of another schema.
275///
276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
277#[serde_with::serde_as]
278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
279pub struct Audio {
280    /// Enable boosting high frequency components. The default is `false`. **Note:** This field is not supported.
281    #[serde(rename = "highBoost")]
282    pub high_boost: Option<bool>,
283    /// Enable boosting low frequency components. The default is `false`. **Note:** This field is not supported.
284    #[serde(rename = "lowBoost")]
285    pub low_boost: Option<bool>,
286    /// 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
287    pub lufs: Option<f64>,
288}
289
290impl common::Part for Audio {}
291
292/// The mapping for the JobConfig.edit_list atoms with audio EditAtom.inputs.
293///
294/// This type is not used in any activity, and only used as *part* of another schema.
295///
296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
297#[serde_with::serde_as]
298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
299pub struct AudioMapping {
300    /// Required. The EditAtom.key that references the atom with audio inputs in the JobConfig.edit_list.
301    #[serde(rename = "atomKey")]
302    pub atom_key: Option<String>,
303    /// Audio volume control in dB. Negative values decrease volume, positive values increase. The default is 0.
304    #[serde(rename = "gainDb")]
305    pub gain_db: Option<f64>,
306    /// Required. The zero-based index of the channel in the input audio stream.
307    #[serde(rename = "inputChannel")]
308    pub input_channel: Option<i32>,
309    /// Required. The Input.key that identifies the input file.
310    #[serde(rename = "inputKey")]
311    pub input_key: Option<String>,
312    /// Required. The zero-based index of the track in the input file.
313    #[serde(rename = "inputTrack")]
314    pub input_track: Option<i32>,
315    /// Required. The zero-based index of the channel in the output audio stream.
316    #[serde(rename = "outputChannel")]
317    pub output_channel: Option<i32>,
318}
319
320impl common::Part for AudioMapping {}
321
322/// Audio stream resource.
323///
324/// This type is not used in any activity, and only used as *part* of another schema.
325///
326#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
327#[serde_with::serde_as]
328#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
329pub struct AudioStream {
330    /// Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000.
331    #[serde(rename = "bitrateBps")]
332    pub bitrate_bps: Option<i32>,
333    /// Number of audio channels. Must be between 1 and 6. The default is 2.
334    #[serde(rename = "channelCount")]
335    pub channel_count: Option<i32>,
336    /// 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
337    #[serde(rename = "channelLayout")]
338    pub channel_layout: Option<Vec<String>>,
339    /// The codec for this audio stream. The default is `aac`. Supported audio codecs: - `aac` - `aac-he` - `aac-he-v2` - `mp3` - `ac3` - `eac3`
340    pub codec: Option<String>,
341    /// The name for this particular audio stream that will be added to the HLS/DASH manifest. Not supported in MP4 files.
342    #[serde(rename = "displayName")]
343    pub display_name: Option<String>,
344    /// 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. Not supported in MP4 files.
345    #[serde(rename = "languageCode")]
346    pub language_code: Option<String>,
347    /// The mapping for the JobConfig.edit_list atoms with audio EditAtom.inputs.
348    pub mapping: Option<Vec<AudioMapping>>,
349    /// The audio sample rate in Hertz. The default is 48000 Hertz.
350    #[serde(rename = "sampleRateHertz")]
351    pub sample_rate_hertz: Option<i32>,
352}
353
354impl common::Part for AudioStream {}
355
356/// Bob Weaver Deinterlacing Filter Configuration.
357///
358/// This type is not used in any activity, and only used as *part* of another schema.
359///
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct BwdifConfig {
364    /// Deinterlace all frames rather than just the frames identified as interlaced. The default is `false`.
365    #[serde(rename = "deinterlaceAllFrames")]
366    pub deinterlace_all_frames: Option<bool>,
367    /// Specifies the deinterlacing mode to adopt. The default is `send_frame`. Supported values: - `send_frame`: Output one frame for each frame - `send_field`: Output one frame for each field
368    pub mode: Option<String>,
369    /// The picture field parity assumed for the input interlaced video. The default is `auto`. Supported values: - `tff`: Assume the top field is first - `bff`: Assume the bottom field is first - `auto`: Enable automatic detection of field parity
370    pub parity: Option<String>,
371}
372
373impl common::Part for BwdifConfig {}
374
375/// Clearkey configuration.
376///
377/// This type is not used in any activity, and only used as *part* of another schema.
378///
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct Clearkey {
383    _never_set: Option<bool>,
384}
385
386impl common::Part for Clearkey {}
387
388/// Color preprocessing configuration. **Note:** This configuration is not supported.
389///
390/// This type is not used in any activity, and only used as *part* of another schema.
391///
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct Color {
396    /// 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.
397    pub brightness: Option<f64>,
398    /// 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.
399    pub contrast: Option<f64>,
400    /// 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.
401    pub saturation: Option<f64>,
402}
403
404impl common::Part for Color {}
405
406/// Video cropping configuration for the input video. The cropped input video is scaled to match the output resolution.
407///
408/// This type is not used in any activity, and only used as *part* of another schema.
409///
410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
411#[serde_with::serde_as]
412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
413pub struct Crop {
414    /// The number of pixels to crop from the bottom. The default is 0.
415    #[serde(rename = "bottomPixels")]
416    pub bottom_pixels: Option<i32>,
417    /// The number of pixels to crop from the left. The default is 0.
418    #[serde(rename = "leftPixels")]
419    pub left_pixels: Option<i32>,
420    /// The number of pixels to crop from the right. The default is 0.
421    #[serde(rename = "rightPixels")]
422    pub right_pixels: Option<i32>,
423    /// The number of pixels to crop from the top. The default is 0.
424    #[serde(rename = "topPixels")]
425    pub top_pixels: Option<i32>,
426}
427
428impl common::Part for Crop {}
429
430/// `DASH` manifest configuration.
431///
432/// This type is not used in any activity, and only used as *part* of another schema.
433///
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct DashConfig {
438    /// The segment reference scheme for a `DASH` manifest. The default is `SEGMENT_LIST`.
439    #[serde(rename = "segmentReferenceScheme")]
440    pub segment_reference_scheme: Option<String>,
441}
442
443impl common::Part for DashConfig {}
444
445/// Deblock preprocessing configuration. **Note:** This configuration is not supported.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct Deblock {
453    /// Enable deblocker. The default is `false`.
454    pub enabled: Option<bool>,
455    /// 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.
456    pub strength: Option<f64>,
457}
458
459impl common::Part for Deblock {}
460
461/// Deinterlace configuration for input video.
462///
463/// This type is not used in any activity, and only used as *part* of another schema.
464///
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct Deinterlace {
469    /// Specifies the Bob Weaver Deinterlacing Filter Configuration.
470    pub bwdif: Option<BwdifConfig>,
471    /// Specifies the Yet Another Deinterlacing Filter Configuration.
472    pub yadif: Option<YadifConfig>,
473}
474
475impl common::Part for Deinterlace {}
476
477/// Denoise preprocessing configuration. **Note:** This configuration is not supported.
478///
479/// This type is not used in any activity, and only used as *part* of another schema.
480///
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct Denoise {
485    /// 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.
486    pub strength: Option<f64>,
487    /// Set the denoiser mode. The default is `standard`. Supported denoiser modes: - `standard` - `grain`
488    pub tune: Option<String>,
489}
490
491impl common::Part for Denoise {}
492
493/// Defines configuration for DRM systems in use.
494///
495/// This type is not used in any activity, and only used as *part* of another schema.
496///
497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
498#[serde_with::serde_as]
499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
500pub struct DrmSystems {
501    /// Clearkey configuration.
502    pub clearkey: Option<Clearkey>,
503    /// Fairplay configuration.
504    pub fairplay: Option<Fairplay>,
505    /// Playready configuration.
506    pub playready: Option<Playready>,
507    /// Widevine configuration.
508    pub widevine: Option<Widevine>,
509}
510
511impl common::Part for DrmSystems {}
512
513/// Edit atom.
514///
515/// This type is not used in any activity, and only used as *part* of another schema.
516///
517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
518#[serde_with::serde_as]
519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
520pub struct EditAtom {
521    /// 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.
522    #[serde(rename = "endTimeOffset")]
523    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
524    pub end_time_offset: Option<chrono::Duration>,
525    /// List of Input.key values identifying files that should be used in this atom. The listed `inputs` must have the same timeline.
526    pub inputs: Option<Vec<String>>,
527    /// A unique key for this atom. Must be specified when using advanced mapping.
528    pub key: Option<String>,
529    /// Start time in seconds for the atom, relative to the input file timeline. The default is `0s`.
530    #[serde(rename = "startTimeOffset")]
531    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
532    pub start_time_offset: Option<chrono::Duration>,
533}
534
535impl common::Part for EditAtom {}
536
537/// 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.
538///
539/// This type is not used in any activity, and only used as *part* of another schema.
540///
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct ElementaryStream {
545    /// Encoding of an audio stream.
546    #[serde(rename = "audioStream")]
547    pub audio_stream: Option<AudioStream>,
548    /// A unique key for this elementary stream.
549    pub key: Option<String>,
550    /// Encoding of a text stream. For example, closed captions or subtitles.
551    #[serde(rename = "textStream")]
552    pub text_stream: Option<TextStream>,
553    /// Encoding of a video stream.
554    #[serde(rename = "videoStream")]
555    pub video_stream: Option<VideoStream>,
556}
557
558impl common::Part for ElementaryStream {}
559
560/// 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); }
561///
562/// # Activities
563///
564/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
565/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
566///
567/// * [locations job templates delete projects](ProjectLocationJobTemplateDeleteCall) (response)
568/// * [locations jobs delete projects](ProjectLocationJobDeleteCall) (response)
569#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
570#[serde_with::serde_as]
571#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
572pub struct Empty {
573    _never_set: Option<bool>,
574}
575
576impl common::ResponseResult for Empty {}
577
578/// Encryption settings.
579///
580/// This type is not used in any activity, and only used as *part* of another schema.
581///
582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
583#[serde_with::serde_as]
584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
585pub struct Encryption {
586    /// Configuration for AES-128 encryption.
587    pub aes128: Option<Aes128Encryption>,
588    /// Required. DRM system(s) to use; at least one must be specified. If a DRM system is omitted, it is considered disabled.
589    #[serde(rename = "drmSystems")]
590    pub drm_systems: Option<DrmSystems>,
591    /// Required. Identifier for this set of encryption options.
592    pub id: Option<String>,
593    /// Configuration for MPEG Common Encryption (MPEG-CENC).
594    #[serde(rename = "mpegCenc")]
595    pub mpeg_cenc: Option<MpegCommonEncryption>,
596    /// Configuration for SAMPLE-AES encryption.
597    #[serde(rename = "sampleAes")]
598    pub sample_aes: Option<SampleAesEncryption>,
599    /// Keys are stored in Google Secret Manager.
600    #[serde(rename = "secretManagerKeySource")]
601    pub secret_manager_key_source: Option<SecretManagerSource>,
602}
603
604impl common::Part for Encryption {}
605
606/// Fairplay configuration.
607///
608/// This type is not used in any activity, and only used as *part* of another schema.
609///
610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
611#[serde_with::serde_as]
612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
613pub struct Fairplay {
614    _never_set: Option<bool>,
615}
616
617impl common::Part for Fairplay {}
618
619/// `fmp4` container configuration.
620///
621/// This type is not used in any activity, and only used as *part* of another schema.
622///
623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
624#[serde_with::serde_as]
625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
626pub struct Fmp4Config {
627    /// Optional. Specify the codec tag string that will be used in the media bitstream. When not specified, the codec appropriate value is used. Supported H265 codec tags: - `hvc1` (default) - `hev1`
628    #[serde(rename = "codecTag")]
629    pub codec_tag: Option<String>,
630}
631
632impl common::Part for Fmp4Config {}
633
634/// H264 codec settings.
635///
636/// This type is not used in any activity, and only used as *part* of another schema.
637///
638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
639#[serde_with::serde_as]
640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
641pub struct H264CodecSettings {
642    /// Specifies whether an open Group of Pictures (GOP) structure should be allowed or not. The default is `false`.
643    #[serde(rename = "allowOpenGop")]
644    pub allow_open_gop: Option<bool>,
645    /// 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.
646    #[serde(rename = "aqStrength")]
647    pub aq_strength: Option<f64>,
648    /// The number of consecutive B-frames. Must be greater than or equal to zero. Must be less than H264CodecSettings.gop_frame_count if set. The default is 0.
649    #[serde(rename = "bFrameCount")]
650    pub b_frame_count: Option<i32>,
651    /// Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is `false`.
652    #[serde(rename = "bPyramid")]
653    pub b_pyramid: Option<bool>,
654    /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 800,000,000.
655    #[serde(rename = "bitrateBps")]
656    pub bitrate_bps: Option<i32>,
657    /// 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.
658    #[serde(rename = "crfLevel")]
659    pub crf_level: Option<i32>,
660    /// Use two-pass encoding strategy to achieve better video quality. H264CodecSettings.rate_control_mode must be `vbr`. The default is `false`.
661    #[serde(rename = "enableTwoPass")]
662    pub enable_two_pass: Option<bool>,
663    /// The entropy coder to use. The default is `cabac`. Supported entropy coders: - `cavlc` - `cabac`
664    #[serde(rename = "entropyCoder")]
665    pub entropy_coder: Option<String>,
666    /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
667    #[serde(rename = "frameRate")]
668    pub frame_rate: Option<f64>,
669    /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
670    #[serde(rename = "frameRateConversionStrategy")]
671    pub frame_rate_conversion_strategy: Option<String>,
672    /// 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`.
673    #[serde(rename = "gopDuration")]
674    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
675    pub gop_duration: Option<chrono::Duration>,
676    /// Select the GOP size based on the specified frame count. Must be greater than zero.
677    #[serde(rename = "gopFrameCount")]
678    pub gop_frame_count: Option<i32>,
679    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
680    #[serde(rename = "heightPixels")]
681    pub height_pixels: Option<i32>,
682    /// Optional. HLG color format setting for H264.
683    pub hlg: Option<H264ColorFormatHLG>,
684    /// 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
685    #[serde(rename = "pixelFormat")]
686    pub pixel_format: Option<String>,
687    /// Enforces the specified codec preset. The default is `veryfast`. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
688    pub preset: Option<String>,
689    /// Enforces the specified codec profile. The following profiles are supported: * `baseline` * `main` * `high` (default) The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
690    pub profile: Option<String>,
691    /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate - `crf` - constant rate factor
692    #[serde(rename = "rateControlMode")]
693    pub rate_control_mode: Option<String>,
694    /// Optional. SDR color format setting for H264.
695    pub sdr: Option<H264ColorFormatSDR>,
696    /// Enforces the specified codec tune. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
697    pub tune: Option<String>,
698    /// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to 90% of H264CodecSettings.vbv_size_bits.
699    #[serde(rename = "vbvFullnessBits")]
700    pub vbv_fullness_bits: Option<i32>,
701    /// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to H264CodecSettings.bitrate_bps.
702    #[serde(rename = "vbvSizeBits")]
703    pub vbv_size_bits: Option<i32>,
704    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
705    #[serde(rename = "widthPixels")]
706    pub width_pixels: Option<i32>,
707}
708
709impl common::Part for H264CodecSettings {}
710
711/// Convert the input video to a Hybrid Log Gamma (HLG) video.
712///
713/// This type is not used in any activity, and only used as *part* of another schema.
714///
715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
716#[serde_with::serde_as]
717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
718pub struct H264ColorFormatHLG {
719    _never_set: Option<bool>,
720}
721
722impl common::Part for H264ColorFormatHLG {}
723
724/// Convert the input video to a Standard Dynamic Range (SDR) video.
725///
726/// This type is not used in any activity, and only used as *part* of another schema.
727///
728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
729#[serde_with::serde_as]
730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
731pub struct H264ColorFormatSDR {
732    _never_set: Option<bool>,
733}
734
735impl common::Part for H264ColorFormatSDR {}
736
737/// H265 codec settings.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct H265CodecSettings {
745    /// Specifies whether an open Group of Pictures (GOP) structure should be allowed or not. The default is `false`.
746    #[serde(rename = "allowOpenGop")]
747    pub allow_open_gop: Option<bool>,
748    /// 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.
749    #[serde(rename = "aqStrength")]
750    pub aq_strength: Option<f64>,
751    /// The number of consecutive B-frames. Must be greater than or equal to zero. Must be less than H265CodecSettings.gop_frame_count if set. The default is 0.
752    #[serde(rename = "bFrameCount")]
753    pub b_frame_count: Option<i32>,
754    /// Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is `false`.
755    #[serde(rename = "bPyramid")]
756    pub b_pyramid: Option<bool>,
757    /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 800,000,000.
758    #[serde(rename = "bitrateBps")]
759    pub bitrate_bps: Option<i32>,
760    /// 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.
761    #[serde(rename = "crfLevel")]
762    pub crf_level: Option<i32>,
763    /// Use two-pass encoding strategy to achieve better video quality. H265CodecSettings.rate_control_mode must be `vbr`. The default is `false`.
764    #[serde(rename = "enableTwoPass")]
765    pub enable_two_pass: Option<bool>,
766    /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
767    #[serde(rename = "frameRate")]
768    pub frame_rate: Option<f64>,
769    /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
770    #[serde(rename = "frameRateConversionStrategy")]
771    pub frame_rate_conversion_strategy: Option<String>,
772    /// 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`.
773    #[serde(rename = "gopDuration")]
774    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
775    pub gop_duration: Option<chrono::Duration>,
776    /// Select the GOP size based on the specified frame count. Must be greater than zero.
777    #[serde(rename = "gopFrameCount")]
778    pub gop_frame_count: Option<i32>,
779    /// Optional. HDR10 color format setting for H265.
780    pub hdr10: Option<H265ColorFormatHDR10>,
781    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
782    #[serde(rename = "heightPixels")]
783    pub height_pixels: Option<i32>,
784    /// Optional. HLG color format setting for H265.
785    pub hlg: Option<H265ColorFormatHLG>,
786    /// 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
787    #[serde(rename = "pixelFormat")]
788    pub pixel_format: Option<String>,
789    /// Enforces the specified codec preset. The default is `veryfast`. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
790    pub preset: Option<String>,
791    /// Enforces the specified codec profile. The following profiles are supported: * 8-bit profiles * `main` (default) * `main-intra` * `mainstillpicture` * 10-bit profiles * `main10` (default) * `main10-intra` * `main422-10` * `main422-10-intra` * `main444-10` * `main444-10-intra` * 12-bit profiles * `main12` (default) * `main12-intra` * `main422-12` * `main422-12-intra` * `main444-12` * `main444-12-intra` The available options are [FFmpeg-compatible](https://x265.readthedocs.io/). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
792    pub profile: Option<String>,
793    /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate - `crf` - constant rate factor
794    #[serde(rename = "rateControlMode")]
795    pub rate_control_mode: Option<String>,
796    /// Optional. SDR color format setting for H265.
797    pub sdr: Option<H265ColorFormatSDR>,
798    /// Enforces the specified codec tune. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
799    pub tune: Option<String>,
800    /// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to 90% of H265CodecSettings.vbv_size_bits.
801    #[serde(rename = "vbvFullnessBits")]
802    pub vbv_fullness_bits: Option<i32>,
803    /// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to `VideoStream.bitrate_bps`.
804    #[serde(rename = "vbvSizeBits")]
805    pub vbv_size_bits: Option<i32>,
806    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
807    #[serde(rename = "widthPixels")]
808    pub width_pixels: Option<i32>,
809}
810
811impl common::Part for H265CodecSettings {}
812
813/// Convert the input video to a High Dynamic Range 10 (HDR10) video.
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 H265ColorFormatHDR10 {
821    _never_set: Option<bool>,
822}
823
824impl common::Part for H265ColorFormatHDR10 {}
825
826/// Convert the input video to a Hybrid Log Gamma (HLG) video.
827///
828/// This type is not used in any activity, and only used as *part* of another schema.
829///
830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
831#[serde_with::serde_as]
832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
833pub struct H265ColorFormatHLG {
834    _never_set: Option<bool>,
835}
836
837impl common::Part for H265ColorFormatHLG {}
838
839/// Convert the input video to a Standard Dynamic Range (SDR) video.
840///
841/// This type is not used in any activity, and only used as *part* of another schema.
842///
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct H265ColorFormatSDR {
847    _never_set: Option<bool>,
848}
849
850impl common::Part for H265ColorFormatSDR {}
851
852/// Overlaid image.
853///
854/// This type is not used in any activity, and only used as *part* of another schema.
855///
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct Image {
860    /// Target image opacity. Valid values are from `1.0` (solid, default) to `0.0` (transparent), exclusive. Set this to a value greater than `0.0`.
861    pub alpha: Option<f64>,
862    /// 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`.
863    pub resolution: Option<NormalizedCoordinate>,
864    /// Required. URI of the image in Cloud Storage. For example, `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported.
865    pub uri: Option<String>,
866}
867
868impl common::Part for Image {}
869
870/// Input asset.
871///
872/// This type is not used in any activity, and only used as *part* of another schema.
873///
874#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
875#[serde_with::serde_as]
876#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
877pub struct Input {
878    /// A unique key for this input. Must be specified when using advanced mapping and edit lists.
879    pub key: Option<String>,
880    /// Preprocessing configurations.
881    #[serde(rename = "preprocessingConfig")]
882    pub preprocessing_config: Option<PreprocessingConfig>,
883    /// 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 is populated from Job.input_uri. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
884    pub uri: Option<String>,
885}
886
887impl common::Part for Input {}
888
889/// Transcoding job resource.
890///
891/// # Activities
892///
893/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
894/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
895///
896/// * [locations jobs create projects](ProjectLocationJobCreateCall) (request|response)
897/// * [locations jobs get projects](ProjectLocationJobGetCall) (response)
898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
899#[serde_with::serde_as]
900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
901pub struct Job {
902    /// The processing priority of a batch job. This field can only be set for batch mode jobs. The default value is 0. This value cannot be negative. Higher values correspond to higher priorities for the job.
903    #[serde(rename = "batchModePriority")]
904    pub batch_mode_priority: Option<i32>,
905    /// The configuration for this job.
906    pub config: Option<JobConfig>,
907    /// Output only. The time the job was created.
908    #[serde(rename = "createTime")]
909    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
910    /// Output only. The time the transcoding finished.
911    #[serde(rename = "endTime")]
912    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
913    /// Output only. An error object that describes the reason for the failure. This property is always present when ProcessingState is `FAILED`.
914    pub error: Option<Status>,
915    /// 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`). See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
916    #[serde(rename = "inputUri")]
917    pub input_uri: Option<String>,
918    /// The labels associated with this job. You can use these to organize and group your jobs.
919    pub labels: Option<HashMap<String, String>>,
920    /// The processing mode of the job. The default is `PROCESSING_MODE_INTERACTIVE`.
921    pub mode: Option<String>,
922    /// The resource name of the job. Format: `projects/{project_number}/locations/{location}/jobs/{job}`
923    pub name: Option<String>,
924    /// Optional. The optimization strategy of the job. The default is `AUTODETECT`.
925    pub optimization: Option<String>,
926    /// 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/`. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
927    #[serde(rename = "outputUri")]
928    pub output_uri: Option<String>,
929    /// Output only. The time the transcoding started.
930    #[serde(rename = "startTime")]
931    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
932    /// Output only. The current state of the job.
933    pub state: Option<String>,
934    /// Input only. Specify the `template_id` to use for populating `Job.config`. The default is `preset/web-hd`, which is the only supported preset. User defined JobTemplate: `{job_template_id}`
935    #[serde(rename = "templateId")]
936    pub template_id: Option<String>,
937    /// 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.
938    #[serde(rename = "ttlAfterCompletionDays")]
939    pub ttl_after_completion_days: Option<i32>,
940}
941
942impl common::RequestValue for Job {}
943impl common::ResponseResult for Job {}
944
945/// Job configuration
946///
947/// This type is not used in any activity, and only used as *part* of another schema.
948///
949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
950#[serde_with::serde_as]
951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
952pub struct JobConfig {
953    /// List of ad breaks. Specifies where to insert ad break tags in the output manifests.
954    #[serde(rename = "adBreaks")]
955    pub ad_breaks: Option<Vec<AdBreak>>,
956    /// List of edit atoms. Defines the ultimate timeline of the resulting file or manifest.
957    #[serde(rename = "editList")]
958    pub edit_list: Option<Vec<EditAtom>>,
959    /// List of elementary streams.
960    #[serde(rename = "elementaryStreams")]
961    pub elementary_streams: Option<Vec<ElementaryStream>>,
962    /// List of encryption configurations for the content. Each configuration has an ID. Specify this ID in the MuxStream.encryption_id field to indicate the configuration to use for that `MuxStream` output.
963    pub encryptions: Option<Vec<Encryption>>,
964    /// List of input assets stored in Cloud Storage.
965    pub inputs: Option<Vec<Input>>,
966    /// List of output manifests.
967    pub manifests: Option<Vec<Manifest>>,
968    /// List of multiplexing settings for output streams.
969    #[serde(rename = "muxStreams")]
970    pub mux_streams: Option<Vec<MuxStream>>,
971    /// Output configuration.
972    pub output: Option<Output>,
973    /// List of overlays on the output video, in descending Z-order.
974    pub overlays: Option<Vec<Overlay>>,
975    /// Destination on Pub/Sub.
976    #[serde(rename = "pubsubDestination")]
977    pub pubsub_destination: Option<PubsubDestination>,
978    /// List of output sprite sheets. Spritesheets require at least one VideoStream in the Jobconfig.
979    #[serde(rename = "spriteSheets")]
980    pub sprite_sheets: Option<Vec<SpriteSheet>>,
981}
982
983impl common::Part for JobConfig {}
984
985/// Transcoding job template resource.
986///
987/// # Activities
988///
989/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
990/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
991///
992/// * [locations job templates create projects](ProjectLocationJobTemplateCreateCall) (request|response)
993/// * [locations job templates get projects](ProjectLocationJobTemplateGetCall) (response)
994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
995#[serde_with::serde_as]
996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
997pub struct JobTemplate {
998    /// The configuration for this template.
999    pub config: Option<JobConfig>,
1000    /// The labels associated with this job template. You can use these to organize and group your job templates.
1001    pub labels: Option<HashMap<String, String>>,
1002    /// The resource name of the job template. Format: `projects/{project_number}/locations/{location}/jobTemplates/{job_template}`
1003    pub name: Option<String>,
1004}
1005
1006impl common::RequestValue for JobTemplate {}
1007impl common::ResponseResult for JobTemplate {}
1008
1009/// Response message for `TranscoderService.ListJobTemplates`.
1010///
1011/// # Activities
1012///
1013/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1014/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1015///
1016/// * [locations job templates list projects](ProjectLocationJobTemplateListCall) (response)
1017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1018#[serde_with::serde_as]
1019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct ListJobTemplatesResponse {
1021    /// List of job templates in the specified region.
1022    #[serde(rename = "jobTemplates")]
1023    pub job_templates: Option<Vec<JobTemplate>>,
1024    /// The pagination token.
1025    #[serde(rename = "nextPageToken")]
1026    pub next_page_token: Option<String>,
1027    /// List of regions that could not be reached.
1028    pub unreachable: Option<Vec<String>>,
1029}
1030
1031impl common::ResponseResult for ListJobTemplatesResponse {}
1032
1033/// Response message for `TranscoderService.ListJobs`.
1034///
1035/// # Activities
1036///
1037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1039///
1040/// * [locations jobs list projects](ProjectLocationJobListCall) (response)
1041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1042#[serde_with::serde_as]
1043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1044pub struct ListJobsResponse {
1045    /// List of jobs in the specified region.
1046    pub jobs: Option<Vec<Job>>,
1047    /// The pagination token.
1048    #[serde(rename = "nextPageToken")]
1049    pub next_page_token: Option<String>,
1050    /// List of regions that could not be reached.
1051    pub unreachable: Option<Vec<String>>,
1052}
1053
1054impl common::ResponseResult for ListJobsResponse {}
1055
1056/// Manifest configuration.
1057///
1058/// This type is not used in any activity, and only used as *part* of another schema.
1059///
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct Manifest {
1064    /// `DASH` manifest configuration.
1065    pub dash: Option<DashConfig>,
1066    /// The name of the generated file. The default is `manifest` with the extension suffix corresponding to the Manifest.type.
1067    #[serde(rename = "fileName")]
1068    pub file_name: Option<String>,
1069    /// Required. List of user supplied MuxStream.key values 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 in this list.
1070    #[serde(rename = "muxStreams")]
1071    pub mux_streams: Option<Vec<String>>,
1072    /// Required. Type of the manifest.
1073    #[serde(rename = "type")]
1074    pub type_: Option<String>,
1075}
1076
1077impl common::Part for Manifest {}
1078
1079/// Configuration for MPEG Common Encryption (MPEG-CENC).
1080///
1081/// This type is not used in any activity, and only used as *part* of another schema.
1082///
1083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1084#[serde_with::serde_as]
1085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1086pub struct MpegCommonEncryption {
1087    /// Required. Specify the encryption scheme. Supported encryption schemes: - `cenc` - `cbcs`
1088    pub scheme: Option<String>,
1089}
1090
1091impl common::Part for MpegCommonEncryption {}
1092
1093/// Multiplexing settings for output stream.
1094///
1095/// This type is not used in any activity, and only used as *part* of another schema.
1096///
1097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1098#[serde_with::serde_as]
1099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1100pub struct MuxStream {
1101    /// The container format. The default is `mp4` Supported container formats: - `ts` - `fmp4`- the corresponding file extension is `.m4s` - `mp4` - `vtt` See also: [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats)
1102    pub container: Option<String>,
1103    /// List of ElementaryStream.key values multiplexed in this stream.
1104    #[serde(rename = "elementaryStreams")]
1105    pub elementary_streams: Option<Vec<String>>,
1106    /// Identifier of the encryption configuration to use. If omitted, output will be unencrypted.
1107    #[serde(rename = "encryptionId")]
1108    pub encryption_id: Option<String>,
1109    /// 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`.
1110    #[serde(rename = "fileName")]
1111    pub file_name: Option<String>,
1112    /// Optional. `fmp4` container configuration.
1113    pub fmp4: Option<Fmp4Config>,
1114    /// A unique key for this multiplexed stream.
1115    pub key: Option<String>,
1116    /// Segment settings for `ts`, `fmp4` and `vtt`.
1117    #[serde(rename = "segmentSettings")]
1118    pub segment_settings: Option<SegmentSettings>,
1119}
1120
1121impl common::Part for MuxStream {}
1122
1123/// 2D normalized coordinates. Default: `{0.0, 0.0}`
1124///
1125/// This type is not used in any activity, and only used as *part* of another schema.
1126///
1127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1128#[serde_with::serde_as]
1129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1130pub struct NormalizedCoordinate {
1131    /// Normalized x coordinate.
1132    pub x: Option<f64>,
1133    /// Normalized y coordinate.
1134    pub y: Option<f64>,
1135}
1136
1137impl common::Part for NormalizedCoordinate {}
1138
1139/// Location of output file(s) in a Cloud Storage bucket.
1140///
1141/// This type is not used in any activity, and only used as *part* of another schema.
1142///
1143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1144#[serde_with::serde_as]
1145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1146pub struct Output {
1147    /// URI for the output file(s). For example, `gs://my-bucket/outputs/`. If empty, the value is populated from Job.output_uri. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
1148    pub uri: Option<String>,
1149}
1150
1151impl common::Part for Output {}
1152
1153/// Overlay configuration.
1154///
1155/// This type is not used in any activity, and only used as *part* of another schema.
1156///
1157#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1158#[serde_with::serde_as]
1159#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1160pub struct Overlay {
1161    /// List of animations. The list should be chronological, without any time overlap.
1162    pub animations: Option<Vec<Animation>>,
1163    /// Image overlay.
1164    pub image: Option<Image>,
1165}
1166
1167impl common::Part for Overlay {}
1168
1169/// Pad filter configuration for the input video. The padded input video is scaled after padding with black to match the output resolution.
1170///
1171/// This type is not used in any activity, and only used as *part* of another schema.
1172///
1173#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1174#[serde_with::serde_as]
1175#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1176pub struct Pad {
1177    /// The number of pixels to add to the bottom. The default is 0.
1178    #[serde(rename = "bottomPixels")]
1179    pub bottom_pixels: Option<i32>,
1180    /// The number of pixels to add to the left. The default is 0.
1181    #[serde(rename = "leftPixels")]
1182    pub left_pixels: Option<i32>,
1183    /// The number of pixels to add to the right. The default is 0.
1184    #[serde(rename = "rightPixels")]
1185    pub right_pixels: Option<i32>,
1186    /// The number of pixels to add to the top. The default is 0.
1187    #[serde(rename = "topPixels")]
1188    pub top_pixels: Option<i32>,
1189}
1190
1191impl common::Part for Pad {}
1192
1193/// Playready configuration.
1194///
1195/// This type is not used in any activity, and only used as *part* of another schema.
1196///
1197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1198#[serde_with::serde_as]
1199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1200pub struct Playready {
1201    _never_set: Option<bool>,
1202}
1203
1204impl common::Part for Playready {}
1205
1206/// Preprocessing configurations.
1207///
1208/// This type is not used in any activity, and only used as *part* of another schema.
1209///
1210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1211#[serde_with::serde_as]
1212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1213pub struct PreprocessingConfig {
1214    /// Audio preprocessing configuration.
1215    pub audio: Option<Audio>,
1216    /// Color preprocessing configuration.
1217    pub color: Option<Color>,
1218    /// Specify the video cropping configuration.
1219    pub crop: Option<Crop>,
1220    /// Deblock preprocessing configuration.
1221    pub deblock: Option<Deblock>,
1222    /// Specify the video deinterlace configuration.
1223    pub deinterlace: Option<Deinterlace>,
1224    /// Denoise preprocessing configuration.
1225    pub denoise: Option<Denoise>,
1226    /// Specify the video pad filter configuration.
1227    pub pad: Option<Pad>,
1228}
1229
1230impl common::Part for PreprocessingConfig {}
1231
1232/// A Pub/Sub destination.
1233///
1234/// This type is not used in any activity, and only used as *part* of another schema.
1235///
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct PubsubDestination {
1240    /// The name of the Pub/Sub topic to publish job completion notification to. For example: `projects/{project}/topics/{topic}`.
1241    pub topic: Option<String>,
1242}
1243
1244impl common::Part for PubsubDestination {}
1245
1246/// Configuration for SAMPLE-AES encryption.
1247///
1248/// This type is not used in any activity, and only used as *part* of another schema.
1249///
1250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1251#[serde_with::serde_as]
1252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1253pub struct SampleAesEncryption {
1254    _never_set: Option<bool>,
1255}
1256
1257impl common::Part for SampleAesEncryption {}
1258
1259/// Configuration for secrets stored in Google Secret Manager.
1260///
1261/// This type is not used in any activity, and only used as *part* of another schema.
1262///
1263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1264#[serde_with::serde_as]
1265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1266pub struct SecretManagerSource {
1267    /// Required. The name of the Secret Version containing the encryption key in the following format: `projects/{project}/secrets/{secret_id}/versions/{version_number}` Note that only numbered versions are supported. Aliases like "latest" are not supported.
1268    #[serde(rename = "secretVersion")]
1269    pub secret_version: Option<String>,
1270}
1271
1272impl common::Part for SecretManagerSource {}
1273
1274/// Segment settings for `ts`, `fmp4` and `vtt`.
1275///
1276/// This type is not used in any activity, and only used as *part* of another schema.
1277///
1278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1279#[serde_with::serde_as]
1280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1281pub struct SegmentSettings {
1282    /// Required. Create an individual segment file. The default is `false`.
1283    #[serde(rename = "individualSegments")]
1284    pub individual_segments: Option<bool>,
1285    /// 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).
1286    #[serde(rename = "segmentDuration")]
1287    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1288    pub segment_duration: Option<chrono::Duration>,
1289}
1290
1291impl common::Part for SegmentSettings {}
1292
1293/// Sprite sheet configuration.
1294///
1295/// This type is not used in any activity, and only used as *part* of another schema.
1296///
1297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1298#[serde_with::serde_as]
1299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1300pub struct SpriteSheet {
1301    /// The maximum number of sprites per row in a sprite sheet. The default is 0, which indicates no maximum limit.
1302    #[serde(rename = "columnCount")]
1303    pub column_count: Option<i32>,
1304    /// 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.
1305    #[serde(rename = "endTimeOffset")]
1306    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1307    pub end_time_offset: Option<chrono::Duration>,
1308    /// 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`.
1309    #[serde(rename = "filePrefix")]
1310    pub file_prefix: Option<String>,
1311    /// Format type. The default is `jpeg`. Supported formats: - `jpeg`
1312    pub format: Option<String>,
1313    /// Starting from `0s`, create sprites at regular intervals. Specify the interval value in seconds.
1314    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1315    pub interval: Option<chrono::Duration>,
1316    /// 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.
1317    pub quality: Option<i32>,
1318    /// 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.
1319    #[serde(rename = "rowCount")]
1320    pub row_count: Option<i32>,
1321    /// 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). For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1322    #[serde(rename = "spriteHeightPixels")]
1323    pub sprite_height_pixels: Option<i32>,
1324    /// 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). For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1325    #[serde(rename = "spriteWidthPixels")]
1326    pub sprite_width_pixels: Option<i32>,
1327    /// Start time in seconds, relative to the output file timeline. Determines the first sprite to pick. The default is `0s`.
1328    #[serde(rename = "startTimeOffset")]
1329    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1330    pub start_time_offset: Option<chrono::Duration>,
1331    /// Total number of sprites. Create the specified number of sprites distributed evenly across the timeline of the output media. The default is 100.
1332    #[serde(rename = "totalCount")]
1333    pub total_count: Option<i32>,
1334}
1335
1336impl common::Part for SpriteSheet {}
1337
1338/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1339///
1340/// This type is not used in any activity, and only used as *part* of another schema.
1341///
1342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1343#[serde_with::serde_as]
1344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1345pub struct Status {
1346    /// The status code, which should be an enum value of google.rpc.Code.
1347    pub code: Option<i32>,
1348    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1349    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1350    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1351    pub message: Option<String>,
1352}
1353
1354impl common::Part for Status {}
1355
1356/// The mapping for the JobConfig.edit_list atoms with text EditAtom.inputs.
1357///
1358/// This type is not used in any activity, and only used as *part* of another schema.
1359///
1360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1361#[serde_with::serde_as]
1362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1363pub struct TextMapping {
1364    /// Required. The EditAtom.key that references atom with text inputs in the JobConfig.edit_list.
1365    #[serde(rename = "atomKey")]
1366    pub atom_key: Option<String>,
1367    /// Required. The Input.key that identifies the input file.
1368    #[serde(rename = "inputKey")]
1369    pub input_key: Option<String>,
1370    /// Required. The zero-based index of the track in the input file.
1371    #[serde(rename = "inputTrack")]
1372    pub input_track: Option<i32>,
1373}
1374
1375impl common::Part for TextMapping {}
1376
1377/// Encoding of a text stream. For example, closed captions or subtitles.
1378///
1379/// This type is not used in any activity, and only used as *part* of another schema.
1380///
1381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1382#[serde_with::serde_as]
1383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1384pub struct TextStream {
1385    /// The codec for this text stream. The default is `webvtt`. Supported text codecs: - `srt` - `ttml` - `cea608` - `cea708` - `webvtt`
1386    pub codec: Option<String>,
1387    /// The name for this particular text stream that will be added to the HLS/DASH manifest. Not supported in MP4 files.
1388    #[serde(rename = "displayName")]
1389    pub display_name: Option<String>,
1390    /// 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. Not supported in MP4 files.
1391    #[serde(rename = "languageCode")]
1392    pub language_code: Option<String>,
1393    /// The mapping for the JobConfig.edit_list atoms with text EditAtom.inputs.
1394    pub mapping: Option<Vec<TextMapping>>,
1395}
1396
1397impl common::Part for TextStream {}
1398
1399/// Video stream resource.
1400///
1401/// This type is not used in any activity, and only used as *part* of another schema.
1402///
1403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1404#[serde_with::serde_as]
1405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1406pub struct VideoStream {
1407    /// H264 codec settings.
1408    pub h264: Option<H264CodecSettings>,
1409    /// H265 codec settings.
1410    pub h265: Option<H265CodecSettings>,
1411    /// VP9 codec settings.
1412    pub vp9: Option<Vp9CodecSettings>,
1413}
1414
1415impl common::Part for VideoStream {}
1416
1417/// VP9 codec settings.
1418///
1419/// This type is not used in any activity, and only used as *part* of another schema.
1420///
1421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1422#[serde_with::serde_as]
1423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1424pub struct Vp9CodecSettings {
1425    /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 480,000,000.
1426    #[serde(rename = "bitrateBps")]
1427    pub bitrate_bps: Option<i32>,
1428    /// 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. **Note:** This field is not supported.
1429    #[serde(rename = "crfLevel")]
1430    pub crf_level: Option<i32>,
1431    /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
1432    #[serde(rename = "frameRate")]
1433    pub frame_rate: Option<f64>,
1434    /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
1435    #[serde(rename = "frameRateConversionStrategy")]
1436    pub frame_rate_conversion_strategy: Option<String>,
1437    /// 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`.
1438    #[serde(rename = "gopDuration")]
1439    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1440    pub gop_duration: Option<chrono::Duration>,
1441    /// Select the GOP size based on the specified frame count. Must be greater than zero.
1442    #[serde(rename = "gopFrameCount")]
1443    pub gop_frame_count: Option<i32>,
1444    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1445    #[serde(rename = "heightPixels")]
1446    pub height_pixels: Option<i32>,
1447    /// Optional. HLG color format setting for VP9.
1448    pub hlg: Option<Vp9ColorFormatHLG>,
1449    /// 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
1450    #[serde(rename = "pixelFormat")]
1451    pub pixel_format: Option<String>,
1452    /// Enforces the specified codec profile. The following profiles are supported: * `profile0` (default) * `profile1` * `profile2` * `profile3` The available options are [WebM-compatible](https://www.webmproject.org/vp9/profiles/). Note that certain values for this field may cause the transcoder to override other fields you set in the `Vp9CodecSettings` message.
1453    pub profile: Option<String>,
1454    /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate
1455    #[serde(rename = "rateControlMode")]
1456    pub rate_control_mode: Option<String>,
1457    /// Optional. SDR color format setting for VP9.
1458    pub sdr: Option<Vp9ColorFormatSDR>,
1459    /// 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. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1460    #[serde(rename = "widthPixels")]
1461    pub width_pixels: Option<i32>,
1462}
1463
1464impl common::Part for Vp9CodecSettings {}
1465
1466/// Convert the input video to a Hybrid Log Gamma (HLG) video.
1467///
1468/// This type is not used in any activity, and only used as *part* of another schema.
1469///
1470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1471#[serde_with::serde_as]
1472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1473pub struct Vp9ColorFormatHLG {
1474    _never_set: Option<bool>,
1475}
1476
1477impl common::Part for Vp9ColorFormatHLG {}
1478
1479/// Convert the input video to a Standard Dynamic Range (SDR) video.
1480///
1481/// This type is not used in any activity, and only used as *part* of another schema.
1482///
1483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1484#[serde_with::serde_as]
1485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1486pub struct Vp9ColorFormatSDR {
1487    _never_set: Option<bool>,
1488}
1489
1490impl common::Part for Vp9ColorFormatSDR {}
1491
1492/// Widevine configuration.
1493///
1494/// This type is not used in any activity, and only used as *part* of another schema.
1495///
1496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1497#[serde_with::serde_as]
1498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1499pub struct Widevine {
1500    _never_set: Option<bool>,
1501}
1502
1503impl common::Part for Widevine {}
1504
1505/// Yet Another Deinterlacing Filter Configuration.
1506///
1507/// This type is not used in any activity, and only used as *part* of another schema.
1508///
1509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1510#[serde_with::serde_as]
1511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1512pub struct YadifConfig {
1513    /// Deinterlace all frames rather than just the frames identified as interlaced. The default is `false`.
1514    #[serde(rename = "deinterlaceAllFrames")]
1515    pub deinterlace_all_frames: Option<bool>,
1516    /// Disable spacial interlacing. The default is `false`.
1517    #[serde(rename = "disableSpatialInterlacing")]
1518    pub disable_spatial_interlacing: Option<bool>,
1519    /// Specifies the deinterlacing mode to adopt. The default is `send_frame`. Supported values: - `send_frame`: Output one frame for each frame - `send_field`: Output one frame for each field
1520    pub mode: Option<String>,
1521    /// The picture field parity assumed for the input interlaced video. The default is `auto`. Supported values: - `tff`: Assume the top field is first - `bff`: Assume the bottom field is first - `auto`: Enable automatic detection of field parity
1522    pub parity: Option<String>,
1523}
1524
1525impl common::Part for YadifConfig {}
1526
1527// ###################
1528// MethodBuilders ###
1529// #################
1530
1531/// A builder providing access to all methods supported on *project* resources.
1532/// It is not used directly, but through the [`Transcoder`] hub.
1533///
1534/// # Example
1535///
1536/// Instantiate a resource builder
1537///
1538/// ```test_harness,no_run
1539/// extern crate hyper;
1540/// extern crate hyper_rustls;
1541/// extern crate google_transcoder1 as transcoder1;
1542///
1543/// # async fn dox() {
1544/// use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1545///
1546/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1547/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1548///     secret,
1549///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1550/// ).build().await.unwrap();
1551///
1552/// let client = hyper_util::client::legacy::Client::builder(
1553///     hyper_util::rt::TokioExecutor::new()
1554/// )
1555/// .build(
1556///     hyper_rustls::HttpsConnectorBuilder::new()
1557///         .with_native_roots()
1558///         .unwrap()
1559///         .https_or_http()
1560///         .enable_http1()
1561///         .build()
1562/// );
1563/// let mut hub = Transcoder::new(client, auth);
1564/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1565/// // 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(...)`
1566/// // to build up your call.
1567/// let rb = hub.projects();
1568/// # }
1569/// ```
1570pub struct ProjectMethods<'a, C>
1571where
1572    C: 'a,
1573{
1574    hub: &'a Transcoder<C>,
1575}
1576
1577impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1578
1579impl<'a, C> ProjectMethods<'a, C> {
1580    /// Create a builder to help you perform the following task:
1581    ///
1582    /// Creates a job template in the specified region.
1583    ///
1584    /// # Arguments
1585    ///
1586    /// * `request` - No description provided.
1587    /// * `parent` - Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
1588    pub fn locations_job_templates_create(
1589        &self,
1590        request: JobTemplate,
1591        parent: &str,
1592    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1593        ProjectLocationJobTemplateCreateCall {
1594            hub: self.hub,
1595            _request: request,
1596            _parent: parent.to_string(),
1597            _job_template_id: Default::default(),
1598            _delegate: Default::default(),
1599            _additional_params: Default::default(),
1600            _scopes: Default::default(),
1601        }
1602    }
1603
1604    /// Create a builder to help you perform the following task:
1605    ///
1606    /// Deletes a job template.
1607    ///
1608    /// # Arguments
1609    ///
1610    /// * `name` - Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1611    pub fn locations_job_templates_delete(
1612        &self,
1613        name: &str,
1614    ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
1615        ProjectLocationJobTemplateDeleteCall {
1616            hub: self.hub,
1617            _name: name.to_string(),
1618            _allow_missing: Default::default(),
1619            _delegate: Default::default(),
1620            _additional_params: Default::default(),
1621            _scopes: Default::default(),
1622        }
1623    }
1624
1625    /// Create a builder to help you perform the following task:
1626    ///
1627    /// Returns the job template data.
1628    ///
1629    /// # Arguments
1630    ///
1631    /// * `name` - Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1632    pub fn locations_job_templates_get(
1633        &self,
1634        name: &str,
1635    ) -> ProjectLocationJobTemplateGetCall<'a, C> {
1636        ProjectLocationJobTemplateGetCall {
1637            hub: self.hub,
1638            _name: name.to_string(),
1639            _delegate: Default::default(),
1640            _additional_params: Default::default(),
1641            _scopes: Default::default(),
1642        }
1643    }
1644
1645    /// Create a builder to help you perform the following task:
1646    ///
1647    /// Lists job templates in the specified region.
1648    ///
1649    /// # Arguments
1650    ///
1651    /// * `parent` - Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
1652    pub fn locations_job_templates_list(
1653        &self,
1654        parent: &str,
1655    ) -> ProjectLocationJobTemplateListCall<'a, C> {
1656        ProjectLocationJobTemplateListCall {
1657            hub: self.hub,
1658            _parent: parent.to_string(),
1659            _page_token: Default::default(),
1660            _page_size: Default::default(),
1661            _order_by: Default::default(),
1662            _filter: Default::default(),
1663            _delegate: Default::default(),
1664            _additional_params: Default::default(),
1665            _scopes: Default::default(),
1666        }
1667    }
1668
1669    /// Create a builder to help you perform the following task:
1670    ///
1671    /// Creates a job in the specified region.
1672    ///
1673    /// # Arguments
1674    ///
1675    /// * `request` - No description provided.
1676    /// * `parent` - Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
1677    pub fn locations_jobs_create(
1678        &self,
1679        request: Job,
1680        parent: &str,
1681    ) -> ProjectLocationJobCreateCall<'a, C> {
1682        ProjectLocationJobCreateCall {
1683            hub: self.hub,
1684            _request: request,
1685            _parent: parent.to_string(),
1686            _delegate: Default::default(),
1687            _additional_params: Default::default(),
1688            _scopes: Default::default(),
1689        }
1690    }
1691
1692    /// Create a builder to help you perform the following task:
1693    ///
1694    /// Deletes a job.
1695    ///
1696    /// # Arguments
1697    ///
1698    /// * `name` - Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
1699    pub fn locations_jobs_delete(&self, name: &str) -> ProjectLocationJobDeleteCall<'a, C> {
1700        ProjectLocationJobDeleteCall {
1701            hub: self.hub,
1702            _name: name.to_string(),
1703            _allow_missing: Default::default(),
1704            _delegate: Default::default(),
1705            _additional_params: Default::default(),
1706            _scopes: Default::default(),
1707        }
1708    }
1709
1710    /// Create a builder to help you perform the following task:
1711    ///
1712    /// Returns the job data.
1713    ///
1714    /// # Arguments
1715    ///
1716    /// * `name` - Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
1717    pub fn locations_jobs_get(&self, name: &str) -> ProjectLocationJobGetCall<'a, C> {
1718        ProjectLocationJobGetCall {
1719            hub: self.hub,
1720            _name: name.to_string(),
1721            _delegate: Default::default(),
1722            _additional_params: Default::default(),
1723            _scopes: Default::default(),
1724        }
1725    }
1726
1727    /// Create a builder to help you perform the following task:
1728    ///
1729    /// Lists jobs in the specified region.
1730    ///
1731    /// # Arguments
1732    ///
1733    /// * `parent` - Required. Format: `projects/{project}/locations/{location}`
1734    pub fn locations_jobs_list(&self, parent: &str) -> ProjectLocationJobListCall<'a, C> {
1735        ProjectLocationJobListCall {
1736            hub: self.hub,
1737            _parent: parent.to_string(),
1738            _page_token: Default::default(),
1739            _page_size: Default::default(),
1740            _order_by: Default::default(),
1741            _filter: Default::default(),
1742            _delegate: Default::default(),
1743            _additional_params: Default::default(),
1744            _scopes: Default::default(),
1745        }
1746    }
1747}
1748
1749// ###################
1750// CallBuilders   ###
1751// #################
1752
1753/// Creates a job template in the specified region.
1754///
1755/// A builder for the *locations.jobTemplates.create* method supported by a *project* resource.
1756/// It is not used directly, but through a [`ProjectMethods`] instance.
1757///
1758/// # Example
1759///
1760/// Instantiate a resource method builder
1761///
1762/// ```test_harness,no_run
1763/// # extern crate hyper;
1764/// # extern crate hyper_rustls;
1765/// # extern crate google_transcoder1 as transcoder1;
1766/// use transcoder1::api::JobTemplate;
1767/// # async fn dox() {
1768/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1769///
1770/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1771/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1772/// #     secret,
1773/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1774/// # ).build().await.unwrap();
1775///
1776/// # let client = hyper_util::client::legacy::Client::builder(
1777/// #     hyper_util::rt::TokioExecutor::new()
1778/// # )
1779/// # .build(
1780/// #     hyper_rustls::HttpsConnectorBuilder::new()
1781/// #         .with_native_roots()
1782/// #         .unwrap()
1783/// #         .https_or_http()
1784/// #         .enable_http1()
1785/// #         .build()
1786/// # );
1787/// # let mut hub = Transcoder::new(client, auth);
1788/// // As the method needs a request, you would usually fill it with the desired information
1789/// // into the respective structure. Some of the parts shown here might not be applicable !
1790/// // Values shown here are possibly random and not representative !
1791/// let mut req = JobTemplate::default();
1792///
1793/// // You can configure optional parameters by calling the respective setters at will, and
1794/// // execute the final call using `doit()`.
1795/// // Values shown here are possibly random and not representative !
1796/// let result = hub.projects().locations_job_templates_create(req, "parent")
1797///              .job_template_id("voluptua.")
1798///              .doit().await;
1799/// # }
1800/// ```
1801pub struct ProjectLocationJobTemplateCreateCall<'a, C>
1802where
1803    C: 'a,
1804{
1805    hub: &'a Transcoder<C>,
1806    _request: JobTemplate,
1807    _parent: String,
1808    _job_template_id: Option<String>,
1809    _delegate: Option<&'a mut dyn common::Delegate>,
1810    _additional_params: HashMap<String, String>,
1811    _scopes: BTreeSet<String>,
1812}
1813
1814impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateCreateCall<'a, C> {}
1815
1816impl<'a, C> ProjectLocationJobTemplateCreateCall<'a, C>
1817where
1818    C: common::Connector,
1819{
1820    /// Perform the operation you have build so far.
1821    pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
1822        use std::borrow::Cow;
1823        use std::io::{Read, Seek};
1824
1825        use common::{url::Params, ToParts};
1826        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1827
1828        let mut dd = common::DefaultDelegate;
1829        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1830        dlg.begin(common::MethodInfo {
1831            id: "transcoder.projects.locations.jobTemplates.create",
1832            http_method: hyper::Method::POST,
1833        });
1834
1835        for &field in ["alt", "parent", "jobTemplateId"].iter() {
1836            if self._additional_params.contains_key(field) {
1837                dlg.finished(false);
1838                return Err(common::Error::FieldClash(field));
1839            }
1840        }
1841
1842        let mut params = Params::with_capacity(5 + self._additional_params.len());
1843        params.push("parent", self._parent);
1844        if let Some(value) = self._job_template_id.as_ref() {
1845            params.push("jobTemplateId", value);
1846        }
1847
1848        params.extend(self._additional_params.iter());
1849
1850        params.push("alt", "json");
1851        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobTemplates";
1852        if self._scopes.is_empty() {
1853            self._scopes
1854                .insert(Scope::CloudPlatform.as_ref().to_string());
1855        }
1856
1857        #[allow(clippy::single_element_loop)]
1858        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1859            url = params.uri_replacement(url, param_name, find_this, true);
1860        }
1861        {
1862            let to_remove = ["parent"];
1863            params.remove_params(&to_remove);
1864        }
1865
1866        let url = params.parse_with_url(&url);
1867
1868        let mut json_mime_type = mime::APPLICATION_JSON;
1869        let mut request_value_reader = {
1870            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1871            common::remove_json_null_values(&mut value);
1872            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1873            serde_json::to_writer(&mut dst, &value).unwrap();
1874            dst
1875        };
1876        let request_size = request_value_reader
1877            .seek(std::io::SeekFrom::End(0))
1878            .unwrap();
1879        request_value_reader
1880            .seek(std::io::SeekFrom::Start(0))
1881            .unwrap();
1882
1883        loop {
1884            let token = match self
1885                .hub
1886                .auth
1887                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1888                .await
1889            {
1890                Ok(token) => token,
1891                Err(e) => match dlg.token(e) {
1892                    Ok(token) => token,
1893                    Err(e) => {
1894                        dlg.finished(false);
1895                        return Err(common::Error::MissingToken(e));
1896                    }
1897                },
1898            };
1899            request_value_reader
1900                .seek(std::io::SeekFrom::Start(0))
1901                .unwrap();
1902            let mut req_result = {
1903                let client = &self.hub.client;
1904                dlg.pre_request();
1905                let mut req_builder = hyper::Request::builder()
1906                    .method(hyper::Method::POST)
1907                    .uri(url.as_str())
1908                    .header(USER_AGENT, self.hub._user_agent.clone());
1909
1910                if let Some(token) = token.as_ref() {
1911                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1912                }
1913
1914                let request = req_builder
1915                    .header(CONTENT_TYPE, json_mime_type.to_string())
1916                    .header(CONTENT_LENGTH, request_size as u64)
1917                    .body(common::to_body(
1918                        request_value_reader.get_ref().clone().into(),
1919                    ));
1920
1921                client.request(request.unwrap()).await
1922            };
1923
1924            match req_result {
1925                Err(err) => {
1926                    if let common::Retry::After(d) = dlg.http_error(&err) {
1927                        sleep(d).await;
1928                        continue;
1929                    }
1930                    dlg.finished(false);
1931                    return Err(common::Error::HttpError(err));
1932                }
1933                Ok(res) => {
1934                    let (mut parts, body) = res.into_parts();
1935                    let mut body = common::Body::new(body);
1936                    if !parts.status.is_success() {
1937                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1938                        let error = serde_json::from_str(&common::to_string(&bytes));
1939                        let response = common::to_response(parts, bytes.into());
1940
1941                        if let common::Retry::After(d) =
1942                            dlg.http_failure(&response, error.as_ref().ok())
1943                        {
1944                            sleep(d).await;
1945                            continue;
1946                        }
1947
1948                        dlg.finished(false);
1949
1950                        return Err(match error {
1951                            Ok(value) => common::Error::BadRequest(value),
1952                            _ => common::Error::Failure(response),
1953                        });
1954                    }
1955                    let response = {
1956                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1957                        let encoded = common::to_string(&bytes);
1958                        match serde_json::from_str(&encoded) {
1959                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1960                            Err(error) => {
1961                                dlg.response_json_decode_error(&encoded, &error);
1962                                return Err(common::Error::JsonDecodeError(
1963                                    encoded.to_string(),
1964                                    error,
1965                                ));
1966                            }
1967                        }
1968                    };
1969
1970                    dlg.finished(true);
1971                    return Ok(response);
1972                }
1973            }
1974        }
1975    }
1976
1977    ///
1978    /// Sets the *request* property to the given value.
1979    ///
1980    /// Even though the property as already been set when instantiating this call,
1981    /// we provide this method for API completeness.
1982    pub fn request(
1983        mut self,
1984        new_value: JobTemplate,
1985    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1986        self._request = new_value;
1987        self
1988    }
1989    /// Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
1990    ///
1991    /// Sets the *parent* path property to the given value.
1992    ///
1993    /// Even though the property as already been set when instantiating this call,
1994    /// we provide this method for API completeness.
1995    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1996        self._parent = new_value.to_string();
1997        self
1998    }
1999    /// 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*`.
2000    ///
2001    /// Sets the *job template id* query property to the given value.
2002    pub fn job_template_id(
2003        mut self,
2004        new_value: &str,
2005    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2006        self._job_template_id = Some(new_value.to_string());
2007        self
2008    }
2009    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2010    /// while executing the actual API request.
2011    ///
2012    /// ````text
2013    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2014    /// ````
2015    ///
2016    /// Sets the *delegate* property to the given value.
2017    pub fn delegate(
2018        mut self,
2019        new_value: &'a mut dyn common::Delegate,
2020    ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2021        self._delegate = Some(new_value);
2022        self
2023    }
2024
2025    /// Set any additional parameter of the query string used in the request.
2026    /// It should be used to set parameters which are not yet available through their own
2027    /// setters.
2028    ///
2029    /// Please note that this method must not be used to set any of the known parameters
2030    /// which have their own setter method. If done anyway, the request will fail.
2031    ///
2032    /// # Additional Parameters
2033    ///
2034    /// * *$.xgafv* (query-string) - V1 error format.
2035    /// * *access_token* (query-string) - OAuth access token.
2036    /// * *alt* (query-string) - Data format for response.
2037    /// * *callback* (query-string) - JSONP
2038    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2039    /// * *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.
2040    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2041    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2042    /// * *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.
2043    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2044    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2045    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateCreateCall<'a, C>
2046    where
2047        T: AsRef<str>,
2048    {
2049        self._additional_params
2050            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2051        self
2052    }
2053
2054    /// Identifies the authorization scope for the method you are building.
2055    ///
2056    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2057    /// [`Scope::CloudPlatform`].
2058    ///
2059    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2060    /// tokens for more than one scope.
2061    ///
2062    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2063    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2064    /// sufficient, a read-write scope will do as well.
2065    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateCreateCall<'a, C>
2066    where
2067        St: AsRef<str>,
2068    {
2069        self._scopes.insert(String::from(scope.as_ref()));
2070        self
2071    }
2072    /// Identifies the authorization scope(s) for the method you are building.
2073    ///
2074    /// See [`Self::add_scope()`] for details.
2075    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateCreateCall<'a, C>
2076    where
2077        I: IntoIterator<Item = St>,
2078        St: AsRef<str>,
2079    {
2080        self._scopes
2081            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2082        self
2083    }
2084
2085    /// Removes all scopes, and no default scope will be used either.
2086    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2087    /// for details).
2088    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2089        self._scopes.clear();
2090        self
2091    }
2092}
2093
2094/// Deletes a job template.
2095///
2096/// A builder for the *locations.jobTemplates.delete* method supported by a *project* resource.
2097/// It is not used directly, but through a [`ProjectMethods`] instance.
2098///
2099/// # Example
2100///
2101/// Instantiate a resource method builder
2102///
2103/// ```test_harness,no_run
2104/// # extern crate hyper;
2105/// # extern crate hyper_rustls;
2106/// # extern crate google_transcoder1 as transcoder1;
2107/// # async fn dox() {
2108/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2109///
2110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2112/// #     secret,
2113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2114/// # ).build().await.unwrap();
2115///
2116/// # let client = hyper_util::client::legacy::Client::builder(
2117/// #     hyper_util::rt::TokioExecutor::new()
2118/// # )
2119/// # .build(
2120/// #     hyper_rustls::HttpsConnectorBuilder::new()
2121/// #         .with_native_roots()
2122/// #         .unwrap()
2123/// #         .https_or_http()
2124/// #         .enable_http1()
2125/// #         .build()
2126/// # );
2127/// # let mut hub = Transcoder::new(client, auth);
2128/// // You can configure optional parameters by calling the respective setters at will, and
2129/// // execute the final call using `doit()`.
2130/// // Values shown here are possibly random and not representative !
2131/// let result = hub.projects().locations_job_templates_delete("name")
2132///              .allow_missing(false)
2133///              .doit().await;
2134/// # }
2135/// ```
2136pub struct ProjectLocationJobTemplateDeleteCall<'a, C>
2137where
2138    C: 'a,
2139{
2140    hub: &'a Transcoder<C>,
2141    _name: String,
2142    _allow_missing: Option<bool>,
2143    _delegate: Option<&'a mut dyn common::Delegate>,
2144    _additional_params: HashMap<String, String>,
2145    _scopes: BTreeSet<String>,
2146}
2147
2148impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateDeleteCall<'a, C> {}
2149
2150impl<'a, C> ProjectLocationJobTemplateDeleteCall<'a, C>
2151where
2152    C: common::Connector,
2153{
2154    /// Perform the operation you have build so far.
2155    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2156        use std::borrow::Cow;
2157        use std::io::{Read, Seek};
2158
2159        use common::{url::Params, ToParts};
2160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2161
2162        let mut dd = common::DefaultDelegate;
2163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2164        dlg.begin(common::MethodInfo {
2165            id: "transcoder.projects.locations.jobTemplates.delete",
2166            http_method: hyper::Method::DELETE,
2167        });
2168
2169        for &field in ["alt", "name", "allowMissing"].iter() {
2170            if self._additional_params.contains_key(field) {
2171                dlg.finished(false);
2172                return Err(common::Error::FieldClash(field));
2173            }
2174        }
2175
2176        let mut params = Params::with_capacity(4 + self._additional_params.len());
2177        params.push("name", self._name);
2178        if let Some(value) = self._allow_missing.as_ref() {
2179            params.push("allowMissing", value.to_string());
2180        }
2181
2182        params.extend(self._additional_params.iter());
2183
2184        params.push("alt", "json");
2185        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2186        if self._scopes.is_empty() {
2187            self._scopes
2188                .insert(Scope::CloudPlatform.as_ref().to_string());
2189        }
2190
2191        #[allow(clippy::single_element_loop)]
2192        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2193            url = params.uri_replacement(url, param_name, find_this, true);
2194        }
2195        {
2196            let to_remove = ["name"];
2197            params.remove_params(&to_remove);
2198        }
2199
2200        let url = params.parse_with_url(&url);
2201
2202        loop {
2203            let token = match self
2204                .hub
2205                .auth
2206                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2207                .await
2208            {
2209                Ok(token) => token,
2210                Err(e) => match dlg.token(e) {
2211                    Ok(token) => token,
2212                    Err(e) => {
2213                        dlg.finished(false);
2214                        return Err(common::Error::MissingToken(e));
2215                    }
2216                },
2217            };
2218            let mut req_result = {
2219                let client = &self.hub.client;
2220                dlg.pre_request();
2221                let mut req_builder = hyper::Request::builder()
2222                    .method(hyper::Method::DELETE)
2223                    .uri(url.as_str())
2224                    .header(USER_AGENT, self.hub._user_agent.clone());
2225
2226                if let Some(token) = token.as_ref() {
2227                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2228                }
2229
2230                let request = req_builder
2231                    .header(CONTENT_LENGTH, 0_u64)
2232                    .body(common::to_body::<String>(None));
2233
2234                client.request(request.unwrap()).await
2235            };
2236
2237            match req_result {
2238                Err(err) => {
2239                    if let common::Retry::After(d) = dlg.http_error(&err) {
2240                        sleep(d).await;
2241                        continue;
2242                    }
2243                    dlg.finished(false);
2244                    return Err(common::Error::HttpError(err));
2245                }
2246                Ok(res) => {
2247                    let (mut parts, body) = res.into_parts();
2248                    let mut body = common::Body::new(body);
2249                    if !parts.status.is_success() {
2250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2251                        let error = serde_json::from_str(&common::to_string(&bytes));
2252                        let response = common::to_response(parts, bytes.into());
2253
2254                        if let common::Retry::After(d) =
2255                            dlg.http_failure(&response, error.as_ref().ok())
2256                        {
2257                            sleep(d).await;
2258                            continue;
2259                        }
2260
2261                        dlg.finished(false);
2262
2263                        return Err(match error {
2264                            Ok(value) => common::Error::BadRequest(value),
2265                            _ => common::Error::Failure(response),
2266                        });
2267                    }
2268                    let response = {
2269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2270                        let encoded = common::to_string(&bytes);
2271                        match serde_json::from_str(&encoded) {
2272                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2273                            Err(error) => {
2274                                dlg.response_json_decode_error(&encoded, &error);
2275                                return Err(common::Error::JsonDecodeError(
2276                                    encoded.to_string(),
2277                                    error,
2278                                ));
2279                            }
2280                        }
2281                    };
2282
2283                    dlg.finished(true);
2284                    return Ok(response);
2285                }
2286            }
2287        }
2288    }
2289
2290    /// Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
2291    ///
2292    /// Sets the *name* path property to the given value.
2293    ///
2294    /// Even though the property as already been set when instantiating this call,
2295    /// we provide this method for API completeness.
2296    pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2297        self._name = new_value.to_string();
2298        self
2299    }
2300    /// If set to true, and the job template is not found, the request will succeed but no action will be taken on the server.
2301    ///
2302    /// Sets the *allow missing* query property to the given value.
2303    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2304        self._allow_missing = Some(new_value);
2305        self
2306    }
2307    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2308    /// while executing the actual API request.
2309    ///
2310    /// ````text
2311    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2312    /// ````
2313    ///
2314    /// Sets the *delegate* property to the given value.
2315    pub fn delegate(
2316        mut self,
2317        new_value: &'a mut dyn common::Delegate,
2318    ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2319        self._delegate = Some(new_value);
2320        self
2321    }
2322
2323    /// Set any additional parameter of the query string used in the request.
2324    /// It should be used to set parameters which are not yet available through their own
2325    /// setters.
2326    ///
2327    /// Please note that this method must not be used to set any of the known parameters
2328    /// which have their own setter method. If done anyway, the request will fail.
2329    ///
2330    /// # Additional Parameters
2331    ///
2332    /// * *$.xgafv* (query-string) - V1 error format.
2333    /// * *access_token* (query-string) - OAuth access token.
2334    /// * *alt* (query-string) - Data format for response.
2335    /// * *callback* (query-string) - JSONP
2336    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2337    /// * *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.
2338    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2339    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2340    /// * *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.
2341    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2342    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2343    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2344    where
2345        T: AsRef<str>,
2346    {
2347        self._additional_params
2348            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2349        self
2350    }
2351
2352    /// Identifies the authorization scope for the method you are building.
2353    ///
2354    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2355    /// [`Scope::CloudPlatform`].
2356    ///
2357    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2358    /// tokens for more than one scope.
2359    ///
2360    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2361    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2362    /// sufficient, a read-write scope will do as well.
2363    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2364    where
2365        St: AsRef<str>,
2366    {
2367        self._scopes.insert(String::from(scope.as_ref()));
2368        self
2369    }
2370    /// Identifies the authorization scope(s) for the method you are building.
2371    ///
2372    /// See [`Self::add_scope()`] for details.
2373    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2374    where
2375        I: IntoIterator<Item = St>,
2376        St: AsRef<str>,
2377    {
2378        self._scopes
2379            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2380        self
2381    }
2382
2383    /// Removes all scopes, and no default scope will be used either.
2384    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2385    /// for details).
2386    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2387        self._scopes.clear();
2388        self
2389    }
2390}
2391
2392/// Returns the job template data.
2393///
2394/// A builder for the *locations.jobTemplates.get* method supported by a *project* resource.
2395/// It is not used directly, but through a [`ProjectMethods`] instance.
2396///
2397/// # Example
2398///
2399/// Instantiate a resource method builder
2400///
2401/// ```test_harness,no_run
2402/// # extern crate hyper;
2403/// # extern crate hyper_rustls;
2404/// # extern crate google_transcoder1 as transcoder1;
2405/// # async fn dox() {
2406/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2407///
2408/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2410/// #     secret,
2411/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2412/// # ).build().await.unwrap();
2413///
2414/// # let client = hyper_util::client::legacy::Client::builder(
2415/// #     hyper_util::rt::TokioExecutor::new()
2416/// # )
2417/// # .build(
2418/// #     hyper_rustls::HttpsConnectorBuilder::new()
2419/// #         .with_native_roots()
2420/// #         .unwrap()
2421/// #         .https_or_http()
2422/// #         .enable_http1()
2423/// #         .build()
2424/// # );
2425/// # let mut hub = Transcoder::new(client, auth);
2426/// // You can configure optional parameters by calling the respective setters at will, and
2427/// // execute the final call using `doit()`.
2428/// // Values shown here are possibly random and not representative !
2429/// let result = hub.projects().locations_job_templates_get("name")
2430///              .doit().await;
2431/// # }
2432/// ```
2433pub struct ProjectLocationJobTemplateGetCall<'a, C>
2434where
2435    C: 'a,
2436{
2437    hub: &'a Transcoder<C>,
2438    _name: String,
2439    _delegate: Option<&'a mut dyn common::Delegate>,
2440    _additional_params: HashMap<String, String>,
2441    _scopes: BTreeSet<String>,
2442}
2443
2444impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateGetCall<'a, C> {}
2445
2446impl<'a, C> ProjectLocationJobTemplateGetCall<'a, C>
2447where
2448    C: common::Connector,
2449{
2450    /// Perform the operation you have build so far.
2451    pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
2452        use std::borrow::Cow;
2453        use std::io::{Read, Seek};
2454
2455        use common::{url::Params, ToParts};
2456        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2457
2458        let mut dd = common::DefaultDelegate;
2459        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2460        dlg.begin(common::MethodInfo {
2461            id: "transcoder.projects.locations.jobTemplates.get",
2462            http_method: hyper::Method::GET,
2463        });
2464
2465        for &field in ["alt", "name"].iter() {
2466            if self._additional_params.contains_key(field) {
2467                dlg.finished(false);
2468                return Err(common::Error::FieldClash(field));
2469            }
2470        }
2471
2472        let mut params = Params::with_capacity(3 + self._additional_params.len());
2473        params.push("name", self._name);
2474
2475        params.extend(self._additional_params.iter());
2476
2477        params.push("alt", "json");
2478        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2479        if self._scopes.is_empty() {
2480            self._scopes
2481                .insert(Scope::CloudPlatform.as_ref().to_string());
2482        }
2483
2484        #[allow(clippy::single_element_loop)]
2485        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2486            url = params.uri_replacement(url, param_name, find_this, true);
2487        }
2488        {
2489            let to_remove = ["name"];
2490            params.remove_params(&to_remove);
2491        }
2492
2493        let url = params.parse_with_url(&url);
2494
2495        loop {
2496            let token = match self
2497                .hub
2498                .auth
2499                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2500                .await
2501            {
2502                Ok(token) => token,
2503                Err(e) => match dlg.token(e) {
2504                    Ok(token) => token,
2505                    Err(e) => {
2506                        dlg.finished(false);
2507                        return Err(common::Error::MissingToken(e));
2508                    }
2509                },
2510            };
2511            let mut req_result = {
2512                let client = &self.hub.client;
2513                dlg.pre_request();
2514                let mut req_builder = hyper::Request::builder()
2515                    .method(hyper::Method::GET)
2516                    .uri(url.as_str())
2517                    .header(USER_AGENT, self.hub._user_agent.clone());
2518
2519                if let Some(token) = token.as_ref() {
2520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2521                }
2522
2523                let request = req_builder
2524                    .header(CONTENT_LENGTH, 0_u64)
2525                    .body(common::to_body::<String>(None));
2526
2527                client.request(request.unwrap()).await
2528            };
2529
2530            match req_result {
2531                Err(err) => {
2532                    if let common::Retry::After(d) = dlg.http_error(&err) {
2533                        sleep(d).await;
2534                        continue;
2535                    }
2536                    dlg.finished(false);
2537                    return Err(common::Error::HttpError(err));
2538                }
2539                Ok(res) => {
2540                    let (mut parts, body) = res.into_parts();
2541                    let mut body = common::Body::new(body);
2542                    if !parts.status.is_success() {
2543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2544                        let error = serde_json::from_str(&common::to_string(&bytes));
2545                        let response = common::to_response(parts, bytes.into());
2546
2547                        if let common::Retry::After(d) =
2548                            dlg.http_failure(&response, error.as_ref().ok())
2549                        {
2550                            sleep(d).await;
2551                            continue;
2552                        }
2553
2554                        dlg.finished(false);
2555
2556                        return Err(match error {
2557                            Ok(value) => common::Error::BadRequest(value),
2558                            _ => common::Error::Failure(response),
2559                        });
2560                    }
2561                    let response = {
2562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2563                        let encoded = common::to_string(&bytes);
2564                        match serde_json::from_str(&encoded) {
2565                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2566                            Err(error) => {
2567                                dlg.response_json_decode_error(&encoded, &error);
2568                                return Err(common::Error::JsonDecodeError(
2569                                    encoded.to_string(),
2570                                    error,
2571                                ));
2572                            }
2573                        }
2574                    };
2575
2576                    dlg.finished(true);
2577                    return Ok(response);
2578                }
2579            }
2580        }
2581    }
2582
2583    /// Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
2584    ///
2585    /// Sets the *name* path property to the given value.
2586    ///
2587    /// Even though the property as already been set when instantiating this call,
2588    /// we provide this method for API completeness.
2589    pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateGetCall<'a, C> {
2590        self._name = new_value.to_string();
2591        self
2592    }
2593    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2594    /// while executing the actual API request.
2595    ///
2596    /// ````text
2597    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2598    /// ````
2599    ///
2600    /// Sets the *delegate* property to the given value.
2601    pub fn delegate(
2602        mut self,
2603        new_value: &'a mut dyn common::Delegate,
2604    ) -> ProjectLocationJobTemplateGetCall<'a, C> {
2605        self._delegate = Some(new_value);
2606        self
2607    }
2608
2609    /// Set any additional parameter of the query string used in the request.
2610    /// It should be used to set parameters which are not yet available through their own
2611    /// setters.
2612    ///
2613    /// Please note that this method must not be used to set any of the known parameters
2614    /// which have their own setter method. If done anyway, the request will fail.
2615    ///
2616    /// # Additional Parameters
2617    ///
2618    /// * *$.xgafv* (query-string) - V1 error format.
2619    /// * *access_token* (query-string) - OAuth access token.
2620    /// * *alt* (query-string) - Data format for response.
2621    /// * *callback* (query-string) - JSONP
2622    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2623    /// * *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.
2624    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2625    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2626    /// * *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.
2627    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2628    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2629    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateGetCall<'a, C>
2630    where
2631        T: AsRef<str>,
2632    {
2633        self._additional_params
2634            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2635        self
2636    }
2637
2638    /// Identifies the authorization scope for the method you are building.
2639    ///
2640    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2641    /// [`Scope::CloudPlatform`].
2642    ///
2643    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2644    /// tokens for more than one scope.
2645    ///
2646    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2647    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2648    /// sufficient, a read-write scope will do as well.
2649    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateGetCall<'a, C>
2650    where
2651        St: AsRef<str>,
2652    {
2653        self._scopes.insert(String::from(scope.as_ref()));
2654        self
2655    }
2656    /// Identifies the authorization scope(s) for the method you are building.
2657    ///
2658    /// See [`Self::add_scope()`] for details.
2659    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateGetCall<'a, C>
2660    where
2661        I: IntoIterator<Item = St>,
2662        St: AsRef<str>,
2663    {
2664        self._scopes
2665            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2666        self
2667    }
2668
2669    /// Removes all scopes, and no default scope will be used either.
2670    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2671    /// for details).
2672    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateGetCall<'a, C> {
2673        self._scopes.clear();
2674        self
2675    }
2676}
2677
2678/// Lists job templates in the specified region.
2679///
2680/// A builder for the *locations.jobTemplates.list* method supported by a *project* resource.
2681/// It is not used directly, but through a [`ProjectMethods`] instance.
2682///
2683/// # Example
2684///
2685/// Instantiate a resource method builder
2686///
2687/// ```test_harness,no_run
2688/// # extern crate hyper;
2689/// # extern crate hyper_rustls;
2690/// # extern crate google_transcoder1 as transcoder1;
2691/// # async fn dox() {
2692/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2693///
2694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2696/// #     secret,
2697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2698/// # ).build().await.unwrap();
2699///
2700/// # let client = hyper_util::client::legacy::Client::builder(
2701/// #     hyper_util::rt::TokioExecutor::new()
2702/// # )
2703/// # .build(
2704/// #     hyper_rustls::HttpsConnectorBuilder::new()
2705/// #         .with_native_roots()
2706/// #         .unwrap()
2707/// #         .https_or_http()
2708/// #         .enable_http1()
2709/// #         .build()
2710/// # );
2711/// # let mut hub = Transcoder::new(client, auth);
2712/// // You can configure optional parameters by calling the respective setters at will, and
2713/// // execute the final call using `doit()`.
2714/// // Values shown here are possibly random and not representative !
2715/// let result = hub.projects().locations_job_templates_list("parent")
2716///              .page_token("amet.")
2717///              .page_size(-20)
2718///              .order_by("ipsum")
2719///              .filter("gubergren")
2720///              .doit().await;
2721/// # }
2722/// ```
2723pub struct ProjectLocationJobTemplateListCall<'a, C>
2724where
2725    C: 'a,
2726{
2727    hub: &'a Transcoder<C>,
2728    _parent: String,
2729    _page_token: Option<String>,
2730    _page_size: Option<i32>,
2731    _order_by: Option<String>,
2732    _filter: Option<String>,
2733    _delegate: Option<&'a mut dyn common::Delegate>,
2734    _additional_params: HashMap<String, String>,
2735    _scopes: BTreeSet<String>,
2736}
2737
2738impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateListCall<'a, C> {}
2739
2740impl<'a, C> ProjectLocationJobTemplateListCall<'a, C>
2741where
2742    C: common::Connector,
2743{
2744    /// Perform the operation you have build so far.
2745    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobTemplatesResponse)> {
2746        use std::borrow::Cow;
2747        use std::io::{Read, Seek};
2748
2749        use common::{url::Params, ToParts};
2750        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2751
2752        let mut dd = common::DefaultDelegate;
2753        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2754        dlg.begin(common::MethodInfo {
2755            id: "transcoder.projects.locations.jobTemplates.list",
2756            http_method: hyper::Method::GET,
2757        });
2758
2759        for &field in [
2760            "alt",
2761            "parent",
2762            "pageToken",
2763            "pageSize",
2764            "orderBy",
2765            "filter",
2766        ]
2767        .iter()
2768        {
2769            if self._additional_params.contains_key(field) {
2770                dlg.finished(false);
2771                return Err(common::Error::FieldClash(field));
2772            }
2773        }
2774
2775        let mut params = Params::with_capacity(7 + self._additional_params.len());
2776        params.push("parent", self._parent);
2777        if let Some(value) = self._page_token.as_ref() {
2778            params.push("pageToken", value);
2779        }
2780        if let Some(value) = self._page_size.as_ref() {
2781            params.push("pageSize", value.to_string());
2782        }
2783        if let Some(value) = self._order_by.as_ref() {
2784            params.push("orderBy", value);
2785        }
2786        if let Some(value) = self._filter.as_ref() {
2787            params.push("filter", value);
2788        }
2789
2790        params.extend(self._additional_params.iter());
2791
2792        params.push("alt", "json");
2793        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobTemplates";
2794        if self._scopes.is_empty() {
2795            self._scopes
2796                .insert(Scope::CloudPlatform.as_ref().to_string());
2797        }
2798
2799        #[allow(clippy::single_element_loop)]
2800        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2801            url = params.uri_replacement(url, param_name, find_this, true);
2802        }
2803        {
2804            let to_remove = ["parent"];
2805            params.remove_params(&to_remove);
2806        }
2807
2808        let url = params.parse_with_url(&url);
2809
2810        loop {
2811            let token = match self
2812                .hub
2813                .auth
2814                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2815                .await
2816            {
2817                Ok(token) => token,
2818                Err(e) => match dlg.token(e) {
2819                    Ok(token) => token,
2820                    Err(e) => {
2821                        dlg.finished(false);
2822                        return Err(common::Error::MissingToken(e));
2823                    }
2824                },
2825            };
2826            let mut req_result = {
2827                let client = &self.hub.client;
2828                dlg.pre_request();
2829                let mut req_builder = hyper::Request::builder()
2830                    .method(hyper::Method::GET)
2831                    .uri(url.as_str())
2832                    .header(USER_AGENT, self.hub._user_agent.clone());
2833
2834                if let Some(token) = token.as_ref() {
2835                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2836                }
2837
2838                let request = req_builder
2839                    .header(CONTENT_LENGTH, 0_u64)
2840                    .body(common::to_body::<String>(None));
2841
2842                client.request(request.unwrap()).await
2843            };
2844
2845            match req_result {
2846                Err(err) => {
2847                    if let common::Retry::After(d) = dlg.http_error(&err) {
2848                        sleep(d).await;
2849                        continue;
2850                    }
2851                    dlg.finished(false);
2852                    return Err(common::Error::HttpError(err));
2853                }
2854                Ok(res) => {
2855                    let (mut parts, body) = res.into_parts();
2856                    let mut body = common::Body::new(body);
2857                    if !parts.status.is_success() {
2858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2859                        let error = serde_json::from_str(&common::to_string(&bytes));
2860                        let response = common::to_response(parts, bytes.into());
2861
2862                        if let common::Retry::After(d) =
2863                            dlg.http_failure(&response, error.as_ref().ok())
2864                        {
2865                            sleep(d).await;
2866                            continue;
2867                        }
2868
2869                        dlg.finished(false);
2870
2871                        return Err(match error {
2872                            Ok(value) => common::Error::BadRequest(value),
2873                            _ => common::Error::Failure(response),
2874                        });
2875                    }
2876                    let response = {
2877                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2878                        let encoded = common::to_string(&bytes);
2879                        match serde_json::from_str(&encoded) {
2880                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2881                            Err(error) => {
2882                                dlg.response_json_decode_error(&encoded, &error);
2883                                return Err(common::Error::JsonDecodeError(
2884                                    encoded.to_string(),
2885                                    error,
2886                                ));
2887                            }
2888                        }
2889                    };
2890
2891                    dlg.finished(true);
2892                    return Ok(response);
2893                }
2894            }
2895        }
2896    }
2897
2898    /// Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
2899    ///
2900    /// Sets the *parent* path property to the given value.
2901    ///
2902    /// Even though the property as already been set when instantiating this call,
2903    /// we provide this method for API completeness.
2904    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2905        self._parent = new_value.to_string();
2906        self
2907    }
2908    /// The `next_page_token` value returned from a previous List request, if any.
2909    ///
2910    /// Sets the *page token* query property to the given value.
2911    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2912        self._page_token = Some(new_value.to_string());
2913        self
2914    }
2915    /// The maximum number of items to return.
2916    ///
2917    /// Sets the *page size* query property to the given value.
2918    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobTemplateListCall<'a, C> {
2919        self._page_size = Some(new_value);
2920        self
2921    }
2922    /// One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
2923    ///
2924    /// Sets the *order by* query property to the given value.
2925    pub fn order_by(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2926        self._order_by = Some(new_value.to_string());
2927        self
2928    }
2929    /// The filter expression, following the syntax outlined in https://google.aip.dev/160.
2930    ///
2931    /// Sets the *filter* query property to the given value.
2932    pub fn filter(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
2933        self._filter = Some(new_value.to_string());
2934        self
2935    }
2936    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2937    /// while executing the actual API request.
2938    ///
2939    /// ````text
2940    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2941    /// ````
2942    ///
2943    /// Sets the *delegate* property to the given value.
2944    pub fn delegate(
2945        mut self,
2946        new_value: &'a mut dyn common::Delegate,
2947    ) -> ProjectLocationJobTemplateListCall<'a, C> {
2948        self._delegate = Some(new_value);
2949        self
2950    }
2951
2952    /// Set any additional parameter of the query string used in the request.
2953    /// It should be used to set parameters which are not yet available through their own
2954    /// setters.
2955    ///
2956    /// Please note that this method must not be used to set any of the known parameters
2957    /// which have their own setter method. If done anyway, the request will fail.
2958    ///
2959    /// # Additional Parameters
2960    ///
2961    /// * *$.xgafv* (query-string) - V1 error format.
2962    /// * *access_token* (query-string) - OAuth access token.
2963    /// * *alt* (query-string) - Data format for response.
2964    /// * *callback* (query-string) - JSONP
2965    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2966    /// * *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.
2967    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2968    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2969    /// * *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.
2970    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2971    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2972    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateListCall<'a, C>
2973    where
2974        T: AsRef<str>,
2975    {
2976        self._additional_params
2977            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2978        self
2979    }
2980
2981    /// Identifies the authorization scope for the method you are building.
2982    ///
2983    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2984    /// [`Scope::CloudPlatform`].
2985    ///
2986    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2987    /// tokens for more than one scope.
2988    ///
2989    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2990    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2991    /// sufficient, a read-write scope will do as well.
2992    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateListCall<'a, C>
2993    where
2994        St: AsRef<str>,
2995    {
2996        self._scopes.insert(String::from(scope.as_ref()));
2997        self
2998    }
2999    /// Identifies the authorization scope(s) for the method you are building.
3000    ///
3001    /// See [`Self::add_scope()`] for details.
3002    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateListCall<'a, C>
3003    where
3004        I: IntoIterator<Item = St>,
3005        St: AsRef<str>,
3006    {
3007        self._scopes
3008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3009        self
3010    }
3011
3012    /// Removes all scopes, and no default scope will be used either.
3013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3014    /// for details).
3015    pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateListCall<'a, C> {
3016        self._scopes.clear();
3017        self
3018    }
3019}
3020
3021/// Creates a job in the specified region.
3022///
3023/// A builder for the *locations.jobs.create* method supported by a *project* resource.
3024/// It is not used directly, but through a [`ProjectMethods`] instance.
3025///
3026/// # Example
3027///
3028/// Instantiate a resource method builder
3029///
3030/// ```test_harness,no_run
3031/// # extern crate hyper;
3032/// # extern crate hyper_rustls;
3033/// # extern crate google_transcoder1 as transcoder1;
3034/// use transcoder1::api::Job;
3035/// # async fn dox() {
3036/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3037///
3038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3040/// #     secret,
3041/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3042/// # ).build().await.unwrap();
3043///
3044/// # let client = hyper_util::client::legacy::Client::builder(
3045/// #     hyper_util::rt::TokioExecutor::new()
3046/// # )
3047/// # .build(
3048/// #     hyper_rustls::HttpsConnectorBuilder::new()
3049/// #         .with_native_roots()
3050/// #         .unwrap()
3051/// #         .https_or_http()
3052/// #         .enable_http1()
3053/// #         .build()
3054/// # );
3055/// # let mut hub = Transcoder::new(client, auth);
3056/// // As the method needs a request, you would usually fill it with the desired information
3057/// // into the respective structure. Some of the parts shown here might not be applicable !
3058/// // Values shown here are possibly random and not representative !
3059/// let mut req = Job::default();
3060///
3061/// // You can configure optional parameters by calling the respective setters at will, and
3062/// // execute the final call using `doit()`.
3063/// // Values shown here are possibly random and not representative !
3064/// let result = hub.projects().locations_jobs_create(req, "parent")
3065///              .doit().await;
3066/// # }
3067/// ```
3068pub struct ProjectLocationJobCreateCall<'a, C>
3069where
3070    C: 'a,
3071{
3072    hub: &'a Transcoder<C>,
3073    _request: Job,
3074    _parent: String,
3075    _delegate: Option<&'a mut dyn common::Delegate>,
3076    _additional_params: HashMap<String, String>,
3077    _scopes: BTreeSet<String>,
3078}
3079
3080impl<'a, C> common::CallBuilder for ProjectLocationJobCreateCall<'a, C> {}
3081
3082impl<'a, C> ProjectLocationJobCreateCall<'a, C>
3083where
3084    C: common::Connector,
3085{
3086    /// Perform the operation you have build so far.
3087    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
3088        use std::borrow::Cow;
3089        use std::io::{Read, Seek};
3090
3091        use common::{url::Params, ToParts};
3092        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3093
3094        let mut dd = common::DefaultDelegate;
3095        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3096        dlg.begin(common::MethodInfo {
3097            id: "transcoder.projects.locations.jobs.create",
3098            http_method: hyper::Method::POST,
3099        });
3100
3101        for &field in ["alt", "parent"].iter() {
3102            if self._additional_params.contains_key(field) {
3103                dlg.finished(false);
3104                return Err(common::Error::FieldClash(field));
3105            }
3106        }
3107
3108        let mut params = Params::with_capacity(4 + self._additional_params.len());
3109        params.push("parent", self._parent);
3110
3111        params.extend(self._additional_params.iter());
3112
3113        params.push("alt", "json");
3114        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobs";
3115        if self._scopes.is_empty() {
3116            self._scopes
3117                .insert(Scope::CloudPlatform.as_ref().to_string());
3118        }
3119
3120        #[allow(clippy::single_element_loop)]
3121        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3122            url = params.uri_replacement(url, param_name, find_this, true);
3123        }
3124        {
3125            let to_remove = ["parent"];
3126            params.remove_params(&to_remove);
3127        }
3128
3129        let url = params.parse_with_url(&url);
3130
3131        let mut json_mime_type = mime::APPLICATION_JSON;
3132        let mut request_value_reader = {
3133            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3134            common::remove_json_null_values(&mut value);
3135            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3136            serde_json::to_writer(&mut dst, &value).unwrap();
3137            dst
3138        };
3139        let request_size = request_value_reader
3140            .seek(std::io::SeekFrom::End(0))
3141            .unwrap();
3142        request_value_reader
3143            .seek(std::io::SeekFrom::Start(0))
3144            .unwrap();
3145
3146        loop {
3147            let token = match self
3148                .hub
3149                .auth
3150                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3151                .await
3152            {
3153                Ok(token) => token,
3154                Err(e) => match dlg.token(e) {
3155                    Ok(token) => token,
3156                    Err(e) => {
3157                        dlg.finished(false);
3158                        return Err(common::Error::MissingToken(e));
3159                    }
3160                },
3161            };
3162            request_value_reader
3163                .seek(std::io::SeekFrom::Start(0))
3164                .unwrap();
3165            let mut req_result = {
3166                let client = &self.hub.client;
3167                dlg.pre_request();
3168                let mut req_builder = hyper::Request::builder()
3169                    .method(hyper::Method::POST)
3170                    .uri(url.as_str())
3171                    .header(USER_AGENT, self.hub._user_agent.clone());
3172
3173                if let Some(token) = token.as_ref() {
3174                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3175                }
3176
3177                let request = req_builder
3178                    .header(CONTENT_TYPE, json_mime_type.to_string())
3179                    .header(CONTENT_LENGTH, request_size as u64)
3180                    .body(common::to_body(
3181                        request_value_reader.get_ref().clone().into(),
3182                    ));
3183
3184                client.request(request.unwrap()).await
3185            };
3186
3187            match req_result {
3188                Err(err) => {
3189                    if let common::Retry::After(d) = dlg.http_error(&err) {
3190                        sleep(d).await;
3191                        continue;
3192                    }
3193                    dlg.finished(false);
3194                    return Err(common::Error::HttpError(err));
3195                }
3196                Ok(res) => {
3197                    let (mut parts, body) = res.into_parts();
3198                    let mut body = common::Body::new(body);
3199                    if !parts.status.is_success() {
3200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3201                        let error = serde_json::from_str(&common::to_string(&bytes));
3202                        let response = common::to_response(parts, bytes.into());
3203
3204                        if let common::Retry::After(d) =
3205                            dlg.http_failure(&response, error.as_ref().ok())
3206                        {
3207                            sleep(d).await;
3208                            continue;
3209                        }
3210
3211                        dlg.finished(false);
3212
3213                        return Err(match error {
3214                            Ok(value) => common::Error::BadRequest(value),
3215                            _ => common::Error::Failure(response),
3216                        });
3217                    }
3218                    let response = {
3219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3220                        let encoded = common::to_string(&bytes);
3221                        match serde_json::from_str(&encoded) {
3222                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3223                            Err(error) => {
3224                                dlg.response_json_decode_error(&encoded, &error);
3225                                return Err(common::Error::JsonDecodeError(
3226                                    encoded.to_string(),
3227                                    error,
3228                                ));
3229                            }
3230                        }
3231                    };
3232
3233                    dlg.finished(true);
3234                    return Ok(response);
3235                }
3236            }
3237        }
3238    }
3239
3240    ///
3241    /// Sets the *request* property to the given value.
3242    ///
3243    /// Even though the property as already been set when instantiating this call,
3244    /// we provide this method for API completeness.
3245    pub fn request(mut self, new_value: Job) -> ProjectLocationJobCreateCall<'a, C> {
3246        self._request = new_value;
3247        self
3248    }
3249    /// Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
3250    ///
3251    /// Sets the *parent* path property to the given value.
3252    ///
3253    /// Even though the property as already been set when instantiating this call,
3254    /// we provide this method for API completeness.
3255    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C> {
3256        self._parent = new_value.to_string();
3257        self
3258    }
3259    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3260    /// while executing the actual API request.
3261    ///
3262    /// ````text
3263    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3264    /// ````
3265    ///
3266    /// Sets the *delegate* property to the given value.
3267    pub fn delegate(
3268        mut self,
3269        new_value: &'a mut dyn common::Delegate,
3270    ) -> ProjectLocationJobCreateCall<'a, C> {
3271        self._delegate = Some(new_value);
3272        self
3273    }
3274
3275    /// Set any additional parameter of the query string used in the request.
3276    /// It should be used to set parameters which are not yet available through their own
3277    /// setters.
3278    ///
3279    /// Please note that this method must not be used to set any of the known parameters
3280    /// which have their own setter method. If done anyway, the request will fail.
3281    ///
3282    /// # Additional Parameters
3283    ///
3284    /// * *$.xgafv* (query-string) - V1 error format.
3285    /// * *access_token* (query-string) - OAuth access token.
3286    /// * *alt* (query-string) - Data format for response.
3287    /// * *callback* (query-string) - JSONP
3288    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3289    /// * *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.
3290    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3291    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3292    /// * *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.
3293    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3294    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3295    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobCreateCall<'a, C>
3296    where
3297        T: AsRef<str>,
3298    {
3299        self._additional_params
3300            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3301        self
3302    }
3303
3304    /// Identifies the authorization scope for the method you are building.
3305    ///
3306    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3307    /// [`Scope::CloudPlatform`].
3308    ///
3309    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3310    /// tokens for more than one scope.
3311    ///
3312    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3313    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3314    /// sufficient, a read-write scope will do as well.
3315    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobCreateCall<'a, C>
3316    where
3317        St: AsRef<str>,
3318    {
3319        self._scopes.insert(String::from(scope.as_ref()));
3320        self
3321    }
3322    /// Identifies the authorization scope(s) for the method you are building.
3323    ///
3324    /// See [`Self::add_scope()`] for details.
3325    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobCreateCall<'a, C>
3326    where
3327        I: IntoIterator<Item = St>,
3328        St: AsRef<str>,
3329    {
3330        self._scopes
3331            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3332        self
3333    }
3334
3335    /// Removes all scopes, and no default scope will be used either.
3336    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3337    /// for details).
3338    pub fn clear_scopes(mut self) -> ProjectLocationJobCreateCall<'a, C> {
3339        self._scopes.clear();
3340        self
3341    }
3342}
3343
3344/// Deletes a job.
3345///
3346/// A builder for the *locations.jobs.delete* method supported by a *project* resource.
3347/// It is not used directly, but through a [`ProjectMethods`] instance.
3348///
3349/// # Example
3350///
3351/// Instantiate a resource method builder
3352///
3353/// ```test_harness,no_run
3354/// # extern crate hyper;
3355/// # extern crate hyper_rustls;
3356/// # extern crate google_transcoder1 as transcoder1;
3357/// # async fn dox() {
3358/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3359///
3360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3361/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3362/// #     secret,
3363/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3364/// # ).build().await.unwrap();
3365///
3366/// # let client = hyper_util::client::legacy::Client::builder(
3367/// #     hyper_util::rt::TokioExecutor::new()
3368/// # )
3369/// # .build(
3370/// #     hyper_rustls::HttpsConnectorBuilder::new()
3371/// #         .with_native_roots()
3372/// #         .unwrap()
3373/// #         .https_or_http()
3374/// #         .enable_http1()
3375/// #         .build()
3376/// # );
3377/// # let mut hub = Transcoder::new(client, auth);
3378/// // You can configure optional parameters by calling the respective setters at will, and
3379/// // execute the final call using `doit()`.
3380/// // Values shown here are possibly random and not representative !
3381/// let result = hub.projects().locations_jobs_delete("name")
3382///              .allow_missing(false)
3383///              .doit().await;
3384/// # }
3385/// ```
3386pub struct ProjectLocationJobDeleteCall<'a, C>
3387where
3388    C: 'a,
3389{
3390    hub: &'a Transcoder<C>,
3391    _name: String,
3392    _allow_missing: Option<bool>,
3393    _delegate: Option<&'a mut dyn common::Delegate>,
3394    _additional_params: HashMap<String, String>,
3395    _scopes: BTreeSet<String>,
3396}
3397
3398impl<'a, C> common::CallBuilder for ProjectLocationJobDeleteCall<'a, C> {}
3399
3400impl<'a, C> ProjectLocationJobDeleteCall<'a, C>
3401where
3402    C: common::Connector,
3403{
3404    /// Perform the operation you have build so far.
3405    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3406        use std::borrow::Cow;
3407        use std::io::{Read, Seek};
3408
3409        use common::{url::Params, ToParts};
3410        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3411
3412        let mut dd = common::DefaultDelegate;
3413        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3414        dlg.begin(common::MethodInfo {
3415            id: "transcoder.projects.locations.jobs.delete",
3416            http_method: hyper::Method::DELETE,
3417        });
3418
3419        for &field in ["alt", "name", "allowMissing"].iter() {
3420            if self._additional_params.contains_key(field) {
3421                dlg.finished(false);
3422                return Err(common::Error::FieldClash(field));
3423            }
3424        }
3425
3426        let mut params = Params::with_capacity(4 + self._additional_params.len());
3427        params.push("name", self._name);
3428        if let Some(value) = self._allow_missing.as_ref() {
3429            params.push("allowMissing", value.to_string());
3430        }
3431
3432        params.extend(self._additional_params.iter());
3433
3434        params.push("alt", "json");
3435        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3436        if self._scopes.is_empty() {
3437            self._scopes
3438                .insert(Scope::CloudPlatform.as_ref().to_string());
3439        }
3440
3441        #[allow(clippy::single_element_loop)]
3442        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3443            url = params.uri_replacement(url, param_name, find_this, true);
3444        }
3445        {
3446            let to_remove = ["name"];
3447            params.remove_params(&to_remove);
3448        }
3449
3450        let url = params.parse_with_url(&url);
3451
3452        loop {
3453            let token = match self
3454                .hub
3455                .auth
3456                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3457                .await
3458            {
3459                Ok(token) => token,
3460                Err(e) => match dlg.token(e) {
3461                    Ok(token) => token,
3462                    Err(e) => {
3463                        dlg.finished(false);
3464                        return Err(common::Error::MissingToken(e));
3465                    }
3466                },
3467            };
3468            let mut req_result = {
3469                let client = &self.hub.client;
3470                dlg.pre_request();
3471                let mut req_builder = hyper::Request::builder()
3472                    .method(hyper::Method::DELETE)
3473                    .uri(url.as_str())
3474                    .header(USER_AGENT, self.hub._user_agent.clone());
3475
3476                if let Some(token) = token.as_ref() {
3477                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3478                }
3479
3480                let request = req_builder
3481                    .header(CONTENT_LENGTH, 0_u64)
3482                    .body(common::to_body::<String>(None));
3483
3484                client.request(request.unwrap()).await
3485            };
3486
3487            match req_result {
3488                Err(err) => {
3489                    if let common::Retry::After(d) = dlg.http_error(&err) {
3490                        sleep(d).await;
3491                        continue;
3492                    }
3493                    dlg.finished(false);
3494                    return Err(common::Error::HttpError(err));
3495                }
3496                Ok(res) => {
3497                    let (mut parts, body) = res.into_parts();
3498                    let mut body = common::Body::new(body);
3499                    if !parts.status.is_success() {
3500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3501                        let error = serde_json::from_str(&common::to_string(&bytes));
3502                        let response = common::to_response(parts, bytes.into());
3503
3504                        if let common::Retry::After(d) =
3505                            dlg.http_failure(&response, error.as_ref().ok())
3506                        {
3507                            sleep(d).await;
3508                            continue;
3509                        }
3510
3511                        dlg.finished(false);
3512
3513                        return Err(match error {
3514                            Ok(value) => common::Error::BadRequest(value),
3515                            _ => common::Error::Failure(response),
3516                        });
3517                    }
3518                    let response = {
3519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3520                        let encoded = common::to_string(&bytes);
3521                        match serde_json::from_str(&encoded) {
3522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3523                            Err(error) => {
3524                                dlg.response_json_decode_error(&encoded, &error);
3525                                return Err(common::Error::JsonDecodeError(
3526                                    encoded.to_string(),
3527                                    error,
3528                                ));
3529                            }
3530                        }
3531                    };
3532
3533                    dlg.finished(true);
3534                    return Ok(response);
3535                }
3536            }
3537        }
3538    }
3539
3540    /// Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
3541    ///
3542    /// Sets the *name* path property to the given value.
3543    ///
3544    /// Even though the property as already been set when instantiating this call,
3545    /// we provide this method for API completeness.
3546    pub fn name(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C> {
3547        self._name = new_value.to_string();
3548        self
3549    }
3550    /// If set to true, and the job is not found, the request will succeed but no action will be taken on the server.
3551    ///
3552    /// Sets the *allow missing* query property to the given value.
3553    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationJobDeleteCall<'a, C> {
3554        self._allow_missing = Some(new_value);
3555        self
3556    }
3557    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3558    /// while executing the actual API request.
3559    ///
3560    /// ````text
3561    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3562    /// ````
3563    ///
3564    /// Sets the *delegate* property to the given value.
3565    pub fn delegate(
3566        mut self,
3567        new_value: &'a mut dyn common::Delegate,
3568    ) -> ProjectLocationJobDeleteCall<'a, C> {
3569        self._delegate = Some(new_value);
3570        self
3571    }
3572
3573    /// Set any additional parameter of the query string used in the request.
3574    /// It should be used to set parameters which are not yet available through their own
3575    /// setters.
3576    ///
3577    /// Please note that this method must not be used to set any of the known parameters
3578    /// which have their own setter method. If done anyway, the request will fail.
3579    ///
3580    /// # Additional Parameters
3581    ///
3582    /// * *$.xgafv* (query-string) - V1 error format.
3583    /// * *access_token* (query-string) - OAuth access token.
3584    /// * *alt* (query-string) - Data format for response.
3585    /// * *callback* (query-string) - JSONP
3586    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3587    /// * *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.
3588    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3589    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3590    /// * *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.
3591    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3592    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3593    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobDeleteCall<'a, C>
3594    where
3595        T: AsRef<str>,
3596    {
3597        self._additional_params
3598            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3599        self
3600    }
3601
3602    /// Identifies the authorization scope for the method you are building.
3603    ///
3604    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3605    /// [`Scope::CloudPlatform`].
3606    ///
3607    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3608    /// tokens for more than one scope.
3609    ///
3610    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3611    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3612    /// sufficient, a read-write scope will do as well.
3613    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobDeleteCall<'a, C>
3614    where
3615        St: AsRef<str>,
3616    {
3617        self._scopes.insert(String::from(scope.as_ref()));
3618        self
3619    }
3620    /// Identifies the authorization scope(s) for the method you are building.
3621    ///
3622    /// See [`Self::add_scope()`] for details.
3623    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobDeleteCall<'a, C>
3624    where
3625        I: IntoIterator<Item = St>,
3626        St: AsRef<str>,
3627    {
3628        self._scopes
3629            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3630        self
3631    }
3632
3633    /// Removes all scopes, and no default scope will be used either.
3634    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3635    /// for details).
3636    pub fn clear_scopes(mut self) -> ProjectLocationJobDeleteCall<'a, C> {
3637        self._scopes.clear();
3638        self
3639    }
3640}
3641
3642/// Returns the job data.
3643///
3644/// A builder for the *locations.jobs.get* method supported by a *project* resource.
3645/// It is not used directly, but through a [`ProjectMethods`] instance.
3646///
3647/// # Example
3648///
3649/// Instantiate a resource method builder
3650///
3651/// ```test_harness,no_run
3652/// # extern crate hyper;
3653/// # extern crate hyper_rustls;
3654/// # extern crate google_transcoder1 as transcoder1;
3655/// # async fn dox() {
3656/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3657///
3658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3660/// #     secret,
3661/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3662/// # ).build().await.unwrap();
3663///
3664/// # let client = hyper_util::client::legacy::Client::builder(
3665/// #     hyper_util::rt::TokioExecutor::new()
3666/// # )
3667/// # .build(
3668/// #     hyper_rustls::HttpsConnectorBuilder::new()
3669/// #         .with_native_roots()
3670/// #         .unwrap()
3671/// #         .https_or_http()
3672/// #         .enable_http1()
3673/// #         .build()
3674/// # );
3675/// # let mut hub = Transcoder::new(client, auth);
3676/// // You can configure optional parameters by calling the respective setters at will, and
3677/// // execute the final call using `doit()`.
3678/// // Values shown here are possibly random and not representative !
3679/// let result = hub.projects().locations_jobs_get("name")
3680///              .doit().await;
3681/// # }
3682/// ```
3683pub struct ProjectLocationJobGetCall<'a, C>
3684where
3685    C: 'a,
3686{
3687    hub: &'a Transcoder<C>,
3688    _name: String,
3689    _delegate: Option<&'a mut dyn common::Delegate>,
3690    _additional_params: HashMap<String, String>,
3691    _scopes: BTreeSet<String>,
3692}
3693
3694impl<'a, C> common::CallBuilder for ProjectLocationJobGetCall<'a, C> {}
3695
3696impl<'a, C> ProjectLocationJobGetCall<'a, C>
3697where
3698    C: common::Connector,
3699{
3700    /// Perform the operation you have build so far.
3701    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
3702        use std::borrow::Cow;
3703        use std::io::{Read, Seek};
3704
3705        use common::{url::Params, ToParts};
3706        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3707
3708        let mut dd = common::DefaultDelegate;
3709        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3710        dlg.begin(common::MethodInfo {
3711            id: "transcoder.projects.locations.jobs.get",
3712            http_method: hyper::Method::GET,
3713        });
3714
3715        for &field in ["alt", "name"].iter() {
3716            if self._additional_params.contains_key(field) {
3717                dlg.finished(false);
3718                return Err(common::Error::FieldClash(field));
3719            }
3720        }
3721
3722        let mut params = Params::with_capacity(3 + self._additional_params.len());
3723        params.push("name", self._name);
3724
3725        params.extend(self._additional_params.iter());
3726
3727        params.push("alt", "json");
3728        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3729        if self._scopes.is_empty() {
3730            self._scopes
3731                .insert(Scope::CloudPlatform.as_ref().to_string());
3732        }
3733
3734        #[allow(clippy::single_element_loop)]
3735        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3736            url = params.uri_replacement(url, param_name, find_this, true);
3737        }
3738        {
3739            let to_remove = ["name"];
3740            params.remove_params(&to_remove);
3741        }
3742
3743        let url = params.parse_with_url(&url);
3744
3745        loop {
3746            let token = match self
3747                .hub
3748                .auth
3749                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3750                .await
3751            {
3752                Ok(token) => token,
3753                Err(e) => match dlg.token(e) {
3754                    Ok(token) => token,
3755                    Err(e) => {
3756                        dlg.finished(false);
3757                        return Err(common::Error::MissingToken(e));
3758                    }
3759                },
3760            };
3761            let mut req_result = {
3762                let client = &self.hub.client;
3763                dlg.pre_request();
3764                let mut req_builder = hyper::Request::builder()
3765                    .method(hyper::Method::GET)
3766                    .uri(url.as_str())
3767                    .header(USER_AGENT, self.hub._user_agent.clone());
3768
3769                if let Some(token) = token.as_ref() {
3770                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3771                }
3772
3773                let request = req_builder
3774                    .header(CONTENT_LENGTH, 0_u64)
3775                    .body(common::to_body::<String>(None));
3776
3777                client.request(request.unwrap()).await
3778            };
3779
3780            match req_result {
3781                Err(err) => {
3782                    if let common::Retry::After(d) = dlg.http_error(&err) {
3783                        sleep(d).await;
3784                        continue;
3785                    }
3786                    dlg.finished(false);
3787                    return Err(common::Error::HttpError(err));
3788                }
3789                Ok(res) => {
3790                    let (mut parts, body) = res.into_parts();
3791                    let mut body = common::Body::new(body);
3792                    if !parts.status.is_success() {
3793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3794                        let error = serde_json::from_str(&common::to_string(&bytes));
3795                        let response = common::to_response(parts, bytes.into());
3796
3797                        if let common::Retry::After(d) =
3798                            dlg.http_failure(&response, error.as_ref().ok())
3799                        {
3800                            sleep(d).await;
3801                            continue;
3802                        }
3803
3804                        dlg.finished(false);
3805
3806                        return Err(match error {
3807                            Ok(value) => common::Error::BadRequest(value),
3808                            _ => common::Error::Failure(response),
3809                        });
3810                    }
3811                    let response = {
3812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3813                        let encoded = common::to_string(&bytes);
3814                        match serde_json::from_str(&encoded) {
3815                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3816                            Err(error) => {
3817                                dlg.response_json_decode_error(&encoded, &error);
3818                                return Err(common::Error::JsonDecodeError(
3819                                    encoded.to_string(),
3820                                    error,
3821                                ));
3822                            }
3823                        }
3824                    };
3825
3826                    dlg.finished(true);
3827                    return Ok(response);
3828                }
3829            }
3830        }
3831    }
3832
3833    /// Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
3834    ///
3835    /// Sets the *name* path property to the given value.
3836    ///
3837    /// Even though the property as already been set when instantiating this call,
3838    /// we provide this method for API completeness.
3839    pub fn name(mut self, new_value: &str) -> ProjectLocationJobGetCall<'a, C> {
3840        self._name = new_value.to_string();
3841        self
3842    }
3843    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3844    /// while executing the actual API request.
3845    ///
3846    /// ````text
3847    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3848    /// ````
3849    ///
3850    /// Sets the *delegate* property to the given value.
3851    pub fn delegate(
3852        mut self,
3853        new_value: &'a mut dyn common::Delegate,
3854    ) -> ProjectLocationJobGetCall<'a, C> {
3855        self._delegate = Some(new_value);
3856        self
3857    }
3858
3859    /// Set any additional parameter of the query string used in the request.
3860    /// It should be used to set parameters which are not yet available through their own
3861    /// setters.
3862    ///
3863    /// Please note that this method must not be used to set any of the known parameters
3864    /// which have their own setter method. If done anyway, the request will fail.
3865    ///
3866    /// # Additional Parameters
3867    ///
3868    /// * *$.xgafv* (query-string) - V1 error format.
3869    /// * *access_token* (query-string) - OAuth access token.
3870    /// * *alt* (query-string) - Data format for response.
3871    /// * *callback* (query-string) - JSONP
3872    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3873    /// * *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.
3874    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3875    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3876    /// * *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.
3877    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3878    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3879    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetCall<'a, C>
3880    where
3881        T: AsRef<str>,
3882    {
3883        self._additional_params
3884            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3885        self
3886    }
3887
3888    /// Identifies the authorization scope for the method you are building.
3889    ///
3890    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3891    /// [`Scope::CloudPlatform`].
3892    ///
3893    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3894    /// tokens for more than one scope.
3895    ///
3896    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3897    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3898    /// sufficient, a read-write scope will do as well.
3899    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetCall<'a, C>
3900    where
3901        St: AsRef<str>,
3902    {
3903        self._scopes.insert(String::from(scope.as_ref()));
3904        self
3905    }
3906    /// Identifies the authorization scope(s) for the method you are building.
3907    ///
3908    /// See [`Self::add_scope()`] for details.
3909    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetCall<'a, C>
3910    where
3911        I: IntoIterator<Item = St>,
3912        St: AsRef<str>,
3913    {
3914        self._scopes
3915            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3916        self
3917    }
3918
3919    /// Removes all scopes, and no default scope will be used either.
3920    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3921    /// for details).
3922    pub fn clear_scopes(mut self) -> ProjectLocationJobGetCall<'a, C> {
3923        self._scopes.clear();
3924        self
3925    }
3926}
3927
3928/// Lists jobs in the specified region.
3929///
3930/// A builder for the *locations.jobs.list* method supported by a *project* resource.
3931/// It is not used directly, but through a [`ProjectMethods`] instance.
3932///
3933/// # Example
3934///
3935/// Instantiate a resource method builder
3936///
3937/// ```test_harness,no_run
3938/// # extern crate hyper;
3939/// # extern crate hyper_rustls;
3940/// # extern crate google_transcoder1 as transcoder1;
3941/// # async fn dox() {
3942/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3943///
3944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3946/// #     secret,
3947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3948/// # ).build().await.unwrap();
3949///
3950/// # let client = hyper_util::client::legacy::Client::builder(
3951/// #     hyper_util::rt::TokioExecutor::new()
3952/// # )
3953/// # .build(
3954/// #     hyper_rustls::HttpsConnectorBuilder::new()
3955/// #         .with_native_roots()
3956/// #         .unwrap()
3957/// #         .https_or_http()
3958/// #         .enable_http1()
3959/// #         .build()
3960/// # );
3961/// # let mut hub = Transcoder::new(client, auth);
3962/// // You can configure optional parameters by calling the respective setters at will, and
3963/// // execute the final call using `doit()`.
3964/// // Values shown here are possibly random and not representative !
3965/// let result = hub.projects().locations_jobs_list("parent")
3966///              .page_token("ipsum")
3967///              .page_size(-88)
3968///              .order_by("amet")
3969///              .filter("duo")
3970///              .doit().await;
3971/// # }
3972/// ```
3973pub struct ProjectLocationJobListCall<'a, C>
3974where
3975    C: 'a,
3976{
3977    hub: &'a Transcoder<C>,
3978    _parent: String,
3979    _page_token: Option<String>,
3980    _page_size: Option<i32>,
3981    _order_by: Option<String>,
3982    _filter: Option<String>,
3983    _delegate: Option<&'a mut dyn common::Delegate>,
3984    _additional_params: HashMap<String, String>,
3985    _scopes: BTreeSet<String>,
3986}
3987
3988impl<'a, C> common::CallBuilder for ProjectLocationJobListCall<'a, C> {}
3989
3990impl<'a, C> ProjectLocationJobListCall<'a, C>
3991where
3992    C: common::Connector,
3993{
3994    /// Perform the operation you have build so far.
3995    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
3996        use std::borrow::Cow;
3997        use std::io::{Read, Seek};
3998
3999        use common::{url::Params, ToParts};
4000        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4001
4002        let mut dd = common::DefaultDelegate;
4003        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4004        dlg.begin(common::MethodInfo {
4005            id: "transcoder.projects.locations.jobs.list",
4006            http_method: hyper::Method::GET,
4007        });
4008
4009        for &field in [
4010            "alt",
4011            "parent",
4012            "pageToken",
4013            "pageSize",
4014            "orderBy",
4015            "filter",
4016        ]
4017        .iter()
4018        {
4019            if self._additional_params.contains_key(field) {
4020                dlg.finished(false);
4021                return Err(common::Error::FieldClash(field));
4022            }
4023        }
4024
4025        let mut params = Params::with_capacity(7 + self._additional_params.len());
4026        params.push("parent", self._parent);
4027        if let Some(value) = self._page_token.as_ref() {
4028            params.push("pageToken", value);
4029        }
4030        if let Some(value) = self._page_size.as_ref() {
4031            params.push("pageSize", value.to_string());
4032        }
4033        if let Some(value) = self._order_by.as_ref() {
4034            params.push("orderBy", value);
4035        }
4036        if let Some(value) = self._filter.as_ref() {
4037            params.push("filter", value);
4038        }
4039
4040        params.extend(self._additional_params.iter());
4041
4042        params.push("alt", "json");
4043        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobs";
4044        if self._scopes.is_empty() {
4045            self._scopes
4046                .insert(Scope::CloudPlatform.as_ref().to_string());
4047        }
4048
4049        #[allow(clippy::single_element_loop)]
4050        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4051            url = params.uri_replacement(url, param_name, find_this, true);
4052        }
4053        {
4054            let to_remove = ["parent"];
4055            params.remove_params(&to_remove);
4056        }
4057
4058        let url = params.parse_with_url(&url);
4059
4060        loop {
4061            let token = match self
4062                .hub
4063                .auth
4064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4065                .await
4066            {
4067                Ok(token) => token,
4068                Err(e) => match dlg.token(e) {
4069                    Ok(token) => token,
4070                    Err(e) => {
4071                        dlg.finished(false);
4072                        return Err(common::Error::MissingToken(e));
4073                    }
4074                },
4075            };
4076            let mut req_result = {
4077                let client = &self.hub.client;
4078                dlg.pre_request();
4079                let mut req_builder = hyper::Request::builder()
4080                    .method(hyper::Method::GET)
4081                    .uri(url.as_str())
4082                    .header(USER_AGENT, self.hub._user_agent.clone());
4083
4084                if let Some(token) = token.as_ref() {
4085                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4086                }
4087
4088                let request = req_builder
4089                    .header(CONTENT_LENGTH, 0_u64)
4090                    .body(common::to_body::<String>(None));
4091
4092                client.request(request.unwrap()).await
4093            };
4094
4095            match req_result {
4096                Err(err) => {
4097                    if let common::Retry::After(d) = dlg.http_error(&err) {
4098                        sleep(d).await;
4099                        continue;
4100                    }
4101                    dlg.finished(false);
4102                    return Err(common::Error::HttpError(err));
4103                }
4104                Ok(res) => {
4105                    let (mut parts, body) = res.into_parts();
4106                    let mut body = common::Body::new(body);
4107                    if !parts.status.is_success() {
4108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4109                        let error = serde_json::from_str(&common::to_string(&bytes));
4110                        let response = common::to_response(parts, bytes.into());
4111
4112                        if let common::Retry::After(d) =
4113                            dlg.http_failure(&response, error.as_ref().ok())
4114                        {
4115                            sleep(d).await;
4116                            continue;
4117                        }
4118
4119                        dlg.finished(false);
4120
4121                        return Err(match error {
4122                            Ok(value) => common::Error::BadRequest(value),
4123                            _ => common::Error::Failure(response),
4124                        });
4125                    }
4126                    let response = {
4127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4128                        let encoded = common::to_string(&bytes);
4129                        match serde_json::from_str(&encoded) {
4130                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4131                            Err(error) => {
4132                                dlg.response_json_decode_error(&encoded, &error);
4133                                return Err(common::Error::JsonDecodeError(
4134                                    encoded.to_string(),
4135                                    error,
4136                                ));
4137                            }
4138                        }
4139                    };
4140
4141                    dlg.finished(true);
4142                    return Ok(response);
4143                }
4144            }
4145        }
4146    }
4147
4148    /// Required. Format: `projects/{project}/locations/{location}`
4149    ///
4150    /// Sets the *parent* path property to the given value.
4151    ///
4152    /// Even though the property as already been set when instantiating this call,
4153    /// we provide this method for API completeness.
4154    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4155        self._parent = new_value.to_string();
4156        self
4157    }
4158    /// The `next_page_token` value returned from a previous List request, if any.
4159    ///
4160    /// Sets the *page token* query property to the given value.
4161    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4162        self._page_token = Some(new_value.to_string());
4163        self
4164    }
4165    /// The maximum number of items to return.
4166    ///
4167    /// Sets the *page size* query property to the given value.
4168    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobListCall<'a, C> {
4169        self._page_size = Some(new_value);
4170        self
4171    }
4172    /// One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
4173    ///
4174    /// Sets the *order by* query property to the given value.
4175    pub fn order_by(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4176        self._order_by = Some(new_value.to_string());
4177        self
4178    }
4179    /// The filter expression, following the syntax outlined in https://google.aip.dev/160.
4180    ///
4181    /// Sets the *filter* query property to the given value.
4182    pub fn filter(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4183        self._filter = Some(new_value.to_string());
4184        self
4185    }
4186    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4187    /// while executing the actual API request.
4188    ///
4189    /// ````text
4190    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4191    /// ````
4192    ///
4193    /// Sets the *delegate* property to the given value.
4194    pub fn delegate(
4195        mut self,
4196        new_value: &'a mut dyn common::Delegate,
4197    ) -> ProjectLocationJobListCall<'a, C> {
4198        self._delegate = Some(new_value);
4199        self
4200    }
4201
4202    /// Set any additional parameter of the query string used in the request.
4203    /// It should be used to set parameters which are not yet available through their own
4204    /// setters.
4205    ///
4206    /// Please note that this method must not be used to set any of the known parameters
4207    /// which have their own setter method. If done anyway, the request will fail.
4208    ///
4209    /// # Additional Parameters
4210    ///
4211    /// * *$.xgafv* (query-string) - V1 error format.
4212    /// * *access_token* (query-string) - OAuth access token.
4213    /// * *alt* (query-string) - Data format for response.
4214    /// * *callback* (query-string) - JSONP
4215    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4216    /// * *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.
4217    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4218    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4219    /// * *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.
4220    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4221    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4222    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobListCall<'a, C>
4223    where
4224        T: AsRef<str>,
4225    {
4226        self._additional_params
4227            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4228        self
4229    }
4230
4231    /// Identifies the authorization scope for the method you are building.
4232    ///
4233    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4234    /// [`Scope::CloudPlatform`].
4235    ///
4236    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4237    /// tokens for more than one scope.
4238    ///
4239    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4240    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4241    /// sufficient, a read-write scope will do as well.
4242    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobListCall<'a, C>
4243    where
4244        St: AsRef<str>,
4245    {
4246        self._scopes.insert(String::from(scope.as_ref()));
4247        self
4248    }
4249    /// Identifies the authorization scope(s) for the method you are building.
4250    ///
4251    /// See [`Self::add_scope()`] for details.
4252    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobListCall<'a, C>
4253    where
4254        I: IntoIterator<Item = St>,
4255        St: AsRef<str>,
4256    {
4257        self._scopes
4258            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4259        self
4260    }
4261
4262    /// Removes all scopes, and no default scope will be used either.
4263    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4264    /// for details).
4265    pub fn clear_scopes(mut self) -> ProjectLocationJobListCall<'a, C> {
4266        self._scopes.clear();
4267        self
4268    }
4269}