google_jobs4/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 /// Manage job postings
20 Full,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27 Scope::Full => "https://www.googleapis.com/auth/jobs",
28 }
29 }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34 fn default() -> Scope {
35 Scope::Full
36 }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all CloudTalentSolution related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_jobs4 as jobs4;
53/// use jobs4::api::BatchCreateJobsRequest;
54/// use jobs4::{Result, Error};
55/// # async fn dox() {
56/// use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57///
58/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
59/// // `client_secret`, among other things.
60/// let secret: yup_oauth2::ApplicationSecret = Default::default();
61/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
62/// // unless you replace `None` with the desired Flow.
63/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
64/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
65/// // retrieve them from storage.
66/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
67/// .with_native_roots()
68/// .unwrap()
69/// .https_only()
70/// .enable_http2()
71/// .build();
72///
73/// let executor = hyper_util::rt::TokioExecutor::new();
74/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
75/// secret,
76/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77/// yup_oauth2::client::CustomHyperClientBuilder::from(
78/// hyper_util::client::legacy::Client::builder(executor).build(connector),
79/// ),
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83/// hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86/// hyper_rustls::HttpsConnectorBuilder::new()
87/// .with_native_roots()
88/// .unwrap()
89/// .https_or_http()
90/// .enable_http2()
91/// .build()
92/// );
93/// let mut hub = CloudTalentSolution::new(client, auth);
94/// // As the method needs a request, you would usually fill it with the desired information
95/// // into the respective structure. Some of the parts shown here might not be applicable !
96/// // Values shown here are possibly random and not representative !
97/// let mut req = BatchCreateJobsRequest::default();
98///
99/// // You can configure optional parameters by calling the respective setters at will, and
100/// // execute the final call using `doit()`.
101/// // Values shown here are possibly random and not representative !
102/// let result = hub.projects().tenants_jobs_batch_create(req, "parent")
103/// .doit().await;
104///
105/// match result {
106/// Err(e) => match e {
107/// // The Error enum provides details about what exactly happened.
108/// // You can also just use its `Debug`, `Display` or `Error` traits
109/// Error::HttpError(_)
110/// |Error::Io(_)
111/// |Error::MissingAPIKey
112/// |Error::MissingToken(_)
113/// |Error::Cancelled
114/// |Error::UploadSizeLimitExceeded(_, _)
115/// |Error::Failure(_)
116/// |Error::BadRequest(_)
117/// |Error::FieldClash(_)
118/// |Error::JsonDecodeError(_, _) => println!("{}", e),
119/// },
120/// Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct CloudTalentSolution<C> {
126 pub client: common::Client<C>,
127 pub auth: Box<dyn common::GetToken>,
128 _user_agent: String,
129 _base_url: String,
130 _root_url: String,
131}
132
133impl<C> common::Hub for CloudTalentSolution<C> {}
134
135impl<'a, C> CloudTalentSolution<C> {
136 pub fn new<A: 'static + common::GetToken>(
137 client: common::Client<C>,
138 auth: A,
139 ) -> CloudTalentSolution<C> {
140 CloudTalentSolution {
141 client,
142 auth: Box::new(auth),
143 _user_agent: "google-api-rust-client/7.0.0".to_string(),
144 _base_url: "https://jobs.googleapis.com/".to_string(),
145 _root_url: "https://jobs.googleapis.com/".to_string(),
146 }
147 }
148
149 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
150 ProjectMethods { hub: self }
151 }
152
153 /// Set the user-agent header field to use in all requests to the server.
154 /// It defaults to `google-api-rust-client/7.0.0`.
155 ///
156 /// Returns the previously set user-agent.
157 pub fn user_agent(&mut self, agent_name: String) -> String {
158 std::mem::replace(&mut self._user_agent, agent_name)
159 }
160
161 /// Set the base url to use in all requests to the server.
162 /// It defaults to `https://jobs.googleapis.com/`.
163 ///
164 /// Returns the previously set base url.
165 pub fn base_url(&mut self, new_base_url: String) -> String {
166 std::mem::replace(&mut self._base_url, new_base_url)
167 }
168
169 /// Set the root url to use in all requests to the server.
170 /// It defaults to `https://jobs.googleapis.com/`.
171 ///
172 /// Returns the previously set root url.
173 pub fn root_url(&mut self, new_root_url: String) -> String {
174 std::mem::replace(&mut self._root_url, new_root_url)
175 }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// Application related details of a job posting.
182///
183/// This type is not used in any activity, and only used as *part* of another schema.
184///
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct ApplicationInfo {
189 /// Use this field to specify email address(es) to which resumes or applications can be sent. The maximum number of allowed characters for each entry is 255.
190 pub emails: Option<Vec<String>>,
191 /// Use this field to provide instructions, such as "Mail your application to ...", that a candidate can follow to apply for the job. This field accepts and sanitizes HTML input, and also accepts bold, italic, ordered list, and unordered list markup tags. The maximum number of allowed characters is 3,000.
192 pub instruction: Option<String>,
193 /// Use this URI field to direct an applicant to a website, for example to link to an online application form. The maximum number of allowed characters for each entry is 2,000.
194 pub uris: Option<Vec<String>>,
195}
196
197impl common::Part for ApplicationInfo {}
198
199/// Request to create a batch of jobs.
200///
201/// # Activities
202///
203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
205///
206/// * [tenants jobs batch create projects](ProjectTenantJobBatchCreateCall) (request)
207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
208#[serde_with::serde_as]
209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
210pub struct BatchCreateJobsRequest {
211 /// Required. The jobs to be created. A maximum of 200 jobs can be created in a batch.
212 pub jobs: Option<Vec<Job>>,
213}
214
215impl common::RequestValue for BatchCreateJobsRequest {}
216
217/// Request to delete a batch of jobs.
218///
219/// # Activities
220///
221/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
222/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
223///
224/// * [tenants jobs batch delete projects](ProjectTenantJobBatchDeleteCall) (request)
225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
226#[serde_with::serde_as]
227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
228pub struct BatchDeleteJobsRequest {
229 /// The names of the jobs to delete. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch.
230 pub names: Option<Vec<String>>,
231}
232
233impl common::RequestValue for BatchDeleteJobsRequest {}
234
235/// Request to update a batch of jobs.
236///
237/// # Activities
238///
239/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
240/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
241///
242/// * [tenants jobs batch update projects](ProjectTenantJobBatchUpdateCall) (request)
243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
244#[serde_with::serde_as]
245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
246pub struct BatchUpdateJobsRequest {
247 /// Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch.
248 pub jobs: Option<Vec<Job>>,
249 /// Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. If update_mask is provided, only the specified fields in Job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. If update_mask is provided, The Job inside JobResult will only contains fields that is updated, plus the Id of the Job. Otherwise, Job will include all fields, which can yield a very large response.
250 #[serde(rename = "updateMask")]
251 pub update_mask: Option<common::FieldMask>,
252}
253
254impl common::RequestValue for BatchUpdateJobsRequest {}
255
256/// An event issued when an end user interacts with the application that implements Cloud Talent Solution. Providing this information improves the quality of results for the API clients, enabling the service to perform optimally. The number of events sent must be consistent with other calls, such as job searches, issued to the service by the client.
257///
258/// # Activities
259///
260/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
261/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
262///
263/// * [tenants client events create projects](ProjectTenantClientEventCreateCall) (request|response)
264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
265#[serde_with::serde_as]
266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
267pub struct ClientEvent {
268 /// Required. The timestamp of the event.
269 #[serde(rename = "createTime")]
270 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
271 /// Required. A unique identifier, generated by the client application.
272 #[serde(rename = "eventId")]
273 pub event_id: Option<String>,
274 /// Notes about the event provided by recruiters or other users, for example, feedback on why a job was bookmarked.
275 #[serde(rename = "eventNotes")]
276 pub event_notes: Option<String>,
277 /// An event issued when a job seeker interacts with the application that implements Cloud Talent Solution.
278 #[serde(rename = "jobEvent")]
279 pub job_event: Option<JobEvent>,
280 /// Strongly recommended for the best service experience. A unique ID generated in the API responses. It can be found in ResponseMetadata.request_id.
281 #[serde(rename = "requestId")]
282 pub request_id: Option<String>,
283}
284
285impl common::RequestValue for ClientEvent {}
286impl common::ResponseResult for ClientEvent {}
287
288/// Parameters needed for commute search.
289///
290/// This type is not used in any activity, and only used as *part* of another schema.
291///
292#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
293#[serde_with::serde_as]
294#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
295pub struct CommuteFilter {
296 /// If `true`, jobs without street level addresses may also be returned. For city level addresses, the city center is used. For state and coarser level addresses, text matching is used. If this field is set to `false` or isn't specified, only jobs that include street level addresses will be returned by commute search.
297 #[serde(rename = "allowImpreciseAddresses")]
298 pub allow_imprecise_addresses: Option<bool>,
299 /// Required. The method of transportation to calculate the commute time for.
300 #[serde(rename = "commuteMethod")]
301 pub commute_method: Option<String>,
302 /// The departure time used to calculate traffic impact, represented as google.type.TimeOfDay in local time zone. Currently traffic model is restricted to hour level resolution.
303 #[serde(rename = "departureTime")]
304 pub departure_time: Option<TimeOfDay>,
305 /// Specifies the traffic density to use when calculating commute time.
306 #[serde(rename = "roadTraffic")]
307 pub road_traffic: Option<String>,
308 /// Required. The latitude and longitude of the location to calculate the commute time from.
309 #[serde(rename = "startCoordinates")]
310 pub start_coordinates: Option<LatLng>,
311 /// Required. The maximum travel time in seconds. The maximum allowed value is `3600s` (one hour). Format is `123s`.
312 #[serde(rename = "travelDuration")]
313 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
314 pub travel_duration: Option<chrono::Duration>,
315}
316
317impl common::Part for CommuteFilter {}
318
319/// Commute details related to this job.
320///
321/// This type is not used in any activity, and only used as *part* of another schema.
322///
323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
324#[serde_with::serde_as]
325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
326pub struct CommuteInfo {
327 /// Location used as the destination in the commute calculation.
328 #[serde(rename = "jobLocation")]
329 pub job_location: Option<Location>,
330 /// The number of seconds required to travel to the job location from the query location. A duration of 0 seconds indicates that the job isn't reachable within the requested duration, but was returned as part of an expanded query.
331 #[serde(rename = "travelDuration")]
332 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
333 pub travel_duration: Option<chrono::Duration>,
334}
335
336impl common::Part for CommuteInfo {}
337
338/// A Company resource represents a company in the service. A company is the entity that owns job postings, that is, the hiring entity responsible for employing applicants for the job position.
339///
340/// # Activities
341///
342/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
343/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
344///
345/// * [tenants companies create projects](ProjectTenantCompanyCreateCall) (request|response)
346/// * [tenants companies get projects](ProjectTenantCompanyGetCall) (response)
347/// * [tenants companies patch projects](ProjectTenantCompanyPatchCall) (request|response)
348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
349#[serde_with::serde_as]
350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
351pub struct Company {
352 /// The URI to employer's career site or careers page on the employer's web site, for example, "https://careers.google.com".
353 #[serde(rename = "careerSiteUri")]
354 pub career_site_uri: Option<String>,
355 /// Output only. Derived details about the company.
356 #[serde(rename = "derivedInfo")]
357 pub derived_info: Option<CompanyDerivedInfo>,
358 /// Required. The display name of the company, for example, "Google LLC".
359 #[serde(rename = "displayName")]
360 pub display_name: Option<String>,
361 /// Equal Employment Opportunity legal disclaimer text to be associated with all jobs, and typically to be displayed in all roles. The maximum number of allowed characters is 500.
362 #[serde(rename = "eeoText")]
363 pub eeo_text: Option<String>,
364 /// Required. Client side company identifier, used to uniquely identify the company. The maximum number of allowed characters is 255.
365 #[serde(rename = "externalId")]
366 pub external_id: Option<String>,
367 /// The street address of the company's main headquarters, which may be different from the job location. The service attempts to geolocate the provided address, and populates a more specific location wherever possible in DerivedInfo.headquarters_location.
368 #[serde(rename = "headquartersAddress")]
369 pub headquarters_address: Option<String>,
370 /// Set to true if it is the hiring agency that post jobs for other employers. Defaults to false if not provided.
371 #[serde(rename = "hiringAgency")]
372 pub hiring_agency: Option<bool>,
373 /// A URI that hosts the employer's company logo.
374 #[serde(rename = "imageUri")]
375 pub image_uri: Option<String>,
376 /// This field is deprecated. Please set the searchability of the custom attribute in the Job.custom_attributes going forward. A list of keys of filterable Job.custom_attributes, whose corresponding `string_values` are used in keyword searches. Jobs with `string_values` under these specified field keys are returned if any of the values match the search keyword. Custom field values with parenthesis, brackets and special symbols are not searchable as-is, and those keyword queries must be surrounded by quotes.
377 #[serde(rename = "keywordSearchableJobCustomAttributes")]
378 pub keyword_searchable_job_custom_attributes: Option<Vec<String>>,
379 /// Required during company update. The resource name for a company. This is generated by the service when a company is created. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
380 pub name: Option<String>,
381 /// The employer's company size.
382 pub size: Option<String>,
383 /// Output only. Indicates whether a company is flagged to be suspended from public availability by the service when job content appears suspicious, abusive, or spammy.
384 pub suspended: Option<bool>,
385 /// The URI representing the company's primary web site or home page, for example, "https://www.google.com". The maximum number of allowed characters is 255.
386 #[serde(rename = "websiteUri")]
387 pub website_uri: Option<String>,
388}
389
390impl common::RequestValue for Company {}
391impl common::ResponseResult for Company {}
392
393/// Derived details about the company.
394///
395/// This type is not used in any activity, and only used as *part* of another schema.
396///
397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
398#[serde_with::serde_as]
399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
400pub struct CompanyDerivedInfo {
401 /// A structured headquarters location of the company, resolved from Company.headquarters_address if provided.
402 #[serde(rename = "headquartersLocation")]
403 pub headquarters_location: Option<Location>,
404}
405
406impl common::Part for CompanyDerivedInfo {}
407
408/// A compensation entry that represents one component of compensation, such as base pay, bonus, or other compensation type. Annualization: One compensation entry can be annualized if - it contains valid amount or range. - and its expected_units_per_year is set or can be derived. Its annualized range is determined as (amount or range) times expected_units_per_year.
409///
410/// This type is not used in any activity, and only used as *part* of another schema.
411///
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct CompensationEntry {
416 /// Compensation amount.
417 pub amount: Option<Money>,
418 /// Compensation description. For example, could indicate equity terms or provide additional context to an estimated bonus.
419 pub description: Option<String>,
420 /// Expected number of units paid each year. If not specified, when Job.employment_types is FULLTIME, a default value is inferred based on unit. Default values: - HOURLY: 2080 - DAILY: 260 - WEEKLY: 52 - MONTHLY: 12 - ANNUAL: 1
421 #[serde(rename = "expectedUnitsPerYear")]
422 pub expected_units_per_year: Option<f64>,
423 /// Compensation range.
424 pub range: Option<CompensationRange>,
425 /// Compensation type. Default is CompensationType.COMPENSATION_TYPE_UNSPECIFIED.
426 #[serde(rename = "type")]
427 pub type_: Option<String>,
428 /// Frequency of the specified amount. Default is CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED.
429 pub unit: Option<String>,
430}
431
432impl common::Part for CompensationEntry {}
433
434/// Filter on job compensation type and amount.
435///
436/// This type is not used in any activity, and only used as *part* of another schema.
437///
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct CompensationFilter {
442 /// If set to true, jobs with unspecified compensation range fields are included.
443 #[serde(rename = "includeJobsWithUnspecifiedCompensationRange")]
444 pub include_jobs_with_unspecified_compensation_range: Option<bool>,
445 /// Compensation range.
446 pub range: Option<CompensationRange>,
447 /// Required. Type of filter.
448 #[serde(rename = "type")]
449 pub type_: Option<String>,
450 /// Required. Specify desired `base compensation entry's` CompensationInfo.CompensationUnit.
451 pub units: Option<Vec<String>>,
452}
453
454impl common::Part for CompensationFilter {}
455
456/// Job compensation details.
457///
458/// This type is not used in any activity, and only used as *part* of another schema.
459///
460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
461#[serde_with::serde_as]
462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
463pub struct CompensationInfo {
464 /// Output only. Annualized base compensation range. Computed as base compensation entry's CompensationEntry.amount times CompensationEntry.expected_units_per_year. See CompensationEntry for explanation on compensation annualization.
465 #[serde(rename = "annualizedBaseCompensationRange")]
466 pub annualized_base_compensation_range: Option<CompensationRange>,
467 /// Output only. Annualized total compensation range. Computed as all compensation entries' CompensationEntry.amount times CompensationEntry.expected_units_per_year. See CompensationEntry for explanation on compensation annualization.
468 #[serde(rename = "annualizedTotalCompensationRange")]
469 pub annualized_total_compensation_range: Option<CompensationRange>,
470 /// Job compensation information. At most one entry can be of type CompensationInfo.CompensationType.BASE, which is referred as **base compensation entry** for the job.
471 pub entries: Option<Vec<CompensationEntry>>,
472}
473
474impl common::Part for CompensationInfo {}
475
476/// Compensation range.
477///
478/// This type is not used in any activity, and only used as *part* of another schema.
479///
480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
481#[serde_with::serde_as]
482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
483pub struct CompensationRange {
484 /// The maximum amount of compensation. If left empty, the value is set to a maximal compensation value and the currency code is set to match the currency code of min_compensation.
485 #[serde(rename = "maxCompensation")]
486 pub max_compensation: Option<Money>,
487 /// The minimum amount of compensation. If left empty, the value is set to zero and the currency code is set to match the currency code of max_compensation.
488 #[serde(rename = "minCompensation")]
489 pub min_compensation: Option<Money>,
490}
491
492impl common::Part for CompensationRange {}
493
494/// Response of auto-complete query.
495///
496/// # Activities
497///
498/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
499/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
500///
501/// * [tenants complete query projects](ProjectTenantCompleteQueryCall) (response)
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct CompleteQueryResponse {
506 /// Results of the matching job/company candidates.
507 #[serde(rename = "completionResults")]
508 pub completion_results: Option<Vec<CompletionResult>>,
509 /// Additional information for the API invocation, such as the request tracking id.
510 pub metadata: Option<ResponseMetadata>,
511}
512
513impl common::ResponseResult for CompleteQueryResponse {}
514
515/// Resource that represents completion results.
516///
517/// This type is not used in any activity, and only used as *part* of another schema.
518///
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct CompletionResult {
523 /// The URI of the company image for COMPANY_NAME.
524 #[serde(rename = "imageUri")]
525 pub image_uri: Option<String>,
526 /// The suggestion for the query.
527 pub suggestion: Option<String>,
528 /// The completion topic.
529 #[serde(rename = "type")]
530 pub type_: Option<String>,
531}
532
533impl common::Part for CompletionResult {}
534
535/// Custom attribute values that are either filterable or non-filterable.
536///
537/// This type is not used in any activity, and only used as *part* of another schema.
538///
539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
540#[serde_with::serde_as]
541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
542pub struct CustomAttribute {
543 /// If the `filterable` flag is true, the custom field values may be used for custom attribute filters JobQuery.custom_attribute_filter. If false, these values may not be used for custom attribute filters. Default is false.
544 pub filterable: Option<bool>,
545 /// If the `keyword_searchable` flag is true, the keywords in custom fields are searchable by keyword match. If false, the values are not searchable by keyword match. Default is false.
546 #[serde(rename = "keywordSearchable")]
547 pub keyword_searchable: Option<bool>,
548 /// Exactly one of string_values or long_values must be specified. This field is used to perform number range search. (`EQ`, `GT`, `GE`, `LE`, `LT`) over filterable `long_value`. Currently at most 1 long_values is supported.
549 #[serde(rename = "longValues")]
550 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
551 pub long_values: Option<Vec<i64>>,
552 /// Exactly one of string_values or long_values must be specified. This field is used to perform a string match (`CASE_SENSITIVE_MATCH` or `CASE_INSENSITIVE_MATCH`) search. For filterable `string_value`s, a maximum total number of 200 values is allowed, with each `string_value` has a byte size of no more than 500B. For unfilterable `string_values`, the maximum total byte size of unfilterable `string_values` is 50KB. Empty string isn't allowed.
553 #[serde(rename = "stringValues")]
554 pub string_values: Option<Vec<String>>,
555}
556
557impl common::Part for CustomAttribute {}
558
559/// Custom ranking information for SearchJobsRequest.
560///
561/// This type is not used in any activity, and only used as *part* of another schema.
562///
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct CustomRankingInfo {
567 /// Required. Controls over how important the score of CustomRankingInfo.ranking_expression gets applied to job's final ranking position. An error is thrown if not specified.
568 #[serde(rename = "importanceLevel")]
569 pub importance_level: Option<String>,
570 /// Required. Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). A combination of the ranking expression and relevance score is used to determine job's final ranking position. The syntax for this expression is a subset of Google SQL syntax. Supported operators are: +, -, *, /, where the left and right side of the operator is either a numeric Job.custom_attributes key, integer/double value or an expression that can be evaluated to a number. Parenthesis are supported to adjust calculation precedence. The expression must be < 200 characters in length. The expression is considered invalid for a job if the expression references custom attributes that are not populated on the job or if the expression results in a divide by zero. If an expression is invalid for a job, that job is demoted to the end of the results. Sample ranking expression (year + 25) * 0.25 - (freshness / 0.5)
571 #[serde(rename = "rankingExpression")]
572 pub ranking_expression: Option<String>,
573}
574
575impl common::Part for CustomRankingInfo {}
576
577/// Device information collected from the job seeker, candidate, or other entity conducting the job search. Providing this information improves the quality of the search results across devices.
578///
579/// This type is not used in any activity, and only used as *part* of another schema.
580///
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct DeviceInfo {
585 /// Type of the device.
586 #[serde(rename = "deviceType")]
587 pub device_type: Option<String>,
588 /// A device-specific ID. The ID must be a unique identifier that distinguishes the device from other devices.
589 pub id: Option<String>,
590}
591
592impl common::Part for DeviceInfo {}
593
594/// 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); }
595///
596/// # Activities
597///
598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
600///
601/// * [tenants companies delete projects](ProjectTenantCompanyDeleteCall) (response)
602/// * [tenants jobs delete projects](ProjectTenantJobDeleteCall) (response)
603/// * [tenants delete projects](ProjectTenantDeleteCall) (response)
604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
605#[serde_with::serde_as]
606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
607pub struct Empty {
608 _never_set: Option<bool>,
609}
610
611impl common::ResponseResult for Empty {}
612
613/// The histogram request.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct HistogramQuery {
621 /// An expression specifies a histogram request against matching jobs for searches. See SearchJobsRequest.histogram_queries for details about syntax.
622 #[serde(rename = "histogramQuery")]
623 pub histogram_query: Option<String>,
624}
625
626impl common::Part for HistogramQuery {}
627
628/// Histogram result that matches HistogramQuery specified in searches.
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct HistogramQueryResult {
636 /// A map from the values of the facet associated with distinct values to the number of matching entries with corresponding value. The key format is: * (for string histogram) string values stored in the field. * (for named numeric bucket) name specified in `bucket()` function, like for `bucket(0, MAX, "non-negative")`, the key will be `non-negative`. * (for anonymous numeric bucket) range formatted as `-`, for example, `0-1000`, `MIN-0`, and `0-MAX`.
637 #[serde_as(as = "Option<HashMap<_, serde_with::DisplayFromStr>>")]
638 pub histogram: Option<HashMap<String, i64>>,
639 /// Requested histogram expression.
640 #[serde(rename = "histogramQuery")]
641 pub histogram_query: Option<String>,
642}
643
644impl common::Part for HistogramQueryResult {}
645
646/// A Job resource represents a job posting (also referred to as a “job listing” or “job requisition”). A job belongs to a Company, which is the hiring entity responsible for the job.
647///
648/// # Activities
649///
650/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
651/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
652///
653/// * [tenants jobs create projects](ProjectTenantJobCreateCall) (request|response)
654/// * [tenants jobs get projects](ProjectTenantJobGetCall) (response)
655/// * [tenants jobs patch projects](ProjectTenantJobPatchCall) (request|response)
656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
657#[serde_with::serde_as]
658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
659pub struct Job {
660 /// Strongly recommended for the best service experience. Location(s) where the employer is looking to hire for this job posting. Specifying the full street address(es) of the hiring location enables better API results, especially job searches by commute time. At most 50 locations are allowed for best search performance. If a job has more locations, it is suggested to split it into multiple jobs with unique requisition_ids (e.g. 'ReqA' becomes 'ReqA-1', 'ReqA-2', and so on.) as multiple jobs with the same company, language_code and requisition_id are not allowed. If the original requisition_id must be preserved, a custom field should be used for storage. It is also suggested to group the locations that close to each other in the same job for better search experience. Jobs with multiple addresses must have their addresses with the same LocationType to allow location filtering to work properly. (For example, a Job with addresses "1600 Amphitheatre Parkway, Mountain View, CA, USA" and "London, UK" may not have location filters applied correctly at search time since the first is a LocationType.STREET_ADDRESS and the second is a LocationType.LOCALITY.) If a job needs to have multiple addresses, it is suggested to split it into multiple jobs with same LocationTypes. The maximum number of allowed characters is 500.
661 pub addresses: Option<Vec<String>>,
662 /// Job application information.
663 #[serde(rename = "applicationInfo")]
664 pub application_info: Option<ApplicationInfo>,
665 /// Required. The resource name of the company listing the job. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For example, "projects/foo/tenants/bar/companies/baz".
666 pub company: Option<String>,
667 /// Output only. Display name of the company listing the job.
668 #[serde(rename = "companyDisplayName")]
669 pub company_display_name: Option<String>,
670 /// Job compensation information (a.k.a. "pay rate") i.e., the compensation that will paid to the employee.
671 #[serde(rename = "compensationInfo")]
672 pub compensation_info: Option<CompensationInfo>,
673 /// A map of fields to hold both filterable and non-filterable custom job attributes that are not covered by the provided structured fields. The keys of the map are strings up to 64 bytes and must match the pattern: `a-zA-Z*`. For example, key0LikeThis or KEY_1_LIKE_THIS. At most 100 filterable and at most 100 unfilterable keys are supported. For filterable `string_values`, across all keys at most 200 values are allowed, with each string no more than 255 characters. For unfilterable `string_values`, the maximum total size of `string_values` across all keys is 50KB.
674 #[serde(rename = "customAttributes")]
675 pub custom_attributes: Option<HashMap<String, CustomAttribute>>,
676 /// The desired education degrees for the job, such as Bachelors, Masters.
677 #[serde(rename = "degreeTypes")]
678 pub degree_types: Option<Vec<String>>,
679 /// The department or functional area within the company with the open position. The maximum number of allowed characters is 255.
680 pub department: Option<String>,
681 /// Output only. Derived details about the job posting.
682 #[serde(rename = "derivedInfo")]
683 pub derived_info: Option<JobDerivedInfo>,
684 /// Required. The description of the job, which typically includes a multi-paragraph description of the company and related information. Separate fields are provided on the job object for responsibilities, qualifications, and other job characteristics. Use of these separate job fields is recommended. This field accepts and sanitizes HTML input, and also accepts bold, italic, ordered list, and unordered list markup tags. The maximum number of allowed characters is 100,000.
685 pub description: Option<String>,
686 /// The employment type(s) of a job, for example, full time or part time.
687 #[serde(rename = "employmentTypes")]
688 pub employment_types: Option<Vec<String>>,
689 /// A description of bonus, commission, and other compensation incentives associated with the job not including salary or pay. The maximum number of allowed characters is 10,000.
690 pub incentives: Option<String>,
691 /// The benefits included with the job.
692 #[serde(rename = "jobBenefits")]
693 pub job_benefits: Option<Vec<String>>,
694 /// The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored.
695 #[serde(rename = "jobEndTime")]
696 pub job_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
697 /// The experience level associated with the job, such as "Entry Level".
698 #[serde(rename = "jobLevel")]
699 pub job_level: Option<String>,
700 /// The start timestamp of the job in UTC time zone. Typically this field is used for contracting engagements. Invalid timestamps are ignored.
701 #[serde(rename = "jobStartTime")]
702 pub job_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
703 /// The language of the posting. This field is distinct from any requirements for fluency that are associated with the job. Language codes must be in BCP-47 format, such as "en-US" or "sr-Latn". For more information, see [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47){: class="external" target="_blank" }. If this field is unspecified and Job.description is present, detected language code based on Job.description is assigned, otherwise defaults to 'en_US'.
704 #[serde(rename = "languageCode")]
705 pub language_code: Option<String>,
706 /// Required during job update. The resource name for the job. This is generated by the service when a job is created. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
707 pub name: Option<String>,
708 /// Output only. The timestamp when this job posting was created.
709 #[serde(rename = "postingCreateTime")]
710 pub posting_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
711 /// Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, the job is marked as expired, and it no longer appears in search results. The expired job can't be listed by the ListJobs API, but it can be retrieved with the GetJob API or updated with the UpdateJob API or deleted with the DeleteJob API. An expired job can be updated and opened again by using a future expiration timestamp. Updating an expired job fails if there is another existing open job with same company, language_code and requisition_id. The expired jobs are retained in our system for 90 days. However, the overall expired job count cannot exceed 3 times the maximum number of open jobs over previous 7 days. If this threshold is exceeded, expired jobs are cleaned out in order of earliest expire time. Expired jobs are no longer accessible after they are cleaned out. Invalid timestamps are ignored, and treated as expire time not provided. If the timestamp is before the instant request is made, the job is treated as expired immediately on creation. This kind of job can not be updated. And when creating a job with past timestamp, the posting_publish_time must be set before posting_expire_time. The purpose of this feature is to allow other objects, such as ApplicationInfo, to refer a job that didn't exist in the system prior to becoming expired. If you want to modify a job that was expired on creation, delete it and create a new one. If this value isn't provided at the time of job creation or is invalid, the job posting expires after 30 days from the job's creation time. For example, if the job was created on 2017/01/01 13:00AM UTC with an unspecified expiration date, the job expires after 2017/01/31 13:00AM UTC. If this value isn't provided on job update, it depends on the field masks set by UpdateJobRequest.update_mask. If the field masks include job_end_time, or the masks are empty meaning that every field is updated, the job posting expires after 30 days from the job's last update time. Otherwise the expiration date isn't updated.
712 #[serde(rename = "postingExpireTime")]
713 pub posting_expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
714 /// The timestamp this job posting was most recently published. The default value is the time the request arrives at the server. Invalid timestamps are ignored.
715 #[serde(rename = "postingPublishTime")]
716 pub posting_publish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
717 /// The job PostingRegion (for example, state, country) throughout which the job is available. If this field is set, a LocationFilter in a search query within the job region finds this job posting if an exact location match isn't specified. If this field is set to PostingRegion.NATION or PostingRegion.ADMINISTRATIVE_AREA, setting job Job.addresses to the same location level as this field is strongly recommended.
718 #[serde(rename = "postingRegion")]
719 pub posting_region: Option<String>,
720 /// Output only. The timestamp when this job posting was last updated.
721 #[serde(rename = "postingUpdateTime")]
722 pub posting_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
723 /// Options for job processing.
724 #[serde(rename = "processingOptions")]
725 pub processing_options: Option<ProcessingOptions>,
726 /// A promotion value of the job, as determined by the client. The value determines the sort order of the jobs returned when searching for jobs using the featured jobs search call, with higher promotional values being returned first and ties being resolved by relevance sort. Only the jobs with a promotionValue >0 are returned in a FEATURED_JOB_SEARCH. Default value is 0, and negative values are treated as 0.
727 #[serde(rename = "promotionValue")]
728 pub promotion_value: Option<i32>,
729 /// A description of the qualifications required to perform the job. The use of this field is recommended as an alternative to using the more general description field. This field accepts and sanitizes HTML input, and also accepts bold, italic, ordered list, and unordered list markup tags. The maximum number of allowed characters is 10,000.
730 pub qualifications: Option<String>,
731 /// Required. The requisition ID, also referred to as the posting ID, is assigned by the client to identify a job. This field is intended to be used by clients for client identification and tracking of postings. A job isn't allowed to be created if there is another job with the same company, language_code and requisition_id. The maximum number of allowed characters is 255.
732 #[serde(rename = "requisitionId")]
733 pub requisition_id: Option<String>,
734 /// A description of job responsibilities. The use of this field is recommended as an alternative to using the more general description field. This field accepts and sanitizes HTML input, and also accepts bold, italic, ordered list, and unordered list markup tags. The maximum number of allowed characters is 10,000.
735 pub responsibilities: Option<String>,
736 /// Required. The title of the job, such as "Software Engineer" The maximum number of allowed characters is 500.
737 pub title: Option<String>,
738 /// Deprecated. The job is only visible to the owner. The visibility of the job. Defaults to Visibility.ACCOUNT_ONLY if not specified.
739 pub visibility: Option<String>,
740}
741
742impl common::RequestValue for Job {}
743impl common::ResponseResult for Job {}
744
745/// Derived details about the job posting.
746///
747/// This type is not used in any activity, and only used as *part* of another schema.
748///
749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
750#[serde_with::serde_as]
751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
752pub struct JobDerivedInfo {
753 /// Job categories derived from Job.title and Job.description.
754 #[serde(rename = "jobCategories")]
755 pub job_categories: Option<Vec<String>>,
756 /// Structured locations of the job, resolved from Job.addresses. locations are exactly matched to Job.addresses in the same order.
757 pub locations: Option<Vec<Location>>,
758}
759
760impl common::Part for JobDerivedInfo {}
761
762/// An event issued when a job seeker interacts with the application that implements Cloud Talent Solution.
763///
764/// This type is not used in any activity, and only used as *part* of another schema.
765///
766#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
767#[serde_with::serde_as]
768#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
769pub struct JobEvent {
770 /// Required. The job name(s) associated with this event. For example, if this is an impression event, this field contains the identifiers of all jobs shown to the job seeker. If this was a view event, this field contains the identifier of the viewed job. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", for example, "projects/foo/tenants/bar/jobs/baz".
771 pub jobs: Option<Vec<String>>,
772 /// Required. The type of the event (see JobEventType).
773 #[serde(rename = "type")]
774 pub type_: Option<String>,
775}
776
777impl common::Part for JobEvent {}
778
779/// The query required to perform a search query.
780///
781/// This type is not used in any activity, and only used as *part* of another schema.
782///
783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
784#[serde_with::serde_as]
785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
786pub struct JobQuery {
787 /// Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). Note: This only works when you specify a CommuteMethod. In this case, location_filters is ignored. Currently we don't support sorting by commute time.
788 #[serde(rename = "commuteFilter")]
789 pub commute_filter: Option<CommuteFilter>,
790 /// This filter specifies the company entities to search against. If a value isn't specified, jobs are searched for against all companies. If multiple values are specified, jobs are searched against the companies specified. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For example, "projects/foo/tenants/bar/companies/baz". At most 20 company filters are allowed.
791 pub companies: Option<Vec<String>>,
792 /// This filter specifies the company Company.display_name of the jobs to search against. The company name must match the value exactly. Alternatively, the value being searched for can be wrapped in different match operators. `SUBSTRING_MATCH([value])` The company name must contain a case insensitive substring match of the value. Using this function may increase latency. Sample Value: `SUBSTRING_MATCH(google)` `MULTI_WORD_TOKEN_MATCH([value])` The value will be treated as a multi word token and the company name must contain a case insensitive match of the value. Using this function may increase latency. Sample Value: `MULTI_WORD_TOKEN_MATCH(google)` If a value isn't specified, jobs within the search results are associated with any company. If multiple values are specified, jobs within the search results may be associated with any of the specified companies. At most 20 company display name filters are allowed.
793 #[serde(rename = "companyDisplayNames")]
794 pub company_display_names: Option<Vec<String>>,
795 /// This search filter is applied only to Job.compensation_info. For example, if the filter is specified as "Hourly job with per-hour compensation > $15", only jobs meeting these criteria are searched. If a filter isn't defined, all open jobs are searched.
796 #[serde(rename = "compensationFilter")]
797 pub compensation_filter: Option<CompensationFilter>,
798 /// This filter specifies a structured syntax to match against the Job.custom_attributes marked as `filterable`. The syntax for this expression is a subset of SQL syntax. Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where the left of the operator is a custom field key and the right of the operator is a number or a quoted string. You must escape backslash (\\) and quote (\") characters. Supported functions are `LOWER([field_name])` to perform a case insensitive match and `EMPTY([field_name])` to filter on the existence of a key. Boolean expressions (AND/OR/NOT) are supported up to 3 levels of nesting (for example, "((A AND B AND C) OR NOT D) AND E"), a maximum of 100 comparisons or functions are allowed in the expression. The expression must be < 10000 bytes in length. Sample Query: `(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND driving_years > 10`
799 #[serde(rename = "customAttributeFilter")]
800 pub custom_attribute_filter: Option<String>,
801 /// This flag controls the spell-check feature. If false, the service attempts to correct a misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed.
802 #[serde(rename = "disableSpellCheck")]
803 pub disable_spell_check: Option<bool>,
804 /// The employment type filter specifies the employment type of jobs to search against, such as EmploymentType.FULL_TIME. If a value isn't specified, jobs in the search results includes any employment type. If multiple values are specified, jobs in the search results include any of the specified employment types.
805 #[serde(rename = "employmentTypes")]
806 pub employment_types: Option<Vec<String>>,
807 /// This filter specifies a list of job names to be excluded during search. At most 400 excluded job names are allowed.
808 #[serde(rename = "excludedJobs")]
809 pub excluded_jobs: Option<Vec<String>>,
810 /// The category filter specifies the categories of jobs to search against. See JobCategory for more information. If a value isn't specified, jobs from any category are searched against. If multiple values are specified, jobs from any of the specified categories are searched against.
811 #[serde(rename = "jobCategories")]
812 pub job_categories: Option<Vec<String>>,
813 /// This filter specifies the locale of jobs to search against, for example, "en-US". If a value isn't specified, the search results can contain jobs in any locale. Language codes should be in BCP-47 format, such as "en-US" or "sr-Latn". For more information, see [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). At most 10 language code filters are allowed.
814 #[serde(rename = "languageCodes")]
815 pub language_codes: Option<Vec<String>>,
816 /// The location filter specifies geo-regions containing the jobs to search against. See LocationFilter for more information. If a location value isn't specified, jobs fitting the other search criteria are retrieved regardless of where they're located. If multiple values are specified, jobs are retrieved from any of the specified locations. If different values are specified for the LocationFilter.distance_in_miles parameter, the maximum provided distance is used for all locations. At most 5 location filters are allowed.
817 #[serde(rename = "locationFilters")]
818 pub location_filters: Option<Vec<LocationFilter>>,
819 /// Jobs published within a range specified by this filter are searched against.
820 #[serde(rename = "publishTimeRange")]
821 pub publish_time_range: Option<TimestampRange>,
822 /// The query string that matches against the job title, description, and location fields. The maximum number of allowed characters is 255.
823 pub query: Option<String>,
824 /// The language code of query. For example, "en-US". This field helps to better interpret the query. If a value isn't specified, the query language code is automatically detected, which may not be accurate. Language code should be in BCP-47 format, such as "en-US" or "sr-Latn". For more information, see [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47).
825 #[serde(rename = "queryLanguageCode")]
826 pub query_language_code: Option<String>,
827}
828
829impl common::Part for JobQuery {}
830
831/// An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
832///
833/// This type is not used in any activity, and only used as *part* of another schema.
834///
835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
836#[serde_with::serde_as]
837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
838pub struct LatLng {
839 /// The latitude in degrees. It must be in the range [-90.0, +90.0].
840 pub latitude: Option<f64>,
841 /// The longitude in degrees. It must be in the range [-180.0, +180.0].
842 pub longitude: Option<f64>,
843}
844
845impl common::Part for LatLng {}
846
847/// The List companies response object.
848///
849/// # Activities
850///
851/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
852/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
853///
854/// * [tenants companies list projects](ProjectTenantCompanyListCall) (response)
855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
856#[serde_with::serde_as]
857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
858pub struct ListCompaniesResponse {
859 /// Companies for the current client.
860 pub companies: Option<Vec<Company>>,
861 /// Additional information for the API invocation, such as the request tracking id.
862 pub metadata: Option<ResponseMetadata>,
863 /// A token to retrieve the next page of results.
864 #[serde(rename = "nextPageToken")]
865 pub next_page_token: Option<String>,
866}
867
868impl common::ResponseResult for ListCompaniesResponse {}
869
870/// List jobs response.
871///
872/// # Activities
873///
874/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
875/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
876///
877/// * [tenants jobs list projects](ProjectTenantJobListCall) (response)
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct ListJobsResponse {
882 /// The Jobs for a given company. The maximum number of items returned is based on the limit field provided in the request.
883 pub jobs: Option<Vec<Job>>,
884 /// Additional information for the API invocation, such as the request tracking id.
885 pub metadata: Option<ResponseMetadata>,
886 /// A token to retrieve the next page of results.
887 #[serde(rename = "nextPageToken")]
888 pub next_page_token: Option<String>,
889}
890
891impl common::ResponseResult for ListJobsResponse {}
892
893/// The List tenants response object.
894///
895/// # Activities
896///
897/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
898/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
899///
900/// * [tenants list projects](ProjectTenantListCall) (response)
901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
902#[serde_with::serde_as]
903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
904pub struct ListTenantsResponse {
905 /// Additional information for the API invocation, such as the request tracking id.
906 pub metadata: Option<ResponseMetadata>,
907 /// A token to retrieve the next page of results.
908 #[serde(rename = "nextPageToken")]
909 pub next_page_token: Option<String>,
910 /// Tenants for the current client.
911 pub tenants: Option<Vec<Tenant>>,
912}
913
914impl common::ResponseResult for ListTenantsResponse {}
915
916/// A resource that represents a location with full geographic information.
917///
918/// This type is not used in any activity, and only used as *part* of another schema.
919///
920#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
921#[serde_with::serde_as]
922#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
923pub struct Location {
924 /// An object representing a latitude/longitude pair.
925 #[serde(rename = "latLng")]
926 pub lat_lng: Option<LatLng>,
927 /// The type of a location, which corresponds to the address lines field of google.type.PostalAddress. For example, "Downtown, Atlanta, GA, USA" has a type of LocationType.NEIGHBORHOOD, and "Kansas City, KS, USA" has a type of LocationType.LOCALITY.
928 #[serde(rename = "locationType")]
929 pub location_type: Option<String>,
930 /// Postal address of the location that includes human readable information, such as postal delivery and payments addresses. Given a postal address, a postal service can deliver items to a premises, P.O. Box, or other delivery location.
931 #[serde(rename = "postalAddress")]
932 pub postal_address: Option<PostalAddress>,
933 /// Radius in miles of the job location. This value is derived from the location bounding box in which a circle with the specified radius centered from google.type.LatLng covers the area associated with the job location. For example, currently, "Mountain View, CA, USA" has a radius of 6.17 miles.
934 #[serde(rename = "radiusMiles")]
935 pub radius_miles: Option<f64>,
936}
937
938impl common::Part for Location {}
939
940/// Geographic region of the search.
941///
942/// This type is not used in any activity, and only used as *part* of another schema.
943///
944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
945#[serde_with::serde_as]
946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
947pub struct LocationFilter {
948 /// The address name, such as "Mountain View" or "Bay Area".
949 pub address: Option<String>,
950 /// The distance_in_miles is applied when the location being searched for is identified as a city or smaller. This field is ignored if the location being searched for is a state or larger.
951 #[serde(rename = "distanceInMiles")]
952 pub distance_in_miles: Option<f64>,
953 /// The latitude and longitude of the geographic center to search from. This field is ignored if `address` is provided.
954 #[serde(rename = "latLng")]
955 pub lat_lng: Option<LatLng>,
956 /// CLDR region code of the country/region. This field may be used in two ways: 1) If telecommute preference is not set, this field is used address ambiguity of the user-input address. For example, "Liverpool" may refer to "Liverpool, NY, US" or "Liverpool, UK". This region code biases the address resolution toward a specific country or territory. If this field is not set, address resolution is biased toward the United States by default. 2) If telecommute preference is set to TELECOMMUTE_ALLOWED, the telecommute location filter will be limited to the region specified in this field. If this field is not set, the telecommute job locations will not be See https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
957 #[serde(rename = "regionCode")]
958 pub region_code: Option<String>,
959 /// Allows the client to return jobs without a set location, specifically, telecommuting jobs (telecommuting is considered by the service as a special location). Job.posting_region indicates if a job permits telecommuting. If this field is set to TelecommutePreference.TELECOMMUTE_ALLOWED, telecommuting jobs are searched, and address and lat_lng are ignored. If not set or set to TelecommutePreference.TELECOMMUTE_EXCLUDED, the telecommute status of the jobs is ignored. Jobs that have PostingRegion.TELECOMMUTE and have additional Job.addresses may still be matched based on other location filters using address or lat_lng. This filter can be used by itself to search exclusively for telecommuting jobs, or it can be combined with another location filter to search for a combination of job locations, such as "Mountain View" or "telecommuting" jobs. However, when used in combination with other location filters, telecommuting jobs can be treated as less relevant than other jobs in the search response. This field is only used for job search requests.
960 #[serde(rename = "telecommutePreference")]
961 pub telecommute_preference: Option<String>,
962}
963
964impl common::Part for LocationFilter {}
965
966/// Job entry with metadata inside SearchJobsResponse.
967///
968/// This type is not used in any activity, and only used as *part* of another schema.
969///
970#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
971#[serde_with::serde_as]
972#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
973pub struct MatchingJob {
974 /// Commute information which is generated based on specified CommuteFilter.
975 #[serde(rename = "commuteInfo")]
976 pub commute_info: Option<CommuteInfo>,
977 /// Job resource that matches the specified SearchJobsRequest.
978 pub job: Option<Job>,
979 /// A summary of the job with core information that's displayed on the search results listing page.
980 #[serde(rename = "jobSummary")]
981 pub job_summary: Option<String>,
982 /// Contains snippets of text from the Job.title field most closely matching a search query's keywords, if available. The matching query keywords are enclosed in HTML bold tags.
983 #[serde(rename = "jobTitleSnippet")]
984 pub job_title_snippet: Option<String>,
985 /// Contains snippets of text from the Job.description and similar fields that most closely match a search query's keywords, if available. All HTML tags in the original fields are stripped when returned in this field, and matching query keywords are enclosed in HTML bold tags.
986 #[serde(rename = "searchTextSnippet")]
987 pub search_text_snippet: Option<String>,
988}
989
990impl common::Part for MatchingJob {}
991
992/// Represents an amount of money with its currency type.
993///
994/// This type is not used in any activity, and only used as *part* of another schema.
995///
996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
997#[serde_with::serde_as]
998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
999pub struct Money {
1000 /// The three-letter currency code defined in ISO 4217.
1001 #[serde(rename = "currencyCode")]
1002 pub currency_code: Option<String>,
1003 /// Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
1004 pub nanos: Option<i32>,
1005 /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
1006 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1007 pub units: Option<i64>,
1008}
1009
1010impl common::Part for Money {}
1011
1012/// This resource represents a long-running operation that is the result of a network API call.
1013///
1014/// # Activities
1015///
1016/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1017/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1018///
1019/// * [operations get projects](ProjectOperationGetCall) (response)
1020/// * [tenants jobs batch create projects](ProjectTenantJobBatchCreateCall) (response)
1021/// * [tenants jobs batch delete projects](ProjectTenantJobBatchDeleteCall) (response)
1022/// * [tenants jobs batch update projects](ProjectTenantJobBatchUpdateCall) (response)
1023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1024#[serde_with::serde_as]
1025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1026pub struct Operation {
1027 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1028 pub done: Option<bool>,
1029 /// The error result of the operation in case of failure or cancellation.
1030 pub error: Option<Status>,
1031 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1032 pub metadata: Option<HashMap<String, serde_json::Value>>,
1033 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1034 pub name: Option<String>,
1035 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1036 pub response: Option<HashMap<String, serde_json::Value>>,
1037}
1038
1039impl common::ResponseResult for Operation {}
1040
1041/// Represents a postal address, such as for postal delivery or payments addresses. With a postal address, a postal service can deliver items to a premise, P.O. box, or similar. A postal address is not intended to model geographical locations like roads, towns, or mountains. In typical usage, an address would be created by user input or from importing existing data, depending on the type of process. Advice on address input or editing: - Use an internationalization-ready address widget such as https://github.com/google/libaddressinput. - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. For more guidance on how to use this schema, see: https://support.google.com/business/answer/6397478.
1042///
1043/// This type is not used in any activity, and only used as *part* of another schema.
1044///
1045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1046#[serde_with::serde_as]
1047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1048pub struct PostalAddress {
1049 /// Unstructured address lines describing the lower levels of an address. Because values in `address_lines` do not have type information and may sometimes contain multiple values in a single field (for example, "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country or region of the address. In places where this can vary (for example, Japan), `address_language` is used to make it explicit (for example, "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this way, the most specific line of an address can be selected based on the language. The minimum permitted structural representation of an address consists of a `region_code` with all remaining information placed in the `address_lines`. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. Creating an address only containing a `region_code` and `address_lines` and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas).
1050 #[serde(rename = "addressLines")]
1051 pub address_lines: Option<Vec<String>>,
1052 /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. For Spain, this is the province and not the autonomous community (for example, "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. For example, in Switzerland, this should be left unpopulated.
1053 #[serde(rename = "administrativeArea")]
1054 pub administrative_area: Option<String>,
1055 /// Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
1056 #[serde(rename = "languageCode")]
1057 pub language_code: Option<String>,
1058 /// Optional. Generally refers to the city or town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave `locality` empty and use `address_lines`.
1059 pub locality: Option<String>,
1060 /// Optional. The name of the organization at the address.
1061 pub organization: Option<String>,
1062 /// Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (for example, state or zip code validation in the United States).
1063 #[serde(rename = "postalCode")]
1064 pub postal_code: Option<String>,
1065 /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
1066 pub recipients: Option<Vec<String>>,
1067 /// Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
1068 #[serde(rename = "regionCode")]
1069 pub region_code: Option<String>,
1070 /// The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. All new revisions **must** be backward compatible with old revisions.
1071 pub revision: Option<i32>,
1072 /// Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
1073 #[serde(rename = "sortingCode")]
1074 pub sorting_code: Option<String>,
1075 /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
1076 pub sublocality: Option<String>,
1077}
1078
1079impl common::Part for PostalAddress {}
1080
1081/// Options for job processing.
1082///
1083/// This type is not used in any activity, and only used as *part* of another schema.
1084///
1085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1086#[serde_with::serde_as]
1087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1088pub struct ProcessingOptions {
1089 /// If set to `true`, the service does not attempt to resolve a more precise address for the job.
1090 #[serde(rename = "disableStreetAddressResolution")]
1091 pub disable_street_address_resolution: Option<bool>,
1092 /// Option for job HTML content sanitization. Applied fields are: * description * applicationInfo.instruction * incentives * qualifications * responsibilities HTML tags in these fields may be stripped if sanitiazation isn't disabled. Defaults to HtmlSanitization.SIMPLE_FORMATTING_ONLY.
1093 #[serde(rename = "htmlSanitization")]
1094 pub html_sanitization: Option<String>,
1095}
1096
1097impl common::Part for ProcessingOptions {}
1098
1099/// Meta information related to the job searcher or entity conducting the job search. This information is used to improve the performance of the service.
1100///
1101/// This type is not used in any activity, and only used as *part* of another schema.
1102///
1103#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1104#[serde_with::serde_as]
1105#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1106pub struct RequestMetadata {
1107 /// Only set when any of domain, session_id and user_id isn't available for some reason. It is highly recommended not to set this field and provide accurate domain, session_id and user_id for the best service experience.
1108 #[serde(rename = "allowMissingIds")]
1109 pub allow_missing_ids: Option<bool>,
1110 /// The type of device used by the job seeker at the time of the call to the service.
1111 #[serde(rename = "deviceInfo")]
1112 pub device_info: Option<DeviceInfo>,
1113 /// Required if allow_missing_ids is unset or `false`. The client-defined scope or source of the service call, which typically is the domain on which the service has been implemented and is currently being run. For example, if the service is being run by client *Foo, Inc.*, on job board www.foo.com and career site www.bar.com, then this field is set to "foo.com" for use on the job board, and "bar.com" for use on the career site. Note that any improvements to the model for a particular tenant site rely on this field being set correctly to a unique domain. The maximum number of allowed characters is 255.
1114 pub domain: Option<String>,
1115 /// Required if allow_missing_ids is unset or `false`. A unique session identification string. A session is defined as the duration of an end user's interaction with the service over a certain period. Obfuscate this field for privacy concerns before providing it to the service. Note that any improvements to the model for a particular tenant site rely on this field being set correctly to a unique session ID. The maximum number of allowed characters is 255.
1116 #[serde(rename = "sessionId")]
1117 pub session_id: Option<String>,
1118 /// Required if allow_missing_ids is unset or `false`. A unique user identification string, as determined by the client. To have the strongest positive impact on search quality make sure the client-level is unique. Obfuscate this field for privacy concerns before providing it to the service. Note that any improvements to the model for a particular tenant site rely on this field being set correctly to a unique user ID. The maximum number of allowed characters is 255.
1119 #[serde(rename = "userId")]
1120 pub user_id: Option<String>,
1121}
1122
1123impl common::Part for RequestMetadata {}
1124
1125/// Additional information returned to client, such as debugging information.
1126///
1127/// This type is not used in any activity, and only used as *part* of another schema.
1128///
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct ResponseMetadata {
1133 /// A unique id associated with this call. This id is logged for tracking purposes.
1134 #[serde(rename = "requestId")]
1135 pub request_id: Option<String>,
1136}
1137
1138impl common::Part for ResponseMetadata {}
1139
1140/// The Request body of the `SearchJobs` call.
1141///
1142/// # Activities
1143///
1144/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1145/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1146///
1147/// * [tenants jobs search projects](ProjectTenantJobSearchCall) (request)
1148/// * [tenants jobs search for alert projects](ProjectTenantJobSearchForAlertCall) (request)
1149#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1150#[serde_with::serde_as]
1151#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1152pub struct SearchJobsRequest {
1153 /// Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm).
1154 #[serde(rename = "customRankingInfo")]
1155 pub custom_ranking_info: Option<CustomRankingInfo>,
1156 /// This field is deprecated. Please use SearchJobsRequest.keyword_match_mode going forward. To migrate, disable_keyword_match set to false maps to KeywordMatchMode.KEYWORD_MATCH_ALL, and disable_keyword_match set to true maps to KeywordMatchMode.KEYWORD_MATCH_DISABLED. If SearchJobsRequest.keyword_match_mode is set, this field is ignored. Controls whether to disable exact keyword match on Job.title, Job.description, Job.company_display_name, Job.addresses, Job.qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Use Company.keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false.
1157 #[serde(rename = "disableKeywordMatch")]
1158 pub disable_keyword_match: Option<bool>,
1159 /// Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results. Defaults to DiversificationLevel.SIMPLE if no value is specified.
1160 #[serde(rename = "diversificationLevel")]
1161 pub diversification_level: Option<String>,
1162 /// Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list. Defaults to false.
1163 #[serde(rename = "enableBroadening")]
1164 pub enable_broadening: Option<bool>,
1165 /// An expression specifies a histogram request against matching jobs. Expression syntax is an aggregation function call with histogram facets and other options. Available aggregation function calls are: * `count(string_histogram_facet)`: Count the number of matching entities, for each distinct attribute value. * `count(numeric_histogram_facet, list of buckets)`: Count the number of matching entities within each bucket. A maximum of 200 histogram buckets are supported. Data types: * Histogram facet: facet names with format `a-zA-Z+`. * String: string like "any string with backslash escape for quote(\")." * Number: whole number and floating point number like 10, -1 and -0.01. * List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"]. Built-in constants: * MIN (minimum number similar to java Double.MIN_VALUE) * MAX (maximum number similar to java Double.MAX_VALUE) Built-in functions: * bucket(start, end[, label]): bucket built-in function creates a bucket with range of start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10). Job histogram facets: * company_display_name: histogram by [Job.company_display_name. * employment_type: histogram by Job.employment_types, for example, "FULL_TIME", "PART_TIME". * company_size (DEPRECATED): histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG". * publish_time_in_day: histogram by the Job.posting_publish_time in days. Must specify list of numeric buckets in spec. * publish_time_in_month: histogram by the Job.posting_publish_time in months. Must specify list of numeric buckets in spec. * publish_time_in_year: histogram by the Job.posting_publish_time in years. Must specify list of numeric buckets in spec. * degree_types: histogram by the Job.degree_types, for example, "Bachelors", "Masters". * job_level: histogram by the Job.job_level, for example, "Entry Level". * country: histogram by the country code of jobs, for example, "US", "FR". * admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL". * city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY". * admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US". * city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically. * locale: histogram by the Job.language_code, for example, "en-US", "fr-FR". * language: histogram by the language subtag of the Job.language_code, for example, "en", "fr". * category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE". * base_compensation_unit: histogram by the CompensationInfo.CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY". * base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by. * annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by. * annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by. * string_custom_attribute: histogram by string Job.custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"]. * numeric_custom_attribute: histogram by numeric Job.custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by. Example expressions: * `count(admin1)` * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])` * `count(string_custom_attribute["some-string-custom-attribute"])` * `count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")])`
1166 #[serde(rename = "histogramQueries")]
1167 pub histogram_queries: Option<Vec<HistogramQuery>>,
1168 /// Query used to search against jobs, such as keyword, location filters, etc.
1169 #[serde(rename = "jobQuery")]
1170 pub job_query: Option<JobQuery>,
1171 /// The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_SMALL if no value is specified.
1172 #[serde(rename = "jobView")]
1173 pub job_view: Option<String>,
1174 /// Controls what keyword match options to use. If both keyword_match_mode and disable_keyword_match are set, keyword_match_mode will take precedence. Defaults to KeywordMatchMode.KEYWORD_MATCH_ALL if no value is specified.
1175 #[serde(rename = "keywordMatchMode")]
1176 pub keyword_match_mode: Option<String>,
1177 /// A limit on the number of jobs returned in the search results. Increasing this value above the default value of 10 can increase search response time. The value can be between 1 and 100.
1178 #[serde(rename = "maxPageSize")]
1179 pub max_page_size: Option<i32>,
1180 /// An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset. The maximum allowed value is 5000. Otherwise an error is thrown. For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page).
1181 pub offset: Option<i32>,
1182 /// The criteria determining how search results are sorted. Default is `"relevance desc"`. Supported options are: * `"relevance desc"`: By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering. * `"posting_publish_time desc"`: By Job.posting_publish_time descending. * `"posting_update_time desc"`: By Job.posting_update_time descending. * `"title"`: By Job.title ascending. * `"title desc"`: By Job.title descending. * `"annualized_base_compensation"`: By job's CompensationInfo.annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * `"annualized_base_compensation desc"`: By job's CompensationInfo.annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * `"annualized_total_compensation"`: By job's CompensationInfo.annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * `"annualized_total_compensation desc"`: By job's CompensationInfo.annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results. * `"custom_ranking desc"`: By the relevance score adjusted to the SearchJobsRequest.CustomRankingInfo.ranking_expression with weight factor assigned by SearchJobsRequest.CustomRankingInfo.importance_level in descending order. * Location sorting: Use the special syntax to order jobs by distance: `"distance_from('Hawaii')"`: Order by distance from Hawaii. `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate. `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by multiple locations. See details below. `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by multiple locations. See details below. The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.
1183 #[serde(rename = "orderBy")]
1184 pub order_by: Option<String>,
1185 /// The token specifying the current offset within search results. See SearchJobsResponse.next_page_token for an explanation of how to obtain the next set of query results.
1186 #[serde(rename = "pageToken")]
1187 pub page_token: Option<String>,
1188 /// Optional. The relevance threshold of the search results. Default to Google defined threshold, leveraging a balance of precision and recall to deliver both highly accurate results and comprehensive coverage of relevant information.
1189 #[serde(rename = "relevanceThreshold")]
1190 pub relevance_threshold: Option<String>,
1191 /// Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as `user_id`) are provided by users, and must be unique and consistent.
1192 #[serde(rename = "requestMetadata")]
1193 pub request_metadata: Option<RequestMetadata>,
1194 /// Mode of a search. Defaults to SearchMode.JOB_SEARCH.
1195 #[serde(rename = "searchMode")]
1196 pub search_mode: Option<String>,
1197}
1198
1199impl common::RequestValue for SearchJobsRequest {}
1200
1201/// Response for SearchJob method.
1202///
1203/// # Activities
1204///
1205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1207///
1208/// * [tenants jobs search projects](ProjectTenantJobSearchCall) (response)
1209/// * [tenants jobs search for alert projects](ProjectTenantJobSearchForAlertCall) (response)
1210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1211#[serde_with::serde_as]
1212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1213pub struct SearchJobsResponse {
1214 /// If query broadening is enabled, we may append additional results from the broadened query. This number indicates how many of the jobs returned in the jobs field are from the broadened query. These results are always at the end of the jobs list. In particular, a value of 0, or if the field isn't set, all the jobs in the jobs list are from the original (without broadening) query. If this field is non-zero, subsequent requests with offset after this result set should contain all broadened results.
1215 #[serde(rename = "broadenedQueryJobsCount")]
1216 pub broadened_query_jobs_count: Option<i32>,
1217 /// The histogram results that match with specified SearchJobsRequest.histogram_queries.
1218 #[serde(rename = "histogramQueryResults")]
1219 pub histogram_query_results: Option<Vec<HistogramQueryResult>>,
1220 /// The location filters that the service applied to the specified query. If any filters are lat-lng based, the Location.location_type is Location.LocationType.LOCATION_TYPE_UNSPECIFIED.
1221 #[serde(rename = "locationFilters")]
1222 pub location_filters: Option<Vec<Location>>,
1223 /// The Job entities that match the specified SearchJobsRequest.
1224 #[serde(rename = "matchingJobs")]
1225 pub matching_jobs: Option<Vec<MatchingJob>>,
1226 /// Additional information for the API invocation, such as the request tracking id.
1227 pub metadata: Option<ResponseMetadata>,
1228 /// The token that specifies the starting position of the next page of results. This field is empty if there are no more results.
1229 #[serde(rename = "nextPageToken")]
1230 pub next_page_token: Option<String>,
1231 /// The spell checking result, and correction.
1232 #[serde(rename = "spellCorrection")]
1233 pub spell_correction: Option<SpellingCorrection>,
1234 /// Number of jobs that match the specified query. Note: This size is precise only if the total is less than 100,000.
1235 #[serde(rename = "totalSize")]
1236 pub total_size: Option<i32>,
1237}
1238
1239impl common::ResponseResult for SearchJobsResponse {}
1240
1241/// Spell check result.
1242///
1243/// This type is not used in any activity, and only used as *part* of another schema.
1244///
1245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1246#[serde_with::serde_as]
1247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1248pub struct SpellingCorrection {
1249 /// Indicates if the query was corrected by the spell checker.
1250 pub corrected: Option<bool>,
1251 /// Corrected output with html tags to highlight the corrected words. Corrected words are called out with the "*...*" html tags. For example, the user input query is "software enginear", where the second word, "enginear," is incorrect. It should be "engineer". When spelling correction is enabled, this value is "software *engineer*".
1252 #[serde(rename = "correctedHtml")]
1253 pub corrected_html: Option<String>,
1254 /// Correction output consisting of the corrected keyword string.
1255 #[serde(rename = "correctedText")]
1256 pub corrected_text: Option<String>,
1257}
1258
1259impl common::Part for SpellingCorrection {}
1260
1261/// 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).
1262///
1263/// This type is not used in any activity, and only used as *part* of another schema.
1264///
1265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1266#[serde_with::serde_as]
1267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1268pub struct Status {
1269 /// The status code, which should be an enum value of google.rpc.Code.
1270 pub code: Option<i32>,
1271 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1272 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1273 /// 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.
1274 pub message: Option<String>,
1275}
1276
1277impl common::Part for Status {}
1278
1279/// A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with specific privileges for resources like jobs. Customer may create multiple tenants to provide data isolation for different groups.
1280///
1281/// # Activities
1282///
1283/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1284/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1285///
1286/// * [tenants create projects](ProjectTenantCreateCall) (request|response)
1287/// * [tenants get projects](ProjectTenantGetCall) (response)
1288/// * [tenants patch projects](ProjectTenantPatchCall) (request|response)
1289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1290#[serde_with::serde_as]
1291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1292pub struct Tenant {
1293 /// Required. Client side tenant identifier, used to uniquely identify the tenant. The maximum number of allowed characters is 255.
1294 #[serde(rename = "externalId")]
1295 pub external_id: Option<String>,
1296 /// Required during tenant update. The resource name for a tenant. This is generated by the service when a tenant is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1297 pub name: Option<String>,
1298}
1299
1300impl common::RequestValue for Tenant {}
1301impl common::ResponseResult for Tenant {}
1302
1303/// Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
1304///
1305/// This type is not used in any activity, and only used as *part* of another schema.
1306///
1307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1308#[serde_with::serde_as]
1309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1310pub struct TimeOfDay {
1311 /// Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
1312 pub hours: Option<i32>,
1313 /// Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
1314 pub minutes: Option<i32>,
1315 /// Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
1316 pub nanos: Option<i32>,
1317 /// Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
1318 pub seconds: Option<i32>,
1319}
1320
1321impl common::Part for TimeOfDay {}
1322
1323/// Message representing a period of time between two timestamps.
1324///
1325/// This type is not used in any activity, and only used as *part* of another schema.
1326///
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct TimestampRange {
1331 /// End of the period (exclusive).
1332 #[serde(rename = "endTime")]
1333 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1334 /// Begin of the period (inclusive).
1335 #[serde(rename = "startTime")]
1336 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1337}
1338
1339impl common::Part for TimestampRange {}
1340
1341// ###################
1342// MethodBuilders ###
1343// #################
1344
1345/// A builder providing access to all methods supported on *project* resources.
1346/// It is not used directly, but through the [`CloudTalentSolution`] hub.
1347///
1348/// # Example
1349///
1350/// Instantiate a resource builder
1351///
1352/// ```test_harness,no_run
1353/// extern crate hyper;
1354/// extern crate hyper_rustls;
1355/// extern crate google_jobs4 as jobs4;
1356///
1357/// # async fn dox() {
1358/// use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1359///
1360/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1361/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1362/// .with_native_roots()
1363/// .unwrap()
1364/// .https_only()
1365/// .enable_http2()
1366/// .build();
1367///
1368/// let executor = hyper_util::rt::TokioExecutor::new();
1369/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1370/// secret,
1371/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1372/// yup_oauth2::client::CustomHyperClientBuilder::from(
1373/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1374/// ),
1375/// ).build().await.unwrap();
1376///
1377/// let client = hyper_util::client::legacy::Client::builder(
1378/// hyper_util::rt::TokioExecutor::new()
1379/// )
1380/// .build(
1381/// hyper_rustls::HttpsConnectorBuilder::new()
1382/// .with_native_roots()
1383/// .unwrap()
1384/// .https_or_http()
1385/// .enable_http2()
1386/// .build()
1387/// );
1388/// let mut hub = CloudTalentSolution::new(client, auth);
1389/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1390/// // like `operations_get(...)`, `tenants_client_events_create(...)`, `tenants_companies_create(...)`, `tenants_companies_delete(...)`, `tenants_companies_get(...)`, `tenants_companies_list(...)`, `tenants_companies_patch(...)`, `tenants_complete_query(...)`, `tenants_create(...)`, `tenants_delete(...)`, `tenants_get(...)`, `tenants_jobs_batch_create(...)`, `tenants_jobs_batch_delete(...)`, `tenants_jobs_batch_update(...)`, `tenants_jobs_create(...)`, `tenants_jobs_delete(...)`, `tenants_jobs_get(...)`, `tenants_jobs_list(...)`, `tenants_jobs_patch(...)`, `tenants_jobs_search(...)`, `tenants_jobs_search_for_alert(...)`, `tenants_list(...)` and `tenants_patch(...)`
1391/// // to build up your call.
1392/// let rb = hub.projects();
1393/// # }
1394/// ```
1395pub struct ProjectMethods<'a, C>
1396where
1397 C: 'a,
1398{
1399 hub: &'a CloudTalentSolution<C>,
1400}
1401
1402impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1403
1404impl<'a, C> ProjectMethods<'a, C> {
1405 /// Create a builder to help you perform the following task:
1406 ///
1407 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1408 ///
1409 /// # Arguments
1410 ///
1411 /// * `name` - The name of the operation resource.
1412 pub fn operations_get(&self, name: &str) -> ProjectOperationGetCall<'a, C> {
1413 ProjectOperationGetCall {
1414 hub: self.hub,
1415 _name: name.to_string(),
1416 _delegate: Default::default(),
1417 _additional_params: Default::default(),
1418 _scopes: Default::default(),
1419 }
1420 }
1421
1422 /// Create a builder to help you perform the following task:
1423 ///
1424 /// Report events issued when end user interacts with customer's application that uses Cloud Talent Solution. You may inspect the created events in [self service tools](https://console.cloud.google.com/talent-solution/overview). [Learn more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
1425 ///
1426 /// # Arguments
1427 ///
1428 /// * `request` - No description provided.
1429 /// * `parent` - Required. Resource name of the tenant under which the event is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1430 pub fn tenants_client_events_create(
1431 &self,
1432 request: ClientEvent,
1433 parent: &str,
1434 ) -> ProjectTenantClientEventCreateCall<'a, C> {
1435 ProjectTenantClientEventCreateCall {
1436 hub: self.hub,
1437 _request: request,
1438 _parent: parent.to_string(),
1439 _delegate: Default::default(),
1440 _additional_params: Default::default(),
1441 _scopes: Default::default(),
1442 }
1443 }
1444
1445 /// Create a builder to help you perform the following task:
1446 ///
1447 /// Creates a new company entity.
1448 ///
1449 /// # Arguments
1450 ///
1451 /// * `request` - No description provided.
1452 /// * `parent` - Required. Resource name of the tenant under which the company is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1453 pub fn tenants_companies_create(
1454 &self,
1455 request: Company,
1456 parent: &str,
1457 ) -> ProjectTenantCompanyCreateCall<'a, C> {
1458 ProjectTenantCompanyCreateCall {
1459 hub: self.hub,
1460 _request: request,
1461 _parent: parent.to_string(),
1462 _delegate: Default::default(),
1463 _additional_params: Default::default(),
1464 _scopes: Default::default(),
1465 }
1466 }
1467
1468 /// Create a builder to help you perform the following task:
1469 ///
1470 /// Deletes specified company. Prerequisite: The company has no jobs associated with it.
1471 ///
1472 /// # Arguments
1473 ///
1474 /// * `name` - Required. The resource name of the company to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
1475 pub fn tenants_companies_delete(&self, name: &str) -> ProjectTenantCompanyDeleteCall<'a, C> {
1476 ProjectTenantCompanyDeleteCall {
1477 hub: self.hub,
1478 _name: name.to_string(),
1479 _delegate: Default::default(),
1480 _additional_params: Default::default(),
1481 _scopes: Default::default(),
1482 }
1483 }
1484
1485 /// Create a builder to help you perform the following task:
1486 ///
1487 /// Retrieves specified company.
1488 ///
1489 /// # Arguments
1490 ///
1491 /// * `name` - Required. The resource name of the company to be retrieved. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
1492 pub fn tenants_companies_get(&self, name: &str) -> ProjectTenantCompanyGetCall<'a, C> {
1493 ProjectTenantCompanyGetCall {
1494 hub: self.hub,
1495 _name: name.to_string(),
1496 _delegate: Default::default(),
1497 _additional_params: Default::default(),
1498 _scopes: Default::default(),
1499 }
1500 }
1501
1502 /// Create a builder to help you perform the following task:
1503 ///
1504 /// Lists all companies associated with the project.
1505 ///
1506 /// # Arguments
1507 ///
1508 /// * `parent` - Required. Resource name of the tenant under which the company is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1509 pub fn tenants_companies_list(&self, parent: &str) -> ProjectTenantCompanyListCall<'a, C> {
1510 ProjectTenantCompanyListCall {
1511 hub: self.hub,
1512 _parent: parent.to_string(),
1513 _require_open_jobs: Default::default(),
1514 _page_token: Default::default(),
1515 _page_size: Default::default(),
1516 _delegate: Default::default(),
1517 _additional_params: Default::default(),
1518 _scopes: Default::default(),
1519 }
1520 }
1521
1522 /// Create a builder to help you perform the following task:
1523 ///
1524 /// Updates specified company.
1525 ///
1526 /// # Arguments
1527 ///
1528 /// * `request` - No description provided.
1529 /// * `name` - Required during company update. The resource name for a company. This is generated by the service when a company is created. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
1530 pub fn tenants_companies_patch(
1531 &self,
1532 request: Company,
1533 name: &str,
1534 ) -> ProjectTenantCompanyPatchCall<'a, C> {
1535 ProjectTenantCompanyPatchCall {
1536 hub: self.hub,
1537 _request: request,
1538 _name: name.to_string(),
1539 _update_mask: Default::default(),
1540 _delegate: Default::default(),
1541 _additional_params: Default::default(),
1542 _scopes: Default::default(),
1543 }
1544 }
1545
1546 /// Create a builder to help you perform the following task:
1547 ///
1548 /// Begins executing a batch create jobs operation.
1549 ///
1550 /// # Arguments
1551 ///
1552 /// * `request` - No description provided.
1553 /// * `parent` - Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1554 pub fn tenants_jobs_batch_create(
1555 &self,
1556 request: BatchCreateJobsRequest,
1557 parent: &str,
1558 ) -> ProjectTenantJobBatchCreateCall<'a, C> {
1559 ProjectTenantJobBatchCreateCall {
1560 hub: self.hub,
1561 _request: request,
1562 _parent: parent.to_string(),
1563 _delegate: Default::default(),
1564 _additional_params: Default::default(),
1565 _scopes: Default::default(),
1566 }
1567 }
1568
1569 /// Create a builder to help you perform the following task:
1570 ///
1571 /// Begins executing a batch delete jobs operation.
1572 ///
1573 /// # Arguments
1574 ///
1575 /// * `request` - No description provided.
1576 /// * `parent` - Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". The parent of all of the jobs specified in `names` must match this field.
1577 pub fn tenants_jobs_batch_delete(
1578 &self,
1579 request: BatchDeleteJobsRequest,
1580 parent: &str,
1581 ) -> ProjectTenantJobBatchDeleteCall<'a, C> {
1582 ProjectTenantJobBatchDeleteCall {
1583 hub: self.hub,
1584 _request: request,
1585 _parent: parent.to_string(),
1586 _delegate: Default::default(),
1587 _additional_params: Default::default(),
1588 _scopes: Default::default(),
1589 }
1590 }
1591
1592 /// Create a builder to help you perform the following task:
1593 ///
1594 /// Begins executing a batch update jobs operation.
1595 ///
1596 /// # Arguments
1597 ///
1598 /// * `request` - No description provided.
1599 /// * `parent` - Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1600 pub fn tenants_jobs_batch_update(
1601 &self,
1602 request: BatchUpdateJobsRequest,
1603 parent: &str,
1604 ) -> ProjectTenantJobBatchUpdateCall<'a, C> {
1605 ProjectTenantJobBatchUpdateCall {
1606 hub: self.hub,
1607 _request: request,
1608 _parent: parent.to_string(),
1609 _delegate: Default::default(),
1610 _additional_params: Default::default(),
1611 _scopes: Default::default(),
1612 }
1613 }
1614
1615 /// Create a builder to help you perform the following task:
1616 ///
1617 /// Creates a new job. Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
1618 ///
1619 /// # Arguments
1620 ///
1621 /// * `request` - No description provided.
1622 /// * `parent` - Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1623 pub fn tenants_jobs_create(
1624 &self,
1625 request: Job,
1626 parent: &str,
1627 ) -> ProjectTenantJobCreateCall<'a, C> {
1628 ProjectTenantJobCreateCall {
1629 hub: self.hub,
1630 _request: request,
1631 _parent: parent.to_string(),
1632 _delegate: Default::default(),
1633 _additional_params: Default::default(),
1634 _scopes: Default::default(),
1635 }
1636 }
1637
1638 /// Create a builder to help you perform the following task:
1639 ///
1640 /// Deletes the specified job. Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
1641 ///
1642 /// # Arguments
1643 ///
1644 /// * `name` - Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz".
1645 pub fn tenants_jobs_delete(&self, name: &str) -> ProjectTenantJobDeleteCall<'a, C> {
1646 ProjectTenantJobDeleteCall {
1647 hub: self.hub,
1648 _name: name.to_string(),
1649 _delegate: Default::default(),
1650 _additional_params: Default::default(),
1651 _scopes: Default::default(),
1652 }
1653 }
1654
1655 /// Create a builder to help you perform the following task:
1656 ///
1657 /// Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
1658 ///
1659 /// # Arguments
1660 ///
1661 /// * `name` - Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz".
1662 pub fn tenants_jobs_get(&self, name: &str) -> ProjectTenantJobGetCall<'a, C> {
1663 ProjectTenantJobGetCall {
1664 hub: self.hub,
1665 _name: name.to_string(),
1666 _delegate: Default::default(),
1667 _additional_params: Default::default(),
1668 _scopes: Default::default(),
1669 }
1670 }
1671
1672 /// Create a builder to help you perform the following task:
1673 ///
1674 /// Lists jobs by filter.
1675 ///
1676 /// # Arguments
1677 ///
1678 /// * `parent` - Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1679 pub fn tenants_jobs_list(&self, parent: &str) -> ProjectTenantJobListCall<'a, C> {
1680 ProjectTenantJobListCall {
1681 hub: self.hub,
1682 _parent: parent.to_string(),
1683 _page_token: Default::default(),
1684 _page_size: Default::default(),
1685 _job_view: Default::default(),
1686 _filter: Default::default(),
1687 _delegate: Default::default(),
1688 _additional_params: Default::default(),
1689 _scopes: Default::default(),
1690 }
1691 }
1692
1693 /// Create a builder to help you perform the following task:
1694 ///
1695 /// Updates specified job. Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
1696 ///
1697 /// # Arguments
1698 ///
1699 /// * `request` - No description provided.
1700 /// * `name` - Required during job update. The resource name for the job. This is generated by the service when a job is created. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
1701 pub fn tenants_jobs_patch(&self, request: Job, name: &str) -> ProjectTenantJobPatchCall<'a, C> {
1702 ProjectTenantJobPatchCall {
1703 hub: self.hub,
1704 _request: request,
1705 _name: name.to_string(),
1706 _update_mask: Default::default(),
1707 _delegate: Default::default(),
1708 _additional_params: Default::default(),
1709 _scopes: Default::default(),
1710 }
1711 }
1712
1713 /// Create a builder to help you perform the following task:
1714 ///
1715 /// Searches for jobs using the provided SearchJobsRequest. This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.
1716 ///
1717 /// # Arguments
1718 ///
1719 /// * `request` - No description provided.
1720 /// * `parent` - Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1721 pub fn tenants_jobs_search(
1722 &self,
1723 request: SearchJobsRequest,
1724 parent: &str,
1725 ) -> ProjectTenantJobSearchCall<'a, C> {
1726 ProjectTenantJobSearchCall {
1727 hub: self.hub,
1728 _request: request,
1729 _parent: parent.to_string(),
1730 _delegate: Default::default(),
1731 _additional_params: Default::default(),
1732 _scopes: Default::default(),
1733 }
1734 }
1735
1736 /// Create a builder to help you perform the following task:
1737 ///
1738 /// Searches for jobs using the provided SearchJobsRequest. This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), it has different algorithmic adjustments that are designed to specifically target passive job seekers. This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.
1739 ///
1740 /// # Arguments
1741 ///
1742 /// * `request` - No description provided.
1743 /// * `parent` - Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
1744 pub fn tenants_jobs_search_for_alert(
1745 &self,
1746 request: SearchJobsRequest,
1747 parent: &str,
1748 ) -> ProjectTenantJobSearchForAlertCall<'a, C> {
1749 ProjectTenantJobSearchForAlertCall {
1750 hub: self.hub,
1751 _request: request,
1752 _parent: parent.to_string(),
1753 _delegate: Default::default(),
1754 _additional_params: Default::default(),
1755 _scopes: Default::default(),
1756 }
1757 }
1758
1759 /// Create a builder to help you perform the following task:
1760 ///
1761 /// Completes the specified prefix with keyword suggestions. Intended for use by a job search auto-complete search box.
1762 ///
1763 /// # Arguments
1764 ///
1765 /// * `tenant` - Required. Resource name of tenant the completion is performed within. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1766 pub fn tenants_complete_query(&self, tenant: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
1767 ProjectTenantCompleteQueryCall {
1768 hub: self.hub,
1769 _tenant: tenant.to_string(),
1770 _type_: Default::default(),
1771 _scope: Default::default(),
1772 _query: Default::default(),
1773 _page_size: Default::default(),
1774 _language_codes: Default::default(),
1775 _company: Default::default(),
1776 _delegate: Default::default(),
1777 _additional_params: Default::default(),
1778 _scopes: Default::default(),
1779 }
1780 }
1781
1782 /// Create a builder to help you perform the following task:
1783 ///
1784 /// Creates a new tenant entity.
1785 ///
1786 /// # Arguments
1787 ///
1788 /// * `request` - No description provided.
1789 /// * `parent` - Required. Resource name of the project under which the tenant is created. The format is "projects/{project_id}", for example, "projects/foo".
1790 pub fn tenants_create(&self, request: Tenant, parent: &str) -> ProjectTenantCreateCall<'a, C> {
1791 ProjectTenantCreateCall {
1792 hub: self.hub,
1793 _request: request,
1794 _parent: parent.to_string(),
1795 _delegate: Default::default(),
1796 _additional_params: Default::default(),
1797 _scopes: Default::default(),
1798 }
1799 }
1800
1801 /// Create a builder to help you perform the following task:
1802 ///
1803 /// Deletes specified tenant.
1804 ///
1805 /// # Arguments
1806 ///
1807 /// * `name` - Required. The resource name of the tenant to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1808 pub fn tenants_delete(&self, name: &str) -> ProjectTenantDeleteCall<'a, C> {
1809 ProjectTenantDeleteCall {
1810 hub: self.hub,
1811 _name: name.to_string(),
1812 _delegate: Default::default(),
1813 _additional_params: Default::default(),
1814 _scopes: Default::default(),
1815 }
1816 }
1817
1818 /// Create a builder to help you perform the following task:
1819 ///
1820 /// Retrieves specified tenant.
1821 ///
1822 /// # Arguments
1823 ///
1824 /// * `name` - Required. The resource name of the tenant to be retrieved. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1825 pub fn tenants_get(&self, name: &str) -> ProjectTenantGetCall<'a, C> {
1826 ProjectTenantGetCall {
1827 hub: self.hub,
1828 _name: name.to_string(),
1829 _delegate: Default::default(),
1830 _additional_params: Default::default(),
1831 _scopes: Default::default(),
1832 }
1833 }
1834
1835 /// Create a builder to help you perform the following task:
1836 ///
1837 /// Lists all tenants associated with the project.
1838 ///
1839 /// # Arguments
1840 ///
1841 /// * `parent` - Required. Resource name of the project under which the tenant is created. The format is "projects/{project_id}", for example, "projects/foo".
1842 pub fn tenants_list(&self, parent: &str) -> ProjectTenantListCall<'a, C> {
1843 ProjectTenantListCall {
1844 hub: self.hub,
1845 _parent: parent.to_string(),
1846 _page_token: Default::default(),
1847 _page_size: Default::default(),
1848 _delegate: Default::default(),
1849 _additional_params: Default::default(),
1850 _scopes: Default::default(),
1851 }
1852 }
1853
1854 /// Create a builder to help you perform the following task:
1855 ///
1856 /// Updates specified tenant.
1857 ///
1858 /// # Arguments
1859 ///
1860 /// * `request` - No description provided.
1861 /// * `name` - Required during tenant update. The resource name for a tenant. This is generated by the service when a tenant is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
1862 pub fn tenants_patch(&self, request: Tenant, name: &str) -> ProjectTenantPatchCall<'a, C> {
1863 ProjectTenantPatchCall {
1864 hub: self.hub,
1865 _request: request,
1866 _name: name.to_string(),
1867 _update_mask: Default::default(),
1868 _delegate: Default::default(),
1869 _additional_params: Default::default(),
1870 _scopes: Default::default(),
1871 }
1872 }
1873}
1874
1875// ###################
1876// CallBuilders ###
1877// #################
1878
1879/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1880///
1881/// A builder for the *operations.get* method supported by a *project* resource.
1882/// It is not used directly, but through a [`ProjectMethods`] instance.
1883///
1884/// # Example
1885///
1886/// Instantiate a resource method builder
1887///
1888/// ```test_harness,no_run
1889/// # extern crate hyper;
1890/// # extern crate hyper_rustls;
1891/// # extern crate google_jobs4 as jobs4;
1892/// # async fn dox() {
1893/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1894///
1895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1896/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1897/// # .with_native_roots()
1898/// # .unwrap()
1899/// # .https_only()
1900/// # .enable_http2()
1901/// # .build();
1902///
1903/// # let executor = hyper_util::rt::TokioExecutor::new();
1904/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1905/// # secret,
1906/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1907/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1908/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1909/// # ),
1910/// # ).build().await.unwrap();
1911///
1912/// # let client = hyper_util::client::legacy::Client::builder(
1913/// # hyper_util::rt::TokioExecutor::new()
1914/// # )
1915/// # .build(
1916/// # hyper_rustls::HttpsConnectorBuilder::new()
1917/// # .with_native_roots()
1918/// # .unwrap()
1919/// # .https_or_http()
1920/// # .enable_http2()
1921/// # .build()
1922/// # );
1923/// # let mut hub = CloudTalentSolution::new(client, auth);
1924/// // You can configure optional parameters by calling the respective setters at will, and
1925/// // execute the final call using `doit()`.
1926/// // Values shown here are possibly random and not representative !
1927/// let result = hub.projects().operations_get("name")
1928/// .doit().await;
1929/// # }
1930/// ```
1931pub struct ProjectOperationGetCall<'a, C>
1932where
1933 C: 'a,
1934{
1935 hub: &'a CloudTalentSolution<C>,
1936 _name: String,
1937 _delegate: Option<&'a mut dyn common::Delegate>,
1938 _additional_params: HashMap<String, String>,
1939 _scopes: BTreeSet<String>,
1940}
1941
1942impl<'a, C> common::CallBuilder for ProjectOperationGetCall<'a, C> {}
1943
1944impl<'a, C> ProjectOperationGetCall<'a, C>
1945where
1946 C: common::Connector,
1947{
1948 /// Perform the operation you have build so far.
1949 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1950 use std::borrow::Cow;
1951 use std::io::{Read, Seek};
1952
1953 use common::{url::Params, ToParts};
1954 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1955
1956 let mut dd = common::DefaultDelegate;
1957 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1958 dlg.begin(common::MethodInfo {
1959 id: "jobs.projects.operations.get",
1960 http_method: hyper::Method::GET,
1961 });
1962
1963 for &field in ["alt", "name"].iter() {
1964 if self._additional_params.contains_key(field) {
1965 dlg.finished(false);
1966 return Err(common::Error::FieldClash(field));
1967 }
1968 }
1969
1970 let mut params = Params::with_capacity(3 + self._additional_params.len());
1971 params.push("name", self._name);
1972
1973 params.extend(self._additional_params.iter());
1974
1975 params.push("alt", "json");
1976 let mut url = self.hub._base_url.clone() + "v4/{+name}";
1977 if self._scopes.is_empty() {
1978 self._scopes
1979 .insert(Scope::CloudPlatform.as_ref().to_string());
1980 }
1981
1982 #[allow(clippy::single_element_loop)]
1983 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1984 url = params.uri_replacement(url, param_name, find_this, true);
1985 }
1986 {
1987 let to_remove = ["name"];
1988 params.remove_params(&to_remove);
1989 }
1990
1991 let url = params.parse_with_url(&url);
1992
1993 loop {
1994 let token = match self
1995 .hub
1996 .auth
1997 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1998 .await
1999 {
2000 Ok(token) => token,
2001 Err(e) => match dlg.token(e) {
2002 Ok(token) => token,
2003 Err(e) => {
2004 dlg.finished(false);
2005 return Err(common::Error::MissingToken(e));
2006 }
2007 },
2008 };
2009 let mut req_result = {
2010 let client = &self.hub.client;
2011 dlg.pre_request();
2012 let mut req_builder = hyper::Request::builder()
2013 .method(hyper::Method::GET)
2014 .uri(url.as_str())
2015 .header(USER_AGENT, self.hub._user_agent.clone());
2016
2017 if let Some(token) = token.as_ref() {
2018 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2019 }
2020
2021 let request = req_builder
2022 .header(CONTENT_LENGTH, 0_u64)
2023 .body(common::to_body::<String>(None));
2024
2025 client.request(request.unwrap()).await
2026 };
2027
2028 match req_result {
2029 Err(err) => {
2030 if let common::Retry::After(d) = dlg.http_error(&err) {
2031 sleep(d).await;
2032 continue;
2033 }
2034 dlg.finished(false);
2035 return Err(common::Error::HttpError(err));
2036 }
2037 Ok(res) => {
2038 let (mut parts, body) = res.into_parts();
2039 let mut body = common::Body::new(body);
2040 if !parts.status.is_success() {
2041 let bytes = common::to_bytes(body).await.unwrap_or_default();
2042 let error = serde_json::from_str(&common::to_string(&bytes));
2043 let response = common::to_response(parts, bytes.into());
2044
2045 if let common::Retry::After(d) =
2046 dlg.http_failure(&response, error.as_ref().ok())
2047 {
2048 sleep(d).await;
2049 continue;
2050 }
2051
2052 dlg.finished(false);
2053
2054 return Err(match error {
2055 Ok(value) => common::Error::BadRequest(value),
2056 _ => common::Error::Failure(response),
2057 });
2058 }
2059 let response = {
2060 let bytes = common::to_bytes(body).await.unwrap_or_default();
2061 let encoded = common::to_string(&bytes);
2062 match serde_json::from_str(&encoded) {
2063 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2064 Err(error) => {
2065 dlg.response_json_decode_error(&encoded, &error);
2066 return Err(common::Error::JsonDecodeError(
2067 encoded.to_string(),
2068 error,
2069 ));
2070 }
2071 }
2072 };
2073
2074 dlg.finished(true);
2075 return Ok(response);
2076 }
2077 }
2078 }
2079 }
2080
2081 /// The name of the operation resource.
2082 ///
2083 /// Sets the *name* path property to the given value.
2084 ///
2085 /// Even though the property as already been set when instantiating this call,
2086 /// we provide this method for API completeness.
2087 pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C> {
2088 self._name = new_value.to_string();
2089 self
2090 }
2091 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2092 /// while executing the actual API request.
2093 ///
2094 /// ````text
2095 /// It should be used to handle progress information, and to implement a certain level of resilience.
2096 /// ````
2097 ///
2098 /// Sets the *delegate* property to the given value.
2099 pub fn delegate(
2100 mut self,
2101 new_value: &'a mut dyn common::Delegate,
2102 ) -> ProjectOperationGetCall<'a, C> {
2103 self._delegate = Some(new_value);
2104 self
2105 }
2106
2107 /// Set any additional parameter of the query string used in the request.
2108 /// It should be used to set parameters which are not yet available through their own
2109 /// setters.
2110 ///
2111 /// Please note that this method must not be used to set any of the known parameters
2112 /// which have their own setter method. If done anyway, the request will fail.
2113 ///
2114 /// # Additional Parameters
2115 ///
2116 /// * *$.xgafv* (query-string) - V1 error format.
2117 /// * *access_token* (query-string) - OAuth access token.
2118 /// * *alt* (query-string) - Data format for response.
2119 /// * *callback* (query-string) - JSONP
2120 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2121 /// * *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.
2122 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2123 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2124 /// * *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.
2125 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2126 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2127 pub fn param<T>(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C>
2128 where
2129 T: AsRef<str>,
2130 {
2131 self._additional_params
2132 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2133 self
2134 }
2135
2136 /// Identifies the authorization scope for the method you are building.
2137 ///
2138 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2139 /// [`Scope::CloudPlatform`].
2140 ///
2141 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2142 /// tokens for more than one scope.
2143 ///
2144 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2145 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2146 /// sufficient, a read-write scope will do as well.
2147 pub fn add_scope<St>(mut self, scope: St) -> ProjectOperationGetCall<'a, C>
2148 where
2149 St: AsRef<str>,
2150 {
2151 self._scopes.insert(String::from(scope.as_ref()));
2152 self
2153 }
2154 /// Identifies the authorization scope(s) for the method you are building.
2155 ///
2156 /// See [`Self::add_scope()`] for details.
2157 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOperationGetCall<'a, C>
2158 where
2159 I: IntoIterator<Item = St>,
2160 St: AsRef<str>,
2161 {
2162 self._scopes
2163 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2164 self
2165 }
2166
2167 /// Removes all scopes, and no default scope will be used either.
2168 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2169 /// for details).
2170 pub fn clear_scopes(mut self) -> ProjectOperationGetCall<'a, C> {
2171 self._scopes.clear();
2172 self
2173 }
2174}
2175
2176/// Report events issued when end user interacts with customer's application that uses Cloud Talent Solution. You may inspect the created events in [self service tools](https://console.cloud.google.com/talent-solution/overview). [Learn more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
2177///
2178/// A builder for the *tenants.clientEvents.create* method supported by a *project* resource.
2179/// It is not used directly, but through a [`ProjectMethods`] instance.
2180///
2181/// # Example
2182///
2183/// Instantiate a resource method builder
2184///
2185/// ```test_harness,no_run
2186/// # extern crate hyper;
2187/// # extern crate hyper_rustls;
2188/// # extern crate google_jobs4 as jobs4;
2189/// use jobs4::api::ClientEvent;
2190/// # async fn dox() {
2191/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2192///
2193/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2194/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2195/// # .with_native_roots()
2196/// # .unwrap()
2197/// # .https_only()
2198/// # .enable_http2()
2199/// # .build();
2200///
2201/// # let executor = hyper_util::rt::TokioExecutor::new();
2202/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2203/// # secret,
2204/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2205/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2206/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2207/// # ),
2208/// # ).build().await.unwrap();
2209///
2210/// # let client = hyper_util::client::legacy::Client::builder(
2211/// # hyper_util::rt::TokioExecutor::new()
2212/// # )
2213/// # .build(
2214/// # hyper_rustls::HttpsConnectorBuilder::new()
2215/// # .with_native_roots()
2216/// # .unwrap()
2217/// # .https_or_http()
2218/// # .enable_http2()
2219/// # .build()
2220/// # );
2221/// # let mut hub = CloudTalentSolution::new(client, auth);
2222/// // As the method needs a request, you would usually fill it with the desired information
2223/// // into the respective structure. Some of the parts shown here might not be applicable !
2224/// // Values shown here are possibly random and not representative !
2225/// let mut req = ClientEvent::default();
2226///
2227/// // You can configure optional parameters by calling the respective setters at will, and
2228/// // execute the final call using `doit()`.
2229/// // Values shown here are possibly random and not representative !
2230/// let result = hub.projects().tenants_client_events_create(req, "parent")
2231/// .doit().await;
2232/// # }
2233/// ```
2234pub struct ProjectTenantClientEventCreateCall<'a, C>
2235where
2236 C: 'a,
2237{
2238 hub: &'a CloudTalentSolution<C>,
2239 _request: ClientEvent,
2240 _parent: String,
2241 _delegate: Option<&'a mut dyn common::Delegate>,
2242 _additional_params: HashMap<String, String>,
2243 _scopes: BTreeSet<String>,
2244}
2245
2246impl<'a, C> common::CallBuilder for ProjectTenantClientEventCreateCall<'a, C> {}
2247
2248impl<'a, C> ProjectTenantClientEventCreateCall<'a, C>
2249where
2250 C: common::Connector,
2251{
2252 /// Perform the operation you have build so far.
2253 pub async fn doit(mut self) -> common::Result<(common::Response, ClientEvent)> {
2254 use std::borrow::Cow;
2255 use std::io::{Read, Seek};
2256
2257 use common::{url::Params, ToParts};
2258 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2259
2260 let mut dd = common::DefaultDelegate;
2261 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2262 dlg.begin(common::MethodInfo {
2263 id: "jobs.projects.tenants.clientEvents.create",
2264 http_method: hyper::Method::POST,
2265 });
2266
2267 for &field in ["alt", "parent"].iter() {
2268 if self._additional_params.contains_key(field) {
2269 dlg.finished(false);
2270 return Err(common::Error::FieldClash(field));
2271 }
2272 }
2273
2274 let mut params = Params::with_capacity(4 + self._additional_params.len());
2275 params.push("parent", self._parent);
2276
2277 params.extend(self._additional_params.iter());
2278
2279 params.push("alt", "json");
2280 let mut url = self.hub._base_url.clone() + "v4/{+parent}/clientEvents";
2281 if self._scopes.is_empty() {
2282 self._scopes
2283 .insert(Scope::CloudPlatform.as_ref().to_string());
2284 }
2285
2286 #[allow(clippy::single_element_loop)]
2287 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2288 url = params.uri_replacement(url, param_name, find_this, true);
2289 }
2290 {
2291 let to_remove = ["parent"];
2292 params.remove_params(&to_remove);
2293 }
2294
2295 let url = params.parse_with_url(&url);
2296
2297 let mut json_mime_type = mime::APPLICATION_JSON;
2298 let mut request_value_reader = {
2299 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2300 common::remove_json_null_values(&mut value);
2301 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2302 serde_json::to_writer(&mut dst, &value).unwrap();
2303 dst
2304 };
2305 let request_size = request_value_reader
2306 .seek(std::io::SeekFrom::End(0))
2307 .unwrap();
2308 request_value_reader
2309 .seek(std::io::SeekFrom::Start(0))
2310 .unwrap();
2311
2312 loop {
2313 let token = match self
2314 .hub
2315 .auth
2316 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2317 .await
2318 {
2319 Ok(token) => token,
2320 Err(e) => match dlg.token(e) {
2321 Ok(token) => token,
2322 Err(e) => {
2323 dlg.finished(false);
2324 return Err(common::Error::MissingToken(e));
2325 }
2326 },
2327 };
2328 request_value_reader
2329 .seek(std::io::SeekFrom::Start(0))
2330 .unwrap();
2331 let mut req_result = {
2332 let client = &self.hub.client;
2333 dlg.pre_request();
2334 let mut req_builder = hyper::Request::builder()
2335 .method(hyper::Method::POST)
2336 .uri(url.as_str())
2337 .header(USER_AGENT, self.hub._user_agent.clone());
2338
2339 if let Some(token) = token.as_ref() {
2340 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2341 }
2342
2343 let request = req_builder
2344 .header(CONTENT_TYPE, json_mime_type.to_string())
2345 .header(CONTENT_LENGTH, request_size as u64)
2346 .body(common::to_body(
2347 request_value_reader.get_ref().clone().into(),
2348 ));
2349
2350 client.request(request.unwrap()).await
2351 };
2352
2353 match req_result {
2354 Err(err) => {
2355 if let common::Retry::After(d) = dlg.http_error(&err) {
2356 sleep(d).await;
2357 continue;
2358 }
2359 dlg.finished(false);
2360 return Err(common::Error::HttpError(err));
2361 }
2362 Ok(res) => {
2363 let (mut parts, body) = res.into_parts();
2364 let mut body = common::Body::new(body);
2365 if !parts.status.is_success() {
2366 let bytes = common::to_bytes(body).await.unwrap_or_default();
2367 let error = serde_json::from_str(&common::to_string(&bytes));
2368 let response = common::to_response(parts, bytes.into());
2369
2370 if let common::Retry::After(d) =
2371 dlg.http_failure(&response, error.as_ref().ok())
2372 {
2373 sleep(d).await;
2374 continue;
2375 }
2376
2377 dlg.finished(false);
2378
2379 return Err(match error {
2380 Ok(value) => common::Error::BadRequest(value),
2381 _ => common::Error::Failure(response),
2382 });
2383 }
2384 let response = {
2385 let bytes = common::to_bytes(body).await.unwrap_or_default();
2386 let encoded = common::to_string(&bytes);
2387 match serde_json::from_str(&encoded) {
2388 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2389 Err(error) => {
2390 dlg.response_json_decode_error(&encoded, &error);
2391 return Err(common::Error::JsonDecodeError(
2392 encoded.to_string(),
2393 error,
2394 ));
2395 }
2396 }
2397 };
2398
2399 dlg.finished(true);
2400 return Ok(response);
2401 }
2402 }
2403 }
2404 }
2405
2406 ///
2407 /// Sets the *request* property to the given value.
2408 ///
2409 /// Even though the property as already been set when instantiating this call,
2410 /// we provide this method for API completeness.
2411 pub fn request(mut self, new_value: ClientEvent) -> ProjectTenantClientEventCreateCall<'a, C> {
2412 self._request = new_value;
2413 self
2414 }
2415 /// Required. Resource name of the tenant under which the event is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
2416 ///
2417 /// Sets the *parent* path property to the given value.
2418 ///
2419 /// Even though the property as already been set when instantiating this call,
2420 /// we provide this method for API completeness.
2421 pub fn parent(mut self, new_value: &str) -> ProjectTenantClientEventCreateCall<'a, C> {
2422 self._parent = new_value.to_string();
2423 self
2424 }
2425 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2426 /// while executing the actual API request.
2427 ///
2428 /// ````text
2429 /// It should be used to handle progress information, and to implement a certain level of resilience.
2430 /// ````
2431 ///
2432 /// Sets the *delegate* property to the given value.
2433 pub fn delegate(
2434 mut self,
2435 new_value: &'a mut dyn common::Delegate,
2436 ) -> ProjectTenantClientEventCreateCall<'a, C> {
2437 self._delegate = Some(new_value);
2438 self
2439 }
2440
2441 /// Set any additional parameter of the query string used in the request.
2442 /// It should be used to set parameters which are not yet available through their own
2443 /// setters.
2444 ///
2445 /// Please note that this method must not be used to set any of the known parameters
2446 /// which have their own setter method. If done anyway, the request will fail.
2447 ///
2448 /// # Additional Parameters
2449 ///
2450 /// * *$.xgafv* (query-string) - V1 error format.
2451 /// * *access_token* (query-string) - OAuth access token.
2452 /// * *alt* (query-string) - Data format for response.
2453 /// * *callback* (query-string) - JSONP
2454 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2455 /// * *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.
2456 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2457 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2458 /// * *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.
2459 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2460 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2461 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantClientEventCreateCall<'a, C>
2462 where
2463 T: AsRef<str>,
2464 {
2465 self._additional_params
2466 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2467 self
2468 }
2469
2470 /// Identifies the authorization scope for the method you are building.
2471 ///
2472 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2473 /// [`Scope::CloudPlatform`].
2474 ///
2475 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2476 /// tokens for more than one scope.
2477 ///
2478 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2479 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2480 /// sufficient, a read-write scope will do as well.
2481 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantClientEventCreateCall<'a, C>
2482 where
2483 St: AsRef<str>,
2484 {
2485 self._scopes.insert(String::from(scope.as_ref()));
2486 self
2487 }
2488 /// Identifies the authorization scope(s) for the method you are building.
2489 ///
2490 /// See [`Self::add_scope()`] for details.
2491 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantClientEventCreateCall<'a, C>
2492 where
2493 I: IntoIterator<Item = St>,
2494 St: AsRef<str>,
2495 {
2496 self._scopes
2497 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2498 self
2499 }
2500
2501 /// Removes all scopes, and no default scope will be used either.
2502 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2503 /// for details).
2504 pub fn clear_scopes(mut self) -> ProjectTenantClientEventCreateCall<'a, C> {
2505 self._scopes.clear();
2506 self
2507 }
2508}
2509
2510/// Creates a new company entity.
2511///
2512/// A builder for the *tenants.companies.create* method supported by a *project* resource.
2513/// It is not used directly, but through a [`ProjectMethods`] instance.
2514///
2515/// # Example
2516///
2517/// Instantiate a resource method builder
2518///
2519/// ```test_harness,no_run
2520/// # extern crate hyper;
2521/// # extern crate hyper_rustls;
2522/// # extern crate google_jobs4 as jobs4;
2523/// use jobs4::api::Company;
2524/// # async fn dox() {
2525/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2526///
2527/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2528/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2529/// # .with_native_roots()
2530/// # .unwrap()
2531/// # .https_only()
2532/// # .enable_http2()
2533/// # .build();
2534///
2535/// # let executor = hyper_util::rt::TokioExecutor::new();
2536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2537/// # secret,
2538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2539/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2540/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2541/// # ),
2542/// # ).build().await.unwrap();
2543///
2544/// # let client = hyper_util::client::legacy::Client::builder(
2545/// # hyper_util::rt::TokioExecutor::new()
2546/// # )
2547/// # .build(
2548/// # hyper_rustls::HttpsConnectorBuilder::new()
2549/// # .with_native_roots()
2550/// # .unwrap()
2551/// # .https_or_http()
2552/// # .enable_http2()
2553/// # .build()
2554/// # );
2555/// # let mut hub = CloudTalentSolution::new(client, auth);
2556/// // As the method needs a request, you would usually fill it with the desired information
2557/// // into the respective structure. Some of the parts shown here might not be applicable !
2558/// // Values shown here are possibly random and not representative !
2559/// let mut req = Company::default();
2560///
2561/// // You can configure optional parameters by calling the respective setters at will, and
2562/// // execute the final call using `doit()`.
2563/// // Values shown here are possibly random and not representative !
2564/// let result = hub.projects().tenants_companies_create(req, "parent")
2565/// .doit().await;
2566/// # }
2567/// ```
2568pub struct ProjectTenantCompanyCreateCall<'a, C>
2569where
2570 C: 'a,
2571{
2572 hub: &'a CloudTalentSolution<C>,
2573 _request: Company,
2574 _parent: String,
2575 _delegate: Option<&'a mut dyn common::Delegate>,
2576 _additional_params: HashMap<String, String>,
2577 _scopes: BTreeSet<String>,
2578}
2579
2580impl<'a, C> common::CallBuilder for ProjectTenantCompanyCreateCall<'a, C> {}
2581
2582impl<'a, C> ProjectTenantCompanyCreateCall<'a, C>
2583where
2584 C: common::Connector,
2585{
2586 /// Perform the operation you have build so far.
2587 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
2588 use std::borrow::Cow;
2589 use std::io::{Read, Seek};
2590
2591 use common::{url::Params, ToParts};
2592 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2593
2594 let mut dd = common::DefaultDelegate;
2595 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2596 dlg.begin(common::MethodInfo {
2597 id: "jobs.projects.tenants.companies.create",
2598 http_method: hyper::Method::POST,
2599 });
2600
2601 for &field in ["alt", "parent"].iter() {
2602 if self._additional_params.contains_key(field) {
2603 dlg.finished(false);
2604 return Err(common::Error::FieldClash(field));
2605 }
2606 }
2607
2608 let mut params = Params::with_capacity(4 + self._additional_params.len());
2609 params.push("parent", self._parent);
2610
2611 params.extend(self._additional_params.iter());
2612
2613 params.push("alt", "json");
2614 let mut url = self.hub._base_url.clone() + "v4/{+parent}/companies";
2615 if self._scopes.is_empty() {
2616 self._scopes
2617 .insert(Scope::CloudPlatform.as_ref().to_string());
2618 }
2619
2620 #[allow(clippy::single_element_loop)]
2621 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2622 url = params.uri_replacement(url, param_name, find_this, true);
2623 }
2624 {
2625 let to_remove = ["parent"];
2626 params.remove_params(&to_remove);
2627 }
2628
2629 let url = params.parse_with_url(&url);
2630
2631 let mut json_mime_type = mime::APPLICATION_JSON;
2632 let mut request_value_reader = {
2633 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2634 common::remove_json_null_values(&mut value);
2635 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2636 serde_json::to_writer(&mut dst, &value).unwrap();
2637 dst
2638 };
2639 let request_size = request_value_reader
2640 .seek(std::io::SeekFrom::End(0))
2641 .unwrap();
2642 request_value_reader
2643 .seek(std::io::SeekFrom::Start(0))
2644 .unwrap();
2645
2646 loop {
2647 let token = match self
2648 .hub
2649 .auth
2650 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2651 .await
2652 {
2653 Ok(token) => token,
2654 Err(e) => match dlg.token(e) {
2655 Ok(token) => token,
2656 Err(e) => {
2657 dlg.finished(false);
2658 return Err(common::Error::MissingToken(e));
2659 }
2660 },
2661 };
2662 request_value_reader
2663 .seek(std::io::SeekFrom::Start(0))
2664 .unwrap();
2665 let mut req_result = {
2666 let client = &self.hub.client;
2667 dlg.pre_request();
2668 let mut req_builder = hyper::Request::builder()
2669 .method(hyper::Method::POST)
2670 .uri(url.as_str())
2671 .header(USER_AGENT, self.hub._user_agent.clone());
2672
2673 if let Some(token) = token.as_ref() {
2674 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2675 }
2676
2677 let request = req_builder
2678 .header(CONTENT_TYPE, json_mime_type.to_string())
2679 .header(CONTENT_LENGTH, request_size as u64)
2680 .body(common::to_body(
2681 request_value_reader.get_ref().clone().into(),
2682 ));
2683
2684 client.request(request.unwrap()).await
2685 };
2686
2687 match req_result {
2688 Err(err) => {
2689 if let common::Retry::After(d) = dlg.http_error(&err) {
2690 sleep(d).await;
2691 continue;
2692 }
2693 dlg.finished(false);
2694 return Err(common::Error::HttpError(err));
2695 }
2696 Ok(res) => {
2697 let (mut parts, body) = res.into_parts();
2698 let mut body = common::Body::new(body);
2699 if !parts.status.is_success() {
2700 let bytes = common::to_bytes(body).await.unwrap_or_default();
2701 let error = serde_json::from_str(&common::to_string(&bytes));
2702 let response = common::to_response(parts, bytes.into());
2703
2704 if let common::Retry::After(d) =
2705 dlg.http_failure(&response, error.as_ref().ok())
2706 {
2707 sleep(d).await;
2708 continue;
2709 }
2710
2711 dlg.finished(false);
2712
2713 return Err(match error {
2714 Ok(value) => common::Error::BadRequest(value),
2715 _ => common::Error::Failure(response),
2716 });
2717 }
2718 let response = {
2719 let bytes = common::to_bytes(body).await.unwrap_or_default();
2720 let encoded = common::to_string(&bytes);
2721 match serde_json::from_str(&encoded) {
2722 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2723 Err(error) => {
2724 dlg.response_json_decode_error(&encoded, &error);
2725 return Err(common::Error::JsonDecodeError(
2726 encoded.to_string(),
2727 error,
2728 ));
2729 }
2730 }
2731 };
2732
2733 dlg.finished(true);
2734 return Ok(response);
2735 }
2736 }
2737 }
2738 }
2739
2740 ///
2741 /// Sets the *request* property to the given value.
2742 ///
2743 /// Even though the property as already been set when instantiating this call,
2744 /// we provide this method for API completeness.
2745 pub fn request(mut self, new_value: Company) -> ProjectTenantCompanyCreateCall<'a, C> {
2746 self._request = new_value;
2747 self
2748 }
2749 /// Required. Resource name of the tenant under which the company is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
2750 ///
2751 /// Sets the *parent* path property to the given value.
2752 ///
2753 /// Even though the property as already been set when instantiating this call,
2754 /// we provide this method for API completeness.
2755 pub fn parent(mut self, new_value: &str) -> ProjectTenantCompanyCreateCall<'a, C> {
2756 self._parent = new_value.to_string();
2757 self
2758 }
2759 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2760 /// while executing the actual API request.
2761 ///
2762 /// ````text
2763 /// It should be used to handle progress information, and to implement a certain level of resilience.
2764 /// ````
2765 ///
2766 /// Sets the *delegate* property to the given value.
2767 pub fn delegate(
2768 mut self,
2769 new_value: &'a mut dyn common::Delegate,
2770 ) -> ProjectTenantCompanyCreateCall<'a, C> {
2771 self._delegate = Some(new_value);
2772 self
2773 }
2774
2775 /// Set any additional parameter of the query string used in the request.
2776 /// It should be used to set parameters which are not yet available through their own
2777 /// setters.
2778 ///
2779 /// Please note that this method must not be used to set any of the known parameters
2780 /// which have their own setter method. If done anyway, the request will fail.
2781 ///
2782 /// # Additional Parameters
2783 ///
2784 /// * *$.xgafv* (query-string) - V1 error format.
2785 /// * *access_token* (query-string) - OAuth access token.
2786 /// * *alt* (query-string) - Data format for response.
2787 /// * *callback* (query-string) - JSONP
2788 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2789 /// * *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.
2790 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2791 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2792 /// * *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.
2793 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2794 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2795 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompanyCreateCall<'a, C>
2796 where
2797 T: AsRef<str>,
2798 {
2799 self._additional_params
2800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2801 self
2802 }
2803
2804 /// Identifies the authorization scope for the method you are building.
2805 ///
2806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2807 /// [`Scope::CloudPlatform`].
2808 ///
2809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2810 /// tokens for more than one scope.
2811 ///
2812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2814 /// sufficient, a read-write scope will do as well.
2815 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompanyCreateCall<'a, C>
2816 where
2817 St: AsRef<str>,
2818 {
2819 self._scopes.insert(String::from(scope.as_ref()));
2820 self
2821 }
2822 /// Identifies the authorization scope(s) for the method you are building.
2823 ///
2824 /// See [`Self::add_scope()`] for details.
2825 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompanyCreateCall<'a, C>
2826 where
2827 I: IntoIterator<Item = St>,
2828 St: AsRef<str>,
2829 {
2830 self._scopes
2831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2832 self
2833 }
2834
2835 /// Removes all scopes, and no default scope will be used either.
2836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2837 /// for details).
2838 pub fn clear_scopes(mut self) -> ProjectTenantCompanyCreateCall<'a, C> {
2839 self._scopes.clear();
2840 self
2841 }
2842}
2843
2844/// Deletes specified company. Prerequisite: The company has no jobs associated with it.
2845///
2846/// A builder for the *tenants.companies.delete* method supported by a *project* resource.
2847/// It is not used directly, but through a [`ProjectMethods`] instance.
2848///
2849/// # Example
2850///
2851/// Instantiate a resource method builder
2852///
2853/// ```test_harness,no_run
2854/// # extern crate hyper;
2855/// # extern crate hyper_rustls;
2856/// # extern crate google_jobs4 as jobs4;
2857/// # async fn dox() {
2858/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2859///
2860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2861/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2862/// # .with_native_roots()
2863/// # .unwrap()
2864/// # .https_only()
2865/// # .enable_http2()
2866/// # .build();
2867///
2868/// # let executor = hyper_util::rt::TokioExecutor::new();
2869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2870/// # secret,
2871/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2872/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2873/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2874/// # ),
2875/// # ).build().await.unwrap();
2876///
2877/// # let client = hyper_util::client::legacy::Client::builder(
2878/// # hyper_util::rt::TokioExecutor::new()
2879/// # )
2880/// # .build(
2881/// # hyper_rustls::HttpsConnectorBuilder::new()
2882/// # .with_native_roots()
2883/// # .unwrap()
2884/// # .https_or_http()
2885/// # .enable_http2()
2886/// # .build()
2887/// # );
2888/// # let mut hub = CloudTalentSolution::new(client, auth);
2889/// // You can configure optional parameters by calling the respective setters at will, and
2890/// // execute the final call using `doit()`.
2891/// // Values shown here are possibly random and not representative !
2892/// let result = hub.projects().tenants_companies_delete("name")
2893/// .doit().await;
2894/// # }
2895/// ```
2896pub struct ProjectTenantCompanyDeleteCall<'a, C>
2897where
2898 C: 'a,
2899{
2900 hub: &'a CloudTalentSolution<C>,
2901 _name: String,
2902 _delegate: Option<&'a mut dyn common::Delegate>,
2903 _additional_params: HashMap<String, String>,
2904 _scopes: BTreeSet<String>,
2905}
2906
2907impl<'a, C> common::CallBuilder for ProjectTenantCompanyDeleteCall<'a, C> {}
2908
2909impl<'a, C> ProjectTenantCompanyDeleteCall<'a, C>
2910where
2911 C: common::Connector,
2912{
2913 /// Perform the operation you have build so far.
2914 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2915 use std::borrow::Cow;
2916 use std::io::{Read, Seek};
2917
2918 use common::{url::Params, ToParts};
2919 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2920
2921 let mut dd = common::DefaultDelegate;
2922 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2923 dlg.begin(common::MethodInfo {
2924 id: "jobs.projects.tenants.companies.delete",
2925 http_method: hyper::Method::DELETE,
2926 });
2927
2928 for &field in ["alt", "name"].iter() {
2929 if self._additional_params.contains_key(field) {
2930 dlg.finished(false);
2931 return Err(common::Error::FieldClash(field));
2932 }
2933 }
2934
2935 let mut params = Params::with_capacity(3 + self._additional_params.len());
2936 params.push("name", self._name);
2937
2938 params.extend(self._additional_params.iter());
2939
2940 params.push("alt", "json");
2941 let mut url = self.hub._base_url.clone() + "v4/{+name}";
2942 if self._scopes.is_empty() {
2943 self._scopes
2944 .insert(Scope::CloudPlatform.as_ref().to_string());
2945 }
2946
2947 #[allow(clippy::single_element_loop)]
2948 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2949 url = params.uri_replacement(url, param_name, find_this, true);
2950 }
2951 {
2952 let to_remove = ["name"];
2953 params.remove_params(&to_remove);
2954 }
2955
2956 let url = params.parse_with_url(&url);
2957
2958 loop {
2959 let token = match self
2960 .hub
2961 .auth
2962 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2963 .await
2964 {
2965 Ok(token) => token,
2966 Err(e) => match dlg.token(e) {
2967 Ok(token) => token,
2968 Err(e) => {
2969 dlg.finished(false);
2970 return Err(common::Error::MissingToken(e));
2971 }
2972 },
2973 };
2974 let mut req_result = {
2975 let client = &self.hub.client;
2976 dlg.pre_request();
2977 let mut req_builder = hyper::Request::builder()
2978 .method(hyper::Method::DELETE)
2979 .uri(url.as_str())
2980 .header(USER_AGENT, self.hub._user_agent.clone());
2981
2982 if let Some(token) = token.as_ref() {
2983 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2984 }
2985
2986 let request = req_builder
2987 .header(CONTENT_LENGTH, 0_u64)
2988 .body(common::to_body::<String>(None));
2989
2990 client.request(request.unwrap()).await
2991 };
2992
2993 match req_result {
2994 Err(err) => {
2995 if let common::Retry::After(d) = dlg.http_error(&err) {
2996 sleep(d).await;
2997 continue;
2998 }
2999 dlg.finished(false);
3000 return Err(common::Error::HttpError(err));
3001 }
3002 Ok(res) => {
3003 let (mut parts, body) = res.into_parts();
3004 let mut body = common::Body::new(body);
3005 if !parts.status.is_success() {
3006 let bytes = common::to_bytes(body).await.unwrap_or_default();
3007 let error = serde_json::from_str(&common::to_string(&bytes));
3008 let response = common::to_response(parts, bytes.into());
3009
3010 if let common::Retry::After(d) =
3011 dlg.http_failure(&response, error.as_ref().ok())
3012 {
3013 sleep(d).await;
3014 continue;
3015 }
3016
3017 dlg.finished(false);
3018
3019 return Err(match error {
3020 Ok(value) => common::Error::BadRequest(value),
3021 _ => common::Error::Failure(response),
3022 });
3023 }
3024 let response = {
3025 let bytes = common::to_bytes(body).await.unwrap_or_default();
3026 let encoded = common::to_string(&bytes);
3027 match serde_json::from_str(&encoded) {
3028 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3029 Err(error) => {
3030 dlg.response_json_decode_error(&encoded, &error);
3031 return Err(common::Error::JsonDecodeError(
3032 encoded.to_string(),
3033 error,
3034 ));
3035 }
3036 }
3037 };
3038
3039 dlg.finished(true);
3040 return Ok(response);
3041 }
3042 }
3043 }
3044 }
3045
3046 /// Required. The resource name of the company to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
3047 ///
3048 /// Sets the *name* path property to the given value.
3049 ///
3050 /// Even though the property as already been set when instantiating this call,
3051 /// we provide this method for API completeness.
3052 pub fn name(mut self, new_value: &str) -> ProjectTenantCompanyDeleteCall<'a, C> {
3053 self._name = new_value.to_string();
3054 self
3055 }
3056 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3057 /// while executing the actual API request.
3058 ///
3059 /// ````text
3060 /// It should be used to handle progress information, and to implement a certain level of resilience.
3061 /// ````
3062 ///
3063 /// Sets the *delegate* property to the given value.
3064 pub fn delegate(
3065 mut self,
3066 new_value: &'a mut dyn common::Delegate,
3067 ) -> ProjectTenantCompanyDeleteCall<'a, C> {
3068 self._delegate = Some(new_value);
3069 self
3070 }
3071
3072 /// Set any additional parameter of the query string used in the request.
3073 /// It should be used to set parameters which are not yet available through their own
3074 /// setters.
3075 ///
3076 /// Please note that this method must not be used to set any of the known parameters
3077 /// which have their own setter method. If done anyway, the request will fail.
3078 ///
3079 /// # Additional Parameters
3080 ///
3081 /// * *$.xgafv* (query-string) - V1 error format.
3082 /// * *access_token* (query-string) - OAuth access token.
3083 /// * *alt* (query-string) - Data format for response.
3084 /// * *callback* (query-string) - JSONP
3085 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3086 /// * *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.
3087 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3088 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3089 /// * *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.
3090 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3091 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3092 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompanyDeleteCall<'a, C>
3093 where
3094 T: AsRef<str>,
3095 {
3096 self._additional_params
3097 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3098 self
3099 }
3100
3101 /// Identifies the authorization scope for the method you are building.
3102 ///
3103 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3104 /// [`Scope::CloudPlatform`].
3105 ///
3106 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3107 /// tokens for more than one scope.
3108 ///
3109 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3110 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3111 /// sufficient, a read-write scope will do as well.
3112 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompanyDeleteCall<'a, C>
3113 where
3114 St: AsRef<str>,
3115 {
3116 self._scopes.insert(String::from(scope.as_ref()));
3117 self
3118 }
3119 /// Identifies the authorization scope(s) for the method you are building.
3120 ///
3121 /// See [`Self::add_scope()`] for details.
3122 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompanyDeleteCall<'a, C>
3123 where
3124 I: IntoIterator<Item = St>,
3125 St: AsRef<str>,
3126 {
3127 self._scopes
3128 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3129 self
3130 }
3131
3132 /// Removes all scopes, and no default scope will be used either.
3133 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3134 /// for details).
3135 pub fn clear_scopes(mut self) -> ProjectTenantCompanyDeleteCall<'a, C> {
3136 self._scopes.clear();
3137 self
3138 }
3139}
3140
3141/// Retrieves specified company.
3142///
3143/// A builder for the *tenants.companies.get* method supported by a *project* resource.
3144/// It is not used directly, but through a [`ProjectMethods`] instance.
3145///
3146/// # Example
3147///
3148/// Instantiate a resource method builder
3149///
3150/// ```test_harness,no_run
3151/// # extern crate hyper;
3152/// # extern crate hyper_rustls;
3153/// # extern crate google_jobs4 as jobs4;
3154/// # async fn dox() {
3155/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3156///
3157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3158/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3159/// # .with_native_roots()
3160/// # .unwrap()
3161/// # .https_only()
3162/// # .enable_http2()
3163/// # .build();
3164///
3165/// # let executor = hyper_util::rt::TokioExecutor::new();
3166/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3167/// # secret,
3168/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3169/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3170/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3171/// # ),
3172/// # ).build().await.unwrap();
3173///
3174/// # let client = hyper_util::client::legacy::Client::builder(
3175/// # hyper_util::rt::TokioExecutor::new()
3176/// # )
3177/// # .build(
3178/// # hyper_rustls::HttpsConnectorBuilder::new()
3179/// # .with_native_roots()
3180/// # .unwrap()
3181/// # .https_or_http()
3182/// # .enable_http2()
3183/// # .build()
3184/// # );
3185/// # let mut hub = CloudTalentSolution::new(client, auth);
3186/// // You can configure optional parameters by calling the respective setters at will, and
3187/// // execute the final call using `doit()`.
3188/// // Values shown here are possibly random and not representative !
3189/// let result = hub.projects().tenants_companies_get("name")
3190/// .doit().await;
3191/// # }
3192/// ```
3193pub struct ProjectTenantCompanyGetCall<'a, C>
3194where
3195 C: 'a,
3196{
3197 hub: &'a CloudTalentSolution<C>,
3198 _name: String,
3199 _delegate: Option<&'a mut dyn common::Delegate>,
3200 _additional_params: HashMap<String, String>,
3201 _scopes: BTreeSet<String>,
3202}
3203
3204impl<'a, C> common::CallBuilder for ProjectTenantCompanyGetCall<'a, C> {}
3205
3206impl<'a, C> ProjectTenantCompanyGetCall<'a, C>
3207where
3208 C: common::Connector,
3209{
3210 /// Perform the operation you have build so far.
3211 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
3212 use std::borrow::Cow;
3213 use std::io::{Read, Seek};
3214
3215 use common::{url::Params, ToParts};
3216 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3217
3218 let mut dd = common::DefaultDelegate;
3219 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3220 dlg.begin(common::MethodInfo {
3221 id: "jobs.projects.tenants.companies.get",
3222 http_method: hyper::Method::GET,
3223 });
3224
3225 for &field in ["alt", "name"].iter() {
3226 if self._additional_params.contains_key(field) {
3227 dlg.finished(false);
3228 return Err(common::Error::FieldClash(field));
3229 }
3230 }
3231
3232 let mut params = Params::with_capacity(3 + self._additional_params.len());
3233 params.push("name", self._name);
3234
3235 params.extend(self._additional_params.iter());
3236
3237 params.push("alt", "json");
3238 let mut url = self.hub._base_url.clone() + "v4/{+name}";
3239 if self._scopes.is_empty() {
3240 self._scopes
3241 .insert(Scope::CloudPlatform.as_ref().to_string());
3242 }
3243
3244 #[allow(clippy::single_element_loop)]
3245 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3246 url = params.uri_replacement(url, param_name, find_this, true);
3247 }
3248 {
3249 let to_remove = ["name"];
3250 params.remove_params(&to_remove);
3251 }
3252
3253 let url = params.parse_with_url(&url);
3254
3255 loop {
3256 let token = match self
3257 .hub
3258 .auth
3259 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3260 .await
3261 {
3262 Ok(token) => token,
3263 Err(e) => match dlg.token(e) {
3264 Ok(token) => token,
3265 Err(e) => {
3266 dlg.finished(false);
3267 return Err(common::Error::MissingToken(e));
3268 }
3269 },
3270 };
3271 let mut req_result = {
3272 let client = &self.hub.client;
3273 dlg.pre_request();
3274 let mut req_builder = hyper::Request::builder()
3275 .method(hyper::Method::GET)
3276 .uri(url.as_str())
3277 .header(USER_AGENT, self.hub._user_agent.clone());
3278
3279 if let Some(token) = token.as_ref() {
3280 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3281 }
3282
3283 let request = req_builder
3284 .header(CONTENT_LENGTH, 0_u64)
3285 .body(common::to_body::<String>(None));
3286
3287 client.request(request.unwrap()).await
3288 };
3289
3290 match req_result {
3291 Err(err) => {
3292 if let common::Retry::After(d) = dlg.http_error(&err) {
3293 sleep(d).await;
3294 continue;
3295 }
3296 dlg.finished(false);
3297 return Err(common::Error::HttpError(err));
3298 }
3299 Ok(res) => {
3300 let (mut parts, body) = res.into_parts();
3301 let mut body = common::Body::new(body);
3302 if !parts.status.is_success() {
3303 let bytes = common::to_bytes(body).await.unwrap_or_default();
3304 let error = serde_json::from_str(&common::to_string(&bytes));
3305 let response = common::to_response(parts, bytes.into());
3306
3307 if let common::Retry::After(d) =
3308 dlg.http_failure(&response, error.as_ref().ok())
3309 {
3310 sleep(d).await;
3311 continue;
3312 }
3313
3314 dlg.finished(false);
3315
3316 return Err(match error {
3317 Ok(value) => common::Error::BadRequest(value),
3318 _ => common::Error::Failure(response),
3319 });
3320 }
3321 let response = {
3322 let bytes = common::to_bytes(body).await.unwrap_or_default();
3323 let encoded = common::to_string(&bytes);
3324 match serde_json::from_str(&encoded) {
3325 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3326 Err(error) => {
3327 dlg.response_json_decode_error(&encoded, &error);
3328 return Err(common::Error::JsonDecodeError(
3329 encoded.to_string(),
3330 error,
3331 ));
3332 }
3333 }
3334 };
3335
3336 dlg.finished(true);
3337 return Ok(response);
3338 }
3339 }
3340 }
3341 }
3342
3343 /// Required. The resource name of the company to be retrieved. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar".
3344 ///
3345 /// Sets the *name* path property to the given value.
3346 ///
3347 /// Even though the property as already been set when instantiating this call,
3348 /// we provide this method for API completeness.
3349 pub fn name(mut self, new_value: &str) -> ProjectTenantCompanyGetCall<'a, C> {
3350 self._name = new_value.to_string();
3351 self
3352 }
3353 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3354 /// while executing the actual API request.
3355 ///
3356 /// ````text
3357 /// It should be used to handle progress information, and to implement a certain level of resilience.
3358 /// ````
3359 ///
3360 /// Sets the *delegate* property to the given value.
3361 pub fn delegate(
3362 mut self,
3363 new_value: &'a mut dyn common::Delegate,
3364 ) -> ProjectTenantCompanyGetCall<'a, C> {
3365 self._delegate = Some(new_value);
3366 self
3367 }
3368
3369 /// Set any additional parameter of the query string used in the request.
3370 /// It should be used to set parameters which are not yet available through their own
3371 /// setters.
3372 ///
3373 /// Please note that this method must not be used to set any of the known parameters
3374 /// which have their own setter method. If done anyway, the request will fail.
3375 ///
3376 /// # Additional Parameters
3377 ///
3378 /// * *$.xgafv* (query-string) - V1 error format.
3379 /// * *access_token* (query-string) - OAuth access token.
3380 /// * *alt* (query-string) - Data format for response.
3381 /// * *callback* (query-string) - JSONP
3382 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3383 /// * *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.
3384 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3385 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3386 /// * *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.
3387 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3388 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3389 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompanyGetCall<'a, C>
3390 where
3391 T: AsRef<str>,
3392 {
3393 self._additional_params
3394 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3395 self
3396 }
3397
3398 /// Identifies the authorization scope for the method you are building.
3399 ///
3400 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3401 /// [`Scope::CloudPlatform`].
3402 ///
3403 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3404 /// tokens for more than one scope.
3405 ///
3406 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3407 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3408 /// sufficient, a read-write scope will do as well.
3409 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompanyGetCall<'a, C>
3410 where
3411 St: AsRef<str>,
3412 {
3413 self._scopes.insert(String::from(scope.as_ref()));
3414 self
3415 }
3416 /// Identifies the authorization scope(s) for the method you are building.
3417 ///
3418 /// See [`Self::add_scope()`] for details.
3419 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompanyGetCall<'a, C>
3420 where
3421 I: IntoIterator<Item = St>,
3422 St: AsRef<str>,
3423 {
3424 self._scopes
3425 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3426 self
3427 }
3428
3429 /// Removes all scopes, and no default scope will be used either.
3430 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3431 /// for details).
3432 pub fn clear_scopes(mut self) -> ProjectTenantCompanyGetCall<'a, C> {
3433 self._scopes.clear();
3434 self
3435 }
3436}
3437
3438/// Lists all companies associated with the project.
3439///
3440/// A builder for the *tenants.companies.list* method supported by a *project* resource.
3441/// It is not used directly, but through a [`ProjectMethods`] instance.
3442///
3443/// # Example
3444///
3445/// Instantiate a resource method builder
3446///
3447/// ```test_harness,no_run
3448/// # extern crate hyper;
3449/// # extern crate hyper_rustls;
3450/// # extern crate google_jobs4 as jobs4;
3451/// # async fn dox() {
3452/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3453///
3454/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3455/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3456/// # .with_native_roots()
3457/// # .unwrap()
3458/// # .https_only()
3459/// # .enable_http2()
3460/// # .build();
3461///
3462/// # let executor = hyper_util::rt::TokioExecutor::new();
3463/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3464/// # secret,
3465/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3466/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3467/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3468/// # ),
3469/// # ).build().await.unwrap();
3470///
3471/// # let client = hyper_util::client::legacy::Client::builder(
3472/// # hyper_util::rt::TokioExecutor::new()
3473/// # )
3474/// # .build(
3475/// # hyper_rustls::HttpsConnectorBuilder::new()
3476/// # .with_native_roots()
3477/// # .unwrap()
3478/// # .https_or_http()
3479/// # .enable_http2()
3480/// # .build()
3481/// # );
3482/// # let mut hub = CloudTalentSolution::new(client, auth);
3483/// // You can configure optional parameters by calling the respective setters at will, and
3484/// // execute the final call using `doit()`.
3485/// // Values shown here are possibly random and not representative !
3486/// let result = hub.projects().tenants_companies_list("parent")
3487/// .require_open_jobs(true)
3488/// .page_token("amet.")
3489/// .page_size(-20)
3490/// .doit().await;
3491/// # }
3492/// ```
3493pub struct ProjectTenantCompanyListCall<'a, C>
3494where
3495 C: 'a,
3496{
3497 hub: &'a CloudTalentSolution<C>,
3498 _parent: String,
3499 _require_open_jobs: Option<bool>,
3500 _page_token: Option<String>,
3501 _page_size: Option<i32>,
3502 _delegate: Option<&'a mut dyn common::Delegate>,
3503 _additional_params: HashMap<String, String>,
3504 _scopes: BTreeSet<String>,
3505}
3506
3507impl<'a, C> common::CallBuilder for ProjectTenantCompanyListCall<'a, C> {}
3508
3509impl<'a, C> ProjectTenantCompanyListCall<'a, C>
3510where
3511 C: common::Connector,
3512{
3513 /// Perform the operation you have build so far.
3514 pub async fn doit(mut self) -> common::Result<(common::Response, ListCompaniesResponse)> {
3515 use std::borrow::Cow;
3516 use std::io::{Read, Seek};
3517
3518 use common::{url::Params, ToParts};
3519 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3520
3521 let mut dd = common::DefaultDelegate;
3522 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3523 dlg.begin(common::MethodInfo {
3524 id: "jobs.projects.tenants.companies.list",
3525 http_method: hyper::Method::GET,
3526 });
3527
3528 for &field in ["alt", "parent", "requireOpenJobs", "pageToken", "pageSize"].iter() {
3529 if self._additional_params.contains_key(field) {
3530 dlg.finished(false);
3531 return Err(common::Error::FieldClash(field));
3532 }
3533 }
3534
3535 let mut params = Params::with_capacity(6 + self._additional_params.len());
3536 params.push("parent", self._parent);
3537 if let Some(value) = self._require_open_jobs.as_ref() {
3538 params.push("requireOpenJobs", value.to_string());
3539 }
3540 if let Some(value) = self._page_token.as_ref() {
3541 params.push("pageToken", value);
3542 }
3543 if let Some(value) = self._page_size.as_ref() {
3544 params.push("pageSize", value.to_string());
3545 }
3546
3547 params.extend(self._additional_params.iter());
3548
3549 params.push("alt", "json");
3550 let mut url = self.hub._base_url.clone() + "v4/{+parent}/companies";
3551 if self._scopes.is_empty() {
3552 self._scopes
3553 .insert(Scope::CloudPlatform.as_ref().to_string());
3554 }
3555
3556 #[allow(clippy::single_element_loop)]
3557 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3558 url = params.uri_replacement(url, param_name, find_this, true);
3559 }
3560 {
3561 let to_remove = ["parent"];
3562 params.remove_params(&to_remove);
3563 }
3564
3565 let url = params.parse_with_url(&url);
3566
3567 loop {
3568 let token = match self
3569 .hub
3570 .auth
3571 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3572 .await
3573 {
3574 Ok(token) => token,
3575 Err(e) => match dlg.token(e) {
3576 Ok(token) => token,
3577 Err(e) => {
3578 dlg.finished(false);
3579 return Err(common::Error::MissingToken(e));
3580 }
3581 },
3582 };
3583 let mut req_result = {
3584 let client = &self.hub.client;
3585 dlg.pre_request();
3586 let mut req_builder = hyper::Request::builder()
3587 .method(hyper::Method::GET)
3588 .uri(url.as_str())
3589 .header(USER_AGENT, self.hub._user_agent.clone());
3590
3591 if let Some(token) = token.as_ref() {
3592 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3593 }
3594
3595 let request = req_builder
3596 .header(CONTENT_LENGTH, 0_u64)
3597 .body(common::to_body::<String>(None));
3598
3599 client.request(request.unwrap()).await
3600 };
3601
3602 match req_result {
3603 Err(err) => {
3604 if let common::Retry::After(d) = dlg.http_error(&err) {
3605 sleep(d).await;
3606 continue;
3607 }
3608 dlg.finished(false);
3609 return Err(common::Error::HttpError(err));
3610 }
3611 Ok(res) => {
3612 let (mut parts, body) = res.into_parts();
3613 let mut body = common::Body::new(body);
3614 if !parts.status.is_success() {
3615 let bytes = common::to_bytes(body).await.unwrap_or_default();
3616 let error = serde_json::from_str(&common::to_string(&bytes));
3617 let response = common::to_response(parts, bytes.into());
3618
3619 if let common::Retry::After(d) =
3620 dlg.http_failure(&response, error.as_ref().ok())
3621 {
3622 sleep(d).await;
3623 continue;
3624 }
3625
3626 dlg.finished(false);
3627
3628 return Err(match error {
3629 Ok(value) => common::Error::BadRequest(value),
3630 _ => common::Error::Failure(response),
3631 });
3632 }
3633 let response = {
3634 let bytes = common::to_bytes(body).await.unwrap_or_default();
3635 let encoded = common::to_string(&bytes);
3636 match serde_json::from_str(&encoded) {
3637 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3638 Err(error) => {
3639 dlg.response_json_decode_error(&encoded, &error);
3640 return Err(common::Error::JsonDecodeError(
3641 encoded.to_string(),
3642 error,
3643 ));
3644 }
3645 }
3646 };
3647
3648 dlg.finished(true);
3649 return Ok(response);
3650 }
3651 }
3652 }
3653 }
3654
3655 /// Required. Resource name of the tenant under which the company is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
3656 ///
3657 /// Sets the *parent* path property to the given value.
3658 ///
3659 /// Even though the property as already been set when instantiating this call,
3660 /// we provide this method for API completeness.
3661 pub fn parent(mut self, new_value: &str) -> ProjectTenantCompanyListCall<'a, C> {
3662 self._parent = new_value.to_string();
3663 self
3664 }
3665 /// Set to true if the companies requested must have open jobs. Defaults to false. If true, at most page_size of companies are fetched, among which only those with open jobs are returned.
3666 ///
3667 /// Sets the *require open jobs* query property to the given value.
3668 pub fn require_open_jobs(mut self, new_value: bool) -> ProjectTenantCompanyListCall<'a, C> {
3669 self._require_open_jobs = Some(new_value);
3670 self
3671 }
3672 /// The starting indicator from which to return results.
3673 ///
3674 /// Sets the *page token* query property to the given value.
3675 pub fn page_token(mut self, new_value: &str) -> ProjectTenantCompanyListCall<'a, C> {
3676 self._page_token = Some(new_value.to_string());
3677 self
3678 }
3679 /// The maximum number of companies to be returned, at most 100. Default is 100 if a non-positive number is provided.
3680 ///
3681 /// Sets the *page size* query property to the given value.
3682 pub fn page_size(mut self, new_value: i32) -> ProjectTenantCompanyListCall<'a, C> {
3683 self._page_size = Some(new_value);
3684 self
3685 }
3686 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3687 /// while executing the actual API request.
3688 ///
3689 /// ````text
3690 /// It should be used to handle progress information, and to implement a certain level of resilience.
3691 /// ````
3692 ///
3693 /// Sets the *delegate* property to the given value.
3694 pub fn delegate(
3695 mut self,
3696 new_value: &'a mut dyn common::Delegate,
3697 ) -> ProjectTenantCompanyListCall<'a, C> {
3698 self._delegate = Some(new_value);
3699 self
3700 }
3701
3702 /// Set any additional parameter of the query string used in the request.
3703 /// It should be used to set parameters which are not yet available through their own
3704 /// setters.
3705 ///
3706 /// Please note that this method must not be used to set any of the known parameters
3707 /// which have their own setter method. If done anyway, the request will fail.
3708 ///
3709 /// # Additional Parameters
3710 ///
3711 /// * *$.xgafv* (query-string) - V1 error format.
3712 /// * *access_token* (query-string) - OAuth access token.
3713 /// * *alt* (query-string) - Data format for response.
3714 /// * *callback* (query-string) - JSONP
3715 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3716 /// * *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.
3717 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3718 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3719 /// * *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.
3720 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3721 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3722 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompanyListCall<'a, C>
3723 where
3724 T: AsRef<str>,
3725 {
3726 self._additional_params
3727 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3728 self
3729 }
3730
3731 /// Identifies the authorization scope for the method you are building.
3732 ///
3733 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3734 /// [`Scope::CloudPlatform`].
3735 ///
3736 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3737 /// tokens for more than one scope.
3738 ///
3739 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3740 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3741 /// sufficient, a read-write scope will do as well.
3742 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompanyListCall<'a, C>
3743 where
3744 St: AsRef<str>,
3745 {
3746 self._scopes.insert(String::from(scope.as_ref()));
3747 self
3748 }
3749 /// Identifies the authorization scope(s) for the method you are building.
3750 ///
3751 /// See [`Self::add_scope()`] for details.
3752 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompanyListCall<'a, C>
3753 where
3754 I: IntoIterator<Item = St>,
3755 St: AsRef<str>,
3756 {
3757 self._scopes
3758 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3759 self
3760 }
3761
3762 /// Removes all scopes, and no default scope will be used either.
3763 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3764 /// for details).
3765 pub fn clear_scopes(mut self) -> ProjectTenantCompanyListCall<'a, C> {
3766 self._scopes.clear();
3767 self
3768 }
3769}
3770
3771/// Updates specified company.
3772///
3773/// A builder for the *tenants.companies.patch* method supported by a *project* resource.
3774/// It is not used directly, but through a [`ProjectMethods`] instance.
3775///
3776/// # Example
3777///
3778/// Instantiate a resource method builder
3779///
3780/// ```test_harness,no_run
3781/// # extern crate hyper;
3782/// # extern crate hyper_rustls;
3783/// # extern crate google_jobs4 as jobs4;
3784/// use jobs4::api::Company;
3785/// # async fn dox() {
3786/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3787///
3788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3789/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3790/// # .with_native_roots()
3791/// # .unwrap()
3792/// # .https_only()
3793/// # .enable_http2()
3794/// # .build();
3795///
3796/// # let executor = hyper_util::rt::TokioExecutor::new();
3797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3798/// # secret,
3799/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3800/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3801/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3802/// # ),
3803/// # ).build().await.unwrap();
3804///
3805/// # let client = hyper_util::client::legacy::Client::builder(
3806/// # hyper_util::rt::TokioExecutor::new()
3807/// # )
3808/// # .build(
3809/// # hyper_rustls::HttpsConnectorBuilder::new()
3810/// # .with_native_roots()
3811/// # .unwrap()
3812/// # .https_or_http()
3813/// # .enable_http2()
3814/// # .build()
3815/// # );
3816/// # let mut hub = CloudTalentSolution::new(client, auth);
3817/// // As the method needs a request, you would usually fill it with the desired information
3818/// // into the respective structure. Some of the parts shown here might not be applicable !
3819/// // Values shown here are possibly random and not representative !
3820/// let mut req = Company::default();
3821///
3822/// // You can configure optional parameters by calling the respective setters at will, and
3823/// // execute the final call using `doit()`.
3824/// // Values shown here are possibly random and not representative !
3825/// let result = hub.projects().tenants_companies_patch(req, "name")
3826/// .update_mask(FieldMask::new::<&str>(&[]))
3827/// .doit().await;
3828/// # }
3829/// ```
3830pub struct ProjectTenantCompanyPatchCall<'a, C>
3831where
3832 C: 'a,
3833{
3834 hub: &'a CloudTalentSolution<C>,
3835 _request: Company,
3836 _name: String,
3837 _update_mask: Option<common::FieldMask>,
3838 _delegate: Option<&'a mut dyn common::Delegate>,
3839 _additional_params: HashMap<String, String>,
3840 _scopes: BTreeSet<String>,
3841}
3842
3843impl<'a, C> common::CallBuilder for ProjectTenantCompanyPatchCall<'a, C> {}
3844
3845impl<'a, C> ProjectTenantCompanyPatchCall<'a, C>
3846where
3847 C: common::Connector,
3848{
3849 /// Perform the operation you have build so far.
3850 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
3851 use std::borrow::Cow;
3852 use std::io::{Read, Seek};
3853
3854 use common::{url::Params, ToParts};
3855 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3856
3857 let mut dd = common::DefaultDelegate;
3858 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3859 dlg.begin(common::MethodInfo {
3860 id: "jobs.projects.tenants.companies.patch",
3861 http_method: hyper::Method::PATCH,
3862 });
3863
3864 for &field in ["alt", "name", "updateMask"].iter() {
3865 if self._additional_params.contains_key(field) {
3866 dlg.finished(false);
3867 return Err(common::Error::FieldClash(field));
3868 }
3869 }
3870
3871 let mut params = Params::with_capacity(5 + self._additional_params.len());
3872 params.push("name", self._name);
3873 if let Some(value) = self._update_mask.as_ref() {
3874 params.push("updateMask", value.to_string());
3875 }
3876
3877 params.extend(self._additional_params.iter());
3878
3879 params.push("alt", "json");
3880 let mut url = self.hub._base_url.clone() + "v4/{+name}";
3881 if self._scopes.is_empty() {
3882 self._scopes
3883 .insert(Scope::CloudPlatform.as_ref().to_string());
3884 }
3885
3886 #[allow(clippy::single_element_loop)]
3887 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3888 url = params.uri_replacement(url, param_name, find_this, true);
3889 }
3890 {
3891 let to_remove = ["name"];
3892 params.remove_params(&to_remove);
3893 }
3894
3895 let url = params.parse_with_url(&url);
3896
3897 let mut json_mime_type = mime::APPLICATION_JSON;
3898 let mut request_value_reader = {
3899 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3900 common::remove_json_null_values(&mut value);
3901 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3902 serde_json::to_writer(&mut dst, &value).unwrap();
3903 dst
3904 };
3905 let request_size = request_value_reader
3906 .seek(std::io::SeekFrom::End(0))
3907 .unwrap();
3908 request_value_reader
3909 .seek(std::io::SeekFrom::Start(0))
3910 .unwrap();
3911
3912 loop {
3913 let token = match self
3914 .hub
3915 .auth
3916 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3917 .await
3918 {
3919 Ok(token) => token,
3920 Err(e) => match dlg.token(e) {
3921 Ok(token) => token,
3922 Err(e) => {
3923 dlg.finished(false);
3924 return Err(common::Error::MissingToken(e));
3925 }
3926 },
3927 };
3928 request_value_reader
3929 .seek(std::io::SeekFrom::Start(0))
3930 .unwrap();
3931 let mut req_result = {
3932 let client = &self.hub.client;
3933 dlg.pre_request();
3934 let mut req_builder = hyper::Request::builder()
3935 .method(hyper::Method::PATCH)
3936 .uri(url.as_str())
3937 .header(USER_AGENT, self.hub._user_agent.clone());
3938
3939 if let Some(token) = token.as_ref() {
3940 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3941 }
3942
3943 let request = req_builder
3944 .header(CONTENT_TYPE, json_mime_type.to_string())
3945 .header(CONTENT_LENGTH, request_size as u64)
3946 .body(common::to_body(
3947 request_value_reader.get_ref().clone().into(),
3948 ));
3949
3950 client.request(request.unwrap()).await
3951 };
3952
3953 match req_result {
3954 Err(err) => {
3955 if let common::Retry::After(d) = dlg.http_error(&err) {
3956 sleep(d).await;
3957 continue;
3958 }
3959 dlg.finished(false);
3960 return Err(common::Error::HttpError(err));
3961 }
3962 Ok(res) => {
3963 let (mut parts, body) = res.into_parts();
3964 let mut body = common::Body::new(body);
3965 if !parts.status.is_success() {
3966 let bytes = common::to_bytes(body).await.unwrap_or_default();
3967 let error = serde_json::from_str(&common::to_string(&bytes));
3968 let response = common::to_response(parts, bytes.into());
3969
3970 if let common::Retry::After(d) =
3971 dlg.http_failure(&response, error.as_ref().ok())
3972 {
3973 sleep(d).await;
3974 continue;
3975 }
3976
3977 dlg.finished(false);
3978
3979 return Err(match error {
3980 Ok(value) => common::Error::BadRequest(value),
3981 _ => common::Error::Failure(response),
3982 });
3983 }
3984 let response = {
3985 let bytes = common::to_bytes(body).await.unwrap_or_default();
3986 let encoded = common::to_string(&bytes);
3987 match serde_json::from_str(&encoded) {
3988 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3989 Err(error) => {
3990 dlg.response_json_decode_error(&encoded, &error);
3991 return Err(common::Error::JsonDecodeError(
3992 encoded.to_string(),
3993 error,
3994 ));
3995 }
3996 }
3997 };
3998
3999 dlg.finished(true);
4000 return Ok(response);
4001 }
4002 }
4003 }
4004 }
4005
4006 ///
4007 /// Sets the *request* property to the given value.
4008 ///
4009 /// Even though the property as already been set when instantiating this call,
4010 /// we provide this method for API completeness.
4011 pub fn request(mut self, new_value: Company) -> ProjectTenantCompanyPatchCall<'a, C> {
4012 self._request = new_value;
4013 self
4014 }
4015 /// Required during company update. The resource name for a company. This is generated by the service when a company is created. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
4016 ///
4017 /// Sets the *name* path property to the given value.
4018 ///
4019 /// Even though the property as already been set when instantiating this call,
4020 /// we provide this method for API completeness.
4021 pub fn name(mut self, new_value: &str) -> ProjectTenantCompanyPatchCall<'a, C> {
4022 self._name = new_value.to_string();
4023 self
4024 }
4025 /// Strongly recommended for the best service experience. If update_mask is provided, only the specified fields in company are updated. Otherwise all the fields are updated. A field mask to specify the company fields to be updated. Only top level fields of Company are supported.
4026 ///
4027 /// Sets the *update mask* query property to the given value.
4028 pub fn update_mask(
4029 mut self,
4030 new_value: common::FieldMask,
4031 ) -> ProjectTenantCompanyPatchCall<'a, C> {
4032 self._update_mask = Some(new_value);
4033 self
4034 }
4035 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4036 /// while executing the actual API request.
4037 ///
4038 /// ````text
4039 /// It should be used to handle progress information, and to implement a certain level of resilience.
4040 /// ````
4041 ///
4042 /// Sets the *delegate* property to the given value.
4043 pub fn delegate(
4044 mut self,
4045 new_value: &'a mut dyn common::Delegate,
4046 ) -> ProjectTenantCompanyPatchCall<'a, C> {
4047 self._delegate = Some(new_value);
4048 self
4049 }
4050
4051 /// Set any additional parameter of the query string used in the request.
4052 /// It should be used to set parameters which are not yet available through their own
4053 /// setters.
4054 ///
4055 /// Please note that this method must not be used to set any of the known parameters
4056 /// which have their own setter method. If done anyway, the request will fail.
4057 ///
4058 /// # Additional Parameters
4059 ///
4060 /// * *$.xgafv* (query-string) - V1 error format.
4061 /// * *access_token* (query-string) - OAuth access token.
4062 /// * *alt* (query-string) - Data format for response.
4063 /// * *callback* (query-string) - JSONP
4064 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4065 /// * *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.
4066 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4067 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4068 /// * *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.
4069 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4070 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4071 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompanyPatchCall<'a, C>
4072 where
4073 T: AsRef<str>,
4074 {
4075 self._additional_params
4076 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4077 self
4078 }
4079
4080 /// Identifies the authorization scope for the method you are building.
4081 ///
4082 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4083 /// [`Scope::CloudPlatform`].
4084 ///
4085 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4086 /// tokens for more than one scope.
4087 ///
4088 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4089 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4090 /// sufficient, a read-write scope will do as well.
4091 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompanyPatchCall<'a, C>
4092 where
4093 St: AsRef<str>,
4094 {
4095 self._scopes.insert(String::from(scope.as_ref()));
4096 self
4097 }
4098 /// Identifies the authorization scope(s) for the method you are building.
4099 ///
4100 /// See [`Self::add_scope()`] for details.
4101 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompanyPatchCall<'a, C>
4102 where
4103 I: IntoIterator<Item = St>,
4104 St: AsRef<str>,
4105 {
4106 self._scopes
4107 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4108 self
4109 }
4110
4111 /// Removes all scopes, and no default scope will be used either.
4112 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4113 /// for details).
4114 pub fn clear_scopes(mut self) -> ProjectTenantCompanyPatchCall<'a, C> {
4115 self._scopes.clear();
4116 self
4117 }
4118}
4119
4120/// Begins executing a batch create jobs operation.
4121///
4122/// A builder for the *tenants.jobs.batchCreate* method supported by a *project* resource.
4123/// It is not used directly, but through a [`ProjectMethods`] instance.
4124///
4125/// # Example
4126///
4127/// Instantiate a resource method builder
4128///
4129/// ```test_harness,no_run
4130/// # extern crate hyper;
4131/// # extern crate hyper_rustls;
4132/// # extern crate google_jobs4 as jobs4;
4133/// use jobs4::api::BatchCreateJobsRequest;
4134/// # async fn dox() {
4135/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4136///
4137/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4138/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4139/// # .with_native_roots()
4140/// # .unwrap()
4141/// # .https_only()
4142/// # .enable_http2()
4143/// # .build();
4144///
4145/// # let executor = hyper_util::rt::TokioExecutor::new();
4146/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4147/// # secret,
4148/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4149/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4150/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4151/// # ),
4152/// # ).build().await.unwrap();
4153///
4154/// # let client = hyper_util::client::legacy::Client::builder(
4155/// # hyper_util::rt::TokioExecutor::new()
4156/// # )
4157/// # .build(
4158/// # hyper_rustls::HttpsConnectorBuilder::new()
4159/// # .with_native_roots()
4160/// # .unwrap()
4161/// # .https_or_http()
4162/// # .enable_http2()
4163/// # .build()
4164/// # );
4165/// # let mut hub = CloudTalentSolution::new(client, auth);
4166/// // As the method needs a request, you would usually fill it with the desired information
4167/// // into the respective structure. Some of the parts shown here might not be applicable !
4168/// // Values shown here are possibly random and not representative !
4169/// let mut req = BatchCreateJobsRequest::default();
4170///
4171/// // You can configure optional parameters by calling the respective setters at will, and
4172/// // execute the final call using `doit()`.
4173/// // Values shown here are possibly random and not representative !
4174/// let result = hub.projects().tenants_jobs_batch_create(req, "parent")
4175/// .doit().await;
4176/// # }
4177/// ```
4178pub struct ProjectTenantJobBatchCreateCall<'a, C>
4179where
4180 C: 'a,
4181{
4182 hub: &'a CloudTalentSolution<C>,
4183 _request: BatchCreateJobsRequest,
4184 _parent: String,
4185 _delegate: Option<&'a mut dyn common::Delegate>,
4186 _additional_params: HashMap<String, String>,
4187 _scopes: BTreeSet<String>,
4188}
4189
4190impl<'a, C> common::CallBuilder for ProjectTenantJobBatchCreateCall<'a, C> {}
4191
4192impl<'a, C> ProjectTenantJobBatchCreateCall<'a, C>
4193where
4194 C: common::Connector,
4195{
4196 /// Perform the operation you have build so far.
4197 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4198 use std::borrow::Cow;
4199 use std::io::{Read, Seek};
4200
4201 use common::{url::Params, ToParts};
4202 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4203
4204 let mut dd = common::DefaultDelegate;
4205 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4206 dlg.begin(common::MethodInfo {
4207 id: "jobs.projects.tenants.jobs.batchCreate",
4208 http_method: hyper::Method::POST,
4209 });
4210
4211 for &field in ["alt", "parent"].iter() {
4212 if self._additional_params.contains_key(field) {
4213 dlg.finished(false);
4214 return Err(common::Error::FieldClash(field));
4215 }
4216 }
4217
4218 let mut params = Params::with_capacity(4 + self._additional_params.len());
4219 params.push("parent", self._parent);
4220
4221 params.extend(self._additional_params.iter());
4222
4223 params.push("alt", "json");
4224 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs:batchCreate";
4225 if self._scopes.is_empty() {
4226 self._scopes
4227 .insert(Scope::CloudPlatform.as_ref().to_string());
4228 }
4229
4230 #[allow(clippy::single_element_loop)]
4231 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4232 url = params.uri_replacement(url, param_name, find_this, true);
4233 }
4234 {
4235 let to_remove = ["parent"];
4236 params.remove_params(&to_remove);
4237 }
4238
4239 let url = params.parse_with_url(&url);
4240
4241 let mut json_mime_type = mime::APPLICATION_JSON;
4242 let mut request_value_reader = {
4243 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4244 common::remove_json_null_values(&mut value);
4245 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4246 serde_json::to_writer(&mut dst, &value).unwrap();
4247 dst
4248 };
4249 let request_size = request_value_reader
4250 .seek(std::io::SeekFrom::End(0))
4251 .unwrap();
4252 request_value_reader
4253 .seek(std::io::SeekFrom::Start(0))
4254 .unwrap();
4255
4256 loop {
4257 let token = match self
4258 .hub
4259 .auth
4260 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4261 .await
4262 {
4263 Ok(token) => token,
4264 Err(e) => match dlg.token(e) {
4265 Ok(token) => token,
4266 Err(e) => {
4267 dlg.finished(false);
4268 return Err(common::Error::MissingToken(e));
4269 }
4270 },
4271 };
4272 request_value_reader
4273 .seek(std::io::SeekFrom::Start(0))
4274 .unwrap();
4275 let mut req_result = {
4276 let client = &self.hub.client;
4277 dlg.pre_request();
4278 let mut req_builder = hyper::Request::builder()
4279 .method(hyper::Method::POST)
4280 .uri(url.as_str())
4281 .header(USER_AGENT, self.hub._user_agent.clone());
4282
4283 if let Some(token) = token.as_ref() {
4284 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4285 }
4286
4287 let request = req_builder
4288 .header(CONTENT_TYPE, json_mime_type.to_string())
4289 .header(CONTENT_LENGTH, request_size as u64)
4290 .body(common::to_body(
4291 request_value_reader.get_ref().clone().into(),
4292 ));
4293
4294 client.request(request.unwrap()).await
4295 };
4296
4297 match req_result {
4298 Err(err) => {
4299 if let common::Retry::After(d) = dlg.http_error(&err) {
4300 sleep(d).await;
4301 continue;
4302 }
4303 dlg.finished(false);
4304 return Err(common::Error::HttpError(err));
4305 }
4306 Ok(res) => {
4307 let (mut parts, body) = res.into_parts();
4308 let mut body = common::Body::new(body);
4309 if !parts.status.is_success() {
4310 let bytes = common::to_bytes(body).await.unwrap_or_default();
4311 let error = serde_json::from_str(&common::to_string(&bytes));
4312 let response = common::to_response(parts, bytes.into());
4313
4314 if let common::Retry::After(d) =
4315 dlg.http_failure(&response, error.as_ref().ok())
4316 {
4317 sleep(d).await;
4318 continue;
4319 }
4320
4321 dlg.finished(false);
4322
4323 return Err(match error {
4324 Ok(value) => common::Error::BadRequest(value),
4325 _ => common::Error::Failure(response),
4326 });
4327 }
4328 let response = {
4329 let bytes = common::to_bytes(body).await.unwrap_or_default();
4330 let encoded = common::to_string(&bytes);
4331 match serde_json::from_str(&encoded) {
4332 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4333 Err(error) => {
4334 dlg.response_json_decode_error(&encoded, &error);
4335 return Err(common::Error::JsonDecodeError(
4336 encoded.to_string(),
4337 error,
4338 ));
4339 }
4340 }
4341 };
4342
4343 dlg.finished(true);
4344 return Ok(response);
4345 }
4346 }
4347 }
4348 }
4349
4350 ///
4351 /// Sets the *request* property to the given value.
4352 ///
4353 /// Even though the property as already been set when instantiating this call,
4354 /// we provide this method for API completeness.
4355 pub fn request(
4356 mut self,
4357 new_value: BatchCreateJobsRequest,
4358 ) -> ProjectTenantJobBatchCreateCall<'a, C> {
4359 self._request = new_value;
4360 self
4361 }
4362 /// Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
4363 ///
4364 /// Sets the *parent* path property to the given value.
4365 ///
4366 /// Even though the property as already been set when instantiating this call,
4367 /// we provide this method for API completeness.
4368 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobBatchCreateCall<'a, C> {
4369 self._parent = new_value.to_string();
4370 self
4371 }
4372 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4373 /// while executing the actual API request.
4374 ///
4375 /// ````text
4376 /// It should be used to handle progress information, and to implement a certain level of resilience.
4377 /// ````
4378 ///
4379 /// Sets the *delegate* property to the given value.
4380 pub fn delegate(
4381 mut self,
4382 new_value: &'a mut dyn common::Delegate,
4383 ) -> ProjectTenantJobBatchCreateCall<'a, C> {
4384 self._delegate = Some(new_value);
4385 self
4386 }
4387
4388 /// Set any additional parameter of the query string used in the request.
4389 /// It should be used to set parameters which are not yet available through their own
4390 /// setters.
4391 ///
4392 /// Please note that this method must not be used to set any of the known parameters
4393 /// which have their own setter method. If done anyway, the request will fail.
4394 ///
4395 /// # Additional Parameters
4396 ///
4397 /// * *$.xgafv* (query-string) - V1 error format.
4398 /// * *access_token* (query-string) - OAuth access token.
4399 /// * *alt* (query-string) - Data format for response.
4400 /// * *callback* (query-string) - JSONP
4401 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4402 /// * *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.
4403 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4404 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4405 /// * *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.
4406 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4407 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4408 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobBatchCreateCall<'a, C>
4409 where
4410 T: AsRef<str>,
4411 {
4412 self._additional_params
4413 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4414 self
4415 }
4416
4417 /// Identifies the authorization scope for the method you are building.
4418 ///
4419 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4420 /// [`Scope::CloudPlatform`].
4421 ///
4422 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4423 /// tokens for more than one scope.
4424 ///
4425 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4426 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4427 /// sufficient, a read-write scope will do as well.
4428 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobBatchCreateCall<'a, C>
4429 where
4430 St: AsRef<str>,
4431 {
4432 self._scopes.insert(String::from(scope.as_ref()));
4433 self
4434 }
4435 /// Identifies the authorization scope(s) for the method you are building.
4436 ///
4437 /// See [`Self::add_scope()`] for details.
4438 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobBatchCreateCall<'a, C>
4439 where
4440 I: IntoIterator<Item = St>,
4441 St: AsRef<str>,
4442 {
4443 self._scopes
4444 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4445 self
4446 }
4447
4448 /// Removes all scopes, and no default scope will be used either.
4449 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4450 /// for details).
4451 pub fn clear_scopes(mut self) -> ProjectTenantJobBatchCreateCall<'a, C> {
4452 self._scopes.clear();
4453 self
4454 }
4455}
4456
4457/// Begins executing a batch delete jobs operation.
4458///
4459/// A builder for the *tenants.jobs.batchDelete* method supported by a *project* resource.
4460/// It is not used directly, but through a [`ProjectMethods`] instance.
4461///
4462/// # Example
4463///
4464/// Instantiate a resource method builder
4465///
4466/// ```test_harness,no_run
4467/// # extern crate hyper;
4468/// # extern crate hyper_rustls;
4469/// # extern crate google_jobs4 as jobs4;
4470/// use jobs4::api::BatchDeleteJobsRequest;
4471/// # async fn dox() {
4472/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4473///
4474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4475/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4476/// # .with_native_roots()
4477/// # .unwrap()
4478/// # .https_only()
4479/// # .enable_http2()
4480/// # .build();
4481///
4482/// # let executor = hyper_util::rt::TokioExecutor::new();
4483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4484/// # secret,
4485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4486/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4487/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4488/// # ),
4489/// # ).build().await.unwrap();
4490///
4491/// # let client = hyper_util::client::legacy::Client::builder(
4492/// # hyper_util::rt::TokioExecutor::new()
4493/// # )
4494/// # .build(
4495/// # hyper_rustls::HttpsConnectorBuilder::new()
4496/// # .with_native_roots()
4497/// # .unwrap()
4498/// # .https_or_http()
4499/// # .enable_http2()
4500/// # .build()
4501/// # );
4502/// # let mut hub = CloudTalentSolution::new(client, auth);
4503/// // As the method needs a request, you would usually fill it with the desired information
4504/// // into the respective structure. Some of the parts shown here might not be applicable !
4505/// // Values shown here are possibly random and not representative !
4506/// let mut req = BatchDeleteJobsRequest::default();
4507///
4508/// // You can configure optional parameters by calling the respective setters at will, and
4509/// // execute the final call using `doit()`.
4510/// // Values shown here are possibly random and not representative !
4511/// let result = hub.projects().tenants_jobs_batch_delete(req, "parent")
4512/// .doit().await;
4513/// # }
4514/// ```
4515pub struct ProjectTenantJobBatchDeleteCall<'a, C>
4516where
4517 C: 'a,
4518{
4519 hub: &'a CloudTalentSolution<C>,
4520 _request: BatchDeleteJobsRequest,
4521 _parent: String,
4522 _delegate: Option<&'a mut dyn common::Delegate>,
4523 _additional_params: HashMap<String, String>,
4524 _scopes: BTreeSet<String>,
4525}
4526
4527impl<'a, C> common::CallBuilder for ProjectTenantJobBatchDeleteCall<'a, C> {}
4528
4529impl<'a, C> ProjectTenantJobBatchDeleteCall<'a, C>
4530where
4531 C: common::Connector,
4532{
4533 /// Perform the operation you have build so far.
4534 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4535 use std::borrow::Cow;
4536 use std::io::{Read, Seek};
4537
4538 use common::{url::Params, ToParts};
4539 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4540
4541 let mut dd = common::DefaultDelegate;
4542 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4543 dlg.begin(common::MethodInfo {
4544 id: "jobs.projects.tenants.jobs.batchDelete",
4545 http_method: hyper::Method::POST,
4546 });
4547
4548 for &field in ["alt", "parent"].iter() {
4549 if self._additional_params.contains_key(field) {
4550 dlg.finished(false);
4551 return Err(common::Error::FieldClash(field));
4552 }
4553 }
4554
4555 let mut params = Params::with_capacity(4 + self._additional_params.len());
4556 params.push("parent", self._parent);
4557
4558 params.extend(self._additional_params.iter());
4559
4560 params.push("alt", "json");
4561 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs:batchDelete";
4562 if self._scopes.is_empty() {
4563 self._scopes
4564 .insert(Scope::CloudPlatform.as_ref().to_string());
4565 }
4566
4567 #[allow(clippy::single_element_loop)]
4568 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4569 url = params.uri_replacement(url, param_name, find_this, true);
4570 }
4571 {
4572 let to_remove = ["parent"];
4573 params.remove_params(&to_remove);
4574 }
4575
4576 let url = params.parse_with_url(&url);
4577
4578 let mut json_mime_type = mime::APPLICATION_JSON;
4579 let mut request_value_reader = {
4580 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4581 common::remove_json_null_values(&mut value);
4582 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4583 serde_json::to_writer(&mut dst, &value).unwrap();
4584 dst
4585 };
4586 let request_size = request_value_reader
4587 .seek(std::io::SeekFrom::End(0))
4588 .unwrap();
4589 request_value_reader
4590 .seek(std::io::SeekFrom::Start(0))
4591 .unwrap();
4592
4593 loop {
4594 let token = match self
4595 .hub
4596 .auth
4597 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4598 .await
4599 {
4600 Ok(token) => token,
4601 Err(e) => match dlg.token(e) {
4602 Ok(token) => token,
4603 Err(e) => {
4604 dlg.finished(false);
4605 return Err(common::Error::MissingToken(e));
4606 }
4607 },
4608 };
4609 request_value_reader
4610 .seek(std::io::SeekFrom::Start(0))
4611 .unwrap();
4612 let mut req_result = {
4613 let client = &self.hub.client;
4614 dlg.pre_request();
4615 let mut req_builder = hyper::Request::builder()
4616 .method(hyper::Method::POST)
4617 .uri(url.as_str())
4618 .header(USER_AGENT, self.hub._user_agent.clone());
4619
4620 if let Some(token) = token.as_ref() {
4621 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4622 }
4623
4624 let request = req_builder
4625 .header(CONTENT_TYPE, json_mime_type.to_string())
4626 .header(CONTENT_LENGTH, request_size as u64)
4627 .body(common::to_body(
4628 request_value_reader.get_ref().clone().into(),
4629 ));
4630
4631 client.request(request.unwrap()).await
4632 };
4633
4634 match req_result {
4635 Err(err) => {
4636 if let common::Retry::After(d) = dlg.http_error(&err) {
4637 sleep(d).await;
4638 continue;
4639 }
4640 dlg.finished(false);
4641 return Err(common::Error::HttpError(err));
4642 }
4643 Ok(res) => {
4644 let (mut parts, body) = res.into_parts();
4645 let mut body = common::Body::new(body);
4646 if !parts.status.is_success() {
4647 let bytes = common::to_bytes(body).await.unwrap_or_default();
4648 let error = serde_json::from_str(&common::to_string(&bytes));
4649 let response = common::to_response(parts, bytes.into());
4650
4651 if let common::Retry::After(d) =
4652 dlg.http_failure(&response, error.as_ref().ok())
4653 {
4654 sleep(d).await;
4655 continue;
4656 }
4657
4658 dlg.finished(false);
4659
4660 return Err(match error {
4661 Ok(value) => common::Error::BadRequest(value),
4662 _ => common::Error::Failure(response),
4663 });
4664 }
4665 let response = {
4666 let bytes = common::to_bytes(body).await.unwrap_or_default();
4667 let encoded = common::to_string(&bytes);
4668 match serde_json::from_str(&encoded) {
4669 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4670 Err(error) => {
4671 dlg.response_json_decode_error(&encoded, &error);
4672 return Err(common::Error::JsonDecodeError(
4673 encoded.to_string(),
4674 error,
4675 ));
4676 }
4677 }
4678 };
4679
4680 dlg.finished(true);
4681 return Ok(response);
4682 }
4683 }
4684 }
4685 }
4686
4687 ///
4688 /// Sets the *request* property to the given value.
4689 ///
4690 /// Even though the property as already been set when instantiating this call,
4691 /// we provide this method for API completeness.
4692 pub fn request(
4693 mut self,
4694 new_value: BatchDeleteJobsRequest,
4695 ) -> ProjectTenantJobBatchDeleteCall<'a, C> {
4696 self._request = new_value;
4697 self
4698 }
4699 /// Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". The parent of all of the jobs specified in `names` must match this field.
4700 ///
4701 /// Sets the *parent* path property to the given value.
4702 ///
4703 /// Even though the property as already been set when instantiating this call,
4704 /// we provide this method for API completeness.
4705 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobBatchDeleteCall<'a, C> {
4706 self._parent = new_value.to_string();
4707 self
4708 }
4709 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4710 /// while executing the actual API request.
4711 ///
4712 /// ````text
4713 /// It should be used to handle progress information, and to implement a certain level of resilience.
4714 /// ````
4715 ///
4716 /// Sets the *delegate* property to the given value.
4717 pub fn delegate(
4718 mut self,
4719 new_value: &'a mut dyn common::Delegate,
4720 ) -> ProjectTenantJobBatchDeleteCall<'a, C> {
4721 self._delegate = Some(new_value);
4722 self
4723 }
4724
4725 /// Set any additional parameter of the query string used in the request.
4726 /// It should be used to set parameters which are not yet available through their own
4727 /// setters.
4728 ///
4729 /// Please note that this method must not be used to set any of the known parameters
4730 /// which have their own setter method. If done anyway, the request will fail.
4731 ///
4732 /// # Additional Parameters
4733 ///
4734 /// * *$.xgafv* (query-string) - V1 error format.
4735 /// * *access_token* (query-string) - OAuth access token.
4736 /// * *alt* (query-string) - Data format for response.
4737 /// * *callback* (query-string) - JSONP
4738 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4739 /// * *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.
4740 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4741 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4742 /// * *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.
4743 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4744 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4745 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobBatchDeleteCall<'a, C>
4746 where
4747 T: AsRef<str>,
4748 {
4749 self._additional_params
4750 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4751 self
4752 }
4753
4754 /// Identifies the authorization scope for the method you are building.
4755 ///
4756 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4757 /// [`Scope::CloudPlatform`].
4758 ///
4759 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4760 /// tokens for more than one scope.
4761 ///
4762 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4763 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4764 /// sufficient, a read-write scope will do as well.
4765 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobBatchDeleteCall<'a, C>
4766 where
4767 St: AsRef<str>,
4768 {
4769 self._scopes.insert(String::from(scope.as_ref()));
4770 self
4771 }
4772 /// Identifies the authorization scope(s) for the method you are building.
4773 ///
4774 /// See [`Self::add_scope()`] for details.
4775 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobBatchDeleteCall<'a, C>
4776 where
4777 I: IntoIterator<Item = St>,
4778 St: AsRef<str>,
4779 {
4780 self._scopes
4781 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4782 self
4783 }
4784
4785 /// Removes all scopes, and no default scope will be used either.
4786 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4787 /// for details).
4788 pub fn clear_scopes(mut self) -> ProjectTenantJobBatchDeleteCall<'a, C> {
4789 self._scopes.clear();
4790 self
4791 }
4792}
4793
4794/// Begins executing a batch update jobs operation.
4795///
4796/// A builder for the *tenants.jobs.batchUpdate* method supported by a *project* resource.
4797/// It is not used directly, but through a [`ProjectMethods`] instance.
4798///
4799/// # Example
4800///
4801/// Instantiate a resource method builder
4802///
4803/// ```test_harness,no_run
4804/// # extern crate hyper;
4805/// # extern crate hyper_rustls;
4806/// # extern crate google_jobs4 as jobs4;
4807/// use jobs4::api::BatchUpdateJobsRequest;
4808/// # async fn dox() {
4809/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4810///
4811/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4812/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4813/// # .with_native_roots()
4814/// # .unwrap()
4815/// # .https_only()
4816/// # .enable_http2()
4817/// # .build();
4818///
4819/// # let executor = hyper_util::rt::TokioExecutor::new();
4820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4821/// # secret,
4822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4823/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4824/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4825/// # ),
4826/// # ).build().await.unwrap();
4827///
4828/// # let client = hyper_util::client::legacy::Client::builder(
4829/// # hyper_util::rt::TokioExecutor::new()
4830/// # )
4831/// # .build(
4832/// # hyper_rustls::HttpsConnectorBuilder::new()
4833/// # .with_native_roots()
4834/// # .unwrap()
4835/// # .https_or_http()
4836/// # .enable_http2()
4837/// # .build()
4838/// # );
4839/// # let mut hub = CloudTalentSolution::new(client, auth);
4840/// // As the method needs a request, you would usually fill it with the desired information
4841/// // into the respective structure. Some of the parts shown here might not be applicable !
4842/// // Values shown here are possibly random and not representative !
4843/// let mut req = BatchUpdateJobsRequest::default();
4844///
4845/// // You can configure optional parameters by calling the respective setters at will, and
4846/// // execute the final call using `doit()`.
4847/// // Values shown here are possibly random and not representative !
4848/// let result = hub.projects().tenants_jobs_batch_update(req, "parent")
4849/// .doit().await;
4850/// # }
4851/// ```
4852pub struct ProjectTenantJobBatchUpdateCall<'a, C>
4853where
4854 C: 'a,
4855{
4856 hub: &'a CloudTalentSolution<C>,
4857 _request: BatchUpdateJobsRequest,
4858 _parent: String,
4859 _delegate: Option<&'a mut dyn common::Delegate>,
4860 _additional_params: HashMap<String, String>,
4861 _scopes: BTreeSet<String>,
4862}
4863
4864impl<'a, C> common::CallBuilder for ProjectTenantJobBatchUpdateCall<'a, C> {}
4865
4866impl<'a, C> ProjectTenantJobBatchUpdateCall<'a, C>
4867where
4868 C: common::Connector,
4869{
4870 /// Perform the operation you have build so far.
4871 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4872 use std::borrow::Cow;
4873 use std::io::{Read, Seek};
4874
4875 use common::{url::Params, ToParts};
4876 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4877
4878 let mut dd = common::DefaultDelegate;
4879 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4880 dlg.begin(common::MethodInfo {
4881 id: "jobs.projects.tenants.jobs.batchUpdate",
4882 http_method: hyper::Method::POST,
4883 });
4884
4885 for &field in ["alt", "parent"].iter() {
4886 if self._additional_params.contains_key(field) {
4887 dlg.finished(false);
4888 return Err(common::Error::FieldClash(field));
4889 }
4890 }
4891
4892 let mut params = Params::with_capacity(4 + self._additional_params.len());
4893 params.push("parent", self._parent);
4894
4895 params.extend(self._additional_params.iter());
4896
4897 params.push("alt", "json");
4898 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs:batchUpdate";
4899 if self._scopes.is_empty() {
4900 self._scopes
4901 .insert(Scope::CloudPlatform.as_ref().to_string());
4902 }
4903
4904 #[allow(clippy::single_element_loop)]
4905 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4906 url = params.uri_replacement(url, param_name, find_this, true);
4907 }
4908 {
4909 let to_remove = ["parent"];
4910 params.remove_params(&to_remove);
4911 }
4912
4913 let url = params.parse_with_url(&url);
4914
4915 let mut json_mime_type = mime::APPLICATION_JSON;
4916 let mut request_value_reader = {
4917 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4918 common::remove_json_null_values(&mut value);
4919 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4920 serde_json::to_writer(&mut dst, &value).unwrap();
4921 dst
4922 };
4923 let request_size = request_value_reader
4924 .seek(std::io::SeekFrom::End(0))
4925 .unwrap();
4926 request_value_reader
4927 .seek(std::io::SeekFrom::Start(0))
4928 .unwrap();
4929
4930 loop {
4931 let token = match self
4932 .hub
4933 .auth
4934 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4935 .await
4936 {
4937 Ok(token) => token,
4938 Err(e) => match dlg.token(e) {
4939 Ok(token) => token,
4940 Err(e) => {
4941 dlg.finished(false);
4942 return Err(common::Error::MissingToken(e));
4943 }
4944 },
4945 };
4946 request_value_reader
4947 .seek(std::io::SeekFrom::Start(0))
4948 .unwrap();
4949 let mut req_result = {
4950 let client = &self.hub.client;
4951 dlg.pre_request();
4952 let mut req_builder = hyper::Request::builder()
4953 .method(hyper::Method::POST)
4954 .uri(url.as_str())
4955 .header(USER_AGENT, self.hub._user_agent.clone());
4956
4957 if let Some(token) = token.as_ref() {
4958 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4959 }
4960
4961 let request = req_builder
4962 .header(CONTENT_TYPE, json_mime_type.to_string())
4963 .header(CONTENT_LENGTH, request_size as u64)
4964 .body(common::to_body(
4965 request_value_reader.get_ref().clone().into(),
4966 ));
4967
4968 client.request(request.unwrap()).await
4969 };
4970
4971 match req_result {
4972 Err(err) => {
4973 if let common::Retry::After(d) = dlg.http_error(&err) {
4974 sleep(d).await;
4975 continue;
4976 }
4977 dlg.finished(false);
4978 return Err(common::Error::HttpError(err));
4979 }
4980 Ok(res) => {
4981 let (mut parts, body) = res.into_parts();
4982 let mut body = common::Body::new(body);
4983 if !parts.status.is_success() {
4984 let bytes = common::to_bytes(body).await.unwrap_or_default();
4985 let error = serde_json::from_str(&common::to_string(&bytes));
4986 let response = common::to_response(parts, bytes.into());
4987
4988 if let common::Retry::After(d) =
4989 dlg.http_failure(&response, error.as_ref().ok())
4990 {
4991 sleep(d).await;
4992 continue;
4993 }
4994
4995 dlg.finished(false);
4996
4997 return Err(match error {
4998 Ok(value) => common::Error::BadRequest(value),
4999 _ => common::Error::Failure(response),
5000 });
5001 }
5002 let response = {
5003 let bytes = common::to_bytes(body).await.unwrap_or_default();
5004 let encoded = common::to_string(&bytes);
5005 match serde_json::from_str(&encoded) {
5006 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5007 Err(error) => {
5008 dlg.response_json_decode_error(&encoded, &error);
5009 return Err(common::Error::JsonDecodeError(
5010 encoded.to_string(),
5011 error,
5012 ));
5013 }
5014 }
5015 };
5016
5017 dlg.finished(true);
5018 return Ok(response);
5019 }
5020 }
5021 }
5022 }
5023
5024 ///
5025 /// Sets the *request* property to the given value.
5026 ///
5027 /// Even though the property as already been set when instantiating this call,
5028 /// we provide this method for API completeness.
5029 pub fn request(
5030 mut self,
5031 new_value: BatchUpdateJobsRequest,
5032 ) -> ProjectTenantJobBatchUpdateCall<'a, C> {
5033 self._request = new_value;
5034 self
5035 }
5036 /// Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
5037 ///
5038 /// Sets the *parent* path property to the given value.
5039 ///
5040 /// Even though the property as already been set when instantiating this call,
5041 /// we provide this method for API completeness.
5042 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobBatchUpdateCall<'a, C> {
5043 self._parent = new_value.to_string();
5044 self
5045 }
5046 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5047 /// while executing the actual API request.
5048 ///
5049 /// ````text
5050 /// It should be used to handle progress information, and to implement a certain level of resilience.
5051 /// ````
5052 ///
5053 /// Sets the *delegate* property to the given value.
5054 pub fn delegate(
5055 mut self,
5056 new_value: &'a mut dyn common::Delegate,
5057 ) -> ProjectTenantJobBatchUpdateCall<'a, C> {
5058 self._delegate = Some(new_value);
5059 self
5060 }
5061
5062 /// Set any additional parameter of the query string used in the request.
5063 /// It should be used to set parameters which are not yet available through their own
5064 /// setters.
5065 ///
5066 /// Please note that this method must not be used to set any of the known parameters
5067 /// which have their own setter method. If done anyway, the request will fail.
5068 ///
5069 /// # Additional Parameters
5070 ///
5071 /// * *$.xgafv* (query-string) - V1 error format.
5072 /// * *access_token* (query-string) - OAuth access token.
5073 /// * *alt* (query-string) - Data format for response.
5074 /// * *callback* (query-string) - JSONP
5075 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5076 /// * *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.
5077 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5078 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5079 /// * *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.
5080 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5081 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5082 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobBatchUpdateCall<'a, C>
5083 where
5084 T: AsRef<str>,
5085 {
5086 self._additional_params
5087 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5088 self
5089 }
5090
5091 /// Identifies the authorization scope for the method you are building.
5092 ///
5093 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5094 /// [`Scope::CloudPlatform`].
5095 ///
5096 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5097 /// tokens for more than one scope.
5098 ///
5099 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5100 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5101 /// sufficient, a read-write scope will do as well.
5102 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobBatchUpdateCall<'a, C>
5103 where
5104 St: AsRef<str>,
5105 {
5106 self._scopes.insert(String::from(scope.as_ref()));
5107 self
5108 }
5109 /// Identifies the authorization scope(s) for the method you are building.
5110 ///
5111 /// See [`Self::add_scope()`] for details.
5112 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobBatchUpdateCall<'a, C>
5113 where
5114 I: IntoIterator<Item = St>,
5115 St: AsRef<str>,
5116 {
5117 self._scopes
5118 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5119 self
5120 }
5121
5122 /// Removes all scopes, and no default scope will be used either.
5123 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5124 /// for details).
5125 pub fn clear_scopes(mut self) -> ProjectTenantJobBatchUpdateCall<'a, C> {
5126 self._scopes.clear();
5127 self
5128 }
5129}
5130
5131/// Creates a new job. Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
5132///
5133/// A builder for the *tenants.jobs.create* method supported by a *project* resource.
5134/// It is not used directly, but through a [`ProjectMethods`] instance.
5135///
5136/// # Example
5137///
5138/// Instantiate a resource method builder
5139///
5140/// ```test_harness,no_run
5141/// # extern crate hyper;
5142/// # extern crate hyper_rustls;
5143/// # extern crate google_jobs4 as jobs4;
5144/// use jobs4::api::Job;
5145/// # async fn dox() {
5146/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5147///
5148/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5149/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5150/// # .with_native_roots()
5151/// # .unwrap()
5152/// # .https_only()
5153/// # .enable_http2()
5154/// # .build();
5155///
5156/// # let executor = hyper_util::rt::TokioExecutor::new();
5157/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5158/// # secret,
5159/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5160/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5161/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5162/// # ),
5163/// # ).build().await.unwrap();
5164///
5165/// # let client = hyper_util::client::legacy::Client::builder(
5166/// # hyper_util::rt::TokioExecutor::new()
5167/// # )
5168/// # .build(
5169/// # hyper_rustls::HttpsConnectorBuilder::new()
5170/// # .with_native_roots()
5171/// # .unwrap()
5172/// # .https_or_http()
5173/// # .enable_http2()
5174/// # .build()
5175/// # );
5176/// # let mut hub = CloudTalentSolution::new(client, auth);
5177/// // As the method needs a request, you would usually fill it with the desired information
5178/// // into the respective structure. Some of the parts shown here might not be applicable !
5179/// // Values shown here are possibly random and not representative !
5180/// let mut req = Job::default();
5181///
5182/// // You can configure optional parameters by calling the respective setters at will, and
5183/// // execute the final call using `doit()`.
5184/// // Values shown here are possibly random and not representative !
5185/// let result = hub.projects().tenants_jobs_create(req, "parent")
5186/// .doit().await;
5187/// # }
5188/// ```
5189pub struct ProjectTenantJobCreateCall<'a, C>
5190where
5191 C: 'a,
5192{
5193 hub: &'a CloudTalentSolution<C>,
5194 _request: Job,
5195 _parent: String,
5196 _delegate: Option<&'a mut dyn common::Delegate>,
5197 _additional_params: HashMap<String, String>,
5198 _scopes: BTreeSet<String>,
5199}
5200
5201impl<'a, C> common::CallBuilder for ProjectTenantJobCreateCall<'a, C> {}
5202
5203impl<'a, C> ProjectTenantJobCreateCall<'a, C>
5204where
5205 C: common::Connector,
5206{
5207 /// Perform the operation you have build so far.
5208 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
5209 use std::borrow::Cow;
5210 use std::io::{Read, Seek};
5211
5212 use common::{url::Params, ToParts};
5213 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5214
5215 let mut dd = common::DefaultDelegate;
5216 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5217 dlg.begin(common::MethodInfo {
5218 id: "jobs.projects.tenants.jobs.create",
5219 http_method: hyper::Method::POST,
5220 });
5221
5222 for &field in ["alt", "parent"].iter() {
5223 if self._additional_params.contains_key(field) {
5224 dlg.finished(false);
5225 return Err(common::Error::FieldClash(field));
5226 }
5227 }
5228
5229 let mut params = Params::with_capacity(4 + self._additional_params.len());
5230 params.push("parent", self._parent);
5231
5232 params.extend(self._additional_params.iter());
5233
5234 params.push("alt", "json");
5235 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs";
5236 if self._scopes.is_empty() {
5237 self._scopes
5238 .insert(Scope::CloudPlatform.as_ref().to_string());
5239 }
5240
5241 #[allow(clippy::single_element_loop)]
5242 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5243 url = params.uri_replacement(url, param_name, find_this, true);
5244 }
5245 {
5246 let to_remove = ["parent"];
5247 params.remove_params(&to_remove);
5248 }
5249
5250 let url = params.parse_with_url(&url);
5251
5252 let mut json_mime_type = mime::APPLICATION_JSON;
5253 let mut request_value_reader = {
5254 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5255 common::remove_json_null_values(&mut value);
5256 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5257 serde_json::to_writer(&mut dst, &value).unwrap();
5258 dst
5259 };
5260 let request_size = request_value_reader
5261 .seek(std::io::SeekFrom::End(0))
5262 .unwrap();
5263 request_value_reader
5264 .seek(std::io::SeekFrom::Start(0))
5265 .unwrap();
5266
5267 loop {
5268 let token = match self
5269 .hub
5270 .auth
5271 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5272 .await
5273 {
5274 Ok(token) => token,
5275 Err(e) => match dlg.token(e) {
5276 Ok(token) => token,
5277 Err(e) => {
5278 dlg.finished(false);
5279 return Err(common::Error::MissingToken(e));
5280 }
5281 },
5282 };
5283 request_value_reader
5284 .seek(std::io::SeekFrom::Start(0))
5285 .unwrap();
5286 let mut req_result = {
5287 let client = &self.hub.client;
5288 dlg.pre_request();
5289 let mut req_builder = hyper::Request::builder()
5290 .method(hyper::Method::POST)
5291 .uri(url.as_str())
5292 .header(USER_AGENT, self.hub._user_agent.clone());
5293
5294 if let Some(token) = token.as_ref() {
5295 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5296 }
5297
5298 let request = req_builder
5299 .header(CONTENT_TYPE, json_mime_type.to_string())
5300 .header(CONTENT_LENGTH, request_size as u64)
5301 .body(common::to_body(
5302 request_value_reader.get_ref().clone().into(),
5303 ));
5304
5305 client.request(request.unwrap()).await
5306 };
5307
5308 match req_result {
5309 Err(err) => {
5310 if let common::Retry::After(d) = dlg.http_error(&err) {
5311 sleep(d).await;
5312 continue;
5313 }
5314 dlg.finished(false);
5315 return Err(common::Error::HttpError(err));
5316 }
5317 Ok(res) => {
5318 let (mut parts, body) = res.into_parts();
5319 let mut body = common::Body::new(body);
5320 if !parts.status.is_success() {
5321 let bytes = common::to_bytes(body).await.unwrap_or_default();
5322 let error = serde_json::from_str(&common::to_string(&bytes));
5323 let response = common::to_response(parts, bytes.into());
5324
5325 if let common::Retry::After(d) =
5326 dlg.http_failure(&response, error.as_ref().ok())
5327 {
5328 sleep(d).await;
5329 continue;
5330 }
5331
5332 dlg.finished(false);
5333
5334 return Err(match error {
5335 Ok(value) => common::Error::BadRequest(value),
5336 _ => common::Error::Failure(response),
5337 });
5338 }
5339 let response = {
5340 let bytes = common::to_bytes(body).await.unwrap_or_default();
5341 let encoded = common::to_string(&bytes);
5342 match serde_json::from_str(&encoded) {
5343 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5344 Err(error) => {
5345 dlg.response_json_decode_error(&encoded, &error);
5346 return Err(common::Error::JsonDecodeError(
5347 encoded.to_string(),
5348 error,
5349 ));
5350 }
5351 }
5352 };
5353
5354 dlg.finished(true);
5355 return Ok(response);
5356 }
5357 }
5358 }
5359 }
5360
5361 ///
5362 /// Sets the *request* property to the given value.
5363 ///
5364 /// Even though the property as already been set when instantiating this call,
5365 /// we provide this method for API completeness.
5366 pub fn request(mut self, new_value: Job) -> ProjectTenantJobCreateCall<'a, C> {
5367 self._request = new_value;
5368 self
5369 }
5370 /// Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
5371 ///
5372 /// Sets the *parent* path property to the given value.
5373 ///
5374 /// Even though the property as already been set when instantiating this call,
5375 /// we provide this method for API completeness.
5376 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobCreateCall<'a, C> {
5377 self._parent = new_value.to_string();
5378 self
5379 }
5380 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5381 /// while executing the actual API request.
5382 ///
5383 /// ````text
5384 /// It should be used to handle progress information, and to implement a certain level of resilience.
5385 /// ````
5386 ///
5387 /// Sets the *delegate* property to the given value.
5388 pub fn delegate(
5389 mut self,
5390 new_value: &'a mut dyn common::Delegate,
5391 ) -> ProjectTenantJobCreateCall<'a, C> {
5392 self._delegate = Some(new_value);
5393 self
5394 }
5395
5396 /// Set any additional parameter of the query string used in the request.
5397 /// It should be used to set parameters which are not yet available through their own
5398 /// setters.
5399 ///
5400 /// Please note that this method must not be used to set any of the known parameters
5401 /// which have their own setter method. If done anyway, the request will fail.
5402 ///
5403 /// # Additional Parameters
5404 ///
5405 /// * *$.xgafv* (query-string) - V1 error format.
5406 /// * *access_token* (query-string) - OAuth access token.
5407 /// * *alt* (query-string) - Data format for response.
5408 /// * *callback* (query-string) - JSONP
5409 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5410 /// * *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.
5411 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5412 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5413 /// * *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.
5414 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5415 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5416 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobCreateCall<'a, C>
5417 where
5418 T: AsRef<str>,
5419 {
5420 self._additional_params
5421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5422 self
5423 }
5424
5425 /// Identifies the authorization scope for the method you are building.
5426 ///
5427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5428 /// [`Scope::CloudPlatform`].
5429 ///
5430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5431 /// tokens for more than one scope.
5432 ///
5433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5435 /// sufficient, a read-write scope will do as well.
5436 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobCreateCall<'a, C>
5437 where
5438 St: AsRef<str>,
5439 {
5440 self._scopes.insert(String::from(scope.as_ref()));
5441 self
5442 }
5443 /// Identifies the authorization scope(s) for the method you are building.
5444 ///
5445 /// See [`Self::add_scope()`] for details.
5446 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobCreateCall<'a, C>
5447 where
5448 I: IntoIterator<Item = St>,
5449 St: AsRef<str>,
5450 {
5451 self._scopes
5452 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5453 self
5454 }
5455
5456 /// Removes all scopes, and no default scope will be used either.
5457 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5458 /// for details).
5459 pub fn clear_scopes(mut self) -> ProjectTenantJobCreateCall<'a, C> {
5460 self._scopes.clear();
5461 self
5462 }
5463}
5464
5465/// Deletes the specified job. Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
5466///
5467/// A builder for the *tenants.jobs.delete* method supported by a *project* resource.
5468/// It is not used directly, but through a [`ProjectMethods`] instance.
5469///
5470/// # Example
5471///
5472/// Instantiate a resource method builder
5473///
5474/// ```test_harness,no_run
5475/// # extern crate hyper;
5476/// # extern crate hyper_rustls;
5477/// # extern crate google_jobs4 as jobs4;
5478/// # async fn dox() {
5479/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5480///
5481/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5482/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5483/// # .with_native_roots()
5484/// # .unwrap()
5485/// # .https_only()
5486/// # .enable_http2()
5487/// # .build();
5488///
5489/// # let executor = hyper_util::rt::TokioExecutor::new();
5490/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5491/// # secret,
5492/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5493/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5494/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5495/// # ),
5496/// # ).build().await.unwrap();
5497///
5498/// # let client = hyper_util::client::legacy::Client::builder(
5499/// # hyper_util::rt::TokioExecutor::new()
5500/// # )
5501/// # .build(
5502/// # hyper_rustls::HttpsConnectorBuilder::new()
5503/// # .with_native_roots()
5504/// # .unwrap()
5505/// # .https_or_http()
5506/// # .enable_http2()
5507/// # .build()
5508/// # );
5509/// # let mut hub = CloudTalentSolution::new(client, auth);
5510/// // You can configure optional parameters by calling the respective setters at will, and
5511/// // execute the final call using `doit()`.
5512/// // Values shown here are possibly random and not representative !
5513/// let result = hub.projects().tenants_jobs_delete("name")
5514/// .doit().await;
5515/// # }
5516/// ```
5517pub struct ProjectTenantJobDeleteCall<'a, C>
5518where
5519 C: 'a,
5520{
5521 hub: &'a CloudTalentSolution<C>,
5522 _name: String,
5523 _delegate: Option<&'a mut dyn common::Delegate>,
5524 _additional_params: HashMap<String, String>,
5525 _scopes: BTreeSet<String>,
5526}
5527
5528impl<'a, C> common::CallBuilder for ProjectTenantJobDeleteCall<'a, C> {}
5529
5530impl<'a, C> ProjectTenantJobDeleteCall<'a, C>
5531where
5532 C: common::Connector,
5533{
5534 /// Perform the operation you have build so far.
5535 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5536 use std::borrow::Cow;
5537 use std::io::{Read, Seek};
5538
5539 use common::{url::Params, ToParts};
5540 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5541
5542 let mut dd = common::DefaultDelegate;
5543 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5544 dlg.begin(common::MethodInfo {
5545 id: "jobs.projects.tenants.jobs.delete",
5546 http_method: hyper::Method::DELETE,
5547 });
5548
5549 for &field in ["alt", "name"].iter() {
5550 if self._additional_params.contains_key(field) {
5551 dlg.finished(false);
5552 return Err(common::Error::FieldClash(field));
5553 }
5554 }
5555
5556 let mut params = Params::with_capacity(3 + self._additional_params.len());
5557 params.push("name", self._name);
5558
5559 params.extend(self._additional_params.iter());
5560
5561 params.push("alt", "json");
5562 let mut url = self.hub._base_url.clone() + "v4/{+name}";
5563 if self._scopes.is_empty() {
5564 self._scopes
5565 .insert(Scope::CloudPlatform.as_ref().to_string());
5566 }
5567
5568 #[allow(clippy::single_element_loop)]
5569 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5570 url = params.uri_replacement(url, param_name, find_this, true);
5571 }
5572 {
5573 let to_remove = ["name"];
5574 params.remove_params(&to_remove);
5575 }
5576
5577 let url = params.parse_with_url(&url);
5578
5579 loop {
5580 let token = match self
5581 .hub
5582 .auth
5583 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5584 .await
5585 {
5586 Ok(token) => token,
5587 Err(e) => match dlg.token(e) {
5588 Ok(token) => token,
5589 Err(e) => {
5590 dlg.finished(false);
5591 return Err(common::Error::MissingToken(e));
5592 }
5593 },
5594 };
5595 let mut req_result = {
5596 let client = &self.hub.client;
5597 dlg.pre_request();
5598 let mut req_builder = hyper::Request::builder()
5599 .method(hyper::Method::DELETE)
5600 .uri(url.as_str())
5601 .header(USER_AGENT, self.hub._user_agent.clone());
5602
5603 if let Some(token) = token.as_ref() {
5604 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5605 }
5606
5607 let request = req_builder
5608 .header(CONTENT_LENGTH, 0_u64)
5609 .body(common::to_body::<String>(None));
5610
5611 client.request(request.unwrap()).await
5612 };
5613
5614 match req_result {
5615 Err(err) => {
5616 if let common::Retry::After(d) = dlg.http_error(&err) {
5617 sleep(d).await;
5618 continue;
5619 }
5620 dlg.finished(false);
5621 return Err(common::Error::HttpError(err));
5622 }
5623 Ok(res) => {
5624 let (mut parts, body) = res.into_parts();
5625 let mut body = common::Body::new(body);
5626 if !parts.status.is_success() {
5627 let bytes = common::to_bytes(body).await.unwrap_or_default();
5628 let error = serde_json::from_str(&common::to_string(&bytes));
5629 let response = common::to_response(parts, bytes.into());
5630
5631 if let common::Retry::After(d) =
5632 dlg.http_failure(&response, error.as_ref().ok())
5633 {
5634 sleep(d).await;
5635 continue;
5636 }
5637
5638 dlg.finished(false);
5639
5640 return Err(match error {
5641 Ok(value) => common::Error::BadRequest(value),
5642 _ => common::Error::Failure(response),
5643 });
5644 }
5645 let response = {
5646 let bytes = common::to_bytes(body).await.unwrap_or_default();
5647 let encoded = common::to_string(&bytes);
5648 match serde_json::from_str(&encoded) {
5649 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5650 Err(error) => {
5651 dlg.response_json_decode_error(&encoded, &error);
5652 return Err(common::Error::JsonDecodeError(
5653 encoded.to_string(),
5654 error,
5655 ));
5656 }
5657 }
5658 };
5659
5660 dlg.finished(true);
5661 return Ok(response);
5662 }
5663 }
5664 }
5665 }
5666
5667 /// Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz".
5668 ///
5669 /// Sets the *name* path property to the given value.
5670 ///
5671 /// Even though the property as already been set when instantiating this call,
5672 /// we provide this method for API completeness.
5673 pub fn name(mut self, new_value: &str) -> ProjectTenantJobDeleteCall<'a, C> {
5674 self._name = new_value.to_string();
5675 self
5676 }
5677 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5678 /// while executing the actual API request.
5679 ///
5680 /// ````text
5681 /// It should be used to handle progress information, and to implement a certain level of resilience.
5682 /// ````
5683 ///
5684 /// Sets the *delegate* property to the given value.
5685 pub fn delegate(
5686 mut self,
5687 new_value: &'a mut dyn common::Delegate,
5688 ) -> ProjectTenantJobDeleteCall<'a, C> {
5689 self._delegate = Some(new_value);
5690 self
5691 }
5692
5693 /// Set any additional parameter of the query string used in the request.
5694 /// It should be used to set parameters which are not yet available through their own
5695 /// setters.
5696 ///
5697 /// Please note that this method must not be used to set any of the known parameters
5698 /// which have their own setter method. If done anyway, the request will fail.
5699 ///
5700 /// # Additional Parameters
5701 ///
5702 /// * *$.xgafv* (query-string) - V1 error format.
5703 /// * *access_token* (query-string) - OAuth access token.
5704 /// * *alt* (query-string) - Data format for response.
5705 /// * *callback* (query-string) - JSONP
5706 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5707 /// * *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.
5708 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5709 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5710 /// * *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.
5711 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5712 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5713 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobDeleteCall<'a, C>
5714 where
5715 T: AsRef<str>,
5716 {
5717 self._additional_params
5718 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5719 self
5720 }
5721
5722 /// Identifies the authorization scope for the method you are building.
5723 ///
5724 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5725 /// [`Scope::CloudPlatform`].
5726 ///
5727 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5728 /// tokens for more than one scope.
5729 ///
5730 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5731 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5732 /// sufficient, a read-write scope will do as well.
5733 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobDeleteCall<'a, C>
5734 where
5735 St: AsRef<str>,
5736 {
5737 self._scopes.insert(String::from(scope.as_ref()));
5738 self
5739 }
5740 /// Identifies the authorization scope(s) for the method you are building.
5741 ///
5742 /// See [`Self::add_scope()`] for details.
5743 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobDeleteCall<'a, C>
5744 where
5745 I: IntoIterator<Item = St>,
5746 St: AsRef<str>,
5747 {
5748 self._scopes
5749 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5750 self
5751 }
5752
5753 /// Removes all scopes, and no default scope will be used either.
5754 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5755 /// for details).
5756 pub fn clear_scopes(mut self) -> ProjectTenantJobDeleteCall<'a, C> {
5757 self._scopes.clear();
5758 self
5759 }
5760}
5761
5762/// Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
5763///
5764/// A builder for the *tenants.jobs.get* method supported by a *project* resource.
5765/// It is not used directly, but through a [`ProjectMethods`] instance.
5766///
5767/// # Example
5768///
5769/// Instantiate a resource method builder
5770///
5771/// ```test_harness,no_run
5772/// # extern crate hyper;
5773/// # extern crate hyper_rustls;
5774/// # extern crate google_jobs4 as jobs4;
5775/// # async fn dox() {
5776/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5777///
5778/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5779/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5780/// # .with_native_roots()
5781/// # .unwrap()
5782/// # .https_only()
5783/// # .enable_http2()
5784/// # .build();
5785///
5786/// # let executor = hyper_util::rt::TokioExecutor::new();
5787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5788/// # secret,
5789/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5790/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5791/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5792/// # ),
5793/// # ).build().await.unwrap();
5794///
5795/// # let client = hyper_util::client::legacy::Client::builder(
5796/// # hyper_util::rt::TokioExecutor::new()
5797/// # )
5798/// # .build(
5799/// # hyper_rustls::HttpsConnectorBuilder::new()
5800/// # .with_native_roots()
5801/// # .unwrap()
5802/// # .https_or_http()
5803/// # .enable_http2()
5804/// # .build()
5805/// # );
5806/// # let mut hub = CloudTalentSolution::new(client, auth);
5807/// // You can configure optional parameters by calling the respective setters at will, and
5808/// // execute the final call using `doit()`.
5809/// // Values shown here are possibly random and not representative !
5810/// let result = hub.projects().tenants_jobs_get("name")
5811/// .doit().await;
5812/// # }
5813/// ```
5814pub struct ProjectTenantJobGetCall<'a, C>
5815where
5816 C: 'a,
5817{
5818 hub: &'a CloudTalentSolution<C>,
5819 _name: String,
5820 _delegate: Option<&'a mut dyn common::Delegate>,
5821 _additional_params: HashMap<String, String>,
5822 _scopes: BTreeSet<String>,
5823}
5824
5825impl<'a, C> common::CallBuilder for ProjectTenantJobGetCall<'a, C> {}
5826
5827impl<'a, C> ProjectTenantJobGetCall<'a, C>
5828where
5829 C: common::Connector,
5830{
5831 /// Perform the operation you have build so far.
5832 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
5833 use std::borrow::Cow;
5834 use std::io::{Read, Seek};
5835
5836 use common::{url::Params, ToParts};
5837 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5838
5839 let mut dd = common::DefaultDelegate;
5840 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5841 dlg.begin(common::MethodInfo {
5842 id: "jobs.projects.tenants.jobs.get",
5843 http_method: hyper::Method::GET,
5844 });
5845
5846 for &field in ["alt", "name"].iter() {
5847 if self._additional_params.contains_key(field) {
5848 dlg.finished(false);
5849 return Err(common::Error::FieldClash(field));
5850 }
5851 }
5852
5853 let mut params = Params::with_capacity(3 + self._additional_params.len());
5854 params.push("name", self._name);
5855
5856 params.extend(self._additional_params.iter());
5857
5858 params.push("alt", "json");
5859 let mut url = self.hub._base_url.clone() + "v4/{+name}";
5860 if self._scopes.is_empty() {
5861 self._scopes
5862 .insert(Scope::CloudPlatform.as_ref().to_string());
5863 }
5864
5865 #[allow(clippy::single_element_loop)]
5866 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5867 url = params.uri_replacement(url, param_name, find_this, true);
5868 }
5869 {
5870 let to_remove = ["name"];
5871 params.remove_params(&to_remove);
5872 }
5873
5874 let url = params.parse_with_url(&url);
5875
5876 loop {
5877 let token = match self
5878 .hub
5879 .auth
5880 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5881 .await
5882 {
5883 Ok(token) => token,
5884 Err(e) => match dlg.token(e) {
5885 Ok(token) => token,
5886 Err(e) => {
5887 dlg.finished(false);
5888 return Err(common::Error::MissingToken(e));
5889 }
5890 },
5891 };
5892 let mut req_result = {
5893 let client = &self.hub.client;
5894 dlg.pre_request();
5895 let mut req_builder = hyper::Request::builder()
5896 .method(hyper::Method::GET)
5897 .uri(url.as_str())
5898 .header(USER_AGENT, self.hub._user_agent.clone());
5899
5900 if let Some(token) = token.as_ref() {
5901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5902 }
5903
5904 let request = req_builder
5905 .header(CONTENT_LENGTH, 0_u64)
5906 .body(common::to_body::<String>(None));
5907
5908 client.request(request.unwrap()).await
5909 };
5910
5911 match req_result {
5912 Err(err) => {
5913 if let common::Retry::After(d) = dlg.http_error(&err) {
5914 sleep(d).await;
5915 continue;
5916 }
5917 dlg.finished(false);
5918 return Err(common::Error::HttpError(err));
5919 }
5920 Ok(res) => {
5921 let (mut parts, body) = res.into_parts();
5922 let mut body = common::Body::new(body);
5923 if !parts.status.is_success() {
5924 let bytes = common::to_bytes(body).await.unwrap_or_default();
5925 let error = serde_json::from_str(&common::to_string(&bytes));
5926 let response = common::to_response(parts, bytes.into());
5927
5928 if let common::Retry::After(d) =
5929 dlg.http_failure(&response, error.as_ref().ok())
5930 {
5931 sleep(d).await;
5932 continue;
5933 }
5934
5935 dlg.finished(false);
5936
5937 return Err(match error {
5938 Ok(value) => common::Error::BadRequest(value),
5939 _ => common::Error::Failure(response),
5940 });
5941 }
5942 let response = {
5943 let bytes = common::to_bytes(body).await.unwrap_or_default();
5944 let encoded = common::to_string(&bytes);
5945 match serde_json::from_str(&encoded) {
5946 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5947 Err(error) => {
5948 dlg.response_json_decode_error(&encoded, &error);
5949 return Err(common::Error::JsonDecodeError(
5950 encoded.to_string(),
5951 error,
5952 ));
5953 }
5954 }
5955 };
5956
5957 dlg.finished(true);
5958 return Ok(response);
5959 }
5960 }
5961 }
5962 }
5963
5964 /// Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz".
5965 ///
5966 /// Sets the *name* path property to the given value.
5967 ///
5968 /// Even though the property as already been set when instantiating this call,
5969 /// we provide this method for API completeness.
5970 pub fn name(mut self, new_value: &str) -> ProjectTenantJobGetCall<'a, C> {
5971 self._name = new_value.to_string();
5972 self
5973 }
5974 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5975 /// while executing the actual API request.
5976 ///
5977 /// ````text
5978 /// It should be used to handle progress information, and to implement a certain level of resilience.
5979 /// ````
5980 ///
5981 /// Sets the *delegate* property to the given value.
5982 pub fn delegate(
5983 mut self,
5984 new_value: &'a mut dyn common::Delegate,
5985 ) -> ProjectTenantJobGetCall<'a, C> {
5986 self._delegate = Some(new_value);
5987 self
5988 }
5989
5990 /// Set any additional parameter of the query string used in the request.
5991 /// It should be used to set parameters which are not yet available through their own
5992 /// setters.
5993 ///
5994 /// Please note that this method must not be used to set any of the known parameters
5995 /// which have their own setter method. If done anyway, the request will fail.
5996 ///
5997 /// # Additional Parameters
5998 ///
5999 /// * *$.xgafv* (query-string) - V1 error format.
6000 /// * *access_token* (query-string) - OAuth access token.
6001 /// * *alt* (query-string) - Data format for response.
6002 /// * *callback* (query-string) - JSONP
6003 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6004 /// * *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.
6005 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6006 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6007 /// * *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.
6008 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6009 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6010 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobGetCall<'a, C>
6011 where
6012 T: AsRef<str>,
6013 {
6014 self._additional_params
6015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6016 self
6017 }
6018
6019 /// Identifies the authorization scope for the method you are building.
6020 ///
6021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6022 /// [`Scope::CloudPlatform`].
6023 ///
6024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6025 /// tokens for more than one scope.
6026 ///
6027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6029 /// sufficient, a read-write scope will do as well.
6030 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobGetCall<'a, C>
6031 where
6032 St: AsRef<str>,
6033 {
6034 self._scopes.insert(String::from(scope.as_ref()));
6035 self
6036 }
6037 /// Identifies the authorization scope(s) for the method you are building.
6038 ///
6039 /// See [`Self::add_scope()`] for details.
6040 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobGetCall<'a, C>
6041 where
6042 I: IntoIterator<Item = St>,
6043 St: AsRef<str>,
6044 {
6045 self._scopes
6046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6047 self
6048 }
6049
6050 /// Removes all scopes, and no default scope will be used either.
6051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6052 /// for details).
6053 pub fn clear_scopes(mut self) -> ProjectTenantJobGetCall<'a, C> {
6054 self._scopes.clear();
6055 self
6056 }
6057}
6058
6059/// Lists jobs by filter.
6060///
6061/// A builder for the *tenants.jobs.list* method supported by a *project* resource.
6062/// It is not used directly, but through a [`ProjectMethods`] instance.
6063///
6064/// # Example
6065///
6066/// Instantiate a resource method builder
6067///
6068/// ```test_harness,no_run
6069/// # extern crate hyper;
6070/// # extern crate hyper_rustls;
6071/// # extern crate google_jobs4 as jobs4;
6072/// # async fn dox() {
6073/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6074///
6075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6076/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6077/// # .with_native_roots()
6078/// # .unwrap()
6079/// # .https_only()
6080/// # .enable_http2()
6081/// # .build();
6082///
6083/// # let executor = hyper_util::rt::TokioExecutor::new();
6084/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6085/// # secret,
6086/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6087/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6088/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6089/// # ),
6090/// # ).build().await.unwrap();
6091///
6092/// # let client = hyper_util::client::legacy::Client::builder(
6093/// # hyper_util::rt::TokioExecutor::new()
6094/// # )
6095/// # .build(
6096/// # hyper_rustls::HttpsConnectorBuilder::new()
6097/// # .with_native_roots()
6098/// # .unwrap()
6099/// # .https_or_http()
6100/// # .enable_http2()
6101/// # .build()
6102/// # );
6103/// # let mut hub = CloudTalentSolution::new(client, auth);
6104/// // You can configure optional parameters by calling the respective setters at will, and
6105/// // execute the final call using `doit()`.
6106/// // Values shown here are possibly random and not representative !
6107/// let result = hub.projects().tenants_jobs_list("parent")
6108/// .page_token("invidunt")
6109/// .page_size(-47)
6110/// .job_view("duo")
6111/// .filter("ipsum")
6112/// .doit().await;
6113/// # }
6114/// ```
6115pub struct ProjectTenantJobListCall<'a, C>
6116where
6117 C: 'a,
6118{
6119 hub: &'a CloudTalentSolution<C>,
6120 _parent: String,
6121 _page_token: Option<String>,
6122 _page_size: Option<i32>,
6123 _job_view: Option<String>,
6124 _filter: Option<String>,
6125 _delegate: Option<&'a mut dyn common::Delegate>,
6126 _additional_params: HashMap<String, String>,
6127 _scopes: BTreeSet<String>,
6128}
6129
6130impl<'a, C> common::CallBuilder for ProjectTenantJobListCall<'a, C> {}
6131
6132impl<'a, C> ProjectTenantJobListCall<'a, C>
6133where
6134 C: common::Connector,
6135{
6136 /// Perform the operation you have build so far.
6137 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
6138 use std::borrow::Cow;
6139 use std::io::{Read, Seek};
6140
6141 use common::{url::Params, ToParts};
6142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6143
6144 let mut dd = common::DefaultDelegate;
6145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6146 dlg.begin(common::MethodInfo {
6147 id: "jobs.projects.tenants.jobs.list",
6148 http_method: hyper::Method::GET,
6149 });
6150
6151 for &field in [
6152 "alt",
6153 "parent",
6154 "pageToken",
6155 "pageSize",
6156 "jobView",
6157 "filter",
6158 ]
6159 .iter()
6160 {
6161 if self._additional_params.contains_key(field) {
6162 dlg.finished(false);
6163 return Err(common::Error::FieldClash(field));
6164 }
6165 }
6166
6167 let mut params = Params::with_capacity(7 + self._additional_params.len());
6168 params.push("parent", self._parent);
6169 if let Some(value) = self._page_token.as_ref() {
6170 params.push("pageToken", value);
6171 }
6172 if let Some(value) = self._page_size.as_ref() {
6173 params.push("pageSize", value.to_string());
6174 }
6175 if let Some(value) = self._job_view.as_ref() {
6176 params.push("jobView", value);
6177 }
6178 if let Some(value) = self._filter.as_ref() {
6179 params.push("filter", value);
6180 }
6181
6182 params.extend(self._additional_params.iter());
6183
6184 params.push("alt", "json");
6185 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs";
6186 if self._scopes.is_empty() {
6187 self._scopes
6188 .insert(Scope::CloudPlatform.as_ref().to_string());
6189 }
6190
6191 #[allow(clippy::single_element_loop)]
6192 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6193 url = params.uri_replacement(url, param_name, find_this, true);
6194 }
6195 {
6196 let to_remove = ["parent"];
6197 params.remove_params(&to_remove);
6198 }
6199
6200 let url = params.parse_with_url(&url);
6201
6202 loop {
6203 let token = match self
6204 .hub
6205 .auth
6206 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6207 .await
6208 {
6209 Ok(token) => token,
6210 Err(e) => match dlg.token(e) {
6211 Ok(token) => token,
6212 Err(e) => {
6213 dlg.finished(false);
6214 return Err(common::Error::MissingToken(e));
6215 }
6216 },
6217 };
6218 let mut req_result = {
6219 let client = &self.hub.client;
6220 dlg.pre_request();
6221 let mut req_builder = hyper::Request::builder()
6222 .method(hyper::Method::GET)
6223 .uri(url.as_str())
6224 .header(USER_AGENT, self.hub._user_agent.clone());
6225
6226 if let Some(token) = token.as_ref() {
6227 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6228 }
6229
6230 let request = req_builder
6231 .header(CONTENT_LENGTH, 0_u64)
6232 .body(common::to_body::<String>(None));
6233
6234 client.request(request.unwrap()).await
6235 };
6236
6237 match req_result {
6238 Err(err) => {
6239 if let common::Retry::After(d) = dlg.http_error(&err) {
6240 sleep(d).await;
6241 continue;
6242 }
6243 dlg.finished(false);
6244 return Err(common::Error::HttpError(err));
6245 }
6246 Ok(res) => {
6247 let (mut parts, body) = res.into_parts();
6248 let mut body = common::Body::new(body);
6249 if !parts.status.is_success() {
6250 let bytes = common::to_bytes(body).await.unwrap_or_default();
6251 let error = serde_json::from_str(&common::to_string(&bytes));
6252 let response = common::to_response(parts, bytes.into());
6253
6254 if let common::Retry::After(d) =
6255 dlg.http_failure(&response, error.as_ref().ok())
6256 {
6257 sleep(d).await;
6258 continue;
6259 }
6260
6261 dlg.finished(false);
6262
6263 return Err(match error {
6264 Ok(value) => common::Error::BadRequest(value),
6265 _ => common::Error::Failure(response),
6266 });
6267 }
6268 let response = {
6269 let bytes = common::to_bytes(body).await.unwrap_or_default();
6270 let encoded = common::to_string(&bytes);
6271 match serde_json::from_str(&encoded) {
6272 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6273 Err(error) => {
6274 dlg.response_json_decode_error(&encoded, &error);
6275 return Err(common::Error::JsonDecodeError(
6276 encoded.to_string(),
6277 error,
6278 ));
6279 }
6280 }
6281 };
6282
6283 dlg.finished(true);
6284 return Ok(response);
6285 }
6286 }
6287 }
6288 }
6289
6290 /// Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
6291 ///
6292 /// Sets the *parent* path property to the given value.
6293 ///
6294 /// Even though the property as already been set when instantiating this call,
6295 /// we provide this method for API completeness.
6296 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobListCall<'a, C> {
6297 self._parent = new_value.to_string();
6298 self
6299 }
6300 /// The starting point of a query result.
6301 ///
6302 /// Sets the *page token* query property to the given value.
6303 pub fn page_token(mut self, new_value: &str) -> ProjectTenantJobListCall<'a, C> {
6304 self._page_token = Some(new_value.to_string());
6305 self
6306 }
6307 /// The maximum number of jobs to be returned per page of results. If job_view is set to JobView.JOB_VIEW_ID_ONLY, the maximum allowed page size is 1000. Otherwise, the maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified.
6308 ///
6309 /// Sets the *page size* query property to the given value.
6310 pub fn page_size(mut self, new_value: i32) -> ProjectTenantJobListCall<'a, C> {
6311 self._page_size = Some(new_value);
6312 self
6313 }
6314 /// The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_FULL if no value is specified.
6315 ///
6316 /// Sets the *job view* query property to the given value.
6317 pub fn job_view(mut self, new_value: &str) -> ProjectTenantJobListCall<'a, C> {
6318 self._job_view = Some(new_value.to_string());
6319 self
6320 }
6321 /// Required. The filter string specifies the jobs to be enumerated. Supported operator: =, AND The fields eligible for filtering are: * `companyName` * `requisitionId` * `status` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified. At least one of `companyName` and `requisitionId` must present or an INVALID_ARGUMENT error is thrown. Sample Query: * companyName = "projects/foo/tenants/bar/companies/baz" * companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1" * companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED" * requisitionId = "req-1" * requisitionId = "req-1" AND status = "EXPIRED"
6322 ///
6323 /// Sets the *filter* query property to the given value.
6324 pub fn filter(mut self, new_value: &str) -> ProjectTenantJobListCall<'a, C> {
6325 self._filter = Some(new_value.to_string());
6326 self
6327 }
6328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6329 /// while executing the actual API request.
6330 ///
6331 /// ````text
6332 /// It should be used to handle progress information, and to implement a certain level of resilience.
6333 /// ````
6334 ///
6335 /// Sets the *delegate* property to the given value.
6336 pub fn delegate(
6337 mut self,
6338 new_value: &'a mut dyn common::Delegate,
6339 ) -> ProjectTenantJobListCall<'a, C> {
6340 self._delegate = Some(new_value);
6341 self
6342 }
6343
6344 /// Set any additional parameter of the query string used in the request.
6345 /// It should be used to set parameters which are not yet available through their own
6346 /// setters.
6347 ///
6348 /// Please note that this method must not be used to set any of the known parameters
6349 /// which have their own setter method. If done anyway, the request will fail.
6350 ///
6351 /// # Additional Parameters
6352 ///
6353 /// * *$.xgafv* (query-string) - V1 error format.
6354 /// * *access_token* (query-string) - OAuth access token.
6355 /// * *alt* (query-string) - Data format for response.
6356 /// * *callback* (query-string) - JSONP
6357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6358 /// * *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.
6359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6361 /// * *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.
6362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6364 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobListCall<'a, C>
6365 where
6366 T: AsRef<str>,
6367 {
6368 self._additional_params
6369 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6370 self
6371 }
6372
6373 /// Identifies the authorization scope for the method you are building.
6374 ///
6375 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6376 /// [`Scope::CloudPlatform`].
6377 ///
6378 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6379 /// tokens for more than one scope.
6380 ///
6381 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6382 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6383 /// sufficient, a read-write scope will do as well.
6384 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobListCall<'a, C>
6385 where
6386 St: AsRef<str>,
6387 {
6388 self._scopes.insert(String::from(scope.as_ref()));
6389 self
6390 }
6391 /// Identifies the authorization scope(s) for the method you are building.
6392 ///
6393 /// See [`Self::add_scope()`] for details.
6394 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobListCall<'a, C>
6395 where
6396 I: IntoIterator<Item = St>,
6397 St: AsRef<str>,
6398 {
6399 self._scopes
6400 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6401 self
6402 }
6403
6404 /// Removes all scopes, and no default scope will be used either.
6405 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6406 /// for details).
6407 pub fn clear_scopes(mut self) -> ProjectTenantJobListCall<'a, C> {
6408 self._scopes.clear();
6409 self
6410 }
6411}
6412
6413/// Updates specified job. Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
6414///
6415/// A builder for the *tenants.jobs.patch* method supported by a *project* resource.
6416/// It is not used directly, but through a [`ProjectMethods`] instance.
6417///
6418/// # Example
6419///
6420/// Instantiate a resource method builder
6421///
6422/// ```test_harness,no_run
6423/// # extern crate hyper;
6424/// # extern crate hyper_rustls;
6425/// # extern crate google_jobs4 as jobs4;
6426/// use jobs4::api::Job;
6427/// # async fn dox() {
6428/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6429///
6430/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6431/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6432/// # .with_native_roots()
6433/// # .unwrap()
6434/// # .https_only()
6435/// # .enable_http2()
6436/// # .build();
6437///
6438/// # let executor = hyper_util::rt::TokioExecutor::new();
6439/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6440/// # secret,
6441/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6442/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6443/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6444/// # ),
6445/// # ).build().await.unwrap();
6446///
6447/// # let client = hyper_util::client::legacy::Client::builder(
6448/// # hyper_util::rt::TokioExecutor::new()
6449/// # )
6450/// # .build(
6451/// # hyper_rustls::HttpsConnectorBuilder::new()
6452/// # .with_native_roots()
6453/// # .unwrap()
6454/// # .https_or_http()
6455/// # .enable_http2()
6456/// # .build()
6457/// # );
6458/// # let mut hub = CloudTalentSolution::new(client, auth);
6459/// // As the method needs a request, you would usually fill it with the desired information
6460/// // into the respective structure. Some of the parts shown here might not be applicable !
6461/// // Values shown here are possibly random and not representative !
6462/// let mut req = Job::default();
6463///
6464/// // You can configure optional parameters by calling the respective setters at will, and
6465/// // execute the final call using `doit()`.
6466/// // Values shown here are possibly random and not representative !
6467/// let result = hub.projects().tenants_jobs_patch(req, "name")
6468/// .update_mask(FieldMask::new::<&str>(&[]))
6469/// .doit().await;
6470/// # }
6471/// ```
6472pub struct ProjectTenantJobPatchCall<'a, C>
6473where
6474 C: 'a,
6475{
6476 hub: &'a CloudTalentSolution<C>,
6477 _request: Job,
6478 _name: String,
6479 _update_mask: Option<common::FieldMask>,
6480 _delegate: Option<&'a mut dyn common::Delegate>,
6481 _additional_params: HashMap<String, String>,
6482 _scopes: BTreeSet<String>,
6483}
6484
6485impl<'a, C> common::CallBuilder for ProjectTenantJobPatchCall<'a, C> {}
6486
6487impl<'a, C> ProjectTenantJobPatchCall<'a, C>
6488where
6489 C: common::Connector,
6490{
6491 /// Perform the operation you have build so far.
6492 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
6493 use std::borrow::Cow;
6494 use std::io::{Read, Seek};
6495
6496 use common::{url::Params, ToParts};
6497 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6498
6499 let mut dd = common::DefaultDelegate;
6500 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6501 dlg.begin(common::MethodInfo {
6502 id: "jobs.projects.tenants.jobs.patch",
6503 http_method: hyper::Method::PATCH,
6504 });
6505
6506 for &field in ["alt", "name", "updateMask"].iter() {
6507 if self._additional_params.contains_key(field) {
6508 dlg.finished(false);
6509 return Err(common::Error::FieldClash(field));
6510 }
6511 }
6512
6513 let mut params = Params::with_capacity(5 + self._additional_params.len());
6514 params.push("name", self._name);
6515 if let Some(value) = self._update_mask.as_ref() {
6516 params.push("updateMask", value.to_string());
6517 }
6518
6519 params.extend(self._additional_params.iter());
6520
6521 params.push("alt", "json");
6522 let mut url = self.hub._base_url.clone() + "v4/{+name}";
6523 if self._scopes.is_empty() {
6524 self._scopes
6525 .insert(Scope::CloudPlatform.as_ref().to_string());
6526 }
6527
6528 #[allow(clippy::single_element_loop)]
6529 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6530 url = params.uri_replacement(url, param_name, find_this, true);
6531 }
6532 {
6533 let to_remove = ["name"];
6534 params.remove_params(&to_remove);
6535 }
6536
6537 let url = params.parse_with_url(&url);
6538
6539 let mut json_mime_type = mime::APPLICATION_JSON;
6540 let mut request_value_reader = {
6541 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6542 common::remove_json_null_values(&mut value);
6543 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6544 serde_json::to_writer(&mut dst, &value).unwrap();
6545 dst
6546 };
6547 let request_size = request_value_reader
6548 .seek(std::io::SeekFrom::End(0))
6549 .unwrap();
6550 request_value_reader
6551 .seek(std::io::SeekFrom::Start(0))
6552 .unwrap();
6553
6554 loop {
6555 let token = match self
6556 .hub
6557 .auth
6558 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6559 .await
6560 {
6561 Ok(token) => token,
6562 Err(e) => match dlg.token(e) {
6563 Ok(token) => token,
6564 Err(e) => {
6565 dlg.finished(false);
6566 return Err(common::Error::MissingToken(e));
6567 }
6568 },
6569 };
6570 request_value_reader
6571 .seek(std::io::SeekFrom::Start(0))
6572 .unwrap();
6573 let mut req_result = {
6574 let client = &self.hub.client;
6575 dlg.pre_request();
6576 let mut req_builder = hyper::Request::builder()
6577 .method(hyper::Method::PATCH)
6578 .uri(url.as_str())
6579 .header(USER_AGENT, self.hub._user_agent.clone());
6580
6581 if let Some(token) = token.as_ref() {
6582 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6583 }
6584
6585 let request = req_builder
6586 .header(CONTENT_TYPE, json_mime_type.to_string())
6587 .header(CONTENT_LENGTH, request_size as u64)
6588 .body(common::to_body(
6589 request_value_reader.get_ref().clone().into(),
6590 ));
6591
6592 client.request(request.unwrap()).await
6593 };
6594
6595 match req_result {
6596 Err(err) => {
6597 if let common::Retry::After(d) = dlg.http_error(&err) {
6598 sleep(d).await;
6599 continue;
6600 }
6601 dlg.finished(false);
6602 return Err(common::Error::HttpError(err));
6603 }
6604 Ok(res) => {
6605 let (mut parts, body) = res.into_parts();
6606 let mut body = common::Body::new(body);
6607 if !parts.status.is_success() {
6608 let bytes = common::to_bytes(body).await.unwrap_or_default();
6609 let error = serde_json::from_str(&common::to_string(&bytes));
6610 let response = common::to_response(parts, bytes.into());
6611
6612 if let common::Retry::After(d) =
6613 dlg.http_failure(&response, error.as_ref().ok())
6614 {
6615 sleep(d).await;
6616 continue;
6617 }
6618
6619 dlg.finished(false);
6620
6621 return Err(match error {
6622 Ok(value) => common::Error::BadRequest(value),
6623 _ => common::Error::Failure(response),
6624 });
6625 }
6626 let response = {
6627 let bytes = common::to_bytes(body).await.unwrap_or_default();
6628 let encoded = common::to_string(&bytes);
6629 match serde_json::from_str(&encoded) {
6630 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6631 Err(error) => {
6632 dlg.response_json_decode_error(&encoded, &error);
6633 return Err(common::Error::JsonDecodeError(
6634 encoded.to_string(),
6635 error,
6636 ));
6637 }
6638 }
6639 };
6640
6641 dlg.finished(true);
6642 return Ok(response);
6643 }
6644 }
6645 }
6646 }
6647
6648 ///
6649 /// Sets the *request* property to the given value.
6650 ///
6651 /// Even though the property as already been set when instantiating this call,
6652 /// we provide this method for API completeness.
6653 pub fn request(mut self, new_value: Job) -> ProjectTenantJobPatchCall<'a, C> {
6654 self._request = new_value;
6655 self
6656 }
6657 /// Required during job update. The resource name for the job. This is generated by the service when a job is created. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
6658 ///
6659 /// Sets the *name* path property to the given value.
6660 ///
6661 /// Even though the property as already been set when instantiating this call,
6662 /// we provide this method for API completeness.
6663 pub fn name(mut self, new_value: &str) -> ProjectTenantJobPatchCall<'a, C> {
6664 self._name = new_value.to_string();
6665 self
6666 }
6667 /// Strongly recommended for the best service experience. If update_mask is provided, only the specified fields in job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported.
6668 ///
6669 /// Sets the *update mask* query property to the given value.
6670 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectTenantJobPatchCall<'a, C> {
6671 self._update_mask = Some(new_value);
6672 self
6673 }
6674 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6675 /// while executing the actual API request.
6676 ///
6677 /// ````text
6678 /// It should be used to handle progress information, and to implement a certain level of resilience.
6679 /// ````
6680 ///
6681 /// Sets the *delegate* property to the given value.
6682 pub fn delegate(
6683 mut self,
6684 new_value: &'a mut dyn common::Delegate,
6685 ) -> ProjectTenantJobPatchCall<'a, C> {
6686 self._delegate = Some(new_value);
6687 self
6688 }
6689
6690 /// Set any additional parameter of the query string used in the request.
6691 /// It should be used to set parameters which are not yet available through their own
6692 /// setters.
6693 ///
6694 /// Please note that this method must not be used to set any of the known parameters
6695 /// which have their own setter method. If done anyway, the request will fail.
6696 ///
6697 /// # Additional Parameters
6698 ///
6699 /// * *$.xgafv* (query-string) - V1 error format.
6700 /// * *access_token* (query-string) - OAuth access token.
6701 /// * *alt* (query-string) - Data format for response.
6702 /// * *callback* (query-string) - JSONP
6703 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6704 /// * *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.
6705 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6706 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6707 /// * *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.
6708 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6709 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6710 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobPatchCall<'a, C>
6711 where
6712 T: AsRef<str>,
6713 {
6714 self._additional_params
6715 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6716 self
6717 }
6718
6719 /// Identifies the authorization scope for the method you are building.
6720 ///
6721 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6722 /// [`Scope::CloudPlatform`].
6723 ///
6724 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6725 /// tokens for more than one scope.
6726 ///
6727 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6728 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6729 /// sufficient, a read-write scope will do as well.
6730 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobPatchCall<'a, C>
6731 where
6732 St: AsRef<str>,
6733 {
6734 self._scopes.insert(String::from(scope.as_ref()));
6735 self
6736 }
6737 /// Identifies the authorization scope(s) for the method you are building.
6738 ///
6739 /// See [`Self::add_scope()`] for details.
6740 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobPatchCall<'a, C>
6741 where
6742 I: IntoIterator<Item = St>,
6743 St: AsRef<str>,
6744 {
6745 self._scopes
6746 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6747 self
6748 }
6749
6750 /// Removes all scopes, and no default scope will be used either.
6751 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6752 /// for details).
6753 pub fn clear_scopes(mut self) -> ProjectTenantJobPatchCall<'a, C> {
6754 self._scopes.clear();
6755 self
6756 }
6757}
6758
6759/// Searches for jobs using the provided SearchJobsRequest. This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.
6760///
6761/// A builder for the *tenants.jobs.search* method supported by a *project* resource.
6762/// It is not used directly, but through a [`ProjectMethods`] instance.
6763///
6764/// # Example
6765///
6766/// Instantiate a resource method builder
6767///
6768/// ```test_harness,no_run
6769/// # extern crate hyper;
6770/// # extern crate hyper_rustls;
6771/// # extern crate google_jobs4 as jobs4;
6772/// use jobs4::api::SearchJobsRequest;
6773/// # async fn dox() {
6774/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6775///
6776/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6777/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6778/// # .with_native_roots()
6779/// # .unwrap()
6780/// # .https_only()
6781/// # .enable_http2()
6782/// # .build();
6783///
6784/// # let executor = hyper_util::rt::TokioExecutor::new();
6785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6786/// # secret,
6787/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6788/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6789/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6790/// # ),
6791/// # ).build().await.unwrap();
6792///
6793/// # let client = hyper_util::client::legacy::Client::builder(
6794/// # hyper_util::rt::TokioExecutor::new()
6795/// # )
6796/// # .build(
6797/// # hyper_rustls::HttpsConnectorBuilder::new()
6798/// # .with_native_roots()
6799/// # .unwrap()
6800/// # .https_or_http()
6801/// # .enable_http2()
6802/// # .build()
6803/// # );
6804/// # let mut hub = CloudTalentSolution::new(client, auth);
6805/// // As the method needs a request, you would usually fill it with the desired information
6806/// // into the respective structure. Some of the parts shown here might not be applicable !
6807/// // Values shown here are possibly random and not representative !
6808/// let mut req = SearchJobsRequest::default();
6809///
6810/// // You can configure optional parameters by calling the respective setters at will, and
6811/// // execute the final call using `doit()`.
6812/// // Values shown here are possibly random and not representative !
6813/// let result = hub.projects().tenants_jobs_search(req, "parent")
6814/// .doit().await;
6815/// # }
6816/// ```
6817pub struct ProjectTenantJobSearchCall<'a, C>
6818where
6819 C: 'a,
6820{
6821 hub: &'a CloudTalentSolution<C>,
6822 _request: SearchJobsRequest,
6823 _parent: String,
6824 _delegate: Option<&'a mut dyn common::Delegate>,
6825 _additional_params: HashMap<String, String>,
6826 _scopes: BTreeSet<String>,
6827}
6828
6829impl<'a, C> common::CallBuilder for ProjectTenantJobSearchCall<'a, C> {}
6830
6831impl<'a, C> ProjectTenantJobSearchCall<'a, C>
6832where
6833 C: common::Connector,
6834{
6835 /// Perform the operation you have build so far.
6836 pub async fn doit(mut self) -> common::Result<(common::Response, SearchJobsResponse)> {
6837 use std::borrow::Cow;
6838 use std::io::{Read, Seek};
6839
6840 use common::{url::Params, ToParts};
6841 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6842
6843 let mut dd = common::DefaultDelegate;
6844 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6845 dlg.begin(common::MethodInfo {
6846 id: "jobs.projects.tenants.jobs.search",
6847 http_method: hyper::Method::POST,
6848 });
6849
6850 for &field in ["alt", "parent"].iter() {
6851 if self._additional_params.contains_key(field) {
6852 dlg.finished(false);
6853 return Err(common::Error::FieldClash(field));
6854 }
6855 }
6856
6857 let mut params = Params::with_capacity(4 + self._additional_params.len());
6858 params.push("parent", self._parent);
6859
6860 params.extend(self._additional_params.iter());
6861
6862 params.push("alt", "json");
6863 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs:search";
6864 if self._scopes.is_empty() {
6865 self._scopes
6866 .insert(Scope::CloudPlatform.as_ref().to_string());
6867 }
6868
6869 #[allow(clippy::single_element_loop)]
6870 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6871 url = params.uri_replacement(url, param_name, find_this, true);
6872 }
6873 {
6874 let to_remove = ["parent"];
6875 params.remove_params(&to_remove);
6876 }
6877
6878 let url = params.parse_with_url(&url);
6879
6880 let mut json_mime_type = mime::APPLICATION_JSON;
6881 let mut request_value_reader = {
6882 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6883 common::remove_json_null_values(&mut value);
6884 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6885 serde_json::to_writer(&mut dst, &value).unwrap();
6886 dst
6887 };
6888 let request_size = request_value_reader
6889 .seek(std::io::SeekFrom::End(0))
6890 .unwrap();
6891 request_value_reader
6892 .seek(std::io::SeekFrom::Start(0))
6893 .unwrap();
6894
6895 loop {
6896 let token = match self
6897 .hub
6898 .auth
6899 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6900 .await
6901 {
6902 Ok(token) => token,
6903 Err(e) => match dlg.token(e) {
6904 Ok(token) => token,
6905 Err(e) => {
6906 dlg.finished(false);
6907 return Err(common::Error::MissingToken(e));
6908 }
6909 },
6910 };
6911 request_value_reader
6912 .seek(std::io::SeekFrom::Start(0))
6913 .unwrap();
6914 let mut req_result = {
6915 let client = &self.hub.client;
6916 dlg.pre_request();
6917 let mut req_builder = hyper::Request::builder()
6918 .method(hyper::Method::POST)
6919 .uri(url.as_str())
6920 .header(USER_AGENT, self.hub._user_agent.clone());
6921
6922 if let Some(token) = token.as_ref() {
6923 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6924 }
6925
6926 let request = req_builder
6927 .header(CONTENT_TYPE, json_mime_type.to_string())
6928 .header(CONTENT_LENGTH, request_size as u64)
6929 .body(common::to_body(
6930 request_value_reader.get_ref().clone().into(),
6931 ));
6932
6933 client.request(request.unwrap()).await
6934 };
6935
6936 match req_result {
6937 Err(err) => {
6938 if let common::Retry::After(d) = dlg.http_error(&err) {
6939 sleep(d).await;
6940 continue;
6941 }
6942 dlg.finished(false);
6943 return Err(common::Error::HttpError(err));
6944 }
6945 Ok(res) => {
6946 let (mut parts, body) = res.into_parts();
6947 let mut body = common::Body::new(body);
6948 if !parts.status.is_success() {
6949 let bytes = common::to_bytes(body).await.unwrap_or_default();
6950 let error = serde_json::from_str(&common::to_string(&bytes));
6951 let response = common::to_response(parts, bytes.into());
6952
6953 if let common::Retry::After(d) =
6954 dlg.http_failure(&response, error.as_ref().ok())
6955 {
6956 sleep(d).await;
6957 continue;
6958 }
6959
6960 dlg.finished(false);
6961
6962 return Err(match error {
6963 Ok(value) => common::Error::BadRequest(value),
6964 _ => common::Error::Failure(response),
6965 });
6966 }
6967 let response = {
6968 let bytes = common::to_bytes(body).await.unwrap_or_default();
6969 let encoded = common::to_string(&bytes);
6970 match serde_json::from_str(&encoded) {
6971 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6972 Err(error) => {
6973 dlg.response_json_decode_error(&encoded, &error);
6974 return Err(common::Error::JsonDecodeError(
6975 encoded.to_string(),
6976 error,
6977 ));
6978 }
6979 }
6980 };
6981
6982 dlg.finished(true);
6983 return Ok(response);
6984 }
6985 }
6986 }
6987 }
6988
6989 ///
6990 /// Sets the *request* property to the given value.
6991 ///
6992 /// Even though the property as already been set when instantiating this call,
6993 /// we provide this method for API completeness.
6994 pub fn request(mut self, new_value: SearchJobsRequest) -> ProjectTenantJobSearchCall<'a, C> {
6995 self._request = new_value;
6996 self
6997 }
6998 /// Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
6999 ///
7000 /// Sets the *parent* path property to the given value.
7001 ///
7002 /// Even though the property as already been set when instantiating this call,
7003 /// we provide this method for API completeness.
7004 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobSearchCall<'a, C> {
7005 self._parent = new_value.to_string();
7006 self
7007 }
7008 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7009 /// while executing the actual API request.
7010 ///
7011 /// ````text
7012 /// It should be used to handle progress information, and to implement a certain level of resilience.
7013 /// ````
7014 ///
7015 /// Sets the *delegate* property to the given value.
7016 pub fn delegate(
7017 mut self,
7018 new_value: &'a mut dyn common::Delegate,
7019 ) -> ProjectTenantJobSearchCall<'a, C> {
7020 self._delegate = Some(new_value);
7021 self
7022 }
7023
7024 /// Set any additional parameter of the query string used in the request.
7025 /// It should be used to set parameters which are not yet available through their own
7026 /// setters.
7027 ///
7028 /// Please note that this method must not be used to set any of the known parameters
7029 /// which have their own setter method. If done anyway, the request will fail.
7030 ///
7031 /// # Additional Parameters
7032 ///
7033 /// * *$.xgafv* (query-string) - V1 error format.
7034 /// * *access_token* (query-string) - OAuth access token.
7035 /// * *alt* (query-string) - Data format for response.
7036 /// * *callback* (query-string) - JSONP
7037 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7038 /// * *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.
7039 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7040 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7041 /// * *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.
7042 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7043 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7044 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobSearchCall<'a, C>
7045 where
7046 T: AsRef<str>,
7047 {
7048 self._additional_params
7049 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7050 self
7051 }
7052
7053 /// Identifies the authorization scope for the method you are building.
7054 ///
7055 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7056 /// [`Scope::CloudPlatform`].
7057 ///
7058 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7059 /// tokens for more than one scope.
7060 ///
7061 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7062 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7063 /// sufficient, a read-write scope will do as well.
7064 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobSearchCall<'a, C>
7065 where
7066 St: AsRef<str>,
7067 {
7068 self._scopes.insert(String::from(scope.as_ref()));
7069 self
7070 }
7071 /// Identifies the authorization scope(s) for the method you are building.
7072 ///
7073 /// See [`Self::add_scope()`] for details.
7074 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobSearchCall<'a, C>
7075 where
7076 I: IntoIterator<Item = St>,
7077 St: AsRef<str>,
7078 {
7079 self._scopes
7080 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7081 self
7082 }
7083
7084 /// Removes all scopes, and no default scope will be used either.
7085 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7086 /// for details).
7087 pub fn clear_scopes(mut self) -> ProjectTenantJobSearchCall<'a, C> {
7088 self._scopes.clear();
7089 self
7090 }
7091}
7092
7093/// Searches for jobs using the provided SearchJobsRequest. This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), it has different algorithmic adjustments that are designed to specifically target passive job seekers. This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.
7094///
7095/// A builder for the *tenants.jobs.searchForAlert* method supported by a *project* resource.
7096/// It is not used directly, but through a [`ProjectMethods`] instance.
7097///
7098/// # Example
7099///
7100/// Instantiate a resource method builder
7101///
7102/// ```test_harness,no_run
7103/// # extern crate hyper;
7104/// # extern crate hyper_rustls;
7105/// # extern crate google_jobs4 as jobs4;
7106/// use jobs4::api::SearchJobsRequest;
7107/// # async fn dox() {
7108/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7109///
7110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7111/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7112/// # .with_native_roots()
7113/// # .unwrap()
7114/// # .https_only()
7115/// # .enable_http2()
7116/// # .build();
7117///
7118/// # let executor = hyper_util::rt::TokioExecutor::new();
7119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7120/// # secret,
7121/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7122/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7123/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7124/// # ),
7125/// # ).build().await.unwrap();
7126///
7127/// # let client = hyper_util::client::legacy::Client::builder(
7128/// # hyper_util::rt::TokioExecutor::new()
7129/// # )
7130/// # .build(
7131/// # hyper_rustls::HttpsConnectorBuilder::new()
7132/// # .with_native_roots()
7133/// # .unwrap()
7134/// # .https_or_http()
7135/// # .enable_http2()
7136/// # .build()
7137/// # );
7138/// # let mut hub = CloudTalentSolution::new(client, auth);
7139/// // As the method needs a request, you would usually fill it with the desired information
7140/// // into the respective structure. Some of the parts shown here might not be applicable !
7141/// // Values shown here are possibly random and not representative !
7142/// let mut req = SearchJobsRequest::default();
7143///
7144/// // You can configure optional parameters by calling the respective setters at will, and
7145/// // execute the final call using `doit()`.
7146/// // Values shown here are possibly random and not representative !
7147/// let result = hub.projects().tenants_jobs_search_for_alert(req, "parent")
7148/// .doit().await;
7149/// # }
7150/// ```
7151pub struct ProjectTenantJobSearchForAlertCall<'a, C>
7152where
7153 C: 'a,
7154{
7155 hub: &'a CloudTalentSolution<C>,
7156 _request: SearchJobsRequest,
7157 _parent: String,
7158 _delegate: Option<&'a mut dyn common::Delegate>,
7159 _additional_params: HashMap<String, String>,
7160 _scopes: BTreeSet<String>,
7161}
7162
7163impl<'a, C> common::CallBuilder for ProjectTenantJobSearchForAlertCall<'a, C> {}
7164
7165impl<'a, C> ProjectTenantJobSearchForAlertCall<'a, C>
7166where
7167 C: common::Connector,
7168{
7169 /// Perform the operation you have build so far.
7170 pub async fn doit(mut self) -> common::Result<(common::Response, SearchJobsResponse)> {
7171 use std::borrow::Cow;
7172 use std::io::{Read, Seek};
7173
7174 use common::{url::Params, ToParts};
7175 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7176
7177 let mut dd = common::DefaultDelegate;
7178 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7179 dlg.begin(common::MethodInfo {
7180 id: "jobs.projects.tenants.jobs.searchForAlert",
7181 http_method: hyper::Method::POST,
7182 });
7183
7184 for &field in ["alt", "parent"].iter() {
7185 if self._additional_params.contains_key(field) {
7186 dlg.finished(false);
7187 return Err(common::Error::FieldClash(field));
7188 }
7189 }
7190
7191 let mut params = Params::with_capacity(4 + self._additional_params.len());
7192 params.push("parent", self._parent);
7193
7194 params.extend(self._additional_params.iter());
7195
7196 params.push("alt", "json");
7197 let mut url = self.hub._base_url.clone() + "v4/{+parent}/jobs:searchForAlert";
7198 if self._scopes.is_empty() {
7199 self._scopes
7200 .insert(Scope::CloudPlatform.as_ref().to_string());
7201 }
7202
7203 #[allow(clippy::single_element_loop)]
7204 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7205 url = params.uri_replacement(url, param_name, find_this, true);
7206 }
7207 {
7208 let to_remove = ["parent"];
7209 params.remove_params(&to_remove);
7210 }
7211
7212 let url = params.parse_with_url(&url);
7213
7214 let mut json_mime_type = mime::APPLICATION_JSON;
7215 let mut request_value_reader = {
7216 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7217 common::remove_json_null_values(&mut value);
7218 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7219 serde_json::to_writer(&mut dst, &value).unwrap();
7220 dst
7221 };
7222 let request_size = request_value_reader
7223 .seek(std::io::SeekFrom::End(0))
7224 .unwrap();
7225 request_value_reader
7226 .seek(std::io::SeekFrom::Start(0))
7227 .unwrap();
7228
7229 loop {
7230 let token = match self
7231 .hub
7232 .auth
7233 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7234 .await
7235 {
7236 Ok(token) => token,
7237 Err(e) => match dlg.token(e) {
7238 Ok(token) => token,
7239 Err(e) => {
7240 dlg.finished(false);
7241 return Err(common::Error::MissingToken(e));
7242 }
7243 },
7244 };
7245 request_value_reader
7246 .seek(std::io::SeekFrom::Start(0))
7247 .unwrap();
7248 let mut req_result = {
7249 let client = &self.hub.client;
7250 dlg.pre_request();
7251 let mut req_builder = hyper::Request::builder()
7252 .method(hyper::Method::POST)
7253 .uri(url.as_str())
7254 .header(USER_AGENT, self.hub._user_agent.clone());
7255
7256 if let Some(token) = token.as_ref() {
7257 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7258 }
7259
7260 let request = req_builder
7261 .header(CONTENT_TYPE, json_mime_type.to_string())
7262 .header(CONTENT_LENGTH, request_size as u64)
7263 .body(common::to_body(
7264 request_value_reader.get_ref().clone().into(),
7265 ));
7266
7267 client.request(request.unwrap()).await
7268 };
7269
7270 match req_result {
7271 Err(err) => {
7272 if let common::Retry::After(d) = dlg.http_error(&err) {
7273 sleep(d).await;
7274 continue;
7275 }
7276 dlg.finished(false);
7277 return Err(common::Error::HttpError(err));
7278 }
7279 Ok(res) => {
7280 let (mut parts, body) = res.into_parts();
7281 let mut body = common::Body::new(body);
7282 if !parts.status.is_success() {
7283 let bytes = common::to_bytes(body).await.unwrap_or_default();
7284 let error = serde_json::from_str(&common::to_string(&bytes));
7285 let response = common::to_response(parts, bytes.into());
7286
7287 if let common::Retry::After(d) =
7288 dlg.http_failure(&response, error.as_ref().ok())
7289 {
7290 sleep(d).await;
7291 continue;
7292 }
7293
7294 dlg.finished(false);
7295
7296 return Err(match error {
7297 Ok(value) => common::Error::BadRequest(value),
7298 _ => common::Error::Failure(response),
7299 });
7300 }
7301 let response = {
7302 let bytes = common::to_bytes(body).await.unwrap_or_default();
7303 let encoded = common::to_string(&bytes);
7304 match serde_json::from_str(&encoded) {
7305 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7306 Err(error) => {
7307 dlg.response_json_decode_error(&encoded, &error);
7308 return Err(common::Error::JsonDecodeError(
7309 encoded.to_string(),
7310 error,
7311 ));
7312 }
7313 }
7314 };
7315
7316 dlg.finished(true);
7317 return Ok(response);
7318 }
7319 }
7320 }
7321 }
7322
7323 ///
7324 /// Sets the *request* property to the given value.
7325 ///
7326 /// Even though the property as already been set when instantiating this call,
7327 /// we provide this method for API completeness.
7328 pub fn request(
7329 mut self,
7330 new_value: SearchJobsRequest,
7331 ) -> ProjectTenantJobSearchForAlertCall<'a, C> {
7332 self._request = new_value;
7333 self
7334 }
7335 /// Required. The resource name of the tenant to search within. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar".
7336 ///
7337 /// Sets the *parent* path property to the given value.
7338 ///
7339 /// Even though the property as already been set when instantiating this call,
7340 /// we provide this method for API completeness.
7341 pub fn parent(mut self, new_value: &str) -> ProjectTenantJobSearchForAlertCall<'a, C> {
7342 self._parent = new_value.to_string();
7343 self
7344 }
7345 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7346 /// while executing the actual API request.
7347 ///
7348 /// ````text
7349 /// It should be used to handle progress information, and to implement a certain level of resilience.
7350 /// ````
7351 ///
7352 /// Sets the *delegate* property to the given value.
7353 pub fn delegate(
7354 mut self,
7355 new_value: &'a mut dyn common::Delegate,
7356 ) -> ProjectTenantJobSearchForAlertCall<'a, C> {
7357 self._delegate = Some(new_value);
7358 self
7359 }
7360
7361 /// Set any additional parameter of the query string used in the request.
7362 /// It should be used to set parameters which are not yet available through their own
7363 /// setters.
7364 ///
7365 /// Please note that this method must not be used to set any of the known parameters
7366 /// which have their own setter method. If done anyway, the request will fail.
7367 ///
7368 /// # Additional Parameters
7369 ///
7370 /// * *$.xgafv* (query-string) - V1 error format.
7371 /// * *access_token* (query-string) - OAuth access token.
7372 /// * *alt* (query-string) - Data format for response.
7373 /// * *callback* (query-string) - JSONP
7374 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7375 /// * *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.
7376 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7377 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7378 /// * *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.
7379 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7380 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7381 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantJobSearchForAlertCall<'a, C>
7382 where
7383 T: AsRef<str>,
7384 {
7385 self._additional_params
7386 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7387 self
7388 }
7389
7390 /// Identifies the authorization scope for the method you are building.
7391 ///
7392 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7393 /// [`Scope::CloudPlatform`].
7394 ///
7395 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7396 /// tokens for more than one scope.
7397 ///
7398 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7399 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7400 /// sufficient, a read-write scope will do as well.
7401 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantJobSearchForAlertCall<'a, C>
7402 where
7403 St: AsRef<str>,
7404 {
7405 self._scopes.insert(String::from(scope.as_ref()));
7406 self
7407 }
7408 /// Identifies the authorization scope(s) for the method you are building.
7409 ///
7410 /// See [`Self::add_scope()`] for details.
7411 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantJobSearchForAlertCall<'a, C>
7412 where
7413 I: IntoIterator<Item = St>,
7414 St: AsRef<str>,
7415 {
7416 self._scopes
7417 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7418 self
7419 }
7420
7421 /// Removes all scopes, and no default scope will be used either.
7422 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7423 /// for details).
7424 pub fn clear_scopes(mut self) -> ProjectTenantJobSearchForAlertCall<'a, C> {
7425 self._scopes.clear();
7426 self
7427 }
7428}
7429
7430/// Completes the specified prefix with keyword suggestions. Intended for use by a job search auto-complete search box.
7431///
7432/// A builder for the *tenants.completeQuery* method supported by a *project* resource.
7433/// It is not used directly, but through a [`ProjectMethods`] instance.
7434///
7435/// # Example
7436///
7437/// Instantiate a resource method builder
7438///
7439/// ```test_harness,no_run
7440/// # extern crate hyper;
7441/// # extern crate hyper_rustls;
7442/// # extern crate google_jobs4 as jobs4;
7443/// # async fn dox() {
7444/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7445///
7446/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7447/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7448/// # .with_native_roots()
7449/// # .unwrap()
7450/// # .https_only()
7451/// # .enable_http2()
7452/// # .build();
7453///
7454/// # let executor = hyper_util::rt::TokioExecutor::new();
7455/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7456/// # secret,
7457/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7458/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7459/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7460/// # ),
7461/// # ).build().await.unwrap();
7462///
7463/// # let client = hyper_util::client::legacy::Client::builder(
7464/// # hyper_util::rt::TokioExecutor::new()
7465/// # )
7466/// # .build(
7467/// # hyper_rustls::HttpsConnectorBuilder::new()
7468/// # .with_native_roots()
7469/// # .unwrap()
7470/// # .https_or_http()
7471/// # .enable_http2()
7472/// # .build()
7473/// # );
7474/// # let mut hub = CloudTalentSolution::new(client, auth);
7475/// // You can configure optional parameters by calling the respective setters at will, and
7476/// // execute the final call using `doit()`.
7477/// // Values shown here are possibly random and not representative !
7478/// let result = hub.projects().tenants_complete_query("tenant")
7479/// .type_("est")
7480/// .scope("ipsum")
7481/// .query("ipsum")
7482/// .page_size(-7)
7483/// .add_language_codes("gubergren")
7484/// .company("ea")
7485/// .doit().await;
7486/// # }
7487/// ```
7488pub struct ProjectTenantCompleteQueryCall<'a, C>
7489where
7490 C: 'a,
7491{
7492 hub: &'a CloudTalentSolution<C>,
7493 _tenant: String,
7494 _type_: Option<String>,
7495 _scope: Option<String>,
7496 _query: Option<String>,
7497 _page_size: Option<i32>,
7498 _language_codes: Vec<String>,
7499 _company: Option<String>,
7500 _delegate: Option<&'a mut dyn common::Delegate>,
7501 _additional_params: HashMap<String, String>,
7502 _scopes: BTreeSet<String>,
7503}
7504
7505impl<'a, C> common::CallBuilder for ProjectTenantCompleteQueryCall<'a, C> {}
7506
7507impl<'a, C> ProjectTenantCompleteQueryCall<'a, C>
7508where
7509 C: common::Connector,
7510{
7511 /// Perform the operation you have build so far.
7512 pub async fn doit(mut self) -> common::Result<(common::Response, CompleteQueryResponse)> {
7513 use std::borrow::Cow;
7514 use std::io::{Read, Seek};
7515
7516 use common::{url::Params, ToParts};
7517 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7518
7519 let mut dd = common::DefaultDelegate;
7520 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7521 dlg.begin(common::MethodInfo {
7522 id: "jobs.projects.tenants.completeQuery",
7523 http_method: hyper::Method::GET,
7524 });
7525
7526 for &field in [
7527 "alt",
7528 "tenant",
7529 "type",
7530 "scope",
7531 "query",
7532 "pageSize",
7533 "languageCodes",
7534 "company",
7535 ]
7536 .iter()
7537 {
7538 if self._additional_params.contains_key(field) {
7539 dlg.finished(false);
7540 return Err(common::Error::FieldClash(field));
7541 }
7542 }
7543
7544 let mut params = Params::with_capacity(9 + self._additional_params.len());
7545 params.push("tenant", self._tenant);
7546 if let Some(value) = self._type_.as_ref() {
7547 params.push("type", value);
7548 }
7549 if let Some(value) = self._scope.as_ref() {
7550 params.push("scope", value);
7551 }
7552 if let Some(value) = self._query.as_ref() {
7553 params.push("query", value);
7554 }
7555 if let Some(value) = self._page_size.as_ref() {
7556 params.push("pageSize", value.to_string());
7557 }
7558 if !self._language_codes.is_empty() {
7559 for f in self._language_codes.iter() {
7560 params.push("languageCodes", f);
7561 }
7562 }
7563 if let Some(value) = self._company.as_ref() {
7564 params.push("company", value);
7565 }
7566
7567 params.extend(self._additional_params.iter());
7568
7569 params.push("alt", "json");
7570 let mut url = self.hub._base_url.clone() + "v4/{+tenant}:completeQuery";
7571 if self._scopes.is_empty() {
7572 self._scopes
7573 .insert(Scope::CloudPlatform.as_ref().to_string());
7574 }
7575
7576 #[allow(clippy::single_element_loop)]
7577 for &(find_this, param_name) in [("{+tenant}", "tenant")].iter() {
7578 url = params.uri_replacement(url, param_name, find_this, true);
7579 }
7580 {
7581 let to_remove = ["tenant"];
7582 params.remove_params(&to_remove);
7583 }
7584
7585 let url = params.parse_with_url(&url);
7586
7587 loop {
7588 let token = match self
7589 .hub
7590 .auth
7591 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7592 .await
7593 {
7594 Ok(token) => token,
7595 Err(e) => match dlg.token(e) {
7596 Ok(token) => token,
7597 Err(e) => {
7598 dlg.finished(false);
7599 return Err(common::Error::MissingToken(e));
7600 }
7601 },
7602 };
7603 let mut req_result = {
7604 let client = &self.hub.client;
7605 dlg.pre_request();
7606 let mut req_builder = hyper::Request::builder()
7607 .method(hyper::Method::GET)
7608 .uri(url.as_str())
7609 .header(USER_AGENT, self.hub._user_agent.clone());
7610
7611 if let Some(token) = token.as_ref() {
7612 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7613 }
7614
7615 let request = req_builder
7616 .header(CONTENT_LENGTH, 0_u64)
7617 .body(common::to_body::<String>(None));
7618
7619 client.request(request.unwrap()).await
7620 };
7621
7622 match req_result {
7623 Err(err) => {
7624 if let common::Retry::After(d) = dlg.http_error(&err) {
7625 sleep(d).await;
7626 continue;
7627 }
7628 dlg.finished(false);
7629 return Err(common::Error::HttpError(err));
7630 }
7631 Ok(res) => {
7632 let (mut parts, body) = res.into_parts();
7633 let mut body = common::Body::new(body);
7634 if !parts.status.is_success() {
7635 let bytes = common::to_bytes(body).await.unwrap_or_default();
7636 let error = serde_json::from_str(&common::to_string(&bytes));
7637 let response = common::to_response(parts, bytes.into());
7638
7639 if let common::Retry::After(d) =
7640 dlg.http_failure(&response, error.as_ref().ok())
7641 {
7642 sleep(d).await;
7643 continue;
7644 }
7645
7646 dlg.finished(false);
7647
7648 return Err(match error {
7649 Ok(value) => common::Error::BadRequest(value),
7650 _ => common::Error::Failure(response),
7651 });
7652 }
7653 let response = {
7654 let bytes = common::to_bytes(body).await.unwrap_or_default();
7655 let encoded = common::to_string(&bytes);
7656 match serde_json::from_str(&encoded) {
7657 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7658 Err(error) => {
7659 dlg.response_json_decode_error(&encoded, &error);
7660 return Err(common::Error::JsonDecodeError(
7661 encoded.to_string(),
7662 error,
7663 ));
7664 }
7665 }
7666 };
7667
7668 dlg.finished(true);
7669 return Ok(response);
7670 }
7671 }
7672 }
7673 }
7674
7675 /// Required. Resource name of tenant the completion is performed within. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
7676 ///
7677 /// Sets the *tenant* path property to the given value.
7678 ///
7679 /// Even though the property as already been set when instantiating this call,
7680 /// we provide this method for API completeness.
7681 pub fn tenant(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7682 self._tenant = new_value.to_string();
7683 self
7684 }
7685 /// The completion topic. The default is CompletionType.COMBINED.
7686 ///
7687 /// Sets the *type* query property to the given value.
7688 pub fn type_(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7689 self._type_ = Some(new_value.to_string());
7690 self
7691 }
7692 /// The scope of the completion. The defaults is CompletionScope.PUBLIC.
7693 ///
7694 /// Sets the *scope* query property to the given value.
7695 pub fn scope(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7696 self._scope = Some(new_value.to_string());
7697 self
7698 }
7699 /// Required. The query used to generate suggestions. The maximum number of allowed characters is 255.
7700 ///
7701 /// Sets the *query* query property to the given value.
7702 pub fn query(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7703 self._query = Some(new_value.to_string());
7704 self
7705 }
7706 /// Required. Completion result count. The maximum allowed page size is 10.
7707 ///
7708 /// Sets the *page size* query property to the given value.
7709 pub fn page_size(mut self, new_value: i32) -> ProjectTenantCompleteQueryCall<'a, C> {
7710 self._page_size = Some(new_value);
7711 self
7712 }
7713 /// The list of languages of the query. This is the BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see [Tags for Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum number of allowed characters is 255.
7714 ///
7715 /// Append the given value to the *language codes* query property.
7716 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
7717 pub fn add_language_codes(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7718 self._language_codes.push(new_value.to_string());
7719 self
7720 }
7721 /// If provided, restricts completion to specified company. The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz".
7722 ///
7723 /// Sets the *company* query property to the given value.
7724 pub fn company(mut self, new_value: &str) -> ProjectTenantCompleteQueryCall<'a, C> {
7725 self._company = Some(new_value.to_string());
7726 self
7727 }
7728 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7729 /// while executing the actual API request.
7730 ///
7731 /// ````text
7732 /// It should be used to handle progress information, and to implement a certain level of resilience.
7733 /// ````
7734 ///
7735 /// Sets the *delegate* property to the given value.
7736 pub fn delegate(
7737 mut self,
7738 new_value: &'a mut dyn common::Delegate,
7739 ) -> ProjectTenantCompleteQueryCall<'a, C> {
7740 self._delegate = Some(new_value);
7741 self
7742 }
7743
7744 /// Set any additional parameter of the query string used in the request.
7745 /// It should be used to set parameters which are not yet available through their own
7746 /// setters.
7747 ///
7748 /// Please note that this method must not be used to set any of the known parameters
7749 /// which have their own setter method. If done anyway, the request will fail.
7750 ///
7751 /// # Additional Parameters
7752 ///
7753 /// * *$.xgafv* (query-string) - V1 error format.
7754 /// * *access_token* (query-string) - OAuth access token.
7755 /// * *alt* (query-string) - Data format for response.
7756 /// * *callback* (query-string) - JSONP
7757 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7758 /// * *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.
7759 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7760 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7761 /// * *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.
7762 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7763 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7764 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCompleteQueryCall<'a, C>
7765 where
7766 T: AsRef<str>,
7767 {
7768 self._additional_params
7769 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7770 self
7771 }
7772
7773 /// Identifies the authorization scope for the method you are building.
7774 ///
7775 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7776 /// [`Scope::CloudPlatform`].
7777 ///
7778 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7779 /// tokens for more than one scope.
7780 ///
7781 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7782 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7783 /// sufficient, a read-write scope will do as well.
7784 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCompleteQueryCall<'a, C>
7785 where
7786 St: AsRef<str>,
7787 {
7788 self._scopes.insert(String::from(scope.as_ref()));
7789 self
7790 }
7791 /// Identifies the authorization scope(s) for the method you are building.
7792 ///
7793 /// See [`Self::add_scope()`] for details.
7794 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCompleteQueryCall<'a, C>
7795 where
7796 I: IntoIterator<Item = St>,
7797 St: AsRef<str>,
7798 {
7799 self._scopes
7800 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7801 self
7802 }
7803
7804 /// Removes all scopes, and no default scope will be used either.
7805 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7806 /// for details).
7807 pub fn clear_scopes(mut self) -> ProjectTenantCompleteQueryCall<'a, C> {
7808 self._scopes.clear();
7809 self
7810 }
7811}
7812
7813/// Creates a new tenant entity.
7814///
7815/// A builder for the *tenants.create* method supported by a *project* resource.
7816/// It is not used directly, but through a [`ProjectMethods`] instance.
7817///
7818/// # Example
7819///
7820/// Instantiate a resource method builder
7821///
7822/// ```test_harness,no_run
7823/// # extern crate hyper;
7824/// # extern crate hyper_rustls;
7825/// # extern crate google_jobs4 as jobs4;
7826/// use jobs4::api::Tenant;
7827/// # async fn dox() {
7828/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7829///
7830/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7831/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7832/// # .with_native_roots()
7833/// # .unwrap()
7834/// # .https_only()
7835/// # .enable_http2()
7836/// # .build();
7837///
7838/// # let executor = hyper_util::rt::TokioExecutor::new();
7839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7840/// # secret,
7841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7842/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7843/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7844/// # ),
7845/// # ).build().await.unwrap();
7846///
7847/// # let client = hyper_util::client::legacy::Client::builder(
7848/// # hyper_util::rt::TokioExecutor::new()
7849/// # )
7850/// # .build(
7851/// # hyper_rustls::HttpsConnectorBuilder::new()
7852/// # .with_native_roots()
7853/// # .unwrap()
7854/// # .https_or_http()
7855/// # .enable_http2()
7856/// # .build()
7857/// # );
7858/// # let mut hub = CloudTalentSolution::new(client, auth);
7859/// // As the method needs a request, you would usually fill it with the desired information
7860/// // into the respective structure. Some of the parts shown here might not be applicable !
7861/// // Values shown here are possibly random and not representative !
7862/// let mut req = Tenant::default();
7863///
7864/// // You can configure optional parameters by calling the respective setters at will, and
7865/// // execute the final call using `doit()`.
7866/// // Values shown here are possibly random and not representative !
7867/// let result = hub.projects().tenants_create(req, "parent")
7868/// .doit().await;
7869/// # }
7870/// ```
7871pub struct ProjectTenantCreateCall<'a, C>
7872where
7873 C: 'a,
7874{
7875 hub: &'a CloudTalentSolution<C>,
7876 _request: Tenant,
7877 _parent: String,
7878 _delegate: Option<&'a mut dyn common::Delegate>,
7879 _additional_params: HashMap<String, String>,
7880 _scopes: BTreeSet<String>,
7881}
7882
7883impl<'a, C> common::CallBuilder for ProjectTenantCreateCall<'a, C> {}
7884
7885impl<'a, C> ProjectTenantCreateCall<'a, C>
7886where
7887 C: common::Connector,
7888{
7889 /// Perform the operation you have build so far.
7890 pub async fn doit(mut self) -> common::Result<(common::Response, Tenant)> {
7891 use std::borrow::Cow;
7892 use std::io::{Read, Seek};
7893
7894 use common::{url::Params, ToParts};
7895 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7896
7897 let mut dd = common::DefaultDelegate;
7898 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7899 dlg.begin(common::MethodInfo {
7900 id: "jobs.projects.tenants.create",
7901 http_method: hyper::Method::POST,
7902 });
7903
7904 for &field in ["alt", "parent"].iter() {
7905 if self._additional_params.contains_key(field) {
7906 dlg.finished(false);
7907 return Err(common::Error::FieldClash(field));
7908 }
7909 }
7910
7911 let mut params = Params::with_capacity(4 + self._additional_params.len());
7912 params.push("parent", self._parent);
7913
7914 params.extend(self._additional_params.iter());
7915
7916 params.push("alt", "json");
7917 let mut url = self.hub._base_url.clone() + "v4/{+parent}/tenants";
7918 if self._scopes.is_empty() {
7919 self._scopes
7920 .insert(Scope::CloudPlatform.as_ref().to_string());
7921 }
7922
7923 #[allow(clippy::single_element_loop)]
7924 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7925 url = params.uri_replacement(url, param_name, find_this, true);
7926 }
7927 {
7928 let to_remove = ["parent"];
7929 params.remove_params(&to_remove);
7930 }
7931
7932 let url = params.parse_with_url(&url);
7933
7934 let mut json_mime_type = mime::APPLICATION_JSON;
7935 let mut request_value_reader = {
7936 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7937 common::remove_json_null_values(&mut value);
7938 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7939 serde_json::to_writer(&mut dst, &value).unwrap();
7940 dst
7941 };
7942 let request_size = request_value_reader
7943 .seek(std::io::SeekFrom::End(0))
7944 .unwrap();
7945 request_value_reader
7946 .seek(std::io::SeekFrom::Start(0))
7947 .unwrap();
7948
7949 loop {
7950 let token = match self
7951 .hub
7952 .auth
7953 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7954 .await
7955 {
7956 Ok(token) => token,
7957 Err(e) => match dlg.token(e) {
7958 Ok(token) => token,
7959 Err(e) => {
7960 dlg.finished(false);
7961 return Err(common::Error::MissingToken(e));
7962 }
7963 },
7964 };
7965 request_value_reader
7966 .seek(std::io::SeekFrom::Start(0))
7967 .unwrap();
7968 let mut req_result = {
7969 let client = &self.hub.client;
7970 dlg.pre_request();
7971 let mut req_builder = hyper::Request::builder()
7972 .method(hyper::Method::POST)
7973 .uri(url.as_str())
7974 .header(USER_AGENT, self.hub._user_agent.clone());
7975
7976 if let Some(token) = token.as_ref() {
7977 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7978 }
7979
7980 let request = req_builder
7981 .header(CONTENT_TYPE, json_mime_type.to_string())
7982 .header(CONTENT_LENGTH, request_size as u64)
7983 .body(common::to_body(
7984 request_value_reader.get_ref().clone().into(),
7985 ));
7986
7987 client.request(request.unwrap()).await
7988 };
7989
7990 match req_result {
7991 Err(err) => {
7992 if let common::Retry::After(d) = dlg.http_error(&err) {
7993 sleep(d).await;
7994 continue;
7995 }
7996 dlg.finished(false);
7997 return Err(common::Error::HttpError(err));
7998 }
7999 Ok(res) => {
8000 let (mut parts, body) = res.into_parts();
8001 let mut body = common::Body::new(body);
8002 if !parts.status.is_success() {
8003 let bytes = common::to_bytes(body).await.unwrap_or_default();
8004 let error = serde_json::from_str(&common::to_string(&bytes));
8005 let response = common::to_response(parts, bytes.into());
8006
8007 if let common::Retry::After(d) =
8008 dlg.http_failure(&response, error.as_ref().ok())
8009 {
8010 sleep(d).await;
8011 continue;
8012 }
8013
8014 dlg.finished(false);
8015
8016 return Err(match error {
8017 Ok(value) => common::Error::BadRequest(value),
8018 _ => common::Error::Failure(response),
8019 });
8020 }
8021 let response = {
8022 let bytes = common::to_bytes(body).await.unwrap_or_default();
8023 let encoded = common::to_string(&bytes);
8024 match serde_json::from_str(&encoded) {
8025 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8026 Err(error) => {
8027 dlg.response_json_decode_error(&encoded, &error);
8028 return Err(common::Error::JsonDecodeError(
8029 encoded.to_string(),
8030 error,
8031 ));
8032 }
8033 }
8034 };
8035
8036 dlg.finished(true);
8037 return Ok(response);
8038 }
8039 }
8040 }
8041 }
8042
8043 ///
8044 /// Sets the *request* property to the given value.
8045 ///
8046 /// Even though the property as already been set when instantiating this call,
8047 /// we provide this method for API completeness.
8048 pub fn request(mut self, new_value: Tenant) -> ProjectTenantCreateCall<'a, C> {
8049 self._request = new_value;
8050 self
8051 }
8052 /// Required. Resource name of the project under which the tenant is created. The format is "projects/{project_id}", for example, "projects/foo".
8053 ///
8054 /// Sets the *parent* path property to the given value.
8055 ///
8056 /// Even though the property as already been set when instantiating this call,
8057 /// we provide this method for API completeness.
8058 pub fn parent(mut self, new_value: &str) -> ProjectTenantCreateCall<'a, C> {
8059 self._parent = new_value.to_string();
8060 self
8061 }
8062 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8063 /// while executing the actual API request.
8064 ///
8065 /// ````text
8066 /// It should be used to handle progress information, and to implement a certain level of resilience.
8067 /// ````
8068 ///
8069 /// Sets the *delegate* property to the given value.
8070 pub fn delegate(
8071 mut self,
8072 new_value: &'a mut dyn common::Delegate,
8073 ) -> ProjectTenantCreateCall<'a, C> {
8074 self._delegate = Some(new_value);
8075 self
8076 }
8077
8078 /// Set any additional parameter of the query string used in the request.
8079 /// It should be used to set parameters which are not yet available through their own
8080 /// setters.
8081 ///
8082 /// Please note that this method must not be used to set any of the known parameters
8083 /// which have their own setter method. If done anyway, the request will fail.
8084 ///
8085 /// # Additional Parameters
8086 ///
8087 /// * *$.xgafv* (query-string) - V1 error format.
8088 /// * *access_token* (query-string) - OAuth access token.
8089 /// * *alt* (query-string) - Data format for response.
8090 /// * *callback* (query-string) - JSONP
8091 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8092 /// * *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.
8093 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8094 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8095 /// * *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.
8096 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8097 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8098 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantCreateCall<'a, C>
8099 where
8100 T: AsRef<str>,
8101 {
8102 self._additional_params
8103 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8104 self
8105 }
8106
8107 /// Identifies the authorization scope for the method you are building.
8108 ///
8109 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8110 /// [`Scope::CloudPlatform`].
8111 ///
8112 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8113 /// tokens for more than one scope.
8114 ///
8115 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8116 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8117 /// sufficient, a read-write scope will do as well.
8118 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantCreateCall<'a, C>
8119 where
8120 St: AsRef<str>,
8121 {
8122 self._scopes.insert(String::from(scope.as_ref()));
8123 self
8124 }
8125 /// Identifies the authorization scope(s) for the method you are building.
8126 ///
8127 /// See [`Self::add_scope()`] for details.
8128 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantCreateCall<'a, C>
8129 where
8130 I: IntoIterator<Item = St>,
8131 St: AsRef<str>,
8132 {
8133 self._scopes
8134 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8135 self
8136 }
8137
8138 /// Removes all scopes, and no default scope will be used either.
8139 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8140 /// for details).
8141 pub fn clear_scopes(mut self) -> ProjectTenantCreateCall<'a, C> {
8142 self._scopes.clear();
8143 self
8144 }
8145}
8146
8147/// Deletes specified tenant.
8148///
8149/// A builder for the *tenants.delete* method supported by a *project* resource.
8150/// It is not used directly, but through a [`ProjectMethods`] instance.
8151///
8152/// # Example
8153///
8154/// Instantiate a resource method builder
8155///
8156/// ```test_harness,no_run
8157/// # extern crate hyper;
8158/// # extern crate hyper_rustls;
8159/// # extern crate google_jobs4 as jobs4;
8160/// # async fn dox() {
8161/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8162///
8163/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8164/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8165/// # .with_native_roots()
8166/// # .unwrap()
8167/// # .https_only()
8168/// # .enable_http2()
8169/// # .build();
8170///
8171/// # let executor = hyper_util::rt::TokioExecutor::new();
8172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8173/// # secret,
8174/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8175/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8176/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8177/// # ),
8178/// # ).build().await.unwrap();
8179///
8180/// # let client = hyper_util::client::legacy::Client::builder(
8181/// # hyper_util::rt::TokioExecutor::new()
8182/// # )
8183/// # .build(
8184/// # hyper_rustls::HttpsConnectorBuilder::new()
8185/// # .with_native_roots()
8186/// # .unwrap()
8187/// # .https_or_http()
8188/// # .enable_http2()
8189/// # .build()
8190/// # );
8191/// # let mut hub = CloudTalentSolution::new(client, auth);
8192/// // You can configure optional parameters by calling the respective setters at will, and
8193/// // execute the final call using `doit()`.
8194/// // Values shown here are possibly random and not representative !
8195/// let result = hub.projects().tenants_delete("name")
8196/// .doit().await;
8197/// # }
8198/// ```
8199pub struct ProjectTenantDeleteCall<'a, C>
8200where
8201 C: 'a,
8202{
8203 hub: &'a CloudTalentSolution<C>,
8204 _name: String,
8205 _delegate: Option<&'a mut dyn common::Delegate>,
8206 _additional_params: HashMap<String, String>,
8207 _scopes: BTreeSet<String>,
8208}
8209
8210impl<'a, C> common::CallBuilder for ProjectTenantDeleteCall<'a, C> {}
8211
8212impl<'a, C> ProjectTenantDeleteCall<'a, C>
8213where
8214 C: common::Connector,
8215{
8216 /// Perform the operation you have build so far.
8217 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8218 use std::borrow::Cow;
8219 use std::io::{Read, Seek};
8220
8221 use common::{url::Params, ToParts};
8222 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8223
8224 let mut dd = common::DefaultDelegate;
8225 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8226 dlg.begin(common::MethodInfo {
8227 id: "jobs.projects.tenants.delete",
8228 http_method: hyper::Method::DELETE,
8229 });
8230
8231 for &field in ["alt", "name"].iter() {
8232 if self._additional_params.contains_key(field) {
8233 dlg.finished(false);
8234 return Err(common::Error::FieldClash(field));
8235 }
8236 }
8237
8238 let mut params = Params::with_capacity(3 + self._additional_params.len());
8239 params.push("name", self._name);
8240
8241 params.extend(self._additional_params.iter());
8242
8243 params.push("alt", "json");
8244 let mut url = self.hub._base_url.clone() + "v4/{+name}";
8245 if self._scopes.is_empty() {
8246 self._scopes
8247 .insert(Scope::CloudPlatform.as_ref().to_string());
8248 }
8249
8250 #[allow(clippy::single_element_loop)]
8251 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8252 url = params.uri_replacement(url, param_name, find_this, true);
8253 }
8254 {
8255 let to_remove = ["name"];
8256 params.remove_params(&to_remove);
8257 }
8258
8259 let url = params.parse_with_url(&url);
8260
8261 loop {
8262 let token = match self
8263 .hub
8264 .auth
8265 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8266 .await
8267 {
8268 Ok(token) => token,
8269 Err(e) => match dlg.token(e) {
8270 Ok(token) => token,
8271 Err(e) => {
8272 dlg.finished(false);
8273 return Err(common::Error::MissingToken(e));
8274 }
8275 },
8276 };
8277 let mut req_result = {
8278 let client = &self.hub.client;
8279 dlg.pre_request();
8280 let mut req_builder = hyper::Request::builder()
8281 .method(hyper::Method::DELETE)
8282 .uri(url.as_str())
8283 .header(USER_AGENT, self.hub._user_agent.clone());
8284
8285 if let Some(token) = token.as_ref() {
8286 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8287 }
8288
8289 let request = req_builder
8290 .header(CONTENT_LENGTH, 0_u64)
8291 .body(common::to_body::<String>(None));
8292
8293 client.request(request.unwrap()).await
8294 };
8295
8296 match req_result {
8297 Err(err) => {
8298 if let common::Retry::After(d) = dlg.http_error(&err) {
8299 sleep(d).await;
8300 continue;
8301 }
8302 dlg.finished(false);
8303 return Err(common::Error::HttpError(err));
8304 }
8305 Ok(res) => {
8306 let (mut parts, body) = res.into_parts();
8307 let mut body = common::Body::new(body);
8308 if !parts.status.is_success() {
8309 let bytes = common::to_bytes(body).await.unwrap_or_default();
8310 let error = serde_json::from_str(&common::to_string(&bytes));
8311 let response = common::to_response(parts, bytes.into());
8312
8313 if let common::Retry::After(d) =
8314 dlg.http_failure(&response, error.as_ref().ok())
8315 {
8316 sleep(d).await;
8317 continue;
8318 }
8319
8320 dlg.finished(false);
8321
8322 return Err(match error {
8323 Ok(value) => common::Error::BadRequest(value),
8324 _ => common::Error::Failure(response),
8325 });
8326 }
8327 let response = {
8328 let bytes = common::to_bytes(body).await.unwrap_or_default();
8329 let encoded = common::to_string(&bytes);
8330 match serde_json::from_str(&encoded) {
8331 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8332 Err(error) => {
8333 dlg.response_json_decode_error(&encoded, &error);
8334 return Err(common::Error::JsonDecodeError(
8335 encoded.to_string(),
8336 error,
8337 ));
8338 }
8339 }
8340 };
8341
8342 dlg.finished(true);
8343 return Ok(response);
8344 }
8345 }
8346 }
8347 }
8348
8349 /// Required. The resource name of the tenant to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
8350 ///
8351 /// Sets the *name* path property to the given value.
8352 ///
8353 /// Even though the property as already been set when instantiating this call,
8354 /// we provide this method for API completeness.
8355 pub fn name(mut self, new_value: &str) -> ProjectTenantDeleteCall<'a, C> {
8356 self._name = new_value.to_string();
8357 self
8358 }
8359 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8360 /// while executing the actual API request.
8361 ///
8362 /// ````text
8363 /// It should be used to handle progress information, and to implement a certain level of resilience.
8364 /// ````
8365 ///
8366 /// Sets the *delegate* property to the given value.
8367 pub fn delegate(
8368 mut self,
8369 new_value: &'a mut dyn common::Delegate,
8370 ) -> ProjectTenantDeleteCall<'a, C> {
8371 self._delegate = Some(new_value);
8372 self
8373 }
8374
8375 /// Set any additional parameter of the query string used in the request.
8376 /// It should be used to set parameters which are not yet available through their own
8377 /// setters.
8378 ///
8379 /// Please note that this method must not be used to set any of the known parameters
8380 /// which have their own setter method. If done anyway, the request will fail.
8381 ///
8382 /// # Additional Parameters
8383 ///
8384 /// * *$.xgafv* (query-string) - V1 error format.
8385 /// * *access_token* (query-string) - OAuth access token.
8386 /// * *alt* (query-string) - Data format for response.
8387 /// * *callback* (query-string) - JSONP
8388 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8389 /// * *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.
8390 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8391 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8392 /// * *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.
8393 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8394 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8395 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantDeleteCall<'a, C>
8396 where
8397 T: AsRef<str>,
8398 {
8399 self._additional_params
8400 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8401 self
8402 }
8403
8404 /// Identifies the authorization scope for the method you are building.
8405 ///
8406 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8407 /// [`Scope::CloudPlatform`].
8408 ///
8409 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8410 /// tokens for more than one scope.
8411 ///
8412 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8413 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8414 /// sufficient, a read-write scope will do as well.
8415 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantDeleteCall<'a, C>
8416 where
8417 St: AsRef<str>,
8418 {
8419 self._scopes.insert(String::from(scope.as_ref()));
8420 self
8421 }
8422 /// Identifies the authorization scope(s) for the method you are building.
8423 ///
8424 /// See [`Self::add_scope()`] for details.
8425 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantDeleteCall<'a, C>
8426 where
8427 I: IntoIterator<Item = St>,
8428 St: AsRef<str>,
8429 {
8430 self._scopes
8431 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8432 self
8433 }
8434
8435 /// Removes all scopes, and no default scope will be used either.
8436 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8437 /// for details).
8438 pub fn clear_scopes(mut self) -> ProjectTenantDeleteCall<'a, C> {
8439 self._scopes.clear();
8440 self
8441 }
8442}
8443
8444/// Retrieves specified tenant.
8445///
8446/// A builder for the *tenants.get* method supported by a *project* resource.
8447/// It is not used directly, but through a [`ProjectMethods`] instance.
8448///
8449/// # Example
8450///
8451/// Instantiate a resource method builder
8452///
8453/// ```test_harness,no_run
8454/// # extern crate hyper;
8455/// # extern crate hyper_rustls;
8456/// # extern crate google_jobs4 as jobs4;
8457/// # async fn dox() {
8458/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8459///
8460/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8461/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8462/// # .with_native_roots()
8463/// # .unwrap()
8464/// # .https_only()
8465/// # .enable_http2()
8466/// # .build();
8467///
8468/// # let executor = hyper_util::rt::TokioExecutor::new();
8469/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8470/// # secret,
8471/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8472/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8473/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8474/// # ),
8475/// # ).build().await.unwrap();
8476///
8477/// # let client = hyper_util::client::legacy::Client::builder(
8478/// # hyper_util::rt::TokioExecutor::new()
8479/// # )
8480/// # .build(
8481/// # hyper_rustls::HttpsConnectorBuilder::new()
8482/// # .with_native_roots()
8483/// # .unwrap()
8484/// # .https_or_http()
8485/// # .enable_http2()
8486/// # .build()
8487/// # );
8488/// # let mut hub = CloudTalentSolution::new(client, auth);
8489/// // You can configure optional parameters by calling the respective setters at will, and
8490/// // execute the final call using `doit()`.
8491/// // Values shown here are possibly random and not representative !
8492/// let result = hub.projects().tenants_get("name")
8493/// .doit().await;
8494/// # }
8495/// ```
8496pub struct ProjectTenantGetCall<'a, C>
8497where
8498 C: 'a,
8499{
8500 hub: &'a CloudTalentSolution<C>,
8501 _name: String,
8502 _delegate: Option<&'a mut dyn common::Delegate>,
8503 _additional_params: HashMap<String, String>,
8504 _scopes: BTreeSet<String>,
8505}
8506
8507impl<'a, C> common::CallBuilder for ProjectTenantGetCall<'a, C> {}
8508
8509impl<'a, C> ProjectTenantGetCall<'a, C>
8510where
8511 C: common::Connector,
8512{
8513 /// Perform the operation you have build so far.
8514 pub async fn doit(mut self) -> common::Result<(common::Response, Tenant)> {
8515 use std::borrow::Cow;
8516 use std::io::{Read, Seek};
8517
8518 use common::{url::Params, ToParts};
8519 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8520
8521 let mut dd = common::DefaultDelegate;
8522 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8523 dlg.begin(common::MethodInfo {
8524 id: "jobs.projects.tenants.get",
8525 http_method: hyper::Method::GET,
8526 });
8527
8528 for &field in ["alt", "name"].iter() {
8529 if self._additional_params.contains_key(field) {
8530 dlg.finished(false);
8531 return Err(common::Error::FieldClash(field));
8532 }
8533 }
8534
8535 let mut params = Params::with_capacity(3 + self._additional_params.len());
8536 params.push("name", self._name);
8537
8538 params.extend(self._additional_params.iter());
8539
8540 params.push("alt", "json");
8541 let mut url = self.hub._base_url.clone() + "v4/{+name}";
8542 if self._scopes.is_empty() {
8543 self._scopes
8544 .insert(Scope::CloudPlatform.as_ref().to_string());
8545 }
8546
8547 #[allow(clippy::single_element_loop)]
8548 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8549 url = params.uri_replacement(url, param_name, find_this, true);
8550 }
8551 {
8552 let to_remove = ["name"];
8553 params.remove_params(&to_remove);
8554 }
8555
8556 let url = params.parse_with_url(&url);
8557
8558 loop {
8559 let token = match self
8560 .hub
8561 .auth
8562 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8563 .await
8564 {
8565 Ok(token) => token,
8566 Err(e) => match dlg.token(e) {
8567 Ok(token) => token,
8568 Err(e) => {
8569 dlg.finished(false);
8570 return Err(common::Error::MissingToken(e));
8571 }
8572 },
8573 };
8574 let mut req_result = {
8575 let client = &self.hub.client;
8576 dlg.pre_request();
8577 let mut req_builder = hyper::Request::builder()
8578 .method(hyper::Method::GET)
8579 .uri(url.as_str())
8580 .header(USER_AGENT, self.hub._user_agent.clone());
8581
8582 if let Some(token) = token.as_ref() {
8583 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8584 }
8585
8586 let request = req_builder
8587 .header(CONTENT_LENGTH, 0_u64)
8588 .body(common::to_body::<String>(None));
8589
8590 client.request(request.unwrap()).await
8591 };
8592
8593 match req_result {
8594 Err(err) => {
8595 if let common::Retry::After(d) = dlg.http_error(&err) {
8596 sleep(d).await;
8597 continue;
8598 }
8599 dlg.finished(false);
8600 return Err(common::Error::HttpError(err));
8601 }
8602 Ok(res) => {
8603 let (mut parts, body) = res.into_parts();
8604 let mut body = common::Body::new(body);
8605 if !parts.status.is_success() {
8606 let bytes = common::to_bytes(body).await.unwrap_or_default();
8607 let error = serde_json::from_str(&common::to_string(&bytes));
8608 let response = common::to_response(parts, bytes.into());
8609
8610 if let common::Retry::After(d) =
8611 dlg.http_failure(&response, error.as_ref().ok())
8612 {
8613 sleep(d).await;
8614 continue;
8615 }
8616
8617 dlg.finished(false);
8618
8619 return Err(match error {
8620 Ok(value) => common::Error::BadRequest(value),
8621 _ => common::Error::Failure(response),
8622 });
8623 }
8624 let response = {
8625 let bytes = common::to_bytes(body).await.unwrap_or_default();
8626 let encoded = common::to_string(&bytes);
8627 match serde_json::from_str(&encoded) {
8628 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8629 Err(error) => {
8630 dlg.response_json_decode_error(&encoded, &error);
8631 return Err(common::Error::JsonDecodeError(
8632 encoded.to_string(),
8633 error,
8634 ));
8635 }
8636 }
8637 };
8638
8639 dlg.finished(true);
8640 return Ok(response);
8641 }
8642 }
8643 }
8644 }
8645
8646 /// Required. The resource name of the tenant to be retrieved. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
8647 ///
8648 /// Sets the *name* path property to the given value.
8649 ///
8650 /// Even though the property as already been set when instantiating this call,
8651 /// we provide this method for API completeness.
8652 pub fn name(mut self, new_value: &str) -> ProjectTenantGetCall<'a, C> {
8653 self._name = new_value.to_string();
8654 self
8655 }
8656 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8657 /// while executing the actual API request.
8658 ///
8659 /// ````text
8660 /// It should be used to handle progress information, and to implement a certain level of resilience.
8661 /// ````
8662 ///
8663 /// Sets the *delegate* property to the given value.
8664 pub fn delegate(
8665 mut self,
8666 new_value: &'a mut dyn common::Delegate,
8667 ) -> ProjectTenantGetCall<'a, C> {
8668 self._delegate = Some(new_value);
8669 self
8670 }
8671
8672 /// Set any additional parameter of the query string used in the request.
8673 /// It should be used to set parameters which are not yet available through their own
8674 /// setters.
8675 ///
8676 /// Please note that this method must not be used to set any of the known parameters
8677 /// which have their own setter method. If done anyway, the request will fail.
8678 ///
8679 /// # Additional Parameters
8680 ///
8681 /// * *$.xgafv* (query-string) - V1 error format.
8682 /// * *access_token* (query-string) - OAuth access token.
8683 /// * *alt* (query-string) - Data format for response.
8684 /// * *callback* (query-string) - JSONP
8685 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8686 /// * *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.
8687 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8688 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8689 /// * *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.
8690 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8691 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8692 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantGetCall<'a, C>
8693 where
8694 T: AsRef<str>,
8695 {
8696 self._additional_params
8697 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8698 self
8699 }
8700
8701 /// Identifies the authorization scope for the method you are building.
8702 ///
8703 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8704 /// [`Scope::CloudPlatform`].
8705 ///
8706 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8707 /// tokens for more than one scope.
8708 ///
8709 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8710 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8711 /// sufficient, a read-write scope will do as well.
8712 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantGetCall<'a, C>
8713 where
8714 St: AsRef<str>,
8715 {
8716 self._scopes.insert(String::from(scope.as_ref()));
8717 self
8718 }
8719 /// Identifies the authorization scope(s) for the method you are building.
8720 ///
8721 /// See [`Self::add_scope()`] for details.
8722 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantGetCall<'a, C>
8723 where
8724 I: IntoIterator<Item = St>,
8725 St: AsRef<str>,
8726 {
8727 self._scopes
8728 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8729 self
8730 }
8731
8732 /// Removes all scopes, and no default scope will be used either.
8733 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8734 /// for details).
8735 pub fn clear_scopes(mut self) -> ProjectTenantGetCall<'a, C> {
8736 self._scopes.clear();
8737 self
8738 }
8739}
8740
8741/// Lists all tenants associated with the project.
8742///
8743/// A builder for the *tenants.list* method supported by a *project* resource.
8744/// It is not used directly, but through a [`ProjectMethods`] instance.
8745///
8746/// # Example
8747///
8748/// Instantiate a resource method builder
8749///
8750/// ```test_harness,no_run
8751/// # extern crate hyper;
8752/// # extern crate hyper_rustls;
8753/// # extern crate google_jobs4 as jobs4;
8754/// # async fn dox() {
8755/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8756///
8757/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8758/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8759/// # .with_native_roots()
8760/// # .unwrap()
8761/// # .https_only()
8762/// # .enable_http2()
8763/// # .build();
8764///
8765/// # let executor = hyper_util::rt::TokioExecutor::new();
8766/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8767/// # secret,
8768/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8769/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8770/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8771/// # ),
8772/// # ).build().await.unwrap();
8773///
8774/// # let client = hyper_util::client::legacy::Client::builder(
8775/// # hyper_util::rt::TokioExecutor::new()
8776/// # )
8777/// # .build(
8778/// # hyper_rustls::HttpsConnectorBuilder::new()
8779/// # .with_native_roots()
8780/// # .unwrap()
8781/// # .https_or_http()
8782/// # .enable_http2()
8783/// # .build()
8784/// # );
8785/// # let mut hub = CloudTalentSolution::new(client, auth);
8786/// // You can configure optional parameters by calling the respective setters at will, and
8787/// // execute the final call using `doit()`.
8788/// // Values shown here are possibly random and not representative !
8789/// let result = hub.projects().tenants_list("parent")
8790/// .page_token("sed")
8791/// .page_size(-70)
8792/// .doit().await;
8793/// # }
8794/// ```
8795pub struct ProjectTenantListCall<'a, C>
8796where
8797 C: 'a,
8798{
8799 hub: &'a CloudTalentSolution<C>,
8800 _parent: String,
8801 _page_token: Option<String>,
8802 _page_size: Option<i32>,
8803 _delegate: Option<&'a mut dyn common::Delegate>,
8804 _additional_params: HashMap<String, String>,
8805 _scopes: BTreeSet<String>,
8806}
8807
8808impl<'a, C> common::CallBuilder for ProjectTenantListCall<'a, C> {}
8809
8810impl<'a, C> ProjectTenantListCall<'a, C>
8811where
8812 C: common::Connector,
8813{
8814 /// Perform the operation you have build so far.
8815 pub async fn doit(mut self) -> common::Result<(common::Response, ListTenantsResponse)> {
8816 use std::borrow::Cow;
8817 use std::io::{Read, Seek};
8818
8819 use common::{url::Params, ToParts};
8820 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8821
8822 let mut dd = common::DefaultDelegate;
8823 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8824 dlg.begin(common::MethodInfo {
8825 id: "jobs.projects.tenants.list",
8826 http_method: hyper::Method::GET,
8827 });
8828
8829 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8830 if self._additional_params.contains_key(field) {
8831 dlg.finished(false);
8832 return Err(common::Error::FieldClash(field));
8833 }
8834 }
8835
8836 let mut params = Params::with_capacity(5 + self._additional_params.len());
8837 params.push("parent", self._parent);
8838 if let Some(value) = self._page_token.as_ref() {
8839 params.push("pageToken", value);
8840 }
8841 if let Some(value) = self._page_size.as_ref() {
8842 params.push("pageSize", value.to_string());
8843 }
8844
8845 params.extend(self._additional_params.iter());
8846
8847 params.push("alt", "json");
8848 let mut url = self.hub._base_url.clone() + "v4/{+parent}/tenants";
8849 if self._scopes.is_empty() {
8850 self._scopes
8851 .insert(Scope::CloudPlatform.as_ref().to_string());
8852 }
8853
8854 #[allow(clippy::single_element_loop)]
8855 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8856 url = params.uri_replacement(url, param_name, find_this, true);
8857 }
8858 {
8859 let to_remove = ["parent"];
8860 params.remove_params(&to_remove);
8861 }
8862
8863 let url = params.parse_with_url(&url);
8864
8865 loop {
8866 let token = match self
8867 .hub
8868 .auth
8869 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8870 .await
8871 {
8872 Ok(token) => token,
8873 Err(e) => match dlg.token(e) {
8874 Ok(token) => token,
8875 Err(e) => {
8876 dlg.finished(false);
8877 return Err(common::Error::MissingToken(e));
8878 }
8879 },
8880 };
8881 let mut req_result = {
8882 let client = &self.hub.client;
8883 dlg.pre_request();
8884 let mut req_builder = hyper::Request::builder()
8885 .method(hyper::Method::GET)
8886 .uri(url.as_str())
8887 .header(USER_AGENT, self.hub._user_agent.clone());
8888
8889 if let Some(token) = token.as_ref() {
8890 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8891 }
8892
8893 let request = req_builder
8894 .header(CONTENT_LENGTH, 0_u64)
8895 .body(common::to_body::<String>(None));
8896
8897 client.request(request.unwrap()).await
8898 };
8899
8900 match req_result {
8901 Err(err) => {
8902 if let common::Retry::After(d) = dlg.http_error(&err) {
8903 sleep(d).await;
8904 continue;
8905 }
8906 dlg.finished(false);
8907 return Err(common::Error::HttpError(err));
8908 }
8909 Ok(res) => {
8910 let (mut parts, body) = res.into_parts();
8911 let mut body = common::Body::new(body);
8912 if !parts.status.is_success() {
8913 let bytes = common::to_bytes(body).await.unwrap_or_default();
8914 let error = serde_json::from_str(&common::to_string(&bytes));
8915 let response = common::to_response(parts, bytes.into());
8916
8917 if let common::Retry::After(d) =
8918 dlg.http_failure(&response, error.as_ref().ok())
8919 {
8920 sleep(d).await;
8921 continue;
8922 }
8923
8924 dlg.finished(false);
8925
8926 return Err(match error {
8927 Ok(value) => common::Error::BadRequest(value),
8928 _ => common::Error::Failure(response),
8929 });
8930 }
8931 let response = {
8932 let bytes = common::to_bytes(body).await.unwrap_or_default();
8933 let encoded = common::to_string(&bytes);
8934 match serde_json::from_str(&encoded) {
8935 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8936 Err(error) => {
8937 dlg.response_json_decode_error(&encoded, &error);
8938 return Err(common::Error::JsonDecodeError(
8939 encoded.to_string(),
8940 error,
8941 ));
8942 }
8943 }
8944 };
8945
8946 dlg.finished(true);
8947 return Ok(response);
8948 }
8949 }
8950 }
8951 }
8952
8953 /// Required. Resource name of the project under which the tenant is created. The format is "projects/{project_id}", for example, "projects/foo".
8954 ///
8955 /// Sets the *parent* path property to the given value.
8956 ///
8957 /// Even though the property as already been set when instantiating this call,
8958 /// we provide this method for API completeness.
8959 pub fn parent(mut self, new_value: &str) -> ProjectTenantListCall<'a, C> {
8960 self._parent = new_value.to_string();
8961 self
8962 }
8963 /// The starting indicator from which to return results.
8964 ///
8965 /// Sets the *page token* query property to the given value.
8966 pub fn page_token(mut self, new_value: &str) -> ProjectTenantListCall<'a, C> {
8967 self._page_token = Some(new_value.to_string());
8968 self
8969 }
8970 /// The maximum number of tenants to be returned, at most 100. Default is 100 if a non-positive number is provided.
8971 ///
8972 /// Sets the *page size* query property to the given value.
8973 pub fn page_size(mut self, new_value: i32) -> ProjectTenantListCall<'a, C> {
8974 self._page_size = Some(new_value);
8975 self
8976 }
8977 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8978 /// while executing the actual API request.
8979 ///
8980 /// ````text
8981 /// It should be used to handle progress information, and to implement a certain level of resilience.
8982 /// ````
8983 ///
8984 /// Sets the *delegate* property to the given value.
8985 pub fn delegate(
8986 mut self,
8987 new_value: &'a mut dyn common::Delegate,
8988 ) -> ProjectTenantListCall<'a, C> {
8989 self._delegate = Some(new_value);
8990 self
8991 }
8992
8993 /// Set any additional parameter of the query string used in the request.
8994 /// It should be used to set parameters which are not yet available through their own
8995 /// setters.
8996 ///
8997 /// Please note that this method must not be used to set any of the known parameters
8998 /// which have their own setter method. If done anyway, the request will fail.
8999 ///
9000 /// # Additional Parameters
9001 ///
9002 /// * *$.xgafv* (query-string) - V1 error format.
9003 /// * *access_token* (query-string) - OAuth access token.
9004 /// * *alt* (query-string) - Data format for response.
9005 /// * *callback* (query-string) - JSONP
9006 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9007 /// * *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.
9008 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9009 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9010 /// * *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.
9011 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9012 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9013 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantListCall<'a, C>
9014 where
9015 T: AsRef<str>,
9016 {
9017 self._additional_params
9018 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9019 self
9020 }
9021
9022 /// Identifies the authorization scope for the method you are building.
9023 ///
9024 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9025 /// [`Scope::CloudPlatform`].
9026 ///
9027 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9028 /// tokens for more than one scope.
9029 ///
9030 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9031 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9032 /// sufficient, a read-write scope will do as well.
9033 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantListCall<'a, C>
9034 where
9035 St: AsRef<str>,
9036 {
9037 self._scopes.insert(String::from(scope.as_ref()));
9038 self
9039 }
9040 /// Identifies the authorization scope(s) for the method you are building.
9041 ///
9042 /// See [`Self::add_scope()`] for details.
9043 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantListCall<'a, C>
9044 where
9045 I: IntoIterator<Item = St>,
9046 St: AsRef<str>,
9047 {
9048 self._scopes
9049 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9050 self
9051 }
9052
9053 /// Removes all scopes, and no default scope will be used either.
9054 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9055 /// for details).
9056 pub fn clear_scopes(mut self) -> ProjectTenantListCall<'a, C> {
9057 self._scopes.clear();
9058 self
9059 }
9060}
9061
9062/// Updates specified tenant.
9063///
9064/// A builder for the *tenants.patch* method supported by a *project* resource.
9065/// It is not used directly, but through a [`ProjectMethods`] instance.
9066///
9067/// # Example
9068///
9069/// Instantiate a resource method builder
9070///
9071/// ```test_harness,no_run
9072/// # extern crate hyper;
9073/// # extern crate hyper_rustls;
9074/// # extern crate google_jobs4 as jobs4;
9075/// use jobs4::api::Tenant;
9076/// # async fn dox() {
9077/// # use jobs4::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9078///
9079/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9080/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9081/// # .with_native_roots()
9082/// # .unwrap()
9083/// # .https_only()
9084/// # .enable_http2()
9085/// # .build();
9086///
9087/// # let executor = hyper_util::rt::TokioExecutor::new();
9088/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9089/// # secret,
9090/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9091/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9092/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9093/// # ),
9094/// # ).build().await.unwrap();
9095///
9096/// # let client = hyper_util::client::legacy::Client::builder(
9097/// # hyper_util::rt::TokioExecutor::new()
9098/// # )
9099/// # .build(
9100/// # hyper_rustls::HttpsConnectorBuilder::new()
9101/// # .with_native_roots()
9102/// # .unwrap()
9103/// # .https_or_http()
9104/// # .enable_http2()
9105/// # .build()
9106/// # );
9107/// # let mut hub = CloudTalentSolution::new(client, auth);
9108/// // As the method needs a request, you would usually fill it with the desired information
9109/// // into the respective structure. Some of the parts shown here might not be applicable !
9110/// // Values shown here are possibly random and not representative !
9111/// let mut req = Tenant::default();
9112///
9113/// // You can configure optional parameters by calling the respective setters at will, and
9114/// // execute the final call using `doit()`.
9115/// // Values shown here are possibly random and not representative !
9116/// let result = hub.projects().tenants_patch(req, "name")
9117/// .update_mask(FieldMask::new::<&str>(&[]))
9118/// .doit().await;
9119/// # }
9120/// ```
9121pub struct ProjectTenantPatchCall<'a, C>
9122where
9123 C: 'a,
9124{
9125 hub: &'a CloudTalentSolution<C>,
9126 _request: Tenant,
9127 _name: String,
9128 _update_mask: Option<common::FieldMask>,
9129 _delegate: Option<&'a mut dyn common::Delegate>,
9130 _additional_params: HashMap<String, String>,
9131 _scopes: BTreeSet<String>,
9132}
9133
9134impl<'a, C> common::CallBuilder for ProjectTenantPatchCall<'a, C> {}
9135
9136impl<'a, C> ProjectTenantPatchCall<'a, C>
9137where
9138 C: common::Connector,
9139{
9140 /// Perform the operation you have build so far.
9141 pub async fn doit(mut self) -> common::Result<(common::Response, Tenant)> {
9142 use std::borrow::Cow;
9143 use std::io::{Read, Seek};
9144
9145 use common::{url::Params, ToParts};
9146 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9147
9148 let mut dd = common::DefaultDelegate;
9149 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9150 dlg.begin(common::MethodInfo {
9151 id: "jobs.projects.tenants.patch",
9152 http_method: hyper::Method::PATCH,
9153 });
9154
9155 for &field in ["alt", "name", "updateMask"].iter() {
9156 if self._additional_params.contains_key(field) {
9157 dlg.finished(false);
9158 return Err(common::Error::FieldClash(field));
9159 }
9160 }
9161
9162 let mut params = Params::with_capacity(5 + self._additional_params.len());
9163 params.push("name", self._name);
9164 if let Some(value) = self._update_mask.as_ref() {
9165 params.push("updateMask", value.to_string());
9166 }
9167
9168 params.extend(self._additional_params.iter());
9169
9170 params.push("alt", "json");
9171 let mut url = self.hub._base_url.clone() + "v4/{+name}";
9172 if self._scopes.is_empty() {
9173 self._scopes
9174 .insert(Scope::CloudPlatform.as_ref().to_string());
9175 }
9176
9177 #[allow(clippy::single_element_loop)]
9178 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9179 url = params.uri_replacement(url, param_name, find_this, true);
9180 }
9181 {
9182 let to_remove = ["name"];
9183 params.remove_params(&to_remove);
9184 }
9185
9186 let url = params.parse_with_url(&url);
9187
9188 let mut json_mime_type = mime::APPLICATION_JSON;
9189 let mut request_value_reader = {
9190 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9191 common::remove_json_null_values(&mut value);
9192 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9193 serde_json::to_writer(&mut dst, &value).unwrap();
9194 dst
9195 };
9196 let request_size = request_value_reader
9197 .seek(std::io::SeekFrom::End(0))
9198 .unwrap();
9199 request_value_reader
9200 .seek(std::io::SeekFrom::Start(0))
9201 .unwrap();
9202
9203 loop {
9204 let token = match self
9205 .hub
9206 .auth
9207 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9208 .await
9209 {
9210 Ok(token) => token,
9211 Err(e) => match dlg.token(e) {
9212 Ok(token) => token,
9213 Err(e) => {
9214 dlg.finished(false);
9215 return Err(common::Error::MissingToken(e));
9216 }
9217 },
9218 };
9219 request_value_reader
9220 .seek(std::io::SeekFrom::Start(0))
9221 .unwrap();
9222 let mut req_result = {
9223 let client = &self.hub.client;
9224 dlg.pre_request();
9225 let mut req_builder = hyper::Request::builder()
9226 .method(hyper::Method::PATCH)
9227 .uri(url.as_str())
9228 .header(USER_AGENT, self.hub._user_agent.clone());
9229
9230 if let Some(token) = token.as_ref() {
9231 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9232 }
9233
9234 let request = req_builder
9235 .header(CONTENT_TYPE, json_mime_type.to_string())
9236 .header(CONTENT_LENGTH, request_size as u64)
9237 .body(common::to_body(
9238 request_value_reader.get_ref().clone().into(),
9239 ));
9240
9241 client.request(request.unwrap()).await
9242 };
9243
9244 match req_result {
9245 Err(err) => {
9246 if let common::Retry::After(d) = dlg.http_error(&err) {
9247 sleep(d).await;
9248 continue;
9249 }
9250 dlg.finished(false);
9251 return Err(common::Error::HttpError(err));
9252 }
9253 Ok(res) => {
9254 let (mut parts, body) = res.into_parts();
9255 let mut body = common::Body::new(body);
9256 if !parts.status.is_success() {
9257 let bytes = common::to_bytes(body).await.unwrap_or_default();
9258 let error = serde_json::from_str(&common::to_string(&bytes));
9259 let response = common::to_response(parts, bytes.into());
9260
9261 if let common::Retry::After(d) =
9262 dlg.http_failure(&response, error.as_ref().ok())
9263 {
9264 sleep(d).await;
9265 continue;
9266 }
9267
9268 dlg.finished(false);
9269
9270 return Err(match error {
9271 Ok(value) => common::Error::BadRequest(value),
9272 _ => common::Error::Failure(response),
9273 });
9274 }
9275 let response = {
9276 let bytes = common::to_bytes(body).await.unwrap_or_default();
9277 let encoded = common::to_string(&bytes);
9278 match serde_json::from_str(&encoded) {
9279 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9280 Err(error) => {
9281 dlg.response_json_decode_error(&encoded, &error);
9282 return Err(common::Error::JsonDecodeError(
9283 encoded.to_string(),
9284 error,
9285 ));
9286 }
9287 }
9288 };
9289
9290 dlg.finished(true);
9291 return Ok(response);
9292 }
9293 }
9294 }
9295 }
9296
9297 ///
9298 /// Sets the *request* property to the given value.
9299 ///
9300 /// Even though the property as already been set when instantiating this call,
9301 /// we provide this method for API completeness.
9302 pub fn request(mut self, new_value: Tenant) -> ProjectTenantPatchCall<'a, C> {
9303 self._request = new_value;
9304 self
9305 }
9306 /// Required during tenant update. The resource name for a tenant. This is generated by the service when a tenant is created. The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar".
9307 ///
9308 /// Sets the *name* path property to the given value.
9309 ///
9310 /// Even though the property as already been set when instantiating this call,
9311 /// we provide this method for API completeness.
9312 pub fn name(mut self, new_value: &str) -> ProjectTenantPatchCall<'a, C> {
9313 self._name = new_value.to_string();
9314 self
9315 }
9316 /// Strongly recommended for the best service experience. If update_mask is provided, only the specified fields in tenant are updated. Otherwise all the fields are updated. A field mask to specify the tenant fields to be updated. Only top level fields of Tenant are supported.
9317 ///
9318 /// Sets the *update mask* query property to the given value.
9319 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectTenantPatchCall<'a, C> {
9320 self._update_mask = Some(new_value);
9321 self
9322 }
9323 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9324 /// while executing the actual API request.
9325 ///
9326 /// ````text
9327 /// It should be used to handle progress information, and to implement a certain level of resilience.
9328 /// ````
9329 ///
9330 /// Sets the *delegate* property to the given value.
9331 pub fn delegate(
9332 mut self,
9333 new_value: &'a mut dyn common::Delegate,
9334 ) -> ProjectTenantPatchCall<'a, C> {
9335 self._delegate = Some(new_value);
9336 self
9337 }
9338
9339 /// Set any additional parameter of the query string used in the request.
9340 /// It should be used to set parameters which are not yet available through their own
9341 /// setters.
9342 ///
9343 /// Please note that this method must not be used to set any of the known parameters
9344 /// which have their own setter method. If done anyway, the request will fail.
9345 ///
9346 /// # Additional Parameters
9347 ///
9348 /// * *$.xgafv* (query-string) - V1 error format.
9349 /// * *access_token* (query-string) - OAuth access token.
9350 /// * *alt* (query-string) - Data format for response.
9351 /// * *callback* (query-string) - JSONP
9352 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9353 /// * *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.
9354 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9355 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9356 /// * *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.
9357 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9358 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9359 pub fn param<T>(mut self, name: T, value: T) -> ProjectTenantPatchCall<'a, C>
9360 where
9361 T: AsRef<str>,
9362 {
9363 self._additional_params
9364 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9365 self
9366 }
9367
9368 /// Identifies the authorization scope for the method you are building.
9369 ///
9370 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9371 /// [`Scope::CloudPlatform`].
9372 ///
9373 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9374 /// tokens for more than one scope.
9375 ///
9376 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9377 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9378 /// sufficient, a read-write scope will do as well.
9379 pub fn add_scope<St>(mut self, scope: St) -> ProjectTenantPatchCall<'a, C>
9380 where
9381 St: AsRef<str>,
9382 {
9383 self._scopes.insert(String::from(scope.as_ref()));
9384 self
9385 }
9386 /// Identifies the authorization scope(s) for the method you are building.
9387 ///
9388 /// See [`Self::add_scope()`] for details.
9389 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTenantPatchCall<'a, C>
9390 where
9391 I: IntoIterator<Item = St>,
9392 St: AsRef<str>,
9393 {
9394 self._scopes
9395 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9396 self
9397 }
9398
9399 /// Removes all scopes, and no default scope will be used either.
9400 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9401 /// for details).
9402 pub fn clear_scopes(mut self) -> ProjectTenantPatchCall<'a, C> {
9403 self._scopes.clear();
9404 self
9405 }
9406}