google_jobs3/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_jobs3 as jobs3;
53/// use jobs3::api::CreateJobRequest;
54/// use jobs3::{Result, Error};
55/// # async fn dox() {
56/// use jobs3::{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 = CreateJobRequest::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().jobs_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 /// Optional but at least one of uris, emails or instruction must be specified. 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 /// Optional but at least one of uris, emails or instruction must be specified. 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 /// Optional but at least one of uris, emails or instruction must be specified. 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/// Input only. Batch delete jobs request.
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/// * [jobs batch delete projects](ProjectJobBatchDeleteCall) (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 BatchDeleteJobsRequest {
211 /// Required. The filter string specifies the jobs to be deleted. Supported operator: =, AND The fields eligible for filtering are: * `companyName` (Required) * `requisitionId` (Required) Sample Query: companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1"
212 pub filter: Option<String>,
213}
214
215impl common::RequestValue for BatchDeleteJobsRequest {}
216
217/// Represents starting and ending value of a range in double.
218///
219/// This type is not used in any activity, and only used as *part* of another schema.
220///
221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
222#[serde_with::serde_as]
223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
224pub struct BucketRange {
225 /// Starting value of the bucket range.
226 pub from: Option<f64>,
227 /// Ending value of the bucket range.
228 pub to: Option<f64>,
229}
230
231impl common::Part for BucketRange {}
232
233/// Represents count of jobs within one bucket.
234///
235/// This type is not used in any activity, and only used as *part* of another schema.
236///
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct BucketizedCount {
241 /// Number of jobs whose numeric field value fall into `range`.
242 pub count: Option<i32>,
243 /// Bucket range on which histogram was performed for the numeric field, that is, the count represents number of jobs in this range.
244 pub range: Option<BucketRange>,
245}
246
247impl common::Part for BucketizedCount {}
248
249/// An event issued when an end user interacts with the application that implements Cloud Talent Solution. Providing this information improves the quality of search and recommendation 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.
250///
251/// # Activities
252///
253/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
254/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
255///
256/// * [client events create projects](ProjectClientEventCreateCall) (response)
257#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
258#[serde_with::serde_as]
259#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
260pub struct ClientEvent {
261 /// Required. The timestamp of the event.
262 #[serde(rename = "createTime")]
263 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
264 /// Required. A unique identifier, generated by the client application. This `event_id` is used to establish the relationship between different events (see parent_event_id).
265 #[serde(rename = "eventId")]
266 pub event_id: Option<String>,
267 /// Optional. Extra information about this event. Used for storing information with no matching field in event payload, for example, user application specific context or details. At most 20 keys are supported. The maximum total size of all keys and values is 2 KB.
268 #[serde(rename = "extraInfo")]
269 pub extra_info: Option<HashMap<String, String>>,
270 /// A event issued when a job seeker interacts with the application that implements Cloud Talent Solution.
271 #[serde(rename = "jobEvent")]
272 pub job_event: Option<JobEvent>,
273 /// Optional. The event_id of an event that resulted in the current event. For example, a Job view event usually follows a parent impression event: A job seeker first does a search where a list of jobs appears (impression). The job seeker then selects a result and views the description of a particular job (Job view).
274 #[serde(rename = "parentEventId")]
275 pub parent_event_id: Option<String>,
276 /// Required. A unique ID generated in the API responses. It can be found in ResponseMetadata.request_id.
277 #[serde(rename = "requestId")]
278 pub request_id: Option<String>,
279}
280
281impl common::ResponseResult for ClientEvent {}
282
283/// Input only. Parameters needed for commute search.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct CommuteFilter {
291 /// Optional. If true, jobs without "precise" addresses (street level addresses or GPS coordinates) might also be returned. For city and coarser level addresses, text matching is used. If this field is set to false or is not specified, only jobs that include precise addresses are returned by Commute Search. Note: If `allow_imprecise_addresses` is set to true, Commute Search is not able to calculate accurate commute times to jobs with city level and coarser address information. Jobs with imprecise addresses will return a `travel_duration` time of 0 regardless of distance from the job seeker.
292 #[serde(rename = "allowImpreciseAddresses")]
293 pub allow_imprecise_addresses: Option<bool>,
294 /// Required. The method of transportation for which to calculate the commute time.
295 #[serde(rename = "commuteMethod")]
296 pub commute_method: Option<String>,
297 /// Optional. 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.
298 #[serde(rename = "departureTime")]
299 pub departure_time: Option<TimeOfDay>,
300 /// Optional. Specifies the traffic density to use when calculating commute time.
301 #[serde(rename = "roadTraffic")]
302 pub road_traffic: Option<String>,
303 /// Required. The latitude and longitude of the location from which to calculate the commute time.
304 #[serde(rename = "startCoordinates")]
305 pub start_coordinates: Option<LatLng>,
306 /// Required. The maximum travel time in seconds. The maximum allowed value is `3600s` (one hour). Format is `123s`.
307 #[serde(rename = "travelDuration")]
308 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
309 pub travel_duration: Option<chrono::Duration>,
310}
311
312impl common::Part for CommuteFilter {}
313
314/// Output only. Commute details related to this job.
315///
316/// This type is not used in any activity, and only used as *part* of another schema.
317///
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct CommuteInfo {
322 /// Location used as the destination in the commute calculation.
323 #[serde(rename = "jobLocation")]
324 pub job_location: Option<Location>,
325 /// The number of seconds required to travel to the job location from the query location. A duration of 0 seconds indicates that the job is not reachable within the requested duration, but was returned as part of an expanded query.
326 #[serde(rename = "travelDuration")]
327 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
328 pub travel_duration: Option<chrono::Duration>,
329}
330
331impl common::Part for CommuteInfo {}
332
333/// 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.
334///
335/// # Activities
336///
337/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
338/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
339///
340/// * [companies create projects](ProjectCompanyCreateCall) (response)
341/// * [companies get projects](ProjectCompanyGetCall) (response)
342/// * [companies patch projects](ProjectCompanyPatchCall) (response)
343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
344#[serde_with::serde_as]
345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
346pub struct Company {
347 /// Optional. The URI to employer's career site or careers page on the employer's web site, for example, "https://careers.google.com".
348 #[serde(rename = "careerSiteUri")]
349 pub career_site_uri: Option<String>,
350 /// Output only. Derived details about the company.
351 #[serde(rename = "derivedInfo")]
352 pub derived_info: Option<CompanyDerivedInfo>,
353 /// Required. The display name of the company, for example, "Google LLC".
354 #[serde(rename = "displayName")]
355 pub display_name: Option<String>,
356 /// Optional. 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.
357 #[serde(rename = "eeoText")]
358 pub eeo_text: Option<String>,
359 /// Required. Client side company identifier, used to uniquely identify the company. The maximum number of allowed characters is 255.
360 #[serde(rename = "externalId")]
361 pub external_id: Option<String>,
362 /// Optional. 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.
363 #[serde(rename = "headquartersAddress")]
364 pub headquarters_address: Option<String>,
365 /// Optional. Set to true if it is the hiring agency that post jobs for other employers. Defaults to false if not provided.
366 #[serde(rename = "hiringAgency")]
367 pub hiring_agency: Option<bool>,
368 /// Optional. A URI that hosts the employer's company logo.
369 #[serde(rename = "imageUri")]
370 pub image_uri: Option<String>,
371 /// Optional. 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 search. Jobs with `string_values` under these specified field keys are returned if any of the values matches the search keyword. Custom field values with parenthesis, brackets and special symbols won't be properly searchable, and those keyword queries need to be surrounded by quotes.
372 #[serde(rename = "keywordSearchableJobCustomAttributes")]
373 pub keyword_searchable_job_custom_attributes: Option<Vec<String>>,
374 /// 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}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
375 pub name: Option<String>,
376 /// Optional. The employer's company size.
377 pub size: Option<String>,
378 /// 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.
379 pub suspended: Option<bool>,
380 /// Optional. 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.
381 #[serde(rename = "websiteUri")]
382 pub website_uri: Option<String>,
383}
384
385impl common::ResponseResult for Company {}
386
387/// Derived details about the company.
388///
389/// This type is not used in any activity, and only used as *part* of another schema.
390///
391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
392#[serde_with::serde_as]
393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
394pub struct CompanyDerivedInfo {
395 /// A structured headquarters location of the company, resolved from Company.hq_location if provided.
396 #[serde(rename = "headquartersLocation")]
397 pub headquarters_location: Option<Location>,
398}
399
400impl common::Part for CompanyDerivedInfo {}
401
402/// 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.
403///
404/// This type is not used in any activity, and only used as *part* of another schema.
405///
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct CompensationEntry {
410 /// Optional. Compensation amount.
411 pub amount: Option<Money>,
412 /// Optional. Compensation description. For example, could indicate equity terms or provide additional context to an estimated bonus.
413 pub description: Option<String>,
414 /// Optional. 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
415 #[serde(rename = "expectedUnitsPerYear")]
416 pub expected_units_per_year: Option<f64>,
417 /// Optional. Compensation range.
418 pub range: Option<CompensationRange>,
419 /// Optional. Compensation type. Default is CompensationUnit.COMPENSATION_TYPE_UNSPECIFIED.
420 #[serde(rename = "type")]
421 pub type_: Option<String>,
422 /// Optional. Frequency of the specified amount. Default is CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED.
423 pub unit: Option<String>,
424}
425
426impl common::Part for CompensationEntry {}
427
428/// Input only. Filter on job compensation type and amount.
429///
430/// This type is not used in any activity, and only used as *part* of another schema.
431///
432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
433#[serde_with::serde_as]
434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
435pub struct CompensationFilter {
436 /// Optional. If set to true, jobs with unspecified compensation range fields are included.
437 #[serde(rename = "includeJobsWithUnspecifiedCompensationRange")]
438 pub include_jobs_with_unspecified_compensation_range: Option<bool>,
439 /// Optional. Compensation range.
440 pub range: Option<CompensationRange>,
441 /// Required. Type of filter.
442 #[serde(rename = "type")]
443 pub type_: Option<String>,
444 /// Required. Specify desired `base compensation entry's` CompensationInfo.CompensationUnit.
445 pub units: Option<Vec<String>>,
446}
447
448impl common::Part for CompensationFilter {}
449
450/// Input only. Compensation based histogram request.
451///
452/// This type is not used in any activity, and only used as *part* of another schema.
453///
454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
455#[serde_with::serde_as]
456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
457pub struct CompensationHistogramRequest {
458 /// Required. Numeric histogram options, like buckets, whether include min or max value.
459 #[serde(rename = "bucketingOption")]
460 pub bucketing_option: Option<NumericBucketingOption>,
461 /// Required. Type of the request, representing which field the histogramming should be performed over. A single request can only specify one histogram of each `CompensationHistogramRequestType`.
462 #[serde(rename = "type")]
463 pub type_: Option<String>,
464}
465
466impl common::Part for CompensationHistogramRequest {}
467
468/// Output only. Compensation based histogram result.
469///
470/// This type is not used in any activity, and only used as *part* of another schema.
471///
472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
473#[serde_with::serde_as]
474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
475pub struct CompensationHistogramResult {
476 /// Histogram result.
477 pub result: Option<NumericBucketingResult>,
478 /// Type of the request, corresponding to CompensationHistogramRequest.type.
479 #[serde(rename = "type")]
480 pub type_: Option<String>,
481}
482
483impl common::Part for CompensationHistogramResult {}
484
485/// Job compensation details.
486///
487/// This type is not used in any activity, and only used as *part* of another schema.
488///
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct CompensationInfo {
493 /// Output only. Annualized base compensation range. Computed as base compensation entry's CompensationEntry.compensation times CompensationEntry.expected_units_per_year. See CompensationEntry for explanation on compensation annualization.
494 #[serde(rename = "annualizedBaseCompensationRange")]
495 pub annualized_base_compensation_range: Option<CompensationRange>,
496 /// Output only. Annualized total compensation range. Computed as all compensation entries' CompensationEntry.compensation times CompensationEntry.expected_units_per_year. See CompensationEntry for explanation on compensation annualization.
497 #[serde(rename = "annualizedTotalCompensationRange")]
498 pub annualized_total_compensation_range: Option<CompensationRange>,
499 /// Optional. Job compensation information. At most one entry can be of type CompensationInfo.CompensationType.BASE, which is referred as ** base compensation entry ** for the job.
500 pub entries: Option<Vec<CompensationEntry>>,
501}
502
503impl common::Part for CompensationInfo {}
504
505/// Compensation range.
506///
507/// This type is not used in any activity, and only used as *part* of another schema.
508///
509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
510#[serde_with::serde_as]
511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
512pub struct CompensationRange {
513 /// Optional. 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.
514 #[serde(rename = "maxCompensation")]
515 pub max_compensation: Option<Money>,
516 /// Optional. 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.
517 #[serde(rename = "minCompensation")]
518 pub min_compensation: Option<Money>,
519}
520
521impl common::Part for CompensationRange {}
522
523/// Output only. Response of auto-complete query.
524///
525/// # Activities
526///
527/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
528/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
529///
530/// * [complete projects](ProjectCompleteCall) (response)
531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
532#[serde_with::serde_as]
533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
534pub struct CompleteQueryResponse {
535 /// Results of the matching job/company candidates.
536 #[serde(rename = "completionResults")]
537 pub completion_results: Option<Vec<CompletionResult>>,
538 /// Additional information for the API invocation, such as the request tracking id.
539 pub metadata: Option<ResponseMetadata>,
540}
541
542impl common::ResponseResult for CompleteQueryResponse {}
543
544/// Output only. Resource that represents completion results.
545///
546/// This type is not used in any activity, and only used as *part* of another schema.
547///
548#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
549#[serde_with::serde_as]
550#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
551pub struct CompletionResult {
552 /// The URI of the company image for CompletionType.COMPANY_NAME.
553 #[serde(rename = "imageUri")]
554 pub image_uri: Option<String>,
555 /// The suggestion for the query.
556 pub suggestion: Option<String>,
557 /// The completion topic.
558 #[serde(rename = "type")]
559 pub type_: Option<String>,
560}
561
562impl common::Part for CompletionResult {}
563
564/// The report event request.
565///
566/// # Activities
567///
568/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
569/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
570///
571/// * [client events create projects](ProjectClientEventCreateCall) (request)
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct CreateClientEventRequest {
576 /// Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution.
577 #[serde(rename = "clientEvent")]
578 pub client_event: Option<ClientEvent>,
579}
580
581impl common::RequestValue for CreateClientEventRequest {}
582
583/// Input only. The Request of the CreateCompany method.
584///
585/// # Activities
586///
587/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
588/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
589///
590/// * [companies create projects](ProjectCompanyCreateCall) (request)
591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
592#[serde_with::serde_as]
593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
594pub struct CreateCompanyRequest {
595 /// Required. The company to be created.
596 pub company: Option<Company>,
597}
598
599impl common::RequestValue for CreateCompanyRequest {}
600
601/// Input only. Create job request.
602///
603/// # Activities
604///
605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
607///
608/// * [jobs create projects](ProjectJobCreateCall) (request)
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct CreateJobRequest {
613 /// Required. The Job to be created.
614 pub job: Option<Job>,
615}
616
617impl common::RequestValue for CreateJobRequest {}
618
619/// Custom attribute values that are either filterable or non-filterable.
620///
621/// This type is not used in any activity, and only used as *part* of another schema.
622///
623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
624#[serde_with::serde_as]
625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
626pub struct CustomAttribute {
627 /// Optional. 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.
628 pub filterable: Option<bool>,
629 /// Optional but 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.
630 #[serde(rename = "longValues")]
631 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
632 pub long_values: Option<Vec<i64>>,
633 /// Optional but 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 is not allowed.
634 #[serde(rename = "stringValues")]
635 pub string_values: Option<Vec<String>>,
636}
637
638impl common::Part for CustomAttribute {}
639
640/// Custom attributes histogram request. An error is thrown if neither string_value_histogram or long_value_histogram_bucketing_option has been defined.
641///
642/// This type is not used in any activity, and only used as *part* of another schema.
643///
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct CustomAttributeHistogramRequest {
648 /// Required. Specifies the custom field key to perform a histogram on. If specified without `long_value_histogram_bucketing_option`, histogram on string values of the given `key` is triggered, otherwise histogram is performed on long values.
649 pub key: Option<String>,
650 /// Optional. Specifies buckets used to perform a range histogram on Job's filterable long custom field values, or min/max value requirements.
651 #[serde(rename = "longValueHistogramBucketingOption")]
652 pub long_value_histogram_bucketing_option: Option<NumericBucketingOption>,
653 /// Optional. If set to true, the response includes the histogram value for each key as a string.
654 #[serde(rename = "stringValueHistogram")]
655 pub string_value_histogram: Option<bool>,
656}
657
658impl common::Part for CustomAttributeHistogramRequest {}
659
660/// Output only. Custom attribute histogram result.
661///
662/// This type is not used in any activity, and only used as *part* of another schema.
663///
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct CustomAttributeHistogramResult {
668 /// Stores the key of custom attribute the histogram is performed on.
669 pub key: Option<String>,
670 /// Stores bucketed histogram counting result or min/max values for custom attribute long values associated with `key`.
671 #[serde(rename = "longValueHistogramResult")]
672 pub long_value_histogram_result: Option<NumericBucketingResult>,
673 /// Stores a map from the values of string custom field associated with `key` to the number of jobs with that value in this histogram result.
674 #[serde(rename = "stringValueHistogramResult")]
675 pub string_value_histogram_result: Option<HashMap<String, i32>>,
676}
677
678impl common::Part for CustomAttributeHistogramResult {}
679
680/// 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.
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct DeviceInfo {
688 /// Optional. Type of the device.
689 #[serde(rename = "deviceType")]
690 pub device_type: Option<String>,
691 /// Optional. A device-specific ID. The ID must be a unique identifier that distinguishes the device from other devices.
692 pub id: Option<String>,
693}
694
695impl common::Part for DeviceInfo {}
696
697/// 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); }
698///
699/// # Activities
700///
701/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
702/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
703///
704/// * [companies delete projects](ProjectCompanyDeleteCall) (response)
705/// * [jobs batch delete projects](ProjectJobBatchDeleteCall) (response)
706/// * [jobs delete projects](ProjectJobDeleteCall) (response)
707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
708#[serde_with::serde_as]
709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
710pub struct Empty {
711 _never_set: Option<bool>,
712}
713
714impl common::ResponseResult for Empty {}
715
716/// Input only. Histogram facets to be specified in SearchJobsRequest.
717///
718/// This type is not used in any activity, and only used as *part* of another schema.
719///
720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
721#[serde_with::serde_as]
722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
723pub struct HistogramFacets {
724 /// Optional. Specifies compensation field-based histogram requests. Duplicate values of CompensationHistogramRequest.type are not allowed.
725 #[serde(rename = "compensationHistogramFacets")]
726 pub compensation_histogram_facets: Option<Vec<CompensationHistogramRequest>>,
727 /// Optional. Specifies the custom attributes histogram requests. Duplicate values of CustomAttributeHistogramRequest.key are not allowed.
728 #[serde(rename = "customAttributeHistogramFacets")]
729 pub custom_attribute_histogram_facets: Option<Vec<CustomAttributeHistogramRequest>>,
730 /// Optional. Specifies the simple type of histogram facets, for example, `COMPANY_SIZE`, `EMPLOYMENT_TYPE` etc.
731 #[serde(rename = "simpleHistogramFacets")]
732 pub simple_histogram_facets: Option<Vec<String>>,
733}
734
735impl common::Part for HistogramFacets {}
736
737/// Output only. Result of a histogram call. The response contains the histogram map for the search type specified by HistogramResult.field. The response is a map of each filter value to the corresponding count of jobs for that filter.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct HistogramResult {
745 /// The Histogram search filters.
746 #[serde(rename = "searchType")]
747 pub search_type: Option<String>,
748 /// A map from the values of field to the number of jobs with that value in this search result. Key: search type (filter names, such as the companyName). Values: the count of jobs that match the filter for this search.
749 pub values: Option<HashMap<String, i32>>,
750}
751
752impl common::Part for HistogramResult {}
753
754/// Output only. Histogram results that match HistogramFacets specified in SearchJobsRequest.
755///
756/// This type is not used in any activity, and only used as *part* of another schema.
757///
758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
759#[serde_with::serde_as]
760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
761pub struct HistogramResults {
762 /// Specifies compensation field-based histogram results that match HistogramFacets.compensation_histogram_requests.
763 #[serde(rename = "compensationHistogramResults")]
764 pub compensation_histogram_results: Option<Vec<CompensationHistogramResult>>,
765 /// Specifies histogram results for custom attributes that match HistogramFacets.custom_attribute_histogram_facets.
766 #[serde(rename = "customAttributeHistogramResults")]
767 pub custom_attribute_histogram_results: Option<Vec<CustomAttributeHistogramResult>>,
768 /// Specifies histogram results that matches HistogramFacets.simple_histogram_facets.
769 #[serde(rename = "simpleHistogramResults")]
770 pub simple_histogram_results: Option<Vec<HistogramResult>>,
771}
772
773impl common::Part for HistogramResults {}
774
775/// 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.
776///
777/// # Activities
778///
779/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
780/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
781///
782/// * [jobs create projects](ProjectJobCreateCall) (response)
783/// * [jobs get projects](ProjectJobGetCall) (response)
784/// * [jobs patch projects](ProjectJobPatchCall) (response)
785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
786#[serde_with::serde_as]
787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
788pub struct Job {
789 /// Optional but 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', etc.) as multiple jobs with the same company_name, 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.
790 pub addresses: Option<Vec<String>>,
791 /// Required. At least one field within ApplicationInfo must be specified. Job application information.
792 #[serde(rename = "applicationInfo")]
793 pub application_info: Option<ApplicationInfo>,
794 /// Output only. Display name of the company listing the job.
795 #[serde(rename = "companyDisplayName")]
796 pub company_display_name: Option<String>,
797 /// Required. The resource name of the company listing the job, such as "projects/api-test-project/companies/foo".
798 #[serde(rename = "companyName")]
799 pub company_name: Option<String>,
800 /// Optional. Job compensation information.
801 #[serde(rename = "compensationInfo")]
802 pub compensation_info: Option<CompensationInfo>,
803 /// Optional. 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.
804 #[serde(rename = "customAttributes")]
805 pub custom_attributes: Option<HashMap<String, CustomAttribute>>,
806 /// Optional. The desired education degrees for the job, such as Bachelors, Masters.
807 #[serde(rename = "degreeTypes")]
808 pub degree_types: Option<Vec<String>>,
809 /// Optional. The department or functional area within the company with the open position. The maximum number of allowed characters is 255.
810 pub department: Option<String>,
811 /// Output only. Derived details about the job posting.
812 #[serde(rename = "derivedInfo")]
813 pub derived_info: Option<JobDerivedInfo>,
814 /// 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.
815 pub description: Option<String>,
816 /// Optional. The employment type(s) of a job, for example, full time or part time.
817 #[serde(rename = "employmentTypes")]
818 pub employment_types: Option<Vec<String>>,
819 /// Optional. 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.
820 pub incentives: Option<String>,
821 /// Optional. The benefits included with the job.
822 #[serde(rename = "jobBenefits")]
823 pub job_benefits: Option<Vec<String>>,
824 /// Optional. The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored.
825 #[serde(rename = "jobEndTime")]
826 pub job_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
827 /// Optional. The experience level associated with the job, such as "Entry Level".
828 #[serde(rename = "jobLevel")]
829 pub job_level: Option<String>,
830 /// Optional. The start timestamp of the job in UTC time zone. Typically this field is used for contracting engagements. Invalid timestamps are ignored.
831 #[serde(rename = "jobStartTime")]
832 pub job_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
833 /// Optional. 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'.
834 #[serde(rename = "languageCode")]
835 pub language_code: Option<String>,
836 /// 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}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
837 pub name: Option<String>,
838 /// Output only. The timestamp when this job posting was created.
839 #[serde(rename = "postingCreateTime")]
840 pub posting_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
841 /// Optional but 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 deleted or listed by the DeleteJob and ListJobs APIs, but it can be retrieved with the GetJob API or updated with the UpdateJob 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_name, 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 of open jobs count over the past week, otherwise jobs with earlier expire time are cleaned first. Expired jobs are no longer accessible after they are cleaned out. Invalid timestamps are ignored, and treated as expire time not provided. Timestamp before the instant request is made is considered valid, the job will be treated as expired immediately. If this value is not 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 is not provided on job update, it depends on the field masks set by UpdateJobRequest.update_mask. If the field masks include expiry_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.
842 #[serde(rename = "postingExpireTime")]
843 pub posting_expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
844 /// Optional. 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.
845 #[serde(rename = "postingPublishTime")]
846 pub posting_publish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
847 /// Optional. 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.
848 #[serde(rename = "postingRegion")]
849 pub posting_region: Option<String>,
850 /// Output only. The timestamp when this job posting was last updated.
851 #[serde(rename = "postingUpdateTime")]
852 pub posting_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
853 /// Optional. Options for job processing.
854 #[serde(rename = "processingOptions")]
855 pub processing_options: Option<ProcessingOptions>,
856 /// Optional. 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.
857 #[serde(rename = "promotionValue")]
858 pub promotion_value: Option<i32>,
859 /// Optional. 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.
860 pub qualifications: Option<String>,
861 /// Required. The requisition ID, also referred to as the posting ID, 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 is not allowed to be created if there is another job with the same [company_name], language_code and requisition_id. The maximum number of allowed characters is 255.
862 #[serde(rename = "requisitionId")]
863 pub requisition_id: Option<String>,
864 /// Optional. 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.
865 pub responsibilities: Option<String>,
866 /// Required. The title of the job, such as "Software Engineer" The maximum number of allowed characters is 500.
867 pub title: Option<String>,
868 /// Deprecated. The job is only visible to the owner. The visibility of the job. Defaults to Visibility.ACCOUNT_ONLY if not specified.
869 pub visibility: Option<String>,
870}
871
872impl common::ResponseResult for Job {}
873
874/// Output only. Derived details about the job posting.
875///
876/// This type is not used in any activity, and only used as *part* of another schema.
877///
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct JobDerivedInfo {
882 /// Job categories derived from Job.title and Job.description.
883 #[serde(rename = "jobCategories")]
884 pub job_categories: Option<Vec<String>>,
885 /// Structured locations of the job, resolved from Job.addresses. locations are exactly matched to Job.addresses in the same order.
886 pub locations: Option<Vec<Location>>,
887}
888
889impl common::Part for JobDerivedInfo {}
890
891/// An event issued when a job seeker interacts with the application that implements Cloud Talent Solution.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct JobEvent {
899 /// 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.
900 pub jobs: Option<Vec<String>>,
901 /// Required. The type of the event (see JobEventType).
902 #[serde(rename = "type")]
903 pub type_: Option<String>,
904}
905
906impl common::Part for JobEvent {}
907
908/// Input only. The query required to perform a search query.
909///
910/// This type is not used in any activity, and only used as *part* of another schema.
911///
912#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
913#[serde_with::serde_as]
914#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
915pub struct JobQuery {
916 /// Optional. Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). Note: This only works with COMMUTE MODE. When specified, [JobQuery.location_filters] is ignored. Currently we don't support sorting by commute time.
917 #[serde(rename = "commuteFilter")]
918 pub commute_filter: Option<CommuteFilter>,
919 /// Optional. 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.
920 #[serde(rename = "companyDisplayNames")]
921 pub company_display_names: Option<Vec<String>>,
922 /// Optional. 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}/companies/{company_id}", for example, "projects/api-test-project/companies/foo". At most 20 company filters are allowed.
923 #[serde(rename = "companyNames")]
924 pub company_names: Option<Vec<String>>,
925 /// Optional. 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.
926 #[serde(rename = "compensationFilter")]
927 pub compensation_filter: Option<CompensationFilter>,
928 /// Optional. 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`
929 #[serde(rename = "customAttributeFilter")]
930 pub custom_attribute_filter: Option<String>,
931 /// Optional. 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.
932 #[serde(rename = "disableSpellCheck")]
933 pub disable_spell_check: Option<bool>,
934 /// Optional. The employment type filter specifies the employment type of jobs to search against, such as EmploymentType.FULL_TIME. If a value is not 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.
935 #[serde(rename = "employmentTypes")]
936 pub employment_types: Option<Vec<String>>,
937 /// Optional. The category filter specifies the categories of jobs to search against. See Category for more information. If a value is not specified, jobs from any category are searched against. If multiple values are specified, jobs from any of the specified categories are searched against.
938 #[serde(rename = "jobCategories")]
939 pub job_categories: Option<Vec<String>>,
940 /// Optional. 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.
941 #[serde(rename = "languageCodes")]
942 pub language_codes: Option<Vec<String>>,
943 /// Optional. 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.
944 #[serde(rename = "locationFilters")]
945 pub location_filters: Option<Vec<LocationFilter>>,
946 /// Optional. Jobs published within a range specified by this filter are searched against.
947 #[serde(rename = "publishTimeRange")]
948 pub publish_time_range: Option<TimestampRange>,
949 /// Optional. The query string that matches against the job title, description, and location fields. The maximum number of allowed characters is 255.
950 pub query: Option<String>,
951 /// 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).
952 #[serde(rename = "queryLanguageCode")]
953 pub query_language_code: Option<String>,
954}
955
956impl common::Part for JobQuery {}
957
958/// 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.
959///
960/// This type is not used in any activity, and only used as *part* of another schema.
961///
962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
963#[serde_with::serde_as]
964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
965pub struct LatLng {
966 /// The latitude in degrees. It must be in the range [-90.0, +90.0].
967 pub latitude: Option<f64>,
968 /// The longitude in degrees. It must be in the range [-180.0, +180.0].
969 pub longitude: Option<f64>,
970}
971
972impl common::Part for LatLng {}
973
974/// Output only. The List companies response object.
975///
976/// # Activities
977///
978/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
979/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
980///
981/// * [companies list projects](ProjectCompanyListCall) (response)
982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
983#[serde_with::serde_as]
984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
985pub struct ListCompaniesResponse {
986 /// Companies for the current client.
987 pub companies: Option<Vec<Company>>,
988 /// Additional information for the API invocation, such as the request tracking id.
989 pub metadata: Option<ResponseMetadata>,
990 /// A token to retrieve the next page of results.
991 #[serde(rename = "nextPageToken")]
992 pub next_page_token: Option<String>,
993}
994
995impl common::ResponseResult for ListCompaniesResponse {}
996
997/// Output only. List jobs response.
998///
999/// # Activities
1000///
1001/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1002/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1003///
1004/// * [jobs list projects](ProjectJobListCall) (response)
1005#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1006#[serde_with::serde_as]
1007#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1008pub struct ListJobsResponse {
1009 /// The Jobs for a given company. The maximum number of items returned is based on the limit field provided in the request.
1010 pub jobs: Option<Vec<Job>>,
1011 /// Additional information for the API invocation, such as the request tracking id.
1012 pub metadata: Option<ResponseMetadata>,
1013 /// A token to retrieve the next page of results.
1014 #[serde(rename = "nextPageToken")]
1015 pub next_page_token: Option<String>,
1016}
1017
1018impl common::ResponseResult for ListJobsResponse {}
1019
1020/// Output only. A resource that represents a location with full geographic information.
1021///
1022/// This type is not used in any activity, and only used as *part* of another schema.
1023///
1024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1025#[serde_with::serde_as]
1026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1027pub struct Location {
1028 /// An object representing a latitude/longitude pair.
1029 #[serde(rename = "latLng")]
1030 pub lat_lng: Option<LatLng>,
1031 /// The type of a location, which corresponds to the address lines field of PostalAddress. For example, "Downtown, Atlanta, GA, USA" has a type of LocationType#NEIGHBORHOOD, and "Kansas City, KS, USA" has a type of LocationType#LOCALITY.
1032 #[serde(rename = "locationType")]
1033 pub location_type: Option<String>,
1034 /// 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.
1035 #[serde(rename = "postalAddress")]
1036 pub postal_address: Option<PostalAddress>,
1037 /// 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 LatLng covers the area associated with the job location. For example, currently, "Mountain View, CA, USA" has a radius of 6.17 miles.
1038 #[serde(rename = "radiusInMiles")]
1039 pub radius_in_miles: Option<f64>,
1040}
1041
1042impl common::Part for Location {}
1043
1044/// Input only. Geographic region of the search.
1045///
1046/// This type is not used in any activity, and only used as *part* of another schema.
1047///
1048#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1049#[serde_with::serde_as]
1050#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1051pub struct LocationFilter {
1052 /// Optional. The address name, such as "Mountain View" or "Bay Area".
1053 pub address: Option<String>,
1054 /// Optional. The distance_in_miles is applied when the location being searched for is identified as a city or smaller. When the location being searched for is a state or larger, this field is ignored.
1055 #[serde(rename = "distanceInMiles")]
1056 pub distance_in_miles: Option<f64>,
1057 /// Optional. The latitude and longitude of the geographic center from which to search. This field's ignored if `address` is provided.
1058 #[serde(rename = "latLng")]
1059 pub lat_lng: Option<LatLng>,
1060 /// Optional. 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 limited. See https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
1061 #[serde(rename = "regionCode")]
1062 pub region_code: Option<String>,
1063 /// Optional. 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 latlng. 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.
1064 #[serde(rename = "telecommutePreference")]
1065 pub telecommute_preference: Option<String>,
1066}
1067
1068impl common::Part for LocationFilter {}
1069
1070/// Output only. Job entry with metadata inside SearchJobsResponse.
1071///
1072/// This type is not used in any activity, and only used as *part* of another schema.
1073///
1074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1075#[serde_with::serde_as]
1076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1077pub struct MatchingJob {
1078 /// Commute information which is generated based on specified CommuteFilter.
1079 #[serde(rename = "commuteInfo")]
1080 pub commute_info: Option<CommuteInfo>,
1081 /// Job resource that matches the specified SearchJobsRequest.
1082 pub job: Option<Job>,
1083 /// A summary of the job with core information that's displayed on the search results listing page.
1084 #[serde(rename = "jobSummary")]
1085 pub job_summary: Option<String>,
1086 /// Contains snippets of text from the Job.job_title field most closely matching a search query's keywords, if available. The matching query keywords are enclosed in HTML bold tags.
1087 #[serde(rename = "jobTitleSnippet")]
1088 pub job_title_snippet: Option<String>,
1089 /// 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.
1090 #[serde(rename = "searchTextSnippet")]
1091 pub search_text_snippet: Option<String>,
1092}
1093
1094impl common::Part for MatchingJob {}
1095
1096/// Represents an amount of money with its currency type.
1097///
1098/// This type is not used in any activity, and only used as *part* of another schema.
1099///
1100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1101#[serde_with::serde_as]
1102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1103pub struct Money {
1104 /// The three-letter currency code defined in ISO 4217.
1105 #[serde(rename = "currencyCode")]
1106 pub currency_code: Option<String>,
1107 /// 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.
1108 pub nanos: Option<i32>,
1109 /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
1110 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1111 pub units: Option<i64>,
1112}
1113
1114impl common::Part for Money {}
1115
1116/// Input only. Use this field to specify bucketing option for the histogram search response.
1117///
1118/// This type is not used in any activity, and only used as *part* of another schema.
1119///
1120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1121#[serde_with::serde_as]
1122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1123pub struct NumericBucketingOption {
1124 /// Required. Two adjacent values form a histogram bucket. Values should be in ascending order. For example, if [5, 10, 15] are provided, four buckets are created: (-inf, 5), 5, 10), [10, 15), [15, inf). At most 20 [buckets_bound is supported.
1125 #[serde(rename = "bucketBounds")]
1126 pub bucket_bounds: Option<Vec<f64>>,
1127 /// Optional. If set to true, the histogram result includes minimum/maximum value of the numeric field.
1128 #[serde(rename = "requiresMinMax")]
1129 pub requires_min_max: Option<bool>,
1130}
1131
1132impl common::Part for NumericBucketingOption {}
1133
1134/// Output only. Custom numeric bucketing result.
1135///
1136/// This type is not used in any activity, and only used as *part* of another schema.
1137///
1138#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1139#[serde_with::serde_as]
1140#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1141pub struct NumericBucketingResult {
1142 /// Count within each bucket. Its size is the length of NumericBucketingOption.bucket_bounds plus 1.
1143 pub counts: Option<Vec<BucketizedCount>>,
1144 /// Stores the maximum value of the numeric field. Is populated only if [NumericBucketingOption.requires_min_max] is set to true.
1145 #[serde(rename = "maxValue")]
1146 pub max_value: Option<f64>,
1147 /// Stores the minimum value of the numeric field. Will be populated only if [NumericBucketingOption.requires_min_max] is set to true.
1148 #[serde(rename = "minValue")]
1149 pub min_value: Option<f64>,
1150}
1151
1152impl common::Part for NumericBucketingResult {}
1153
1154/// 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.
1155///
1156/// This type is not used in any activity, and only used as *part* of another schema.
1157///
1158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1159#[serde_with::serde_as]
1160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1161pub struct PostalAddress {
1162 /// 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).
1163 #[serde(rename = "addressLines")]
1164 pub address_lines: Option<Vec<String>>,
1165 /// 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.
1166 #[serde(rename = "administrativeArea")]
1167 pub administrative_area: Option<String>,
1168 /// 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".
1169 #[serde(rename = "languageCode")]
1170 pub language_code: Option<String>,
1171 /// 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`.
1172 pub locality: Option<String>,
1173 /// Optional. The name of the organization at the address.
1174 pub organization: Option<String>,
1175 /// 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).
1176 #[serde(rename = "postalCode")]
1177 pub postal_code: Option<String>,
1178 /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
1179 pub recipients: Option<Vec<String>>,
1180 /// 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.
1181 #[serde(rename = "regionCode")]
1182 pub region_code: Option<String>,
1183 /// 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.
1184 pub revision: Option<i32>,
1185 /// 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).
1186 #[serde(rename = "sortingCode")]
1187 pub sorting_code: Option<String>,
1188 /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
1189 pub sublocality: Option<String>,
1190}
1191
1192impl common::Part for PostalAddress {}
1193
1194/// Input only. Options for job processing.
1195///
1196/// This type is not used in any activity, and only used as *part* of another schema.
1197///
1198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1199#[serde_with::serde_as]
1200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1201pub struct ProcessingOptions {
1202 /// Optional. If set to `true`, the service does not attempt to resolve a more precise address for the job.
1203 #[serde(rename = "disableStreetAddressResolution")]
1204 pub disable_street_address_resolution: Option<bool>,
1205 /// Optional. 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 is not disabled. Defaults to HtmlSanitization.SIMPLE_FORMATTING_ONLY.
1206 #[serde(rename = "htmlSanitization")]
1207 pub html_sanitization: Option<String>,
1208}
1209
1210impl common::Part for ProcessingOptions {}
1211
1212/// Input only. Meta information related to the job searcher or entity conducting the job search. This information is used to improve the performance of the service.
1213///
1214/// This type is not used in any activity, and only used as *part* of another schema.
1215///
1216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1217#[serde_with::serde_as]
1218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1219pub struct RequestMetadata {
1220 /// Optional. The type of device used by the job seeker at the time of the call to the service.
1221 #[serde(rename = "deviceInfo")]
1222 pub device_info: Option<DeviceInfo>,
1223 /// Required. 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. If this field isn't available for some reason, send "UNKNOWN". Any improvements to the model for a particular tenant site rely on this field being set correctly to a domain. The maximum number of allowed characters is 255.
1224 pub domain: Option<String>,
1225 /// Required. 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. If this field is not available for some reason, send "UNKNOWN". Note that any improvements to the model for a particular tenant site, rely on this field being set correctly to some unique session_id. The maximum number of allowed characters is 255.
1226 #[serde(rename = "sessionId")]
1227 pub session_id: Option<String>,
1228 /// Required. 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. If this field is not available for some reason, send "UNKNOWN". 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.
1229 #[serde(rename = "userId")]
1230 pub user_id: Option<String>,
1231}
1232
1233impl common::Part for RequestMetadata {}
1234
1235/// Output only. Additional information returned to client, such as debugging information.
1236///
1237/// This type is not used in any activity, and only used as *part* of another schema.
1238///
1239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1240#[serde_with::serde_as]
1241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1242pub struct ResponseMetadata {
1243 /// A unique id associated with this call. This id is logged for tracking purposes.
1244 #[serde(rename = "requestId")]
1245 pub request_id: Option<String>,
1246}
1247
1248impl common::Part for ResponseMetadata {}
1249
1250/// Input only. The Request body of the `SearchJobs` call.
1251///
1252/// # Activities
1253///
1254/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1255/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1256///
1257/// * [jobs search projects](ProjectJobSearchCall) (request)
1258/// * [jobs search for alert projects](ProjectJobSearchForAlertCall) (request)
1259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1260#[serde_with::serde_as]
1261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1262pub struct SearchJobsRequest {
1263 /// Optional. Controls whether to disable exact keyword match on Job.job_title, Job.description, Job.company_display_name, Job.locations, 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, the query "program manager," a result is returned even if the job posting has the title "software developer," which does not fall into "program manager" ontology, but does have "program manager" appearing in its description. For queries like "cloud" that does not contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value. Please use Company.keyword_searchable_custom_fields or Company.keyword_searchable_custom_attributes if company specific globally matched custom field/attribute string values is needed. Enabling keyword match improves recall of subsequent search requests. Defaults to false.
1264 #[serde(rename = "disableKeywordMatch")]
1265 pub disable_keyword_match: Option<bool>,
1266 /// Optional. 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.
1267 #[serde(rename = "diversificationLevel")]
1268 pub diversification_level: Option<String>,
1269 /// Optional. 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.
1270 #[serde(rename = "enableBroadening")]
1271 pub enable_broadening: Option<bool>,
1272 /// Optional. Histogram requests for jobs matching JobQuery.
1273 #[serde(rename = "histogramFacets")]
1274 pub histogram_facets: Option<HistogramFacets>,
1275 /// Optional. Query used to search against jobs, such as keyword, location filters, etc.
1276 #[serde(rename = "jobQuery")]
1277 pub job_query: Option<JobQuery>,
1278 /// Optional. The desired job attributes returned for jobs in the search response. Defaults to JobView.SMALL if no value is specified.
1279 #[serde(rename = "jobView")]
1280 pub job_view: Option<String>,
1281 /// Optional. 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).
1282 pub offset: Option<i32>,
1283 /// Optional. 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.
1284 #[serde(rename = "orderBy")]
1285 pub order_by: Option<String>,
1286 /// Optional. 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.
1287 #[serde(rename = "pageSize")]
1288 pub page_size: Option<i32>,
1289 /// Optional. 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.
1290 #[serde(rename = "pageToken")]
1291 pub page_token: Option<String>,
1292 /// 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.
1293 #[serde(rename = "requestMetadata")]
1294 pub request_metadata: Option<RequestMetadata>,
1295 /// This field is deprecated.
1296 #[serde(rename = "requirePreciseResultSize")]
1297 pub require_precise_result_size: Option<bool>,
1298 /// Optional. Mode of a search. Defaults to SearchMode.JOB_SEARCH.
1299 #[serde(rename = "searchMode")]
1300 pub search_mode: Option<String>,
1301}
1302
1303impl common::RequestValue for SearchJobsRequest {}
1304
1305/// Output only. Response for SearchJob method.
1306///
1307/// # Activities
1308///
1309/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1310/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1311///
1312/// * [jobs search projects](ProjectJobSearchCall) (response)
1313/// * [jobs search for alert projects](ProjectJobSearchForAlertCall) (response)
1314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1315#[serde_with::serde_as]
1316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1317pub struct SearchJobsResponse {
1318 /// 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.
1319 #[serde(rename = "broadenedQueryJobsCount")]
1320 pub broadened_query_jobs_count: Option<i32>,
1321 /// An estimation of the number of jobs that match the specified query. This number is not guaranteed to be accurate. For accurate results, see SearchJobsResponse.total_size.
1322 #[serde(rename = "estimatedTotalSize")]
1323 pub estimated_total_size: Option<i32>,
1324 /// The histogram results that match specified SearchJobsRequest.histogram_facets.
1325 #[serde(rename = "histogramResults")]
1326 pub histogram_results: Option<HistogramResults>,
1327 /// The location filters that the service applied to the specified query. If any filters are lat-lng based, the JobLocation.location_type is JobLocation.LocationType#LOCATION_TYPE_UNSPECIFIED.
1328 #[serde(rename = "locationFilters")]
1329 pub location_filters: Option<Vec<Location>>,
1330 /// The Job entities that match the specified SearchJobsRequest.
1331 #[serde(rename = "matchingJobs")]
1332 pub matching_jobs: Option<Vec<MatchingJob>>,
1333 /// Additional information for the API invocation, such as the request tracking id.
1334 pub metadata: Option<ResponseMetadata>,
1335 /// The token that specifies the starting position of the next page of results. This field is empty if there are no more results.
1336 #[serde(rename = "nextPageToken")]
1337 pub next_page_token: Option<String>,
1338 /// The spell checking result, and correction.
1339 #[serde(rename = "spellCorrection")]
1340 pub spell_correction: Option<SpellingCorrection>,
1341 /// The precise result count with limit 100,000.
1342 #[serde(rename = "totalSize")]
1343 pub total_size: Option<i32>,
1344}
1345
1346impl common::ResponseResult for SearchJobsResponse {}
1347
1348/// Output only. Spell check result.
1349///
1350/// This type is not used in any activity, and only used as *part* of another schema.
1351///
1352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1353#[serde_with::serde_as]
1354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1355pub struct SpellingCorrection {
1356 /// Indicates if the query was corrected by the spell checker.
1357 pub corrected: Option<bool>,
1358 /// Correction output consisting of the corrected keyword string.
1359 #[serde(rename = "correctedText")]
1360 pub corrected_text: Option<String>,
1361}
1362
1363impl common::Part for SpellingCorrection {}
1364
1365/// 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`.
1366///
1367/// This type is not used in any activity, and only used as *part* of another schema.
1368///
1369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1370#[serde_with::serde_as]
1371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1372pub struct TimeOfDay {
1373 /// 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.
1374 pub hours: Option<i32>,
1375 /// Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
1376 pub minutes: Option<i32>,
1377 /// Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
1378 pub nanos: Option<i32>,
1379 /// 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.
1380 pub seconds: Option<i32>,
1381}
1382
1383impl common::Part for TimeOfDay {}
1384
1385/// Message representing a period of time between two timestamps.
1386///
1387/// This type is not used in any activity, and only used as *part* of another schema.
1388///
1389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1390#[serde_with::serde_as]
1391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1392pub struct TimestampRange {
1393 /// End of the period.
1394 #[serde(rename = "endTime")]
1395 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1396 /// Begin of the period.
1397 #[serde(rename = "startTime")]
1398 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1399}
1400
1401impl common::Part for TimestampRange {}
1402
1403/// Input only. Request for updating a specified company.
1404///
1405/// # Activities
1406///
1407/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1408/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1409///
1410/// * [companies patch projects](ProjectCompanyPatchCall) (request)
1411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1412#[serde_with::serde_as]
1413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1414pub struct UpdateCompanyRequest {
1415 /// Required. The company resource to replace the current resource in the system.
1416 pub company: Option<Company>,
1417 /// Optional but 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.
1418 #[serde(rename = "updateMask")]
1419 pub update_mask: Option<common::FieldMask>,
1420}
1421
1422impl common::RequestValue for UpdateCompanyRequest {}
1423
1424/// Input only. Update job request.
1425///
1426/// # Activities
1427///
1428/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1429/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1430///
1431/// * [jobs patch projects](ProjectJobPatchCall) (request)
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct UpdateJobRequest {
1436 /// Required. The Job to be updated.
1437 pub job: Option<Job>,
1438 /// Optional but strongly recommended to be provided 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.
1439 #[serde(rename = "updateMask")]
1440 pub update_mask: Option<common::FieldMask>,
1441}
1442
1443impl common::RequestValue for UpdateJobRequest {}
1444
1445// ###################
1446// MethodBuilders ###
1447// #################
1448
1449/// A builder providing access to all methods supported on *project* resources.
1450/// It is not used directly, but through the [`CloudTalentSolution`] hub.
1451///
1452/// # Example
1453///
1454/// Instantiate a resource builder
1455///
1456/// ```test_harness,no_run
1457/// extern crate hyper;
1458/// extern crate hyper_rustls;
1459/// extern crate google_jobs3 as jobs3;
1460///
1461/// # async fn dox() {
1462/// use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1463///
1464/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1465/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1466/// .with_native_roots()
1467/// .unwrap()
1468/// .https_only()
1469/// .enable_http2()
1470/// .build();
1471///
1472/// let executor = hyper_util::rt::TokioExecutor::new();
1473/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1474/// secret,
1475/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1476/// yup_oauth2::client::CustomHyperClientBuilder::from(
1477/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1478/// ),
1479/// ).build().await.unwrap();
1480///
1481/// let client = hyper_util::client::legacy::Client::builder(
1482/// hyper_util::rt::TokioExecutor::new()
1483/// )
1484/// .build(
1485/// hyper_rustls::HttpsConnectorBuilder::new()
1486/// .with_native_roots()
1487/// .unwrap()
1488/// .https_or_http()
1489/// .enable_http2()
1490/// .build()
1491/// );
1492/// let mut hub = CloudTalentSolution::new(client, auth);
1493/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1494/// // like `client_events_create(...)`, `companies_create(...)`, `companies_delete(...)`, `companies_get(...)`, `companies_list(...)`, `companies_patch(...)`, `complete(...)`, `jobs_batch_delete(...)`, `jobs_create(...)`, `jobs_delete(...)`, `jobs_get(...)`, `jobs_list(...)`, `jobs_patch(...)`, `jobs_search(...)` and `jobs_search_for_alert(...)`
1495/// // to build up your call.
1496/// let rb = hub.projects();
1497/// # }
1498/// ```
1499pub struct ProjectMethods<'a, C>
1500where
1501 C: 'a,
1502{
1503 hub: &'a CloudTalentSolution<C>,
1504}
1505
1506impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1507
1508impl<'a, C> ProjectMethods<'a, C> {
1509 /// Create a builder to help you perform the following task:
1510 ///
1511 /// 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.
1512 ///
1513 /// # Arguments
1514 ///
1515 /// * `request` - No description provided.
1516 /// * `parent` - Parent project name.
1517 pub fn client_events_create(
1518 &self,
1519 request: CreateClientEventRequest,
1520 parent: &str,
1521 ) -> ProjectClientEventCreateCall<'a, C> {
1522 ProjectClientEventCreateCall {
1523 hub: self.hub,
1524 _request: request,
1525 _parent: parent.to_string(),
1526 _delegate: Default::default(),
1527 _additional_params: Default::default(),
1528 _scopes: Default::default(),
1529 }
1530 }
1531
1532 /// Create a builder to help you perform the following task:
1533 ///
1534 /// Creates a new company entity.
1535 ///
1536 /// # Arguments
1537 ///
1538 /// * `request` - No description provided.
1539 /// * `parent` - Required. Resource name of the project under which the company is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
1540 pub fn companies_create(
1541 &self,
1542 request: CreateCompanyRequest,
1543 parent: &str,
1544 ) -> ProjectCompanyCreateCall<'a, C> {
1545 ProjectCompanyCreateCall {
1546 hub: self.hub,
1547 _request: request,
1548 _parent: parent.to_string(),
1549 _delegate: Default::default(),
1550 _additional_params: Default::default(),
1551 _scopes: Default::default(),
1552 }
1553 }
1554
1555 /// Create a builder to help you perform the following task:
1556 ///
1557 /// Deletes specified company. Prerequisite: The company has no jobs associated with it.
1558 ///
1559 /// # Arguments
1560 ///
1561 /// * `name` - Required. The resource name of the company to be deleted. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
1562 pub fn companies_delete(&self, name: &str) -> ProjectCompanyDeleteCall<'a, C> {
1563 ProjectCompanyDeleteCall {
1564 hub: self.hub,
1565 _name: name.to_string(),
1566 _delegate: Default::default(),
1567 _additional_params: Default::default(),
1568 _scopes: Default::default(),
1569 }
1570 }
1571
1572 /// Create a builder to help you perform the following task:
1573 ///
1574 /// Retrieves specified company.
1575 ///
1576 /// # Arguments
1577 ///
1578 /// * `name` - Required. The resource name of the company to be retrieved. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
1579 pub fn companies_get(&self, name: &str) -> ProjectCompanyGetCall<'a, C> {
1580 ProjectCompanyGetCall {
1581 hub: self.hub,
1582 _name: name.to_string(),
1583 _delegate: Default::default(),
1584 _additional_params: Default::default(),
1585 _scopes: Default::default(),
1586 }
1587 }
1588
1589 /// Create a builder to help you perform the following task:
1590 ///
1591 /// Lists all companies associated with the service account.
1592 ///
1593 /// # Arguments
1594 ///
1595 /// * `parent` - Required. Resource name of the project under which the company is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
1596 pub fn companies_list(&self, parent: &str) -> ProjectCompanyListCall<'a, C> {
1597 ProjectCompanyListCall {
1598 hub: self.hub,
1599 _parent: parent.to_string(),
1600 _require_open_jobs: Default::default(),
1601 _page_token: Default::default(),
1602 _page_size: Default::default(),
1603 _delegate: Default::default(),
1604 _additional_params: Default::default(),
1605 _scopes: Default::default(),
1606 }
1607 }
1608
1609 /// Create a builder to help you perform the following task:
1610 ///
1611 /// Updates specified company. Company names can't be updated. To update a company name, delete the company and all jobs associated with it, and only then re-create them.
1612 ///
1613 /// # Arguments
1614 ///
1615 /// * `request` - No description provided.
1616 /// * `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}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
1617 pub fn companies_patch(
1618 &self,
1619 request: UpdateCompanyRequest,
1620 name: &str,
1621 ) -> ProjectCompanyPatchCall<'a, C> {
1622 ProjectCompanyPatchCall {
1623 hub: self.hub,
1624 _request: request,
1625 _name: name.to_string(),
1626 _delegate: Default::default(),
1627 _additional_params: Default::default(),
1628 _scopes: Default::default(),
1629 }
1630 }
1631
1632 /// Create a builder to help you perform the following task:
1633 ///
1634 /// Deletes a list of Jobs by filter.
1635 ///
1636 /// # Arguments
1637 ///
1638 /// * `request` - No description provided.
1639 /// * `parent` - Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
1640 pub fn jobs_batch_delete(
1641 &self,
1642 request: BatchDeleteJobsRequest,
1643 parent: &str,
1644 ) -> ProjectJobBatchDeleteCall<'a, C> {
1645 ProjectJobBatchDeleteCall {
1646 hub: self.hub,
1647 _request: request,
1648 _parent: parent.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 /// Creates a new job. Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
1658 ///
1659 /// # Arguments
1660 ///
1661 /// * `request` - No description provided.
1662 /// * `parent` - Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
1663 pub fn jobs_create(
1664 &self,
1665 request: CreateJobRequest,
1666 parent: &str,
1667 ) -> ProjectJobCreateCall<'a, C> {
1668 ProjectJobCreateCall {
1669 hub: self.hub,
1670 _request: request,
1671 _parent: parent.to_string(),
1672 _delegate: Default::default(),
1673 _additional_params: Default::default(),
1674 _scopes: Default::default(),
1675 }
1676 }
1677
1678 /// Create a builder to help you perform the following task:
1679 ///
1680 /// Deletes the specified job. Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
1681 ///
1682 /// # Arguments
1683 ///
1684 /// * `name` - Required. The resource name of the job to be deleted. The format is "projects/{project_id}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234".
1685 pub fn jobs_delete(&self, name: &str) -> ProjectJobDeleteCall<'a, C> {
1686 ProjectJobDeleteCall {
1687 hub: self.hub,
1688 _name: name.to_string(),
1689 _delegate: Default::default(),
1690 _additional_params: Default::default(),
1691 _scopes: Default::default(),
1692 }
1693 }
1694
1695 /// Create a builder to help you perform the following task:
1696 ///
1697 /// Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
1698 ///
1699 /// # Arguments
1700 ///
1701 /// * `name` - Required. The resource name of the job to retrieve. The format is "projects/{project_id}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234".
1702 pub fn jobs_get(&self, name: &str) -> ProjectJobGetCall<'a, C> {
1703 ProjectJobGetCall {
1704 hub: self.hub,
1705 _name: name.to_string(),
1706 _delegate: Default::default(),
1707 _additional_params: Default::default(),
1708 _scopes: Default::default(),
1709 }
1710 }
1711
1712 /// Create a builder to help you perform the following task:
1713 ///
1714 /// Lists jobs by filter.
1715 ///
1716 /// # Arguments
1717 ///
1718 /// * `parent` - Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
1719 pub fn jobs_list(&self, parent: &str) -> ProjectJobListCall<'a, C> {
1720 ProjectJobListCall {
1721 hub: self.hub,
1722 _parent: parent.to_string(),
1723 _page_token: Default::default(),
1724 _page_size: Default::default(),
1725 _job_view: Default::default(),
1726 _filter: Default::default(),
1727 _delegate: Default::default(),
1728 _additional_params: Default::default(),
1729 _scopes: Default::default(),
1730 }
1731 }
1732
1733 /// Create a builder to help you perform the following task:
1734 ///
1735 /// Updates specified job. Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
1736 ///
1737 /// # Arguments
1738 ///
1739 /// * `request` - No description provided.
1740 /// * `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}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
1741 pub fn jobs_patch(&self, request: UpdateJobRequest, name: &str) -> ProjectJobPatchCall<'a, C> {
1742 ProjectJobPatchCall {
1743 hub: self.hub,
1744 _request: request,
1745 _name: name.to_string(),
1746 _delegate: Default::default(),
1747 _additional_params: Default::default(),
1748 _scopes: Default::default(),
1749 }
1750 }
1751
1752 /// Create a builder to help you perform the following task:
1753 ///
1754 /// 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.
1755 ///
1756 /// # Arguments
1757 ///
1758 /// * `request` - No description provided.
1759 /// * `parent` - Required. The resource name of the project to search within. The format is "projects/{project_id}", for example, "projects/api-test-project".
1760 pub fn jobs_search(
1761 &self,
1762 request: SearchJobsRequest,
1763 parent: &str,
1764 ) -> ProjectJobSearchCall<'a, C> {
1765 ProjectJobSearchCall {
1766 hub: self.hub,
1767 _request: request,
1768 _parent: parent.to_string(),
1769 _delegate: Default::default(),
1770 _additional_params: Default::default(),
1771 _scopes: Default::default(),
1772 }
1773 }
1774
1775 /// Create a builder to help you perform the following task:
1776 ///
1777 /// 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), and has different algorithmic adjustments that are targeted to 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.
1778 ///
1779 /// # Arguments
1780 ///
1781 /// * `request` - No description provided.
1782 /// * `parent` - Required. The resource name of the project to search within. The format is "projects/{project_id}", for example, "projects/api-test-project".
1783 pub fn jobs_search_for_alert(
1784 &self,
1785 request: SearchJobsRequest,
1786 parent: &str,
1787 ) -> ProjectJobSearchForAlertCall<'a, C> {
1788 ProjectJobSearchForAlertCall {
1789 hub: self.hub,
1790 _request: request,
1791 _parent: parent.to_string(),
1792 _delegate: Default::default(),
1793 _additional_params: Default::default(),
1794 _scopes: Default::default(),
1795 }
1796 }
1797
1798 /// Create a builder to help you perform the following task:
1799 ///
1800 /// Completes the specified prefix with keyword suggestions. Intended for use by a job search auto-complete search box.
1801 ///
1802 /// # Arguments
1803 ///
1804 /// * `name` - Required. Resource name of project the completion is performed within. The format is "projects/{project_id}", for example, "projects/api-test-project".
1805 pub fn complete(&self, name: &str) -> ProjectCompleteCall<'a, C> {
1806 ProjectCompleteCall {
1807 hub: self.hub,
1808 _name: name.to_string(),
1809 _type_: Default::default(),
1810 _scope: Default::default(),
1811 _query: Default::default(),
1812 _page_size: Default::default(),
1813 _language_codes: Default::default(),
1814 _language_code: Default::default(),
1815 _company_name: Default::default(),
1816 _delegate: Default::default(),
1817 _additional_params: Default::default(),
1818 _scopes: Default::default(),
1819 }
1820 }
1821}
1822
1823// ###################
1824// CallBuilders ###
1825// #################
1826
1827/// 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.
1828///
1829/// A builder for the *clientEvents.create* method supported by a *project* resource.
1830/// It is not used directly, but through a [`ProjectMethods`] instance.
1831///
1832/// # Example
1833///
1834/// Instantiate a resource method builder
1835///
1836/// ```test_harness,no_run
1837/// # extern crate hyper;
1838/// # extern crate hyper_rustls;
1839/// # extern crate google_jobs3 as jobs3;
1840/// use jobs3::api::CreateClientEventRequest;
1841/// # async fn dox() {
1842/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1843///
1844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1845/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1846/// # .with_native_roots()
1847/// # .unwrap()
1848/// # .https_only()
1849/// # .enable_http2()
1850/// # .build();
1851///
1852/// # let executor = hyper_util::rt::TokioExecutor::new();
1853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1854/// # secret,
1855/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1856/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1857/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1858/// # ),
1859/// # ).build().await.unwrap();
1860///
1861/// # let client = hyper_util::client::legacy::Client::builder(
1862/// # hyper_util::rt::TokioExecutor::new()
1863/// # )
1864/// # .build(
1865/// # hyper_rustls::HttpsConnectorBuilder::new()
1866/// # .with_native_roots()
1867/// # .unwrap()
1868/// # .https_or_http()
1869/// # .enable_http2()
1870/// # .build()
1871/// # );
1872/// # let mut hub = CloudTalentSolution::new(client, auth);
1873/// // As the method needs a request, you would usually fill it with the desired information
1874/// // into the respective structure. Some of the parts shown here might not be applicable !
1875/// // Values shown here are possibly random and not representative !
1876/// let mut req = CreateClientEventRequest::default();
1877///
1878/// // You can configure optional parameters by calling the respective setters at will, and
1879/// // execute the final call using `doit()`.
1880/// // Values shown here are possibly random and not representative !
1881/// let result = hub.projects().client_events_create(req, "parent")
1882/// .doit().await;
1883/// # }
1884/// ```
1885pub struct ProjectClientEventCreateCall<'a, C>
1886where
1887 C: 'a,
1888{
1889 hub: &'a CloudTalentSolution<C>,
1890 _request: CreateClientEventRequest,
1891 _parent: String,
1892 _delegate: Option<&'a mut dyn common::Delegate>,
1893 _additional_params: HashMap<String, String>,
1894 _scopes: BTreeSet<String>,
1895}
1896
1897impl<'a, C> common::CallBuilder for ProjectClientEventCreateCall<'a, C> {}
1898
1899impl<'a, C> ProjectClientEventCreateCall<'a, C>
1900where
1901 C: common::Connector,
1902{
1903 /// Perform the operation you have build so far.
1904 pub async fn doit(mut self) -> common::Result<(common::Response, ClientEvent)> {
1905 use std::borrow::Cow;
1906 use std::io::{Read, Seek};
1907
1908 use common::{url::Params, ToParts};
1909 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1910
1911 let mut dd = common::DefaultDelegate;
1912 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1913 dlg.begin(common::MethodInfo {
1914 id: "jobs.projects.clientEvents.create",
1915 http_method: hyper::Method::POST,
1916 });
1917
1918 for &field in ["alt", "parent"].iter() {
1919 if self._additional_params.contains_key(field) {
1920 dlg.finished(false);
1921 return Err(common::Error::FieldClash(field));
1922 }
1923 }
1924
1925 let mut params = Params::with_capacity(4 + self._additional_params.len());
1926 params.push("parent", self._parent);
1927
1928 params.extend(self._additional_params.iter());
1929
1930 params.push("alt", "json");
1931 let mut url = self.hub._base_url.clone() + "v3/{+parent}/clientEvents";
1932 if self._scopes.is_empty() {
1933 self._scopes
1934 .insert(Scope::CloudPlatform.as_ref().to_string());
1935 }
1936
1937 #[allow(clippy::single_element_loop)]
1938 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1939 url = params.uri_replacement(url, param_name, find_this, true);
1940 }
1941 {
1942 let to_remove = ["parent"];
1943 params.remove_params(&to_remove);
1944 }
1945
1946 let url = params.parse_with_url(&url);
1947
1948 let mut json_mime_type = mime::APPLICATION_JSON;
1949 let mut request_value_reader = {
1950 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1951 common::remove_json_null_values(&mut value);
1952 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1953 serde_json::to_writer(&mut dst, &value).unwrap();
1954 dst
1955 };
1956 let request_size = request_value_reader
1957 .seek(std::io::SeekFrom::End(0))
1958 .unwrap();
1959 request_value_reader
1960 .seek(std::io::SeekFrom::Start(0))
1961 .unwrap();
1962
1963 loop {
1964 let token = match self
1965 .hub
1966 .auth
1967 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1968 .await
1969 {
1970 Ok(token) => token,
1971 Err(e) => match dlg.token(e) {
1972 Ok(token) => token,
1973 Err(e) => {
1974 dlg.finished(false);
1975 return Err(common::Error::MissingToken(e));
1976 }
1977 },
1978 };
1979 request_value_reader
1980 .seek(std::io::SeekFrom::Start(0))
1981 .unwrap();
1982 let mut req_result = {
1983 let client = &self.hub.client;
1984 dlg.pre_request();
1985 let mut req_builder = hyper::Request::builder()
1986 .method(hyper::Method::POST)
1987 .uri(url.as_str())
1988 .header(USER_AGENT, self.hub._user_agent.clone());
1989
1990 if let Some(token) = token.as_ref() {
1991 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1992 }
1993
1994 let request = req_builder
1995 .header(CONTENT_TYPE, json_mime_type.to_string())
1996 .header(CONTENT_LENGTH, request_size as u64)
1997 .body(common::to_body(
1998 request_value_reader.get_ref().clone().into(),
1999 ));
2000
2001 client.request(request.unwrap()).await
2002 };
2003
2004 match req_result {
2005 Err(err) => {
2006 if let common::Retry::After(d) = dlg.http_error(&err) {
2007 sleep(d).await;
2008 continue;
2009 }
2010 dlg.finished(false);
2011 return Err(common::Error::HttpError(err));
2012 }
2013 Ok(res) => {
2014 let (mut parts, body) = res.into_parts();
2015 let mut body = common::Body::new(body);
2016 if !parts.status.is_success() {
2017 let bytes = common::to_bytes(body).await.unwrap_or_default();
2018 let error = serde_json::from_str(&common::to_string(&bytes));
2019 let response = common::to_response(parts, bytes.into());
2020
2021 if let common::Retry::After(d) =
2022 dlg.http_failure(&response, error.as_ref().ok())
2023 {
2024 sleep(d).await;
2025 continue;
2026 }
2027
2028 dlg.finished(false);
2029
2030 return Err(match error {
2031 Ok(value) => common::Error::BadRequest(value),
2032 _ => common::Error::Failure(response),
2033 });
2034 }
2035 let response = {
2036 let bytes = common::to_bytes(body).await.unwrap_or_default();
2037 let encoded = common::to_string(&bytes);
2038 match serde_json::from_str(&encoded) {
2039 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2040 Err(error) => {
2041 dlg.response_json_decode_error(&encoded, &error);
2042 return Err(common::Error::JsonDecodeError(
2043 encoded.to_string(),
2044 error,
2045 ));
2046 }
2047 }
2048 };
2049
2050 dlg.finished(true);
2051 return Ok(response);
2052 }
2053 }
2054 }
2055 }
2056
2057 ///
2058 /// Sets the *request* property to the given value.
2059 ///
2060 /// Even though the property as already been set when instantiating this call,
2061 /// we provide this method for API completeness.
2062 pub fn request(
2063 mut self,
2064 new_value: CreateClientEventRequest,
2065 ) -> ProjectClientEventCreateCall<'a, C> {
2066 self._request = new_value;
2067 self
2068 }
2069 /// Parent project name.
2070 ///
2071 /// Sets the *parent* path property to the given value.
2072 ///
2073 /// Even though the property as already been set when instantiating this call,
2074 /// we provide this method for API completeness.
2075 pub fn parent(mut self, new_value: &str) -> ProjectClientEventCreateCall<'a, C> {
2076 self._parent = new_value.to_string();
2077 self
2078 }
2079 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2080 /// while executing the actual API request.
2081 ///
2082 /// ````text
2083 /// It should be used to handle progress information, and to implement a certain level of resilience.
2084 /// ````
2085 ///
2086 /// Sets the *delegate* property to the given value.
2087 pub fn delegate(
2088 mut self,
2089 new_value: &'a mut dyn common::Delegate,
2090 ) -> ProjectClientEventCreateCall<'a, C> {
2091 self._delegate = Some(new_value);
2092 self
2093 }
2094
2095 /// Set any additional parameter of the query string used in the request.
2096 /// It should be used to set parameters which are not yet available through their own
2097 /// setters.
2098 ///
2099 /// Please note that this method must not be used to set any of the known parameters
2100 /// which have their own setter method. If done anyway, the request will fail.
2101 ///
2102 /// # Additional Parameters
2103 ///
2104 /// * *$.xgafv* (query-string) - V1 error format.
2105 /// * *access_token* (query-string) - OAuth access token.
2106 /// * *alt* (query-string) - Data format for response.
2107 /// * *callback* (query-string) - JSONP
2108 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2109 /// * *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.
2110 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2111 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2112 /// * *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.
2113 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2114 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2115 pub fn param<T>(mut self, name: T, value: T) -> ProjectClientEventCreateCall<'a, C>
2116 where
2117 T: AsRef<str>,
2118 {
2119 self._additional_params
2120 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2121 self
2122 }
2123
2124 /// Identifies the authorization scope for the method you are building.
2125 ///
2126 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2127 /// [`Scope::CloudPlatform`].
2128 ///
2129 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2130 /// tokens for more than one scope.
2131 ///
2132 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2133 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2134 /// sufficient, a read-write scope will do as well.
2135 pub fn add_scope<St>(mut self, scope: St) -> ProjectClientEventCreateCall<'a, C>
2136 where
2137 St: AsRef<str>,
2138 {
2139 self._scopes.insert(String::from(scope.as_ref()));
2140 self
2141 }
2142 /// Identifies the authorization scope(s) for the method you are building.
2143 ///
2144 /// See [`Self::add_scope()`] for details.
2145 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectClientEventCreateCall<'a, C>
2146 where
2147 I: IntoIterator<Item = St>,
2148 St: AsRef<str>,
2149 {
2150 self._scopes
2151 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2152 self
2153 }
2154
2155 /// Removes all scopes, and no default scope will be used either.
2156 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2157 /// for details).
2158 pub fn clear_scopes(mut self) -> ProjectClientEventCreateCall<'a, C> {
2159 self._scopes.clear();
2160 self
2161 }
2162}
2163
2164/// Creates a new company entity.
2165///
2166/// A builder for the *companies.create* method supported by a *project* resource.
2167/// It is not used directly, but through a [`ProjectMethods`] instance.
2168///
2169/// # Example
2170///
2171/// Instantiate a resource method builder
2172///
2173/// ```test_harness,no_run
2174/// # extern crate hyper;
2175/// # extern crate hyper_rustls;
2176/// # extern crate google_jobs3 as jobs3;
2177/// use jobs3::api::CreateCompanyRequest;
2178/// # async fn dox() {
2179/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2180///
2181/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2182/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2183/// # .with_native_roots()
2184/// # .unwrap()
2185/// # .https_only()
2186/// # .enable_http2()
2187/// # .build();
2188///
2189/// # let executor = hyper_util::rt::TokioExecutor::new();
2190/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2191/// # secret,
2192/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2193/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2194/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2195/// # ),
2196/// # ).build().await.unwrap();
2197///
2198/// # let client = hyper_util::client::legacy::Client::builder(
2199/// # hyper_util::rt::TokioExecutor::new()
2200/// # )
2201/// # .build(
2202/// # hyper_rustls::HttpsConnectorBuilder::new()
2203/// # .with_native_roots()
2204/// # .unwrap()
2205/// # .https_or_http()
2206/// # .enable_http2()
2207/// # .build()
2208/// # );
2209/// # let mut hub = CloudTalentSolution::new(client, auth);
2210/// // As the method needs a request, you would usually fill it with the desired information
2211/// // into the respective structure. Some of the parts shown here might not be applicable !
2212/// // Values shown here are possibly random and not representative !
2213/// let mut req = CreateCompanyRequest::default();
2214///
2215/// // You can configure optional parameters by calling the respective setters at will, and
2216/// // execute the final call using `doit()`.
2217/// // Values shown here are possibly random and not representative !
2218/// let result = hub.projects().companies_create(req, "parent")
2219/// .doit().await;
2220/// # }
2221/// ```
2222pub struct ProjectCompanyCreateCall<'a, C>
2223where
2224 C: 'a,
2225{
2226 hub: &'a CloudTalentSolution<C>,
2227 _request: CreateCompanyRequest,
2228 _parent: String,
2229 _delegate: Option<&'a mut dyn common::Delegate>,
2230 _additional_params: HashMap<String, String>,
2231 _scopes: BTreeSet<String>,
2232}
2233
2234impl<'a, C> common::CallBuilder for ProjectCompanyCreateCall<'a, C> {}
2235
2236impl<'a, C> ProjectCompanyCreateCall<'a, C>
2237where
2238 C: common::Connector,
2239{
2240 /// Perform the operation you have build so far.
2241 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
2242 use std::borrow::Cow;
2243 use std::io::{Read, Seek};
2244
2245 use common::{url::Params, ToParts};
2246 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2247
2248 let mut dd = common::DefaultDelegate;
2249 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2250 dlg.begin(common::MethodInfo {
2251 id: "jobs.projects.companies.create",
2252 http_method: hyper::Method::POST,
2253 });
2254
2255 for &field in ["alt", "parent"].iter() {
2256 if self._additional_params.contains_key(field) {
2257 dlg.finished(false);
2258 return Err(common::Error::FieldClash(field));
2259 }
2260 }
2261
2262 let mut params = Params::with_capacity(4 + self._additional_params.len());
2263 params.push("parent", self._parent);
2264
2265 params.extend(self._additional_params.iter());
2266
2267 params.push("alt", "json");
2268 let mut url = self.hub._base_url.clone() + "v3/{+parent}/companies";
2269 if self._scopes.is_empty() {
2270 self._scopes
2271 .insert(Scope::CloudPlatform.as_ref().to_string());
2272 }
2273
2274 #[allow(clippy::single_element_loop)]
2275 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2276 url = params.uri_replacement(url, param_name, find_this, true);
2277 }
2278 {
2279 let to_remove = ["parent"];
2280 params.remove_params(&to_remove);
2281 }
2282
2283 let url = params.parse_with_url(&url);
2284
2285 let mut json_mime_type = mime::APPLICATION_JSON;
2286 let mut request_value_reader = {
2287 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2288 common::remove_json_null_values(&mut value);
2289 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2290 serde_json::to_writer(&mut dst, &value).unwrap();
2291 dst
2292 };
2293 let request_size = request_value_reader
2294 .seek(std::io::SeekFrom::End(0))
2295 .unwrap();
2296 request_value_reader
2297 .seek(std::io::SeekFrom::Start(0))
2298 .unwrap();
2299
2300 loop {
2301 let token = match self
2302 .hub
2303 .auth
2304 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2305 .await
2306 {
2307 Ok(token) => token,
2308 Err(e) => match dlg.token(e) {
2309 Ok(token) => token,
2310 Err(e) => {
2311 dlg.finished(false);
2312 return Err(common::Error::MissingToken(e));
2313 }
2314 },
2315 };
2316 request_value_reader
2317 .seek(std::io::SeekFrom::Start(0))
2318 .unwrap();
2319 let mut req_result = {
2320 let client = &self.hub.client;
2321 dlg.pre_request();
2322 let mut req_builder = hyper::Request::builder()
2323 .method(hyper::Method::POST)
2324 .uri(url.as_str())
2325 .header(USER_AGENT, self.hub._user_agent.clone());
2326
2327 if let Some(token) = token.as_ref() {
2328 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2329 }
2330
2331 let request = req_builder
2332 .header(CONTENT_TYPE, json_mime_type.to_string())
2333 .header(CONTENT_LENGTH, request_size as u64)
2334 .body(common::to_body(
2335 request_value_reader.get_ref().clone().into(),
2336 ));
2337
2338 client.request(request.unwrap()).await
2339 };
2340
2341 match req_result {
2342 Err(err) => {
2343 if let common::Retry::After(d) = dlg.http_error(&err) {
2344 sleep(d).await;
2345 continue;
2346 }
2347 dlg.finished(false);
2348 return Err(common::Error::HttpError(err));
2349 }
2350 Ok(res) => {
2351 let (mut parts, body) = res.into_parts();
2352 let mut body = common::Body::new(body);
2353 if !parts.status.is_success() {
2354 let bytes = common::to_bytes(body).await.unwrap_or_default();
2355 let error = serde_json::from_str(&common::to_string(&bytes));
2356 let response = common::to_response(parts, bytes.into());
2357
2358 if let common::Retry::After(d) =
2359 dlg.http_failure(&response, error.as_ref().ok())
2360 {
2361 sleep(d).await;
2362 continue;
2363 }
2364
2365 dlg.finished(false);
2366
2367 return Err(match error {
2368 Ok(value) => common::Error::BadRequest(value),
2369 _ => common::Error::Failure(response),
2370 });
2371 }
2372 let response = {
2373 let bytes = common::to_bytes(body).await.unwrap_or_default();
2374 let encoded = common::to_string(&bytes);
2375 match serde_json::from_str(&encoded) {
2376 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2377 Err(error) => {
2378 dlg.response_json_decode_error(&encoded, &error);
2379 return Err(common::Error::JsonDecodeError(
2380 encoded.to_string(),
2381 error,
2382 ));
2383 }
2384 }
2385 };
2386
2387 dlg.finished(true);
2388 return Ok(response);
2389 }
2390 }
2391 }
2392 }
2393
2394 ///
2395 /// Sets the *request* property to the given value.
2396 ///
2397 /// Even though the property as already been set when instantiating this call,
2398 /// we provide this method for API completeness.
2399 pub fn request(mut self, new_value: CreateCompanyRequest) -> ProjectCompanyCreateCall<'a, C> {
2400 self._request = new_value;
2401 self
2402 }
2403 /// Required. Resource name of the project under which the company is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
2404 ///
2405 /// Sets the *parent* path property to the given value.
2406 ///
2407 /// Even though the property as already been set when instantiating this call,
2408 /// we provide this method for API completeness.
2409 pub fn parent(mut self, new_value: &str) -> ProjectCompanyCreateCall<'a, C> {
2410 self._parent = new_value.to_string();
2411 self
2412 }
2413 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2414 /// while executing the actual API request.
2415 ///
2416 /// ````text
2417 /// It should be used to handle progress information, and to implement a certain level of resilience.
2418 /// ````
2419 ///
2420 /// Sets the *delegate* property to the given value.
2421 pub fn delegate(
2422 mut self,
2423 new_value: &'a mut dyn common::Delegate,
2424 ) -> ProjectCompanyCreateCall<'a, C> {
2425 self._delegate = Some(new_value);
2426 self
2427 }
2428
2429 /// Set any additional parameter of the query string used in the request.
2430 /// It should be used to set parameters which are not yet available through their own
2431 /// setters.
2432 ///
2433 /// Please note that this method must not be used to set any of the known parameters
2434 /// which have their own setter method. If done anyway, the request will fail.
2435 ///
2436 /// # Additional Parameters
2437 ///
2438 /// * *$.xgafv* (query-string) - V1 error format.
2439 /// * *access_token* (query-string) - OAuth access token.
2440 /// * *alt* (query-string) - Data format for response.
2441 /// * *callback* (query-string) - JSONP
2442 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2443 /// * *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.
2444 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2445 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2446 /// * *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.
2447 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2448 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2449 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompanyCreateCall<'a, C>
2450 where
2451 T: AsRef<str>,
2452 {
2453 self._additional_params
2454 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2455 self
2456 }
2457
2458 /// Identifies the authorization scope for the method you are building.
2459 ///
2460 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2461 /// [`Scope::CloudPlatform`].
2462 ///
2463 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2464 /// tokens for more than one scope.
2465 ///
2466 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2467 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2468 /// sufficient, a read-write scope will do as well.
2469 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompanyCreateCall<'a, C>
2470 where
2471 St: AsRef<str>,
2472 {
2473 self._scopes.insert(String::from(scope.as_ref()));
2474 self
2475 }
2476 /// Identifies the authorization scope(s) for the method you are building.
2477 ///
2478 /// See [`Self::add_scope()`] for details.
2479 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompanyCreateCall<'a, C>
2480 where
2481 I: IntoIterator<Item = St>,
2482 St: AsRef<str>,
2483 {
2484 self._scopes
2485 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2486 self
2487 }
2488
2489 /// Removes all scopes, and no default scope will be used either.
2490 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2491 /// for details).
2492 pub fn clear_scopes(mut self) -> ProjectCompanyCreateCall<'a, C> {
2493 self._scopes.clear();
2494 self
2495 }
2496}
2497
2498/// Deletes specified company. Prerequisite: The company has no jobs associated with it.
2499///
2500/// A builder for the *companies.delete* method supported by a *project* resource.
2501/// It is not used directly, but through a [`ProjectMethods`] instance.
2502///
2503/// # Example
2504///
2505/// Instantiate a resource method builder
2506///
2507/// ```test_harness,no_run
2508/// # extern crate hyper;
2509/// # extern crate hyper_rustls;
2510/// # extern crate google_jobs3 as jobs3;
2511/// # async fn dox() {
2512/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2513///
2514/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2515/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2516/// # .with_native_roots()
2517/// # .unwrap()
2518/// # .https_only()
2519/// # .enable_http2()
2520/// # .build();
2521///
2522/// # let executor = hyper_util::rt::TokioExecutor::new();
2523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2524/// # secret,
2525/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2526/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2527/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2528/// # ),
2529/// # ).build().await.unwrap();
2530///
2531/// # let client = hyper_util::client::legacy::Client::builder(
2532/// # hyper_util::rt::TokioExecutor::new()
2533/// # )
2534/// # .build(
2535/// # hyper_rustls::HttpsConnectorBuilder::new()
2536/// # .with_native_roots()
2537/// # .unwrap()
2538/// # .https_or_http()
2539/// # .enable_http2()
2540/// # .build()
2541/// # );
2542/// # let mut hub = CloudTalentSolution::new(client, auth);
2543/// // You can configure optional parameters by calling the respective setters at will, and
2544/// // execute the final call using `doit()`.
2545/// // Values shown here are possibly random and not representative !
2546/// let result = hub.projects().companies_delete("name")
2547/// .doit().await;
2548/// # }
2549/// ```
2550pub struct ProjectCompanyDeleteCall<'a, C>
2551where
2552 C: 'a,
2553{
2554 hub: &'a CloudTalentSolution<C>,
2555 _name: String,
2556 _delegate: Option<&'a mut dyn common::Delegate>,
2557 _additional_params: HashMap<String, String>,
2558 _scopes: BTreeSet<String>,
2559}
2560
2561impl<'a, C> common::CallBuilder for ProjectCompanyDeleteCall<'a, C> {}
2562
2563impl<'a, C> ProjectCompanyDeleteCall<'a, C>
2564where
2565 C: common::Connector,
2566{
2567 /// Perform the operation you have build so far.
2568 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2569 use std::borrow::Cow;
2570 use std::io::{Read, Seek};
2571
2572 use common::{url::Params, ToParts};
2573 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2574
2575 let mut dd = common::DefaultDelegate;
2576 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2577 dlg.begin(common::MethodInfo {
2578 id: "jobs.projects.companies.delete",
2579 http_method: hyper::Method::DELETE,
2580 });
2581
2582 for &field in ["alt", "name"].iter() {
2583 if self._additional_params.contains_key(field) {
2584 dlg.finished(false);
2585 return Err(common::Error::FieldClash(field));
2586 }
2587 }
2588
2589 let mut params = Params::with_capacity(3 + self._additional_params.len());
2590 params.push("name", self._name);
2591
2592 params.extend(self._additional_params.iter());
2593
2594 params.push("alt", "json");
2595 let mut url = self.hub._base_url.clone() + "v3/{+name}";
2596 if self._scopes.is_empty() {
2597 self._scopes
2598 .insert(Scope::CloudPlatform.as_ref().to_string());
2599 }
2600
2601 #[allow(clippy::single_element_loop)]
2602 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2603 url = params.uri_replacement(url, param_name, find_this, true);
2604 }
2605 {
2606 let to_remove = ["name"];
2607 params.remove_params(&to_remove);
2608 }
2609
2610 let url = params.parse_with_url(&url);
2611
2612 loop {
2613 let token = match self
2614 .hub
2615 .auth
2616 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2617 .await
2618 {
2619 Ok(token) => token,
2620 Err(e) => match dlg.token(e) {
2621 Ok(token) => token,
2622 Err(e) => {
2623 dlg.finished(false);
2624 return Err(common::Error::MissingToken(e));
2625 }
2626 },
2627 };
2628 let mut req_result = {
2629 let client = &self.hub.client;
2630 dlg.pre_request();
2631 let mut req_builder = hyper::Request::builder()
2632 .method(hyper::Method::DELETE)
2633 .uri(url.as_str())
2634 .header(USER_AGENT, self.hub._user_agent.clone());
2635
2636 if let Some(token) = token.as_ref() {
2637 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2638 }
2639
2640 let request = req_builder
2641 .header(CONTENT_LENGTH, 0_u64)
2642 .body(common::to_body::<String>(None));
2643
2644 client.request(request.unwrap()).await
2645 };
2646
2647 match req_result {
2648 Err(err) => {
2649 if let common::Retry::After(d) = dlg.http_error(&err) {
2650 sleep(d).await;
2651 continue;
2652 }
2653 dlg.finished(false);
2654 return Err(common::Error::HttpError(err));
2655 }
2656 Ok(res) => {
2657 let (mut parts, body) = res.into_parts();
2658 let mut body = common::Body::new(body);
2659 if !parts.status.is_success() {
2660 let bytes = common::to_bytes(body).await.unwrap_or_default();
2661 let error = serde_json::from_str(&common::to_string(&bytes));
2662 let response = common::to_response(parts, bytes.into());
2663
2664 if let common::Retry::After(d) =
2665 dlg.http_failure(&response, error.as_ref().ok())
2666 {
2667 sleep(d).await;
2668 continue;
2669 }
2670
2671 dlg.finished(false);
2672
2673 return Err(match error {
2674 Ok(value) => common::Error::BadRequest(value),
2675 _ => common::Error::Failure(response),
2676 });
2677 }
2678 let response = {
2679 let bytes = common::to_bytes(body).await.unwrap_or_default();
2680 let encoded = common::to_string(&bytes);
2681 match serde_json::from_str(&encoded) {
2682 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2683 Err(error) => {
2684 dlg.response_json_decode_error(&encoded, &error);
2685 return Err(common::Error::JsonDecodeError(
2686 encoded.to_string(),
2687 error,
2688 ));
2689 }
2690 }
2691 };
2692
2693 dlg.finished(true);
2694 return Ok(response);
2695 }
2696 }
2697 }
2698 }
2699
2700 /// Required. The resource name of the company to be deleted. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
2701 ///
2702 /// Sets the *name* path property to the given value.
2703 ///
2704 /// Even though the property as already been set when instantiating this call,
2705 /// we provide this method for API completeness.
2706 pub fn name(mut self, new_value: &str) -> ProjectCompanyDeleteCall<'a, C> {
2707 self._name = new_value.to_string();
2708 self
2709 }
2710 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2711 /// while executing the actual API request.
2712 ///
2713 /// ````text
2714 /// It should be used to handle progress information, and to implement a certain level of resilience.
2715 /// ````
2716 ///
2717 /// Sets the *delegate* property to the given value.
2718 pub fn delegate(
2719 mut self,
2720 new_value: &'a mut dyn common::Delegate,
2721 ) -> ProjectCompanyDeleteCall<'a, C> {
2722 self._delegate = Some(new_value);
2723 self
2724 }
2725
2726 /// Set any additional parameter of the query string used in the request.
2727 /// It should be used to set parameters which are not yet available through their own
2728 /// setters.
2729 ///
2730 /// Please note that this method must not be used to set any of the known parameters
2731 /// which have their own setter method. If done anyway, the request will fail.
2732 ///
2733 /// # Additional Parameters
2734 ///
2735 /// * *$.xgafv* (query-string) - V1 error format.
2736 /// * *access_token* (query-string) - OAuth access token.
2737 /// * *alt* (query-string) - Data format for response.
2738 /// * *callback* (query-string) - JSONP
2739 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2740 /// * *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.
2741 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2742 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2743 /// * *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.
2744 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2745 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2746 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompanyDeleteCall<'a, C>
2747 where
2748 T: AsRef<str>,
2749 {
2750 self._additional_params
2751 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2752 self
2753 }
2754
2755 /// Identifies the authorization scope for the method you are building.
2756 ///
2757 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2758 /// [`Scope::CloudPlatform`].
2759 ///
2760 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2761 /// tokens for more than one scope.
2762 ///
2763 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2764 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2765 /// sufficient, a read-write scope will do as well.
2766 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompanyDeleteCall<'a, C>
2767 where
2768 St: AsRef<str>,
2769 {
2770 self._scopes.insert(String::from(scope.as_ref()));
2771 self
2772 }
2773 /// Identifies the authorization scope(s) for the method you are building.
2774 ///
2775 /// See [`Self::add_scope()`] for details.
2776 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompanyDeleteCall<'a, C>
2777 where
2778 I: IntoIterator<Item = St>,
2779 St: AsRef<str>,
2780 {
2781 self._scopes
2782 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2783 self
2784 }
2785
2786 /// Removes all scopes, and no default scope will be used either.
2787 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2788 /// for details).
2789 pub fn clear_scopes(mut self) -> ProjectCompanyDeleteCall<'a, C> {
2790 self._scopes.clear();
2791 self
2792 }
2793}
2794
2795/// Retrieves specified company.
2796///
2797/// A builder for the *companies.get* method supported by a *project* resource.
2798/// It is not used directly, but through a [`ProjectMethods`] instance.
2799///
2800/// # Example
2801///
2802/// Instantiate a resource method builder
2803///
2804/// ```test_harness,no_run
2805/// # extern crate hyper;
2806/// # extern crate hyper_rustls;
2807/// # extern crate google_jobs3 as jobs3;
2808/// # async fn dox() {
2809/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2810///
2811/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2812/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2813/// # .with_native_roots()
2814/// # .unwrap()
2815/// # .https_only()
2816/// # .enable_http2()
2817/// # .build();
2818///
2819/// # let executor = hyper_util::rt::TokioExecutor::new();
2820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2821/// # secret,
2822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2823/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2824/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2825/// # ),
2826/// # ).build().await.unwrap();
2827///
2828/// # let client = hyper_util::client::legacy::Client::builder(
2829/// # hyper_util::rt::TokioExecutor::new()
2830/// # )
2831/// # .build(
2832/// # hyper_rustls::HttpsConnectorBuilder::new()
2833/// # .with_native_roots()
2834/// # .unwrap()
2835/// # .https_or_http()
2836/// # .enable_http2()
2837/// # .build()
2838/// # );
2839/// # let mut hub = CloudTalentSolution::new(client, auth);
2840/// // You can configure optional parameters by calling the respective setters at will, and
2841/// // execute the final call using `doit()`.
2842/// // Values shown here are possibly random and not representative !
2843/// let result = hub.projects().companies_get("name")
2844/// .doit().await;
2845/// # }
2846/// ```
2847pub struct ProjectCompanyGetCall<'a, C>
2848where
2849 C: 'a,
2850{
2851 hub: &'a CloudTalentSolution<C>,
2852 _name: String,
2853 _delegate: Option<&'a mut dyn common::Delegate>,
2854 _additional_params: HashMap<String, String>,
2855 _scopes: BTreeSet<String>,
2856}
2857
2858impl<'a, C> common::CallBuilder for ProjectCompanyGetCall<'a, C> {}
2859
2860impl<'a, C> ProjectCompanyGetCall<'a, C>
2861where
2862 C: common::Connector,
2863{
2864 /// Perform the operation you have build so far.
2865 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
2866 use std::borrow::Cow;
2867 use std::io::{Read, Seek};
2868
2869 use common::{url::Params, ToParts};
2870 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2871
2872 let mut dd = common::DefaultDelegate;
2873 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2874 dlg.begin(common::MethodInfo {
2875 id: "jobs.projects.companies.get",
2876 http_method: hyper::Method::GET,
2877 });
2878
2879 for &field in ["alt", "name"].iter() {
2880 if self._additional_params.contains_key(field) {
2881 dlg.finished(false);
2882 return Err(common::Error::FieldClash(field));
2883 }
2884 }
2885
2886 let mut params = Params::with_capacity(3 + self._additional_params.len());
2887 params.push("name", self._name);
2888
2889 params.extend(self._additional_params.iter());
2890
2891 params.push("alt", "json");
2892 let mut url = self.hub._base_url.clone() + "v3/{+name}";
2893 if self._scopes.is_empty() {
2894 self._scopes
2895 .insert(Scope::CloudPlatform.as_ref().to_string());
2896 }
2897
2898 #[allow(clippy::single_element_loop)]
2899 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2900 url = params.uri_replacement(url, param_name, find_this, true);
2901 }
2902 {
2903 let to_remove = ["name"];
2904 params.remove_params(&to_remove);
2905 }
2906
2907 let url = params.parse_with_url(&url);
2908
2909 loop {
2910 let token = match self
2911 .hub
2912 .auth
2913 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2914 .await
2915 {
2916 Ok(token) => token,
2917 Err(e) => match dlg.token(e) {
2918 Ok(token) => token,
2919 Err(e) => {
2920 dlg.finished(false);
2921 return Err(common::Error::MissingToken(e));
2922 }
2923 },
2924 };
2925 let mut req_result = {
2926 let client = &self.hub.client;
2927 dlg.pre_request();
2928 let mut req_builder = hyper::Request::builder()
2929 .method(hyper::Method::GET)
2930 .uri(url.as_str())
2931 .header(USER_AGENT, self.hub._user_agent.clone());
2932
2933 if let Some(token) = token.as_ref() {
2934 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2935 }
2936
2937 let request = req_builder
2938 .header(CONTENT_LENGTH, 0_u64)
2939 .body(common::to_body::<String>(None));
2940
2941 client.request(request.unwrap()).await
2942 };
2943
2944 match req_result {
2945 Err(err) => {
2946 if let common::Retry::After(d) = dlg.http_error(&err) {
2947 sleep(d).await;
2948 continue;
2949 }
2950 dlg.finished(false);
2951 return Err(common::Error::HttpError(err));
2952 }
2953 Ok(res) => {
2954 let (mut parts, body) = res.into_parts();
2955 let mut body = common::Body::new(body);
2956 if !parts.status.is_success() {
2957 let bytes = common::to_bytes(body).await.unwrap_or_default();
2958 let error = serde_json::from_str(&common::to_string(&bytes));
2959 let response = common::to_response(parts, bytes.into());
2960
2961 if let common::Retry::After(d) =
2962 dlg.http_failure(&response, error.as_ref().ok())
2963 {
2964 sleep(d).await;
2965 continue;
2966 }
2967
2968 dlg.finished(false);
2969
2970 return Err(match error {
2971 Ok(value) => common::Error::BadRequest(value),
2972 _ => common::Error::Failure(response),
2973 });
2974 }
2975 let response = {
2976 let bytes = common::to_bytes(body).await.unwrap_or_default();
2977 let encoded = common::to_string(&bytes);
2978 match serde_json::from_str(&encoded) {
2979 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2980 Err(error) => {
2981 dlg.response_json_decode_error(&encoded, &error);
2982 return Err(common::Error::JsonDecodeError(
2983 encoded.to_string(),
2984 error,
2985 ));
2986 }
2987 }
2988 };
2989
2990 dlg.finished(true);
2991 return Ok(response);
2992 }
2993 }
2994 }
2995 }
2996
2997 /// Required. The resource name of the company to be retrieved. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
2998 ///
2999 /// Sets the *name* path property to the given value.
3000 ///
3001 /// Even though the property as already been set when instantiating this call,
3002 /// we provide this method for API completeness.
3003 pub fn name(mut self, new_value: &str) -> ProjectCompanyGetCall<'a, C> {
3004 self._name = new_value.to_string();
3005 self
3006 }
3007 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3008 /// while executing the actual API request.
3009 ///
3010 /// ````text
3011 /// It should be used to handle progress information, and to implement a certain level of resilience.
3012 /// ````
3013 ///
3014 /// Sets the *delegate* property to the given value.
3015 pub fn delegate(
3016 mut self,
3017 new_value: &'a mut dyn common::Delegate,
3018 ) -> ProjectCompanyGetCall<'a, C> {
3019 self._delegate = Some(new_value);
3020 self
3021 }
3022
3023 /// Set any additional parameter of the query string used in the request.
3024 /// It should be used to set parameters which are not yet available through their own
3025 /// setters.
3026 ///
3027 /// Please note that this method must not be used to set any of the known parameters
3028 /// which have their own setter method. If done anyway, the request will fail.
3029 ///
3030 /// # Additional Parameters
3031 ///
3032 /// * *$.xgafv* (query-string) - V1 error format.
3033 /// * *access_token* (query-string) - OAuth access token.
3034 /// * *alt* (query-string) - Data format for response.
3035 /// * *callback* (query-string) - JSONP
3036 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3037 /// * *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.
3038 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3039 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3040 /// * *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.
3041 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3042 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3043 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompanyGetCall<'a, C>
3044 where
3045 T: AsRef<str>,
3046 {
3047 self._additional_params
3048 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3049 self
3050 }
3051
3052 /// Identifies the authorization scope for the method you are building.
3053 ///
3054 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3055 /// [`Scope::CloudPlatform`].
3056 ///
3057 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3058 /// tokens for more than one scope.
3059 ///
3060 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3061 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3062 /// sufficient, a read-write scope will do as well.
3063 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompanyGetCall<'a, C>
3064 where
3065 St: AsRef<str>,
3066 {
3067 self._scopes.insert(String::from(scope.as_ref()));
3068 self
3069 }
3070 /// Identifies the authorization scope(s) for the method you are building.
3071 ///
3072 /// See [`Self::add_scope()`] for details.
3073 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompanyGetCall<'a, C>
3074 where
3075 I: IntoIterator<Item = St>,
3076 St: AsRef<str>,
3077 {
3078 self._scopes
3079 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3080 self
3081 }
3082
3083 /// Removes all scopes, and no default scope will be used either.
3084 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3085 /// for details).
3086 pub fn clear_scopes(mut self) -> ProjectCompanyGetCall<'a, C> {
3087 self._scopes.clear();
3088 self
3089 }
3090}
3091
3092/// Lists all companies associated with the service account.
3093///
3094/// A builder for the *companies.list* method supported by a *project* resource.
3095/// It is not used directly, but through a [`ProjectMethods`] instance.
3096///
3097/// # Example
3098///
3099/// Instantiate a resource method builder
3100///
3101/// ```test_harness,no_run
3102/// # extern crate hyper;
3103/// # extern crate hyper_rustls;
3104/// # extern crate google_jobs3 as jobs3;
3105/// # async fn dox() {
3106/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3107///
3108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3109/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3110/// # .with_native_roots()
3111/// # .unwrap()
3112/// # .https_only()
3113/// # .enable_http2()
3114/// # .build();
3115///
3116/// # let executor = hyper_util::rt::TokioExecutor::new();
3117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3118/// # secret,
3119/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3120/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3121/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3122/// # ),
3123/// # ).build().await.unwrap();
3124///
3125/// # let client = hyper_util::client::legacy::Client::builder(
3126/// # hyper_util::rt::TokioExecutor::new()
3127/// # )
3128/// # .build(
3129/// # hyper_rustls::HttpsConnectorBuilder::new()
3130/// # .with_native_roots()
3131/// # .unwrap()
3132/// # .https_or_http()
3133/// # .enable_http2()
3134/// # .build()
3135/// # );
3136/// # let mut hub = CloudTalentSolution::new(client, auth);
3137/// // You can configure optional parameters by calling the respective setters at will, and
3138/// // execute the final call using `doit()`.
3139/// // Values shown here are possibly random and not representative !
3140/// let result = hub.projects().companies_list("parent")
3141/// .require_open_jobs(true)
3142/// .page_token("amet.")
3143/// .page_size(-20)
3144/// .doit().await;
3145/// # }
3146/// ```
3147pub struct ProjectCompanyListCall<'a, C>
3148where
3149 C: 'a,
3150{
3151 hub: &'a CloudTalentSolution<C>,
3152 _parent: String,
3153 _require_open_jobs: Option<bool>,
3154 _page_token: Option<String>,
3155 _page_size: Option<i32>,
3156 _delegate: Option<&'a mut dyn common::Delegate>,
3157 _additional_params: HashMap<String, String>,
3158 _scopes: BTreeSet<String>,
3159}
3160
3161impl<'a, C> common::CallBuilder for ProjectCompanyListCall<'a, C> {}
3162
3163impl<'a, C> ProjectCompanyListCall<'a, C>
3164where
3165 C: common::Connector,
3166{
3167 /// Perform the operation you have build so far.
3168 pub async fn doit(mut self) -> common::Result<(common::Response, ListCompaniesResponse)> {
3169 use std::borrow::Cow;
3170 use std::io::{Read, Seek};
3171
3172 use common::{url::Params, ToParts};
3173 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3174
3175 let mut dd = common::DefaultDelegate;
3176 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3177 dlg.begin(common::MethodInfo {
3178 id: "jobs.projects.companies.list",
3179 http_method: hyper::Method::GET,
3180 });
3181
3182 for &field in ["alt", "parent", "requireOpenJobs", "pageToken", "pageSize"].iter() {
3183 if self._additional_params.contains_key(field) {
3184 dlg.finished(false);
3185 return Err(common::Error::FieldClash(field));
3186 }
3187 }
3188
3189 let mut params = Params::with_capacity(6 + self._additional_params.len());
3190 params.push("parent", self._parent);
3191 if let Some(value) = self._require_open_jobs.as_ref() {
3192 params.push("requireOpenJobs", value.to_string());
3193 }
3194 if let Some(value) = self._page_token.as_ref() {
3195 params.push("pageToken", value);
3196 }
3197 if let Some(value) = self._page_size.as_ref() {
3198 params.push("pageSize", value.to_string());
3199 }
3200
3201 params.extend(self._additional_params.iter());
3202
3203 params.push("alt", "json");
3204 let mut url = self.hub._base_url.clone() + "v3/{+parent}/companies";
3205 if self._scopes.is_empty() {
3206 self._scopes
3207 .insert(Scope::CloudPlatform.as_ref().to_string());
3208 }
3209
3210 #[allow(clippy::single_element_loop)]
3211 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3212 url = params.uri_replacement(url, param_name, find_this, true);
3213 }
3214 {
3215 let to_remove = ["parent"];
3216 params.remove_params(&to_remove);
3217 }
3218
3219 let url = params.parse_with_url(&url);
3220
3221 loop {
3222 let token = match self
3223 .hub
3224 .auth
3225 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3226 .await
3227 {
3228 Ok(token) => token,
3229 Err(e) => match dlg.token(e) {
3230 Ok(token) => token,
3231 Err(e) => {
3232 dlg.finished(false);
3233 return Err(common::Error::MissingToken(e));
3234 }
3235 },
3236 };
3237 let mut req_result = {
3238 let client = &self.hub.client;
3239 dlg.pre_request();
3240 let mut req_builder = hyper::Request::builder()
3241 .method(hyper::Method::GET)
3242 .uri(url.as_str())
3243 .header(USER_AGENT, self.hub._user_agent.clone());
3244
3245 if let Some(token) = token.as_ref() {
3246 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3247 }
3248
3249 let request = req_builder
3250 .header(CONTENT_LENGTH, 0_u64)
3251 .body(common::to_body::<String>(None));
3252
3253 client.request(request.unwrap()).await
3254 };
3255
3256 match req_result {
3257 Err(err) => {
3258 if let common::Retry::After(d) = dlg.http_error(&err) {
3259 sleep(d).await;
3260 continue;
3261 }
3262 dlg.finished(false);
3263 return Err(common::Error::HttpError(err));
3264 }
3265 Ok(res) => {
3266 let (mut parts, body) = res.into_parts();
3267 let mut body = common::Body::new(body);
3268 if !parts.status.is_success() {
3269 let bytes = common::to_bytes(body).await.unwrap_or_default();
3270 let error = serde_json::from_str(&common::to_string(&bytes));
3271 let response = common::to_response(parts, bytes.into());
3272
3273 if let common::Retry::After(d) =
3274 dlg.http_failure(&response, error.as_ref().ok())
3275 {
3276 sleep(d).await;
3277 continue;
3278 }
3279
3280 dlg.finished(false);
3281
3282 return Err(match error {
3283 Ok(value) => common::Error::BadRequest(value),
3284 _ => common::Error::Failure(response),
3285 });
3286 }
3287 let response = {
3288 let bytes = common::to_bytes(body).await.unwrap_or_default();
3289 let encoded = common::to_string(&bytes);
3290 match serde_json::from_str(&encoded) {
3291 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3292 Err(error) => {
3293 dlg.response_json_decode_error(&encoded, &error);
3294 return Err(common::Error::JsonDecodeError(
3295 encoded.to_string(),
3296 error,
3297 ));
3298 }
3299 }
3300 };
3301
3302 dlg.finished(true);
3303 return Ok(response);
3304 }
3305 }
3306 }
3307 }
3308
3309 /// Required. Resource name of the project under which the company is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
3310 ///
3311 /// Sets the *parent* path property to the given value.
3312 ///
3313 /// Even though the property as already been set when instantiating this call,
3314 /// we provide this method for API completeness.
3315 pub fn parent(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C> {
3316 self._parent = new_value.to_string();
3317 self
3318 }
3319 /// Optional. 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.
3320 ///
3321 /// Sets the *require open jobs* query property to the given value.
3322 pub fn require_open_jobs(mut self, new_value: bool) -> ProjectCompanyListCall<'a, C> {
3323 self._require_open_jobs = Some(new_value);
3324 self
3325 }
3326 /// Optional. The starting indicator from which to return results.
3327 ///
3328 /// Sets the *page token* query property to the given value.
3329 pub fn page_token(mut self, new_value: &str) -> ProjectCompanyListCall<'a, C> {
3330 self._page_token = Some(new_value.to_string());
3331 self
3332 }
3333 /// Optional. The maximum number of companies to be returned, at most 100. Default is 100 if a non-positive number is provided.
3334 ///
3335 /// Sets the *page size* query property to the given value.
3336 pub fn page_size(mut self, new_value: i32) -> ProjectCompanyListCall<'a, C> {
3337 self._page_size = Some(new_value);
3338 self
3339 }
3340 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3341 /// while executing the actual API request.
3342 ///
3343 /// ````text
3344 /// It should be used to handle progress information, and to implement a certain level of resilience.
3345 /// ````
3346 ///
3347 /// Sets the *delegate* property to the given value.
3348 pub fn delegate(
3349 mut self,
3350 new_value: &'a mut dyn common::Delegate,
3351 ) -> ProjectCompanyListCall<'a, C> {
3352 self._delegate = Some(new_value);
3353 self
3354 }
3355
3356 /// Set any additional parameter of the query string used in the request.
3357 /// It should be used to set parameters which are not yet available through their own
3358 /// setters.
3359 ///
3360 /// Please note that this method must not be used to set any of the known parameters
3361 /// which have their own setter method. If done anyway, the request will fail.
3362 ///
3363 /// # Additional Parameters
3364 ///
3365 /// * *$.xgafv* (query-string) - V1 error format.
3366 /// * *access_token* (query-string) - OAuth access token.
3367 /// * *alt* (query-string) - Data format for response.
3368 /// * *callback* (query-string) - JSONP
3369 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3370 /// * *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.
3371 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3372 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3373 /// * *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.
3374 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3375 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3376 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompanyListCall<'a, C>
3377 where
3378 T: AsRef<str>,
3379 {
3380 self._additional_params
3381 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3382 self
3383 }
3384
3385 /// Identifies the authorization scope for the method you are building.
3386 ///
3387 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3388 /// [`Scope::CloudPlatform`].
3389 ///
3390 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3391 /// tokens for more than one scope.
3392 ///
3393 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3394 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3395 /// sufficient, a read-write scope will do as well.
3396 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompanyListCall<'a, C>
3397 where
3398 St: AsRef<str>,
3399 {
3400 self._scopes.insert(String::from(scope.as_ref()));
3401 self
3402 }
3403 /// Identifies the authorization scope(s) for the method you are building.
3404 ///
3405 /// See [`Self::add_scope()`] for details.
3406 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompanyListCall<'a, C>
3407 where
3408 I: IntoIterator<Item = St>,
3409 St: AsRef<str>,
3410 {
3411 self._scopes
3412 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3413 self
3414 }
3415
3416 /// Removes all scopes, and no default scope will be used either.
3417 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3418 /// for details).
3419 pub fn clear_scopes(mut self) -> ProjectCompanyListCall<'a, C> {
3420 self._scopes.clear();
3421 self
3422 }
3423}
3424
3425/// Updates specified company. Company names can't be updated. To update a company name, delete the company and all jobs associated with it, and only then re-create them.
3426///
3427/// A builder for the *companies.patch* method supported by a *project* resource.
3428/// It is not used directly, but through a [`ProjectMethods`] instance.
3429///
3430/// # Example
3431///
3432/// Instantiate a resource method builder
3433///
3434/// ```test_harness,no_run
3435/// # extern crate hyper;
3436/// # extern crate hyper_rustls;
3437/// # extern crate google_jobs3 as jobs3;
3438/// use jobs3::api::UpdateCompanyRequest;
3439/// # async fn dox() {
3440/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3441///
3442/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3443/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3444/// # .with_native_roots()
3445/// # .unwrap()
3446/// # .https_only()
3447/// # .enable_http2()
3448/// # .build();
3449///
3450/// # let executor = hyper_util::rt::TokioExecutor::new();
3451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3452/// # secret,
3453/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3454/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3455/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3456/// # ),
3457/// # ).build().await.unwrap();
3458///
3459/// # let client = hyper_util::client::legacy::Client::builder(
3460/// # hyper_util::rt::TokioExecutor::new()
3461/// # )
3462/// # .build(
3463/// # hyper_rustls::HttpsConnectorBuilder::new()
3464/// # .with_native_roots()
3465/// # .unwrap()
3466/// # .https_or_http()
3467/// # .enable_http2()
3468/// # .build()
3469/// # );
3470/// # let mut hub = CloudTalentSolution::new(client, auth);
3471/// // As the method needs a request, you would usually fill it with the desired information
3472/// // into the respective structure. Some of the parts shown here might not be applicable !
3473/// // Values shown here are possibly random and not representative !
3474/// let mut req = UpdateCompanyRequest::default();
3475///
3476/// // You can configure optional parameters by calling the respective setters at will, and
3477/// // execute the final call using `doit()`.
3478/// // Values shown here are possibly random and not representative !
3479/// let result = hub.projects().companies_patch(req, "name")
3480/// .doit().await;
3481/// # }
3482/// ```
3483pub struct ProjectCompanyPatchCall<'a, C>
3484where
3485 C: 'a,
3486{
3487 hub: &'a CloudTalentSolution<C>,
3488 _request: UpdateCompanyRequest,
3489 _name: String,
3490 _delegate: Option<&'a mut dyn common::Delegate>,
3491 _additional_params: HashMap<String, String>,
3492 _scopes: BTreeSet<String>,
3493}
3494
3495impl<'a, C> common::CallBuilder for ProjectCompanyPatchCall<'a, C> {}
3496
3497impl<'a, C> ProjectCompanyPatchCall<'a, C>
3498where
3499 C: common::Connector,
3500{
3501 /// Perform the operation you have build so far.
3502 pub async fn doit(mut self) -> common::Result<(common::Response, Company)> {
3503 use std::borrow::Cow;
3504 use std::io::{Read, Seek};
3505
3506 use common::{url::Params, ToParts};
3507 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3508
3509 let mut dd = common::DefaultDelegate;
3510 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3511 dlg.begin(common::MethodInfo {
3512 id: "jobs.projects.companies.patch",
3513 http_method: hyper::Method::PATCH,
3514 });
3515
3516 for &field in ["alt", "name"].iter() {
3517 if self._additional_params.contains_key(field) {
3518 dlg.finished(false);
3519 return Err(common::Error::FieldClash(field));
3520 }
3521 }
3522
3523 let mut params = Params::with_capacity(4 + self._additional_params.len());
3524 params.push("name", self._name);
3525
3526 params.extend(self._additional_params.iter());
3527
3528 params.push("alt", "json");
3529 let mut url = self.hub._base_url.clone() + "v3/{+name}";
3530 if self._scopes.is_empty() {
3531 self._scopes
3532 .insert(Scope::CloudPlatform.as_ref().to_string());
3533 }
3534
3535 #[allow(clippy::single_element_loop)]
3536 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3537 url = params.uri_replacement(url, param_name, find_this, true);
3538 }
3539 {
3540 let to_remove = ["name"];
3541 params.remove_params(&to_remove);
3542 }
3543
3544 let url = params.parse_with_url(&url);
3545
3546 let mut json_mime_type = mime::APPLICATION_JSON;
3547 let mut request_value_reader = {
3548 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3549 common::remove_json_null_values(&mut value);
3550 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3551 serde_json::to_writer(&mut dst, &value).unwrap();
3552 dst
3553 };
3554 let request_size = request_value_reader
3555 .seek(std::io::SeekFrom::End(0))
3556 .unwrap();
3557 request_value_reader
3558 .seek(std::io::SeekFrom::Start(0))
3559 .unwrap();
3560
3561 loop {
3562 let token = match self
3563 .hub
3564 .auth
3565 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3566 .await
3567 {
3568 Ok(token) => token,
3569 Err(e) => match dlg.token(e) {
3570 Ok(token) => token,
3571 Err(e) => {
3572 dlg.finished(false);
3573 return Err(common::Error::MissingToken(e));
3574 }
3575 },
3576 };
3577 request_value_reader
3578 .seek(std::io::SeekFrom::Start(0))
3579 .unwrap();
3580 let mut req_result = {
3581 let client = &self.hub.client;
3582 dlg.pre_request();
3583 let mut req_builder = hyper::Request::builder()
3584 .method(hyper::Method::PATCH)
3585 .uri(url.as_str())
3586 .header(USER_AGENT, self.hub._user_agent.clone());
3587
3588 if let Some(token) = token.as_ref() {
3589 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3590 }
3591
3592 let request = req_builder
3593 .header(CONTENT_TYPE, json_mime_type.to_string())
3594 .header(CONTENT_LENGTH, request_size as u64)
3595 .body(common::to_body(
3596 request_value_reader.get_ref().clone().into(),
3597 ));
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 ///
3656 /// Sets the *request* property to the given value.
3657 ///
3658 /// Even though the property as already been set when instantiating this call,
3659 /// we provide this method for API completeness.
3660 pub fn request(mut self, new_value: UpdateCompanyRequest) -> ProjectCompanyPatchCall<'a, C> {
3661 self._request = new_value;
3662 self
3663 }
3664 /// 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}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
3665 ///
3666 /// Sets the *name* path property to the given value.
3667 ///
3668 /// Even though the property as already been set when instantiating this call,
3669 /// we provide this method for API completeness.
3670 pub fn name(mut self, new_value: &str) -> ProjectCompanyPatchCall<'a, C> {
3671 self._name = new_value.to_string();
3672 self
3673 }
3674 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3675 /// while executing the actual API request.
3676 ///
3677 /// ````text
3678 /// It should be used to handle progress information, and to implement a certain level of resilience.
3679 /// ````
3680 ///
3681 /// Sets the *delegate* property to the given value.
3682 pub fn delegate(
3683 mut self,
3684 new_value: &'a mut dyn common::Delegate,
3685 ) -> ProjectCompanyPatchCall<'a, C> {
3686 self._delegate = Some(new_value);
3687 self
3688 }
3689
3690 /// Set any additional parameter of the query string used in the request.
3691 /// It should be used to set parameters which are not yet available through their own
3692 /// setters.
3693 ///
3694 /// Please note that this method must not be used to set any of the known parameters
3695 /// which have their own setter method. If done anyway, the request will fail.
3696 ///
3697 /// # Additional Parameters
3698 ///
3699 /// * *$.xgafv* (query-string) - V1 error format.
3700 /// * *access_token* (query-string) - OAuth access token.
3701 /// * *alt* (query-string) - Data format for response.
3702 /// * *callback* (query-string) - JSONP
3703 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3704 /// * *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.
3705 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3706 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3707 /// * *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.
3708 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3709 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3710 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompanyPatchCall<'a, C>
3711 where
3712 T: AsRef<str>,
3713 {
3714 self._additional_params
3715 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3716 self
3717 }
3718
3719 /// Identifies the authorization scope for the method you are building.
3720 ///
3721 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3722 /// [`Scope::CloudPlatform`].
3723 ///
3724 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3725 /// tokens for more than one scope.
3726 ///
3727 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3728 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3729 /// sufficient, a read-write scope will do as well.
3730 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompanyPatchCall<'a, C>
3731 where
3732 St: AsRef<str>,
3733 {
3734 self._scopes.insert(String::from(scope.as_ref()));
3735 self
3736 }
3737 /// Identifies the authorization scope(s) for the method you are building.
3738 ///
3739 /// See [`Self::add_scope()`] for details.
3740 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompanyPatchCall<'a, C>
3741 where
3742 I: IntoIterator<Item = St>,
3743 St: AsRef<str>,
3744 {
3745 self._scopes
3746 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3747 self
3748 }
3749
3750 /// Removes all scopes, and no default scope will be used either.
3751 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3752 /// for details).
3753 pub fn clear_scopes(mut self) -> ProjectCompanyPatchCall<'a, C> {
3754 self._scopes.clear();
3755 self
3756 }
3757}
3758
3759/// Deletes a list of Jobs by filter.
3760///
3761/// A builder for the *jobs.batchDelete* method supported by a *project* resource.
3762/// It is not used directly, but through a [`ProjectMethods`] instance.
3763///
3764/// # Example
3765///
3766/// Instantiate a resource method builder
3767///
3768/// ```test_harness,no_run
3769/// # extern crate hyper;
3770/// # extern crate hyper_rustls;
3771/// # extern crate google_jobs3 as jobs3;
3772/// use jobs3::api::BatchDeleteJobsRequest;
3773/// # async fn dox() {
3774/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3775///
3776/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3777/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3778/// # .with_native_roots()
3779/// # .unwrap()
3780/// # .https_only()
3781/// # .enable_http2()
3782/// # .build();
3783///
3784/// # let executor = hyper_util::rt::TokioExecutor::new();
3785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3786/// # secret,
3787/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3788/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3789/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3790/// # ),
3791/// # ).build().await.unwrap();
3792///
3793/// # let client = hyper_util::client::legacy::Client::builder(
3794/// # hyper_util::rt::TokioExecutor::new()
3795/// # )
3796/// # .build(
3797/// # hyper_rustls::HttpsConnectorBuilder::new()
3798/// # .with_native_roots()
3799/// # .unwrap()
3800/// # .https_or_http()
3801/// # .enable_http2()
3802/// # .build()
3803/// # );
3804/// # let mut hub = CloudTalentSolution::new(client, auth);
3805/// // As the method needs a request, you would usually fill it with the desired information
3806/// // into the respective structure. Some of the parts shown here might not be applicable !
3807/// // Values shown here are possibly random and not representative !
3808/// let mut req = BatchDeleteJobsRequest::default();
3809///
3810/// // You can configure optional parameters by calling the respective setters at will, and
3811/// // execute the final call using `doit()`.
3812/// // Values shown here are possibly random and not representative !
3813/// let result = hub.projects().jobs_batch_delete(req, "parent")
3814/// .doit().await;
3815/// # }
3816/// ```
3817pub struct ProjectJobBatchDeleteCall<'a, C>
3818where
3819 C: 'a,
3820{
3821 hub: &'a CloudTalentSolution<C>,
3822 _request: BatchDeleteJobsRequest,
3823 _parent: String,
3824 _delegate: Option<&'a mut dyn common::Delegate>,
3825 _additional_params: HashMap<String, String>,
3826 _scopes: BTreeSet<String>,
3827}
3828
3829impl<'a, C> common::CallBuilder for ProjectJobBatchDeleteCall<'a, C> {}
3830
3831impl<'a, C> ProjectJobBatchDeleteCall<'a, C>
3832where
3833 C: common::Connector,
3834{
3835 /// Perform the operation you have build so far.
3836 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3837 use std::borrow::Cow;
3838 use std::io::{Read, Seek};
3839
3840 use common::{url::Params, ToParts};
3841 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3842
3843 let mut dd = common::DefaultDelegate;
3844 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3845 dlg.begin(common::MethodInfo {
3846 id: "jobs.projects.jobs.batchDelete",
3847 http_method: hyper::Method::POST,
3848 });
3849
3850 for &field in ["alt", "parent"].iter() {
3851 if self._additional_params.contains_key(field) {
3852 dlg.finished(false);
3853 return Err(common::Error::FieldClash(field));
3854 }
3855 }
3856
3857 let mut params = Params::with_capacity(4 + self._additional_params.len());
3858 params.push("parent", self._parent);
3859
3860 params.extend(self._additional_params.iter());
3861
3862 params.push("alt", "json");
3863 let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs:batchDelete";
3864 if self._scopes.is_empty() {
3865 self._scopes
3866 .insert(Scope::CloudPlatform.as_ref().to_string());
3867 }
3868
3869 #[allow(clippy::single_element_loop)]
3870 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3871 url = params.uri_replacement(url, param_name, find_this, true);
3872 }
3873 {
3874 let to_remove = ["parent"];
3875 params.remove_params(&to_remove);
3876 }
3877
3878 let url = params.parse_with_url(&url);
3879
3880 let mut json_mime_type = mime::APPLICATION_JSON;
3881 let mut request_value_reader = {
3882 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3883 common::remove_json_null_values(&mut value);
3884 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3885 serde_json::to_writer(&mut dst, &value).unwrap();
3886 dst
3887 };
3888 let request_size = request_value_reader
3889 .seek(std::io::SeekFrom::End(0))
3890 .unwrap();
3891 request_value_reader
3892 .seek(std::io::SeekFrom::Start(0))
3893 .unwrap();
3894
3895 loop {
3896 let token = match self
3897 .hub
3898 .auth
3899 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3900 .await
3901 {
3902 Ok(token) => token,
3903 Err(e) => match dlg.token(e) {
3904 Ok(token) => token,
3905 Err(e) => {
3906 dlg.finished(false);
3907 return Err(common::Error::MissingToken(e));
3908 }
3909 },
3910 };
3911 request_value_reader
3912 .seek(std::io::SeekFrom::Start(0))
3913 .unwrap();
3914 let mut req_result = {
3915 let client = &self.hub.client;
3916 dlg.pre_request();
3917 let mut req_builder = hyper::Request::builder()
3918 .method(hyper::Method::POST)
3919 .uri(url.as_str())
3920 .header(USER_AGENT, self.hub._user_agent.clone());
3921
3922 if let Some(token) = token.as_ref() {
3923 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3924 }
3925
3926 let request = req_builder
3927 .header(CONTENT_TYPE, json_mime_type.to_string())
3928 .header(CONTENT_LENGTH, request_size as u64)
3929 .body(common::to_body(
3930 request_value_reader.get_ref().clone().into(),
3931 ));
3932
3933 client.request(request.unwrap()).await
3934 };
3935
3936 match req_result {
3937 Err(err) => {
3938 if let common::Retry::After(d) = dlg.http_error(&err) {
3939 sleep(d).await;
3940 continue;
3941 }
3942 dlg.finished(false);
3943 return Err(common::Error::HttpError(err));
3944 }
3945 Ok(res) => {
3946 let (mut parts, body) = res.into_parts();
3947 let mut body = common::Body::new(body);
3948 if !parts.status.is_success() {
3949 let bytes = common::to_bytes(body).await.unwrap_or_default();
3950 let error = serde_json::from_str(&common::to_string(&bytes));
3951 let response = common::to_response(parts, bytes.into());
3952
3953 if let common::Retry::After(d) =
3954 dlg.http_failure(&response, error.as_ref().ok())
3955 {
3956 sleep(d).await;
3957 continue;
3958 }
3959
3960 dlg.finished(false);
3961
3962 return Err(match error {
3963 Ok(value) => common::Error::BadRequest(value),
3964 _ => common::Error::Failure(response),
3965 });
3966 }
3967 let response = {
3968 let bytes = common::to_bytes(body).await.unwrap_or_default();
3969 let encoded = common::to_string(&bytes);
3970 match serde_json::from_str(&encoded) {
3971 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3972 Err(error) => {
3973 dlg.response_json_decode_error(&encoded, &error);
3974 return Err(common::Error::JsonDecodeError(
3975 encoded.to_string(),
3976 error,
3977 ));
3978 }
3979 }
3980 };
3981
3982 dlg.finished(true);
3983 return Ok(response);
3984 }
3985 }
3986 }
3987 }
3988
3989 ///
3990 /// Sets the *request* property to the given value.
3991 ///
3992 /// Even though the property as already been set when instantiating this call,
3993 /// we provide this method for API completeness.
3994 pub fn request(
3995 mut self,
3996 new_value: BatchDeleteJobsRequest,
3997 ) -> ProjectJobBatchDeleteCall<'a, C> {
3998 self._request = new_value;
3999 self
4000 }
4001 /// Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
4002 ///
4003 /// Sets the *parent* path property to the given value.
4004 ///
4005 /// Even though the property as already been set when instantiating this call,
4006 /// we provide this method for API completeness.
4007 pub fn parent(mut self, new_value: &str) -> ProjectJobBatchDeleteCall<'a, C> {
4008 self._parent = new_value.to_string();
4009 self
4010 }
4011 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4012 /// while executing the actual API request.
4013 ///
4014 /// ````text
4015 /// It should be used to handle progress information, and to implement a certain level of resilience.
4016 /// ````
4017 ///
4018 /// Sets the *delegate* property to the given value.
4019 pub fn delegate(
4020 mut self,
4021 new_value: &'a mut dyn common::Delegate,
4022 ) -> ProjectJobBatchDeleteCall<'a, C> {
4023 self._delegate = Some(new_value);
4024 self
4025 }
4026
4027 /// Set any additional parameter of the query string used in the request.
4028 /// It should be used to set parameters which are not yet available through their own
4029 /// setters.
4030 ///
4031 /// Please note that this method must not be used to set any of the known parameters
4032 /// which have their own setter method. If done anyway, the request will fail.
4033 ///
4034 /// # Additional Parameters
4035 ///
4036 /// * *$.xgafv* (query-string) - V1 error format.
4037 /// * *access_token* (query-string) - OAuth access token.
4038 /// * *alt* (query-string) - Data format for response.
4039 /// * *callback* (query-string) - JSONP
4040 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4041 /// * *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.
4042 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4043 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4044 /// * *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.
4045 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4046 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4047 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobBatchDeleteCall<'a, C>
4048 where
4049 T: AsRef<str>,
4050 {
4051 self._additional_params
4052 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4053 self
4054 }
4055
4056 /// Identifies the authorization scope for the method you are building.
4057 ///
4058 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4059 /// [`Scope::CloudPlatform`].
4060 ///
4061 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4062 /// tokens for more than one scope.
4063 ///
4064 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4065 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4066 /// sufficient, a read-write scope will do as well.
4067 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobBatchDeleteCall<'a, C>
4068 where
4069 St: AsRef<str>,
4070 {
4071 self._scopes.insert(String::from(scope.as_ref()));
4072 self
4073 }
4074 /// Identifies the authorization scope(s) for the method you are building.
4075 ///
4076 /// See [`Self::add_scope()`] for details.
4077 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobBatchDeleteCall<'a, C>
4078 where
4079 I: IntoIterator<Item = St>,
4080 St: AsRef<str>,
4081 {
4082 self._scopes
4083 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4084 self
4085 }
4086
4087 /// Removes all scopes, and no default scope will be used either.
4088 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4089 /// for details).
4090 pub fn clear_scopes(mut self) -> ProjectJobBatchDeleteCall<'a, C> {
4091 self._scopes.clear();
4092 self
4093 }
4094}
4095
4096/// Creates a new job. Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
4097///
4098/// A builder for the *jobs.create* method supported by a *project* resource.
4099/// It is not used directly, but through a [`ProjectMethods`] instance.
4100///
4101/// # Example
4102///
4103/// Instantiate a resource method builder
4104///
4105/// ```test_harness,no_run
4106/// # extern crate hyper;
4107/// # extern crate hyper_rustls;
4108/// # extern crate google_jobs3 as jobs3;
4109/// use jobs3::api::CreateJobRequest;
4110/// # async fn dox() {
4111/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4112///
4113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4114/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4115/// # .with_native_roots()
4116/// # .unwrap()
4117/// # .https_only()
4118/// # .enable_http2()
4119/// # .build();
4120///
4121/// # let executor = hyper_util::rt::TokioExecutor::new();
4122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4123/// # secret,
4124/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4125/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4126/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4127/// # ),
4128/// # ).build().await.unwrap();
4129///
4130/// # let client = hyper_util::client::legacy::Client::builder(
4131/// # hyper_util::rt::TokioExecutor::new()
4132/// # )
4133/// # .build(
4134/// # hyper_rustls::HttpsConnectorBuilder::new()
4135/// # .with_native_roots()
4136/// # .unwrap()
4137/// # .https_or_http()
4138/// # .enable_http2()
4139/// # .build()
4140/// # );
4141/// # let mut hub = CloudTalentSolution::new(client, auth);
4142/// // As the method needs a request, you would usually fill it with the desired information
4143/// // into the respective structure. Some of the parts shown here might not be applicable !
4144/// // Values shown here are possibly random and not representative !
4145/// let mut req = CreateJobRequest::default();
4146///
4147/// // You can configure optional parameters by calling the respective setters at will, and
4148/// // execute the final call using `doit()`.
4149/// // Values shown here are possibly random and not representative !
4150/// let result = hub.projects().jobs_create(req, "parent")
4151/// .doit().await;
4152/// # }
4153/// ```
4154pub struct ProjectJobCreateCall<'a, C>
4155where
4156 C: 'a,
4157{
4158 hub: &'a CloudTalentSolution<C>,
4159 _request: CreateJobRequest,
4160 _parent: String,
4161 _delegate: Option<&'a mut dyn common::Delegate>,
4162 _additional_params: HashMap<String, String>,
4163 _scopes: BTreeSet<String>,
4164}
4165
4166impl<'a, C> common::CallBuilder for ProjectJobCreateCall<'a, C> {}
4167
4168impl<'a, C> ProjectJobCreateCall<'a, C>
4169where
4170 C: common::Connector,
4171{
4172 /// Perform the operation you have build so far.
4173 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
4174 use std::borrow::Cow;
4175 use std::io::{Read, Seek};
4176
4177 use common::{url::Params, ToParts};
4178 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4179
4180 let mut dd = common::DefaultDelegate;
4181 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4182 dlg.begin(common::MethodInfo {
4183 id: "jobs.projects.jobs.create",
4184 http_method: hyper::Method::POST,
4185 });
4186
4187 for &field in ["alt", "parent"].iter() {
4188 if self._additional_params.contains_key(field) {
4189 dlg.finished(false);
4190 return Err(common::Error::FieldClash(field));
4191 }
4192 }
4193
4194 let mut params = Params::with_capacity(4 + self._additional_params.len());
4195 params.push("parent", self._parent);
4196
4197 params.extend(self._additional_params.iter());
4198
4199 params.push("alt", "json");
4200 let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs";
4201 if self._scopes.is_empty() {
4202 self._scopes
4203 .insert(Scope::CloudPlatform.as_ref().to_string());
4204 }
4205
4206 #[allow(clippy::single_element_loop)]
4207 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4208 url = params.uri_replacement(url, param_name, find_this, true);
4209 }
4210 {
4211 let to_remove = ["parent"];
4212 params.remove_params(&to_remove);
4213 }
4214
4215 let url = params.parse_with_url(&url);
4216
4217 let mut json_mime_type = mime::APPLICATION_JSON;
4218 let mut request_value_reader = {
4219 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4220 common::remove_json_null_values(&mut value);
4221 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4222 serde_json::to_writer(&mut dst, &value).unwrap();
4223 dst
4224 };
4225 let request_size = request_value_reader
4226 .seek(std::io::SeekFrom::End(0))
4227 .unwrap();
4228 request_value_reader
4229 .seek(std::io::SeekFrom::Start(0))
4230 .unwrap();
4231
4232 loop {
4233 let token = match self
4234 .hub
4235 .auth
4236 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4237 .await
4238 {
4239 Ok(token) => token,
4240 Err(e) => match dlg.token(e) {
4241 Ok(token) => token,
4242 Err(e) => {
4243 dlg.finished(false);
4244 return Err(common::Error::MissingToken(e));
4245 }
4246 },
4247 };
4248 request_value_reader
4249 .seek(std::io::SeekFrom::Start(0))
4250 .unwrap();
4251 let mut req_result = {
4252 let client = &self.hub.client;
4253 dlg.pre_request();
4254 let mut req_builder = hyper::Request::builder()
4255 .method(hyper::Method::POST)
4256 .uri(url.as_str())
4257 .header(USER_AGENT, self.hub._user_agent.clone());
4258
4259 if let Some(token) = token.as_ref() {
4260 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4261 }
4262
4263 let request = req_builder
4264 .header(CONTENT_TYPE, json_mime_type.to_string())
4265 .header(CONTENT_LENGTH, request_size as u64)
4266 .body(common::to_body(
4267 request_value_reader.get_ref().clone().into(),
4268 ));
4269
4270 client.request(request.unwrap()).await
4271 };
4272
4273 match req_result {
4274 Err(err) => {
4275 if let common::Retry::After(d) = dlg.http_error(&err) {
4276 sleep(d).await;
4277 continue;
4278 }
4279 dlg.finished(false);
4280 return Err(common::Error::HttpError(err));
4281 }
4282 Ok(res) => {
4283 let (mut parts, body) = res.into_parts();
4284 let mut body = common::Body::new(body);
4285 if !parts.status.is_success() {
4286 let bytes = common::to_bytes(body).await.unwrap_or_default();
4287 let error = serde_json::from_str(&common::to_string(&bytes));
4288 let response = common::to_response(parts, bytes.into());
4289
4290 if let common::Retry::After(d) =
4291 dlg.http_failure(&response, error.as_ref().ok())
4292 {
4293 sleep(d).await;
4294 continue;
4295 }
4296
4297 dlg.finished(false);
4298
4299 return Err(match error {
4300 Ok(value) => common::Error::BadRequest(value),
4301 _ => common::Error::Failure(response),
4302 });
4303 }
4304 let response = {
4305 let bytes = common::to_bytes(body).await.unwrap_or_default();
4306 let encoded = common::to_string(&bytes);
4307 match serde_json::from_str(&encoded) {
4308 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4309 Err(error) => {
4310 dlg.response_json_decode_error(&encoded, &error);
4311 return Err(common::Error::JsonDecodeError(
4312 encoded.to_string(),
4313 error,
4314 ));
4315 }
4316 }
4317 };
4318
4319 dlg.finished(true);
4320 return Ok(response);
4321 }
4322 }
4323 }
4324 }
4325
4326 ///
4327 /// Sets the *request* property to the given value.
4328 ///
4329 /// Even though the property as already been set when instantiating this call,
4330 /// we provide this method for API completeness.
4331 pub fn request(mut self, new_value: CreateJobRequest) -> ProjectJobCreateCall<'a, C> {
4332 self._request = new_value;
4333 self
4334 }
4335 /// Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
4336 ///
4337 /// Sets the *parent* path property to the given value.
4338 ///
4339 /// Even though the property as already been set when instantiating this call,
4340 /// we provide this method for API completeness.
4341 pub fn parent(mut self, new_value: &str) -> ProjectJobCreateCall<'a, C> {
4342 self._parent = new_value.to_string();
4343 self
4344 }
4345 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4346 /// while executing the actual API request.
4347 ///
4348 /// ````text
4349 /// It should be used to handle progress information, and to implement a certain level of resilience.
4350 /// ````
4351 ///
4352 /// Sets the *delegate* property to the given value.
4353 pub fn delegate(
4354 mut self,
4355 new_value: &'a mut dyn common::Delegate,
4356 ) -> ProjectJobCreateCall<'a, C> {
4357 self._delegate = Some(new_value);
4358 self
4359 }
4360
4361 /// Set any additional parameter of the query string used in the request.
4362 /// It should be used to set parameters which are not yet available through their own
4363 /// setters.
4364 ///
4365 /// Please note that this method must not be used to set any of the known parameters
4366 /// which have their own setter method. If done anyway, the request will fail.
4367 ///
4368 /// # Additional Parameters
4369 ///
4370 /// * *$.xgafv* (query-string) - V1 error format.
4371 /// * *access_token* (query-string) - OAuth access token.
4372 /// * *alt* (query-string) - Data format for response.
4373 /// * *callback* (query-string) - JSONP
4374 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4375 /// * *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.
4376 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4377 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4378 /// * *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.
4379 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4380 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4381 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobCreateCall<'a, C>
4382 where
4383 T: AsRef<str>,
4384 {
4385 self._additional_params
4386 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4387 self
4388 }
4389
4390 /// Identifies the authorization scope for the method you are building.
4391 ///
4392 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4393 /// [`Scope::CloudPlatform`].
4394 ///
4395 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4396 /// tokens for more than one scope.
4397 ///
4398 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4399 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4400 /// sufficient, a read-write scope will do as well.
4401 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobCreateCall<'a, C>
4402 where
4403 St: AsRef<str>,
4404 {
4405 self._scopes.insert(String::from(scope.as_ref()));
4406 self
4407 }
4408 /// Identifies the authorization scope(s) for the method you are building.
4409 ///
4410 /// See [`Self::add_scope()`] for details.
4411 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobCreateCall<'a, C>
4412 where
4413 I: IntoIterator<Item = St>,
4414 St: AsRef<str>,
4415 {
4416 self._scopes
4417 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4418 self
4419 }
4420
4421 /// Removes all scopes, and no default scope will be used either.
4422 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4423 /// for details).
4424 pub fn clear_scopes(mut self) -> ProjectJobCreateCall<'a, C> {
4425 self._scopes.clear();
4426 self
4427 }
4428}
4429
4430/// Deletes the specified job. Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
4431///
4432/// A builder for the *jobs.delete* method supported by a *project* resource.
4433/// It is not used directly, but through a [`ProjectMethods`] instance.
4434///
4435/// # Example
4436///
4437/// Instantiate a resource method builder
4438///
4439/// ```test_harness,no_run
4440/// # extern crate hyper;
4441/// # extern crate hyper_rustls;
4442/// # extern crate google_jobs3 as jobs3;
4443/// # async fn dox() {
4444/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4445///
4446/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4447/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4448/// # .with_native_roots()
4449/// # .unwrap()
4450/// # .https_only()
4451/// # .enable_http2()
4452/// # .build();
4453///
4454/// # let executor = hyper_util::rt::TokioExecutor::new();
4455/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4456/// # secret,
4457/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4458/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4459/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4460/// # ),
4461/// # ).build().await.unwrap();
4462///
4463/// # let client = hyper_util::client::legacy::Client::builder(
4464/// # hyper_util::rt::TokioExecutor::new()
4465/// # )
4466/// # .build(
4467/// # hyper_rustls::HttpsConnectorBuilder::new()
4468/// # .with_native_roots()
4469/// # .unwrap()
4470/// # .https_or_http()
4471/// # .enable_http2()
4472/// # .build()
4473/// # );
4474/// # let mut hub = CloudTalentSolution::new(client, auth);
4475/// // You can configure optional parameters by calling the respective setters at will, and
4476/// // execute the final call using `doit()`.
4477/// // Values shown here are possibly random and not representative !
4478/// let result = hub.projects().jobs_delete("name")
4479/// .doit().await;
4480/// # }
4481/// ```
4482pub struct ProjectJobDeleteCall<'a, C>
4483where
4484 C: 'a,
4485{
4486 hub: &'a CloudTalentSolution<C>,
4487 _name: String,
4488 _delegate: Option<&'a mut dyn common::Delegate>,
4489 _additional_params: HashMap<String, String>,
4490 _scopes: BTreeSet<String>,
4491}
4492
4493impl<'a, C> common::CallBuilder for ProjectJobDeleteCall<'a, C> {}
4494
4495impl<'a, C> ProjectJobDeleteCall<'a, C>
4496where
4497 C: common::Connector,
4498{
4499 /// Perform the operation you have build so far.
4500 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4501 use std::borrow::Cow;
4502 use std::io::{Read, Seek};
4503
4504 use common::{url::Params, ToParts};
4505 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4506
4507 let mut dd = common::DefaultDelegate;
4508 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4509 dlg.begin(common::MethodInfo {
4510 id: "jobs.projects.jobs.delete",
4511 http_method: hyper::Method::DELETE,
4512 });
4513
4514 for &field in ["alt", "name"].iter() {
4515 if self._additional_params.contains_key(field) {
4516 dlg.finished(false);
4517 return Err(common::Error::FieldClash(field));
4518 }
4519 }
4520
4521 let mut params = Params::with_capacity(3 + self._additional_params.len());
4522 params.push("name", self._name);
4523
4524 params.extend(self._additional_params.iter());
4525
4526 params.push("alt", "json");
4527 let mut url = self.hub._base_url.clone() + "v3/{+name}";
4528 if self._scopes.is_empty() {
4529 self._scopes
4530 .insert(Scope::CloudPlatform.as_ref().to_string());
4531 }
4532
4533 #[allow(clippy::single_element_loop)]
4534 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4535 url = params.uri_replacement(url, param_name, find_this, true);
4536 }
4537 {
4538 let to_remove = ["name"];
4539 params.remove_params(&to_remove);
4540 }
4541
4542 let url = params.parse_with_url(&url);
4543
4544 loop {
4545 let token = match self
4546 .hub
4547 .auth
4548 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4549 .await
4550 {
4551 Ok(token) => token,
4552 Err(e) => match dlg.token(e) {
4553 Ok(token) => token,
4554 Err(e) => {
4555 dlg.finished(false);
4556 return Err(common::Error::MissingToken(e));
4557 }
4558 },
4559 };
4560 let mut req_result = {
4561 let client = &self.hub.client;
4562 dlg.pre_request();
4563 let mut req_builder = hyper::Request::builder()
4564 .method(hyper::Method::DELETE)
4565 .uri(url.as_str())
4566 .header(USER_AGENT, self.hub._user_agent.clone());
4567
4568 if let Some(token) = token.as_ref() {
4569 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4570 }
4571
4572 let request = req_builder
4573 .header(CONTENT_LENGTH, 0_u64)
4574 .body(common::to_body::<String>(None));
4575
4576 client.request(request.unwrap()).await
4577 };
4578
4579 match req_result {
4580 Err(err) => {
4581 if let common::Retry::After(d) = dlg.http_error(&err) {
4582 sleep(d).await;
4583 continue;
4584 }
4585 dlg.finished(false);
4586 return Err(common::Error::HttpError(err));
4587 }
4588 Ok(res) => {
4589 let (mut parts, body) = res.into_parts();
4590 let mut body = common::Body::new(body);
4591 if !parts.status.is_success() {
4592 let bytes = common::to_bytes(body).await.unwrap_or_default();
4593 let error = serde_json::from_str(&common::to_string(&bytes));
4594 let response = common::to_response(parts, bytes.into());
4595
4596 if let common::Retry::After(d) =
4597 dlg.http_failure(&response, error.as_ref().ok())
4598 {
4599 sleep(d).await;
4600 continue;
4601 }
4602
4603 dlg.finished(false);
4604
4605 return Err(match error {
4606 Ok(value) => common::Error::BadRequest(value),
4607 _ => common::Error::Failure(response),
4608 });
4609 }
4610 let response = {
4611 let bytes = common::to_bytes(body).await.unwrap_or_default();
4612 let encoded = common::to_string(&bytes);
4613 match serde_json::from_str(&encoded) {
4614 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4615 Err(error) => {
4616 dlg.response_json_decode_error(&encoded, &error);
4617 return Err(common::Error::JsonDecodeError(
4618 encoded.to_string(),
4619 error,
4620 ));
4621 }
4622 }
4623 };
4624
4625 dlg.finished(true);
4626 return Ok(response);
4627 }
4628 }
4629 }
4630 }
4631
4632 /// Required. The resource name of the job to be deleted. The format is "projects/{project_id}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234".
4633 ///
4634 /// Sets the *name* path property to the given value.
4635 ///
4636 /// Even though the property as already been set when instantiating this call,
4637 /// we provide this method for API completeness.
4638 pub fn name(mut self, new_value: &str) -> ProjectJobDeleteCall<'a, C> {
4639 self._name = new_value.to_string();
4640 self
4641 }
4642 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4643 /// while executing the actual API request.
4644 ///
4645 /// ````text
4646 /// It should be used to handle progress information, and to implement a certain level of resilience.
4647 /// ````
4648 ///
4649 /// Sets the *delegate* property to the given value.
4650 pub fn delegate(
4651 mut self,
4652 new_value: &'a mut dyn common::Delegate,
4653 ) -> ProjectJobDeleteCall<'a, C> {
4654 self._delegate = Some(new_value);
4655 self
4656 }
4657
4658 /// Set any additional parameter of the query string used in the request.
4659 /// It should be used to set parameters which are not yet available through their own
4660 /// setters.
4661 ///
4662 /// Please note that this method must not be used to set any of the known parameters
4663 /// which have their own setter method. If done anyway, the request will fail.
4664 ///
4665 /// # Additional Parameters
4666 ///
4667 /// * *$.xgafv* (query-string) - V1 error format.
4668 /// * *access_token* (query-string) - OAuth access token.
4669 /// * *alt* (query-string) - Data format for response.
4670 /// * *callback* (query-string) - JSONP
4671 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4672 /// * *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.
4673 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4674 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4675 /// * *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.
4676 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4677 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4678 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobDeleteCall<'a, C>
4679 where
4680 T: AsRef<str>,
4681 {
4682 self._additional_params
4683 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4684 self
4685 }
4686
4687 /// Identifies the authorization scope for the method you are building.
4688 ///
4689 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4690 /// [`Scope::CloudPlatform`].
4691 ///
4692 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4693 /// tokens for more than one scope.
4694 ///
4695 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4696 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4697 /// sufficient, a read-write scope will do as well.
4698 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobDeleteCall<'a, C>
4699 where
4700 St: AsRef<str>,
4701 {
4702 self._scopes.insert(String::from(scope.as_ref()));
4703 self
4704 }
4705 /// Identifies the authorization scope(s) for the method you are building.
4706 ///
4707 /// See [`Self::add_scope()`] for details.
4708 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobDeleteCall<'a, C>
4709 where
4710 I: IntoIterator<Item = St>,
4711 St: AsRef<str>,
4712 {
4713 self._scopes
4714 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4715 self
4716 }
4717
4718 /// Removes all scopes, and no default scope will be used either.
4719 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4720 /// for details).
4721 pub fn clear_scopes(mut self) -> ProjectJobDeleteCall<'a, C> {
4722 self._scopes.clear();
4723 self
4724 }
4725}
4726
4727/// Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
4728///
4729/// A builder for the *jobs.get* method supported by a *project* resource.
4730/// It is not used directly, but through a [`ProjectMethods`] instance.
4731///
4732/// # Example
4733///
4734/// Instantiate a resource method builder
4735///
4736/// ```test_harness,no_run
4737/// # extern crate hyper;
4738/// # extern crate hyper_rustls;
4739/// # extern crate google_jobs3 as jobs3;
4740/// # async fn dox() {
4741/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4742///
4743/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4744/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4745/// # .with_native_roots()
4746/// # .unwrap()
4747/// # .https_only()
4748/// # .enable_http2()
4749/// # .build();
4750///
4751/// # let executor = hyper_util::rt::TokioExecutor::new();
4752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4753/// # secret,
4754/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4755/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4756/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4757/// # ),
4758/// # ).build().await.unwrap();
4759///
4760/// # let client = hyper_util::client::legacy::Client::builder(
4761/// # hyper_util::rt::TokioExecutor::new()
4762/// # )
4763/// # .build(
4764/// # hyper_rustls::HttpsConnectorBuilder::new()
4765/// # .with_native_roots()
4766/// # .unwrap()
4767/// # .https_or_http()
4768/// # .enable_http2()
4769/// # .build()
4770/// # );
4771/// # let mut hub = CloudTalentSolution::new(client, auth);
4772/// // You can configure optional parameters by calling the respective setters at will, and
4773/// // execute the final call using `doit()`.
4774/// // Values shown here are possibly random and not representative !
4775/// let result = hub.projects().jobs_get("name")
4776/// .doit().await;
4777/// # }
4778/// ```
4779pub struct ProjectJobGetCall<'a, C>
4780where
4781 C: 'a,
4782{
4783 hub: &'a CloudTalentSolution<C>,
4784 _name: String,
4785 _delegate: Option<&'a mut dyn common::Delegate>,
4786 _additional_params: HashMap<String, String>,
4787 _scopes: BTreeSet<String>,
4788}
4789
4790impl<'a, C> common::CallBuilder for ProjectJobGetCall<'a, C> {}
4791
4792impl<'a, C> ProjectJobGetCall<'a, C>
4793where
4794 C: common::Connector,
4795{
4796 /// Perform the operation you have build so far.
4797 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
4798 use std::borrow::Cow;
4799 use std::io::{Read, Seek};
4800
4801 use common::{url::Params, ToParts};
4802 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4803
4804 let mut dd = common::DefaultDelegate;
4805 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4806 dlg.begin(common::MethodInfo {
4807 id: "jobs.projects.jobs.get",
4808 http_method: hyper::Method::GET,
4809 });
4810
4811 for &field in ["alt", "name"].iter() {
4812 if self._additional_params.contains_key(field) {
4813 dlg.finished(false);
4814 return Err(common::Error::FieldClash(field));
4815 }
4816 }
4817
4818 let mut params = Params::with_capacity(3 + self._additional_params.len());
4819 params.push("name", self._name);
4820
4821 params.extend(self._additional_params.iter());
4822
4823 params.push("alt", "json");
4824 let mut url = self.hub._base_url.clone() + "v3/{+name}";
4825 if self._scopes.is_empty() {
4826 self._scopes
4827 .insert(Scope::CloudPlatform.as_ref().to_string());
4828 }
4829
4830 #[allow(clippy::single_element_loop)]
4831 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4832 url = params.uri_replacement(url, param_name, find_this, true);
4833 }
4834 {
4835 let to_remove = ["name"];
4836 params.remove_params(&to_remove);
4837 }
4838
4839 let url = params.parse_with_url(&url);
4840
4841 loop {
4842 let token = match self
4843 .hub
4844 .auth
4845 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4846 .await
4847 {
4848 Ok(token) => token,
4849 Err(e) => match dlg.token(e) {
4850 Ok(token) => token,
4851 Err(e) => {
4852 dlg.finished(false);
4853 return Err(common::Error::MissingToken(e));
4854 }
4855 },
4856 };
4857 let mut req_result = {
4858 let client = &self.hub.client;
4859 dlg.pre_request();
4860 let mut req_builder = hyper::Request::builder()
4861 .method(hyper::Method::GET)
4862 .uri(url.as_str())
4863 .header(USER_AGENT, self.hub._user_agent.clone());
4864
4865 if let Some(token) = token.as_ref() {
4866 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4867 }
4868
4869 let request = req_builder
4870 .header(CONTENT_LENGTH, 0_u64)
4871 .body(common::to_body::<String>(None));
4872
4873 client.request(request.unwrap()).await
4874 };
4875
4876 match req_result {
4877 Err(err) => {
4878 if let common::Retry::After(d) = dlg.http_error(&err) {
4879 sleep(d).await;
4880 continue;
4881 }
4882 dlg.finished(false);
4883 return Err(common::Error::HttpError(err));
4884 }
4885 Ok(res) => {
4886 let (mut parts, body) = res.into_parts();
4887 let mut body = common::Body::new(body);
4888 if !parts.status.is_success() {
4889 let bytes = common::to_bytes(body).await.unwrap_or_default();
4890 let error = serde_json::from_str(&common::to_string(&bytes));
4891 let response = common::to_response(parts, bytes.into());
4892
4893 if let common::Retry::After(d) =
4894 dlg.http_failure(&response, error.as_ref().ok())
4895 {
4896 sleep(d).await;
4897 continue;
4898 }
4899
4900 dlg.finished(false);
4901
4902 return Err(match error {
4903 Ok(value) => common::Error::BadRequest(value),
4904 _ => common::Error::Failure(response),
4905 });
4906 }
4907 let response = {
4908 let bytes = common::to_bytes(body).await.unwrap_or_default();
4909 let encoded = common::to_string(&bytes);
4910 match serde_json::from_str(&encoded) {
4911 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4912 Err(error) => {
4913 dlg.response_json_decode_error(&encoded, &error);
4914 return Err(common::Error::JsonDecodeError(
4915 encoded.to_string(),
4916 error,
4917 ));
4918 }
4919 }
4920 };
4921
4922 dlg.finished(true);
4923 return Ok(response);
4924 }
4925 }
4926 }
4927 }
4928
4929 /// Required. The resource name of the job to retrieve. The format is "projects/{project_id}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234".
4930 ///
4931 /// Sets the *name* path property to the given value.
4932 ///
4933 /// Even though the property as already been set when instantiating this call,
4934 /// we provide this method for API completeness.
4935 pub fn name(mut self, new_value: &str) -> ProjectJobGetCall<'a, C> {
4936 self._name = new_value.to_string();
4937 self
4938 }
4939 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4940 /// while executing the actual API request.
4941 ///
4942 /// ````text
4943 /// It should be used to handle progress information, and to implement a certain level of resilience.
4944 /// ````
4945 ///
4946 /// Sets the *delegate* property to the given value.
4947 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectJobGetCall<'a, C> {
4948 self._delegate = Some(new_value);
4949 self
4950 }
4951
4952 /// Set any additional parameter of the query string used in the request.
4953 /// It should be used to set parameters which are not yet available through their own
4954 /// setters.
4955 ///
4956 /// Please note that this method must not be used to set any of the known parameters
4957 /// which have their own setter method. If done anyway, the request will fail.
4958 ///
4959 /// # Additional Parameters
4960 ///
4961 /// * *$.xgafv* (query-string) - V1 error format.
4962 /// * *access_token* (query-string) - OAuth access token.
4963 /// * *alt* (query-string) - Data format for response.
4964 /// * *callback* (query-string) - JSONP
4965 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4966 /// * *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.
4967 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4968 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4969 /// * *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.
4970 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4971 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4972 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobGetCall<'a, C>
4973 where
4974 T: AsRef<str>,
4975 {
4976 self._additional_params
4977 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4978 self
4979 }
4980
4981 /// Identifies the authorization scope for the method you are building.
4982 ///
4983 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4984 /// [`Scope::CloudPlatform`].
4985 ///
4986 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4987 /// tokens for more than one scope.
4988 ///
4989 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4990 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4991 /// sufficient, a read-write scope will do as well.
4992 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobGetCall<'a, C>
4993 where
4994 St: AsRef<str>,
4995 {
4996 self._scopes.insert(String::from(scope.as_ref()));
4997 self
4998 }
4999 /// Identifies the authorization scope(s) for the method you are building.
5000 ///
5001 /// See [`Self::add_scope()`] for details.
5002 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobGetCall<'a, C>
5003 where
5004 I: IntoIterator<Item = St>,
5005 St: AsRef<str>,
5006 {
5007 self._scopes
5008 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5009 self
5010 }
5011
5012 /// Removes all scopes, and no default scope will be used either.
5013 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5014 /// for details).
5015 pub fn clear_scopes(mut self) -> ProjectJobGetCall<'a, C> {
5016 self._scopes.clear();
5017 self
5018 }
5019}
5020
5021/// Lists jobs by filter.
5022///
5023/// A builder for the *jobs.list* method supported by a *project* resource.
5024/// It is not used directly, but through a [`ProjectMethods`] instance.
5025///
5026/// # Example
5027///
5028/// Instantiate a resource method builder
5029///
5030/// ```test_harness,no_run
5031/// # extern crate hyper;
5032/// # extern crate hyper_rustls;
5033/// # extern crate google_jobs3 as jobs3;
5034/// # async fn dox() {
5035/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5036///
5037/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5038/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5039/// # .with_native_roots()
5040/// # .unwrap()
5041/// # .https_only()
5042/// # .enable_http2()
5043/// # .build();
5044///
5045/// # let executor = hyper_util::rt::TokioExecutor::new();
5046/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5047/// # secret,
5048/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5049/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5050/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5051/// # ),
5052/// # ).build().await.unwrap();
5053///
5054/// # let client = hyper_util::client::legacy::Client::builder(
5055/// # hyper_util::rt::TokioExecutor::new()
5056/// # )
5057/// # .build(
5058/// # hyper_rustls::HttpsConnectorBuilder::new()
5059/// # .with_native_roots()
5060/// # .unwrap()
5061/// # .https_or_http()
5062/// # .enable_http2()
5063/// # .build()
5064/// # );
5065/// # let mut hub = CloudTalentSolution::new(client, auth);
5066/// // You can configure optional parameters by calling the respective setters at will, and
5067/// // execute the final call using `doit()`.
5068/// // Values shown here are possibly random and not representative !
5069/// let result = hub.projects().jobs_list("parent")
5070/// .page_token("ea")
5071/// .page_size(-55)
5072/// .job_view("invidunt")
5073/// .filter("amet")
5074/// .doit().await;
5075/// # }
5076/// ```
5077pub struct ProjectJobListCall<'a, C>
5078where
5079 C: 'a,
5080{
5081 hub: &'a CloudTalentSolution<C>,
5082 _parent: String,
5083 _page_token: Option<String>,
5084 _page_size: Option<i32>,
5085 _job_view: Option<String>,
5086 _filter: Option<String>,
5087 _delegate: Option<&'a mut dyn common::Delegate>,
5088 _additional_params: HashMap<String, String>,
5089 _scopes: BTreeSet<String>,
5090}
5091
5092impl<'a, C> common::CallBuilder for ProjectJobListCall<'a, C> {}
5093
5094impl<'a, C> ProjectJobListCall<'a, C>
5095where
5096 C: common::Connector,
5097{
5098 /// Perform the operation you have build so far.
5099 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
5100 use std::borrow::Cow;
5101 use std::io::{Read, Seek};
5102
5103 use common::{url::Params, ToParts};
5104 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5105
5106 let mut dd = common::DefaultDelegate;
5107 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5108 dlg.begin(common::MethodInfo {
5109 id: "jobs.projects.jobs.list",
5110 http_method: hyper::Method::GET,
5111 });
5112
5113 for &field in [
5114 "alt",
5115 "parent",
5116 "pageToken",
5117 "pageSize",
5118 "jobView",
5119 "filter",
5120 ]
5121 .iter()
5122 {
5123 if self._additional_params.contains_key(field) {
5124 dlg.finished(false);
5125 return Err(common::Error::FieldClash(field));
5126 }
5127 }
5128
5129 let mut params = Params::with_capacity(7 + self._additional_params.len());
5130 params.push("parent", self._parent);
5131 if let Some(value) = self._page_token.as_ref() {
5132 params.push("pageToken", value);
5133 }
5134 if let Some(value) = self._page_size.as_ref() {
5135 params.push("pageSize", value.to_string());
5136 }
5137 if let Some(value) = self._job_view.as_ref() {
5138 params.push("jobView", value);
5139 }
5140 if let Some(value) = self._filter.as_ref() {
5141 params.push("filter", value);
5142 }
5143
5144 params.extend(self._additional_params.iter());
5145
5146 params.push("alt", "json");
5147 let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs";
5148 if self._scopes.is_empty() {
5149 self._scopes
5150 .insert(Scope::CloudPlatform.as_ref().to_string());
5151 }
5152
5153 #[allow(clippy::single_element_loop)]
5154 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5155 url = params.uri_replacement(url, param_name, find_this, true);
5156 }
5157 {
5158 let to_remove = ["parent"];
5159 params.remove_params(&to_remove);
5160 }
5161
5162 let url = params.parse_with_url(&url);
5163
5164 loop {
5165 let token = match self
5166 .hub
5167 .auth
5168 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5169 .await
5170 {
5171 Ok(token) => token,
5172 Err(e) => match dlg.token(e) {
5173 Ok(token) => token,
5174 Err(e) => {
5175 dlg.finished(false);
5176 return Err(common::Error::MissingToken(e));
5177 }
5178 },
5179 };
5180 let mut req_result = {
5181 let client = &self.hub.client;
5182 dlg.pre_request();
5183 let mut req_builder = hyper::Request::builder()
5184 .method(hyper::Method::GET)
5185 .uri(url.as_str())
5186 .header(USER_AGENT, self.hub._user_agent.clone());
5187
5188 if let Some(token) = token.as_ref() {
5189 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5190 }
5191
5192 let request = req_builder
5193 .header(CONTENT_LENGTH, 0_u64)
5194 .body(common::to_body::<String>(None));
5195
5196 client.request(request.unwrap()).await
5197 };
5198
5199 match req_result {
5200 Err(err) => {
5201 if let common::Retry::After(d) = dlg.http_error(&err) {
5202 sleep(d).await;
5203 continue;
5204 }
5205 dlg.finished(false);
5206 return Err(common::Error::HttpError(err));
5207 }
5208 Ok(res) => {
5209 let (mut parts, body) = res.into_parts();
5210 let mut body = common::Body::new(body);
5211 if !parts.status.is_success() {
5212 let bytes = common::to_bytes(body).await.unwrap_or_default();
5213 let error = serde_json::from_str(&common::to_string(&bytes));
5214 let response = common::to_response(parts, bytes.into());
5215
5216 if let common::Retry::After(d) =
5217 dlg.http_failure(&response, error.as_ref().ok())
5218 {
5219 sleep(d).await;
5220 continue;
5221 }
5222
5223 dlg.finished(false);
5224
5225 return Err(match error {
5226 Ok(value) => common::Error::BadRequest(value),
5227 _ => common::Error::Failure(response),
5228 });
5229 }
5230 let response = {
5231 let bytes = common::to_bytes(body).await.unwrap_or_default();
5232 let encoded = common::to_string(&bytes);
5233 match serde_json::from_str(&encoded) {
5234 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5235 Err(error) => {
5236 dlg.response_json_decode_error(&encoded, &error);
5237 return Err(common::Error::JsonDecodeError(
5238 encoded.to_string(),
5239 error,
5240 ));
5241 }
5242 }
5243 };
5244
5245 dlg.finished(true);
5246 return Ok(response);
5247 }
5248 }
5249 }
5250 }
5251
5252 /// Required. The resource name of the project under which the job is created. The format is "projects/{project_id}", for example, "projects/api-test-project".
5253 ///
5254 /// Sets the *parent* path property to the given value.
5255 ///
5256 /// Even though the property as already been set when instantiating this call,
5257 /// we provide this method for API completeness.
5258 pub fn parent(mut self, new_value: &str) -> ProjectJobListCall<'a, C> {
5259 self._parent = new_value.to_string();
5260 self
5261 }
5262 /// Optional. The starting point of a query result.
5263 ///
5264 /// Sets the *page token* query property to the given value.
5265 pub fn page_token(mut self, new_value: &str) -> ProjectJobListCall<'a, C> {
5266 self._page_token = Some(new_value.to_string());
5267 self
5268 }
5269 /// Optional. 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.
5270 ///
5271 /// Sets the *page size* query property to the given value.
5272 pub fn page_size(mut self, new_value: i32) -> ProjectJobListCall<'a, C> {
5273 self._page_size = Some(new_value);
5274 self
5275 }
5276 /// Optional. The desired job attributes returned for jobs in the search response. Defaults to JobView.JOB_VIEW_FULL if no value is specified.
5277 ///
5278 /// Sets the *job view* query property to the given value.
5279 pub fn job_view(mut self, new_value: &str) -> ProjectJobListCall<'a, C> {
5280 self._job_view = Some(new_value.to_string());
5281 self
5282 }
5283 /// 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/api-test-project/companies/123" * companyName = "projects/api-test-project/companies/123" AND requisitionId = "req-1" * companyName = "projects/api-test-project/companies/123" AND status = "EXPIRED" * requisitionId = "req-1" * requisitionId = "req-1" AND status = "EXPIRED"
5284 ///
5285 /// Sets the *filter* query property to the given value.
5286 pub fn filter(mut self, new_value: &str) -> ProjectJobListCall<'a, C> {
5287 self._filter = Some(new_value.to_string());
5288 self
5289 }
5290 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5291 /// while executing the actual API request.
5292 ///
5293 /// ````text
5294 /// It should be used to handle progress information, and to implement a certain level of resilience.
5295 /// ````
5296 ///
5297 /// Sets the *delegate* property to the given value.
5298 pub fn delegate(
5299 mut self,
5300 new_value: &'a mut dyn common::Delegate,
5301 ) -> ProjectJobListCall<'a, C> {
5302 self._delegate = Some(new_value);
5303 self
5304 }
5305
5306 /// Set any additional parameter of the query string used in the request.
5307 /// It should be used to set parameters which are not yet available through their own
5308 /// setters.
5309 ///
5310 /// Please note that this method must not be used to set any of the known parameters
5311 /// which have their own setter method. If done anyway, the request will fail.
5312 ///
5313 /// # Additional Parameters
5314 ///
5315 /// * *$.xgafv* (query-string) - V1 error format.
5316 /// * *access_token* (query-string) - OAuth access token.
5317 /// * *alt* (query-string) - Data format for response.
5318 /// * *callback* (query-string) - JSONP
5319 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5320 /// * *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.
5321 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5322 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5323 /// * *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.
5324 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5325 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5326 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobListCall<'a, C>
5327 where
5328 T: AsRef<str>,
5329 {
5330 self._additional_params
5331 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5332 self
5333 }
5334
5335 /// Identifies the authorization scope for the method you are building.
5336 ///
5337 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5338 /// [`Scope::CloudPlatform`].
5339 ///
5340 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5341 /// tokens for more than one scope.
5342 ///
5343 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5344 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5345 /// sufficient, a read-write scope will do as well.
5346 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobListCall<'a, C>
5347 where
5348 St: AsRef<str>,
5349 {
5350 self._scopes.insert(String::from(scope.as_ref()));
5351 self
5352 }
5353 /// Identifies the authorization scope(s) for the method you are building.
5354 ///
5355 /// See [`Self::add_scope()`] for details.
5356 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobListCall<'a, C>
5357 where
5358 I: IntoIterator<Item = St>,
5359 St: AsRef<str>,
5360 {
5361 self._scopes
5362 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5363 self
5364 }
5365
5366 /// Removes all scopes, and no default scope will be used either.
5367 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5368 /// for details).
5369 pub fn clear_scopes(mut self) -> ProjectJobListCall<'a, C> {
5370 self._scopes.clear();
5371 self
5372 }
5373}
5374
5375/// Updates specified job. Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
5376///
5377/// A builder for the *jobs.patch* method supported by a *project* resource.
5378/// It is not used directly, but through a [`ProjectMethods`] instance.
5379///
5380/// # Example
5381///
5382/// Instantiate a resource method builder
5383///
5384/// ```test_harness,no_run
5385/// # extern crate hyper;
5386/// # extern crate hyper_rustls;
5387/// # extern crate google_jobs3 as jobs3;
5388/// use jobs3::api::UpdateJobRequest;
5389/// # async fn dox() {
5390/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5391///
5392/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5393/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5394/// # .with_native_roots()
5395/// # .unwrap()
5396/// # .https_only()
5397/// # .enable_http2()
5398/// # .build();
5399///
5400/// # let executor = hyper_util::rt::TokioExecutor::new();
5401/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5402/// # secret,
5403/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5404/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5405/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5406/// # ),
5407/// # ).build().await.unwrap();
5408///
5409/// # let client = hyper_util::client::legacy::Client::builder(
5410/// # hyper_util::rt::TokioExecutor::new()
5411/// # )
5412/// # .build(
5413/// # hyper_rustls::HttpsConnectorBuilder::new()
5414/// # .with_native_roots()
5415/// # .unwrap()
5416/// # .https_or_http()
5417/// # .enable_http2()
5418/// # .build()
5419/// # );
5420/// # let mut hub = CloudTalentSolution::new(client, auth);
5421/// // As the method needs a request, you would usually fill it with the desired information
5422/// // into the respective structure. Some of the parts shown here might not be applicable !
5423/// // Values shown here are possibly random and not representative !
5424/// let mut req = UpdateJobRequest::default();
5425///
5426/// // You can configure optional parameters by calling the respective setters at will, and
5427/// // execute the final call using `doit()`.
5428/// // Values shown here are possibly random and not representative !
5429/// let result = hub.projects().jobs_patch(req, "name")
5430/// .doit().await;
5431/// # }
5432/// ```
5433pub struct ProjectJobPatchCall<'a, C>
5434where
5435 C: 'a,
5436{
5437 hub: &'a CloudTalentSolution<C>,
5438 _request: UpdateJobRequest,
5439 _name: String,
5440 _delegate: Option<&'a mut dyn common::Delegate>,
5441 _additional_params: HashMap<String, String>,
5442 _scopes: BTreeSet<String>,
5443}
5444
5445impl<'a, C> common::CallBuilder for ProjectJobPatchCall<'a, C> {}
5446
5447impl<'a, C> ProjectJobPatchCall<'a, C>
5448where
5449 C: common::Connector,
5450{
5451 /// Perform the operation you have build so far.
5452 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
5453 use std::borrow::Cow;
5454 use std::io::{Read, Seek};
5455
5456 use common::{url::Params, ToParts};
5457 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5458
5459 let mut dd = common::DefaultDelegate;
5460 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5461 dlg.begin(common::MethodInfo {
5462 id: "jobs.projects.jobs.patch",
5463 http_method: hyper::Method::PATCH,
5464 });
5465
5466 for &field in ["alt", "name"].iter() {
5467 if self._additional_params.contains_key(field) {
5468 dlg.finished(false);
5469 return Err(common::Error::FieldClash(field));
5470 }
5471 }
5472
5473 let mut params = Params::with_capacity(4 + self._additional_params.len());
5474 params.push("name", self._name);
5475
5476 params.extend(self._additional_params.iter());
5477
5478 params.push("alt", "json");
5479 let mut url = self.hub._base_url.clone() + "v3/{+name}";
5480 if self._scopes.is_empty() {
5481 self._scopes
5482 .insert(Scope::CloudPlatform.as_ref().to_string());
5483 }
5484
5485 #[allow(clippy::single_element_loop)]
5486 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5487 url = params.uri_replacement(url, param_name, find_this, true);
5488 }
5489 {
5490 let to_remove = ["name"];
5491 params.remove_params(&to_remove);
5492 }
5493
5494 let url = params.parse_with_url(&url);
5495
5496 let mut json_mime_type = mime::APPLICATION_JSON;
5497 let mut request_value_reader = {
5498 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5499 common::remove_json_null_values(&mut value);
5500 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5501 serde_json::to_writer(&mut dst, &value).unwrap();
5502 dst
5503 };
5504 let request_size = request_value_reader
5505 .seek(std::io::SeekFrom::End(0))
5506 .unwrap();
5507 request_value_reader
5508 .seek(std::io::SeekFrom::Start(0))
5509 .unwrap();
5510
5511 loop {
5512 let token = match self
5513 .hub
5514 .auth
5515 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5516 .await
5517 {
5518 Ok(token) => token,
5519 Err(e) => match dlg.token(e) {
5520 Ok(token) => token,
5521 Err(e) => {
5522 dlg.finished(false);
5523 return Err(common::Error::MissingToken(e));
5524 }
5525 },
5526 };
5527 request_value_reader
5528 .seek(std::io::SeekFrom::Start(0))
5529 .unwrap();
5530 let mut req_result = {
5531 let client = &self.hub.client;
5532 dlg.pre_request();
5533 let mut req_builder = hyper::Request::builder()
5534 .method(hyper::Method::PATCH)
5535 .uri(url.as_str())
5536 .header(USER_AGENT, self.hub._user_agent.clone());
5537
5538 if let Some(token) = token.as_ref() {
5539 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5540 }
5541
5542 let request = req_builder
5543 .header(CONTENT_TYPE, json_mime_type.to_string())
5544 .header(CONTENT_LENGTH, request_size as u64)
5545 .body(common::to_body(
5546 request_value_reader.get_ref().clone().into(),
5547 ));
5548
5549 client.request(request.unwrap()).await
5550 };
5551
5552 match req_result {
5553 Err(err) => {
5554 if let common::Retry::After(d) = dlg.http_error(&err) {
5555 sleep(d).await;
5556 continue;
5557 }
5558 dlg.finished(false);
5559 return Err(common::Error::HttpError(err));
5560 }
5561 Ok(res) => {
5562 let (mut parts, body) = res.into_parts();
5563 let mut body = common::Body::new(body);
5564 if !parts.status.is_success() {
5565 let bytes = common::to_bytes(body).await.unwrap_or_default();
5566 let error = serde_json::from_str(&common::to_string(&bytes));
5567 let response = common::to_response(parts, bytes.into());
5568
5569 if let common::Retry::After(d) =
5570 dlg.http_failure(&response, error.as_ref().ok())
5571 {
5572 sleep(d).await;
5573 continue;
5574 }
5575
5576 dlg.finished(false);
5577
5578 return Err(match error {
5579 Ok(value) => common::Error::BadRequest(value),
5580 _ => common::Error::Failure(response),
5581 });
5582 }
5583 let response = {
5584 let bytes = common::to_bytes(body).await.unwrap_or_default();
5585 let encoded = common::to_string(&bytes);
5586 match serde_json::from_str(&encoded) {
5587 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5588 Err(error) => {
5589 dlg.response_json_decode_error(&encoded, &error);
5590 return Err(common::Error::JsonDecodeError(
5591 encoded.to_string(),
5592 error,
5593 ));
5594 }
5595 }
5596 };
5597
5598 dlg.finished(true);
5599 return Ok(response);
5600 }
5601 }
5602 }
5603 }
5604
5605 ///
5606 /// Sets the *request* property to the given value.
5607 ///
5608 /// Even though the property as already been set when instantiating this call,
5609 /// we provide this method for API completeness.
5610 pub fn request(mut self, new_value: UpdateJobRequest) -> ProjectJobPatchCall<'a, C> {
5611 self._request = new_value;
5612 self
5613 }
5614 /// 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}/jobs/{job_id}", for example, "projects/api-test-project/jobs/1234". Use of this field in job queries and API calls is preferred over the use of requisition_id since this value is unique.
5615 ///
5616 /// Sets the *name* path property to the given value.
5617 ///
5618 /// Even though the property as already been set when instantiating this call,
5619 /// we provide this method for API completeness.
5620 pub fn name(mut self, new_value: &str) -> ProjectJobPatchCall<'a, C> {
5621 self._name = new_value.to_string();
5622 self
5623 }
5624 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5625 /// while executing the actual API request.
5626 ///
5627 /// ````text
5628 /// It should be used to handle progress information, and to implement a certain level of resilience.
5629 /// ````
5630 ///
5631 /// Sets the *delegate* property to the given value.
5632 pub fn delegate(
5633 mut self,
5634 new_value: &'a mut dyn common::Delegate,
5635 ) -> ProjectJobPatchCall<'a, C> {
5636 self._delegate = Some(new_value);
5637 self
5638 }
5639
5640 /// Set any additional parameter of the query string used in the request.
5641 /// It should be used to set parameters which are not yet available through their own
5642 /// setters.
5643 ///
5644 /// Please note that this method must not be used to set any of the known parameters
5645 /// which have their own setter method. If done anyway, the request will fail.
5646 ///
5647 /// # Additional Parameters
5648 ///
5649 /// * *$.xgafv* (query-string) - V1 error format.
5650 /// * *access_token* (query-string) - OAuth access token.
5651 /// * *alt* (query-string) - Data format for response.
5652 /// * *callback* (query-string) - JSONP
5653 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5654 /// * *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.
5655 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5656 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5657 /// * *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.
5658 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5659 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5660 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobPatchCall<'a, C>
5661 where
5662 T: AsRef<str>,
5663 {
5664 self._additional_params
5665 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5666 self
5667 }
5668
5669 /// Identifies the authorization scope for the method you are building.
5670 ///
5671 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5672 /// [`Scope::CloudPlatform`].
5673 ///
5674 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5675 /// tokens for more than one scope.
5676 ///
5677 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5678 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5679 /// sufficient, a read-write scope will do as well.
5680 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobPatchCall<'a, C>
5681 where
5682 St: AsRef<str>,
5683 {
5684 self._scopes.insert(String::from(scope.as_ref()));
5685 self
5686 }
5687 /// Identifies the authorization scope(s) for the method you are building.
5688 ///
5689 /// See [`Self::add_scope()`] for details.
5690 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobPatchCall<'a, C>
5691 where
5692 I: IntoIterator<Item = St>,
5693 St: AsRef<str>,
5694 {
5695 self._scopes
5696 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5697 self
5698 }
5699
5700 /// Removes all scopes, and no default scope will be used either.
5701 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5702 /// for details).
5703 pub fn clear_scopes(mut self) -> ProjectJobPatchCall<'a, C> {
5704 self._scopes.clear();
5705 self
5706 }
5707}
5708
5709/// 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.
5710///
5711/// A builder for the *jobs.search* method supported by a *project* resource.
5712/// It is not used directly, but through a [`ProjectMethods`] instance.
5713///
5714/// # Example
5715///
5716/// Instantiate a resource method builder
5717///
5718/// ```test_harness,no_run
5719/// # extern crate hyper;
5720/// # extern crate hyper_rustls;
5721/// # extern crate google_jobs3 as jobs3;
5722/// use jobs3::api::SearchJobsRequest;
5723/// # async fn dox() {
5724/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5725///
5726/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5727/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5728/// # .with_native_roots()
5729/// # .unwrap()
5730/// # .https_only()
5731/// # .enable_http2()
5732/// # .build();
5733///
5734/// # let executor = hyper_util::rt::TokioExecutor::new();
5735/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5736/// # secret,
5737/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5738/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5739/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5740/// # ),
5741/// # ).build().await.unwrap();
5742///
5743/// # let client = hyper_util::client::legacy::Client::builder(
5744/// # hyper_util::rt::TokioExecutor::new()
5745/// # )
5746/// # .build(
5747/// # hyper_rustls::HttpsConnectorBuilder::new()
5748/// # .with_native_roots()
5749/// # .unwrap()
5750/// # .https_or_http()
5751/// # .enable_http2()
5752/// # .build()
5753/// # );
5754/// # let mut hub = CloudTalentSolution::new(client, auth);
5755/// // As the method needs a request, you would usually fill it with the desired information
5756/// // into the respective structure. Some of the parts shown here might not be applicable !
5757/// // Values shown here are possibly random and not representative !
5758/// let mut req = SearchJobsRequest::default();
5759///
5760/// // You can configure optional parameters by calling the respective setters at will, and
5761/// // execute the final call using `doit()`.
5762/// // Values shown here are possibly random and not representative !
5763/// let result = hub.projects().jobs_search(req, "parent")
5764/// .doit().await;
5765/// # }
5766/// ```
5767pub struct ProjectJobSearchCall<'a, C>
5768where
5769 C: 'a,
5770{
5771 hub: &'a CloudTalentSolution<C>,
5772 _request: SearchJobsRequest,
5773 _parent: String,
5774 _delegate: Option<&'a mut dyn common::Delegate>,
5775 _additional_params: HashMap<String, String>,
5776 _scopes: BTreeSet<String>,
5777}
5778
5779impl<'a, C> common::CallBuilder for ProjectJobSearchCall<'a, C> {}
5780
5781impl<'a, C> ProjectJobSearchCall<'a, C>
5782where
5783 C: common::Connector,
5784{
5785 /// Perform the operation you have build so far.
5786 pub async fn doit(mut self) -> common::Result<(common::Response, SearchJobsResponse)> {
5787 use std::borrow::Cow;
5788 use std::io::{Read, Seek};
5789
5790 use common::{url::Params, ToParts};
5791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5792
5793 let mut dd = common::DefaultDelegate;
5794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5795 dlg.begin(common::MethodInfo {
5796 id: "jobs.projects.jobs.search",
5797 http_method: hyper::Method::POST,
5798 });
5799
5800 for &field in ["alt", "parent"].iter() {
5801 if self._additional_params.contains_key(field) {
5802 dlg.finished(false);
5803 return Err(common::Error::FieldClash(field));
5804 }
5805 }
5806
5807 let mut params = Params::with_capacity(4 + self._additional_params.len());
5808 params.push("parent", self._parent);
5809
5810 params.extend(self._additional_params.iter());
5811
5812 params.push("alt", "json");
5813 let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs:search";
5814 if self._scopes.is_empty() {
5815 self._scopes
5816 .insert(Scope::CloudPlatform.as_ref().to_string());
5817 }
5818
5819 #[allow(clippy::single_element_loop)]
5820 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5821 url = params.uri_replacement(url, param_name, find_this, true);
5822 }
5823 {
5824 let to_remove = ["parent"];
5825 params.remove_params(&to_remove);
5826 }
5827
5828 let url = params.parse_with_url(&url);
5829
5830 let mut json_mime_type = mime::APPLICATION_JSON;
5831 let mut request_value_reader = {
5832 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5833 common::remove_json_null_values(&mut value);
5834 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5835 serde_json::to_writer(&mut dst, &value).unwrap();
5836 dst
5837 };
5838 let request_size = request_value_reader
5839 .seek(std::io::SeekFrom::End(0))
5840 .unwrap();
5841 request_value_reader
5842 .seek(std::io::SeekFrom::Start(0))
5843 .unwrap();
5844
5845 loop {
5846 let token = match self
5847 .hub
5848 .auth
5849 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5850 .await
5851 {
5852 Ok(token) => token,
5853 Err(e) => match dlg.token(e) {
5854 Ok(token) => token,
5855 Err(e) => {
5856 dlg.finished(false);
5857 return Err(common::Error::MissingToken(e));
5858 }
5859 },
5860 };
5861 request_value_reader
5862 .seek(std::io::SeekFrom::Start(0))
5863 .unwrap();
5864 let mut req_result = {
5865 let client = &self.hub.client;
5866 dlg.pre_request();
5867 let mut req_builder = hyper::Request::builder()
5868 .method(hyper::Method::POST)
5869 .uri(url.as_str())
5870 .header(USER_AGENT, self.hub._user_agent.clone());
5871
5872 if let Some(token) = token.as_ref() {
5873 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5874 }
5875
5876 let request = req_builder
5877 .header(CONTENT_TYPE, json_mime_type.to_string())
5878 .header(CONTENT_LENGTH, request_size as u64)
5879 .body(common::to_body(
5880 request_value_reader.get_ref().clone().into(),
5881 ));
5882
5883 client.request(request.unwrap()).await
5884 };
5885
5886 match req_result {
5887 Err(err) => {
5888 if let common::Retry::After(d) = dlg.http_error(&err) {
5889 sleep(d).await;
5890 continue;
5891 }
5892 dlg.finished(false);
5893 return Err(common::Error::HttpError(err));
5894 }
5895 Ok(res) => {
5896 let (mut parts, body) = res.into_parts();
5897 let mut body = common::Body::new(body);
5898 if !parts.status.is_success() {
5899 let bytes = common::to_bytes(body).await.unwrap_or_default();
5900 let error = serde_json::from_str(&common::to_string(&bytes));
5901 let response = common::to_response(parts, bytes.into());
5902
5903 if let common::Retry::After(d) =
5904 dlg.http_failure(&response, error.as_ref().ok())
5905 {
5906 sleep(d).await;
5907 continue;
5908 }
5909
5910 dlg.finished(false);
5911
5912 return Err(match error {
5913 Ok(value) => common::Error::BadRequest(value),
5914 _ => common::Error::Failure(response),
5915 });
5916 }
5917 let response = {
5918 let bytes = common::to_bytes(body).await.unwrap_or_default();
5919 let encoded = common::to_string(&bytes);
5920 match serde_json::from_str(&encoded) {
5921 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5922 Err(error) => {
5923 dlg.response_json_decode_error(&encoded, &error);
5924 return Err(common::Error::JsonDecodeError(
5925 encoded.to_string(),
5926 error,
5927 ));
5928 }
5929 }
5930 };
5931
5932 dlg.finished(true);
5933 return Ok(response);
5934 }
5935 }
5936 }
5937 }
5938
5939 ///
5940 /// Sets the *request* property to the given value.
5941 ///
5942 /// Even though the property as already been set when instantiating this call,
5943 /// we provide this method for API completeness.
5944 pub fn request(mut self, new_value: SearchJobsRequest) -> ProjectJobSearchCall<'a, C> {
5945 self._request = new_value;
5946 self
5947 }
5948 /// Required. The resource name of the project to search within. The format is "projects/{project_id}", for example, "projects/api-test-project".
5949 ///
5950 /// Sets the *parent* path property to the given value.
5951 ///
5952 /// Even though the property as already been set when instantiating this call,
5953 /// we provide this method for API completeness.
5954 pub fn parent(mut self, new_value: &str) -> ProjectJobSearchCall<'a, C> {
5955 self._parent = new_value.to_string();
5956 self
5957 }
5958 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5959 /// while executing the actual API request.
5960 ///
5961 /// ````text
5962 /// It should be used to handle progress information, and to implement a certain level of resilience.
5963 /// ````
5964 ///
5965 /// Sets the *delegate* property to the given value.
5966 pub fn delegate(
5967 mut self,
5968 new_value: &'a mut dyn common::Delegate,
5969 ) -> ProjectJobSearchCall<'a, C> {
5970 self._delegate = Some(new_value);
5971 self
5972 }
5973
5974 /// Set any additional parameter of the query string used in the request.
5975 /// It should be used to set parameters which are not yet available through their own
5976 /// setters.
5977 ///
5978 /// Please note that this method must not be used to set any of the known parameters
5979 /// which have their own setter method. If done anyway, the request will fail.
5980 ///
5981 /// # Additional Parameters
5982 ///
5983 /// * *$.xgafv* (query-string) - V1 error format.
5984 /// * *access_token* (query-string) - OAuth access token.
5985 /// * *alt* (query-string) - Data format for response.
5986 /// * *callback* (query-string) - JSONP
5987 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5988 /// * *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.
5989 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5990 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5991 /// * *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.
5992 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5993 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5994 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobSearchCall<'a, C>
5995 where
5996 T: AsRef<str>,
5997 {
5998 self._additional_params
5999 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6000 self
6001 }
6002
6003 /// Identifies the authorization scope for the method you are building.
6004 ///
6005 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6006 /// [`Scope::CloudPlatform`].
6007 ///
6008 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6009 /// tokens for more than one scope.
6010 ///
6011 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6012 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6013 /// sufficient, a read-write scope will do as well.
6014 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobSearchCall<'a, C>
6015 where
6016 St: AsRef<str>,
6017 {
6018 self._scopes.insert(String::from(scope.as_ref()));
6019 self
6020 }
6021 /// Identifies the authorization scope(s) for the method you are building.
6022 ///
6023 /// See [`Self::add_scope()`] for details.
6024 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobSearchCall<'a, C>
6025 where
6026 I: IntoIterator<Item = St>,
6027 St: AsRef<str>,
6028 {
6029 self._scopes
6030 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6031 self
6032 }
6033
6034 /// Removes all scopes, and no default scope will be used either.
6035 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6036 /// for details).
6037 pub fn clear_scopes(mut self) -> ProjectJobSearchCall<'a, C> {
6038 self._scopes.clear();
6039 self
6040 }
6041}
6042
6043/// 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), and has different algorithmic adjustments that are targeted to 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.
6044///
6045/// A builder for the *jobs.searchForAlert* method supported by a *project* resource.
6046/// It is not used directly, but through a [`ProjectMethods`] instance.
6047///
6048/// # Example
6049///
6050/// Instantiate a resource method builder
6051///
6052/// ```test_harness,no_run
6053/// # extern crate hyper;
6054/// # extern crate hyper_rustls;
6055/// # extern crate google_jobs3 as jobs3;
6056/// use jobs3::api::SearchJobsRequest;
6057/// # async fn dox() {
6058/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6059///
6060/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6061/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6062/// # .with_native_roots()
6063/// # .unwrap()
6064/// # .https_only()
6065/// # .enable_http2()
6066/// # .build();
6067///
6068/// # let executor = hyper_util::rt::TokioExecutor::new();
6069/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6070/// # secret,
6071/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6072/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6073/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6074/// # ),
6075/// # ).build().await.unwrap();
6076///
6077/// # let client = hyper_util::client::legacy::Client::builder(
6078/// # hyper_util::rt::TokioExecutor::new()
6079/// # )
6080/// # .build(
6081/// # hyper_rustls::HttpsConnectorBuilder::new()
6082/// # .with_native_roots()
6083/// # .unwrap()
6084/// # .https_or_http()
6085/// # .enable_http2()
6086/// # .build()
6087/// # );
6088/// # let mut hub = CloudTalentSolution::new(client, auth);
6089/// // As the method needs a request, you would usually fill it with the desired information
6090/// // into the respective structure. Some of the parts shown here might not be applicable !
6091/// // Values shown here are possibly random and not representative !
6092/// let mut req = SearchJobsRequest::default();
6093///
6094/// // You can configure optional parameters by calling the respective setters at will, and
6095/// // execute the final call using `doit()`.
6096/// // Values shown here are possibly random and not representative !
6097/// let result = hub.projects().jobs_search_for_alert(req, "parent")
6098/// .doit().await;
6099/// # }
6100/// ```
6101pub struct ProjectJobSearchForAlertCall<'a, C>
6102where
6103 C: 'a,
6104{
6105 hub: &'a CloudTalentSolution<C>,
6106 _request: SearchJobsRequest,
6107 _parent: String,
6108 _delegate: Option<&'a mut dyn common::Delegate>,
6109 _additional_params: HashMap<String, String>,
6110 _scopes: BTreeSet<String>,
6111}
6112
6113impl<'a, C> common::CallBuilder for ProjectJobSearchForAlertCall<'a, C> {}
6114
6115impl<'a, C> ProjectJobSearchForAlertCall<'a, C>
6116where
6117 C: common::Connector,
6118{
6119 /// Perform the operation you have build so far.
6120 pub async fn doit(mut self) -> common::Result<(common::Response, SearchJobsResponse)> {
6121 use std::borrow::Cow;
6122 use std::io::{Read, Seek};
6123
6124 use common::{url::Params, ToParts};
6125 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6126
6127 let mut dd = common::DefaultDelegate;
6128 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6129 dlg.begin(common::MethodInfo {
6130 id: "jobs.projects.jobs.searchForAlert",
6131 http_method: hyper::Method::POST,
6132 });
6133
6134 for &field in ["alt", "parent"].iter() {
6135 if self._additional_params.contains_key(field) {
6136 dlg.finished(false);
6137 return Err(common::Error::FieldClash(field));
6138 }
6139 }
6140
6141 let mut params = Params::with_capacity(4 + self._additional_params.len());
6142 params.push("parent", self._parent);
6143
6144 params.extend(self._additional_params.iter());
6145
6146 params.push("alt", "json");
6147 let mut url = self.hub._base_url.clone() + "v3/{+parent}/jobs:searchForAlert";
6148 if self._scopes.is_empty() {
6149 self._scopes
6150 .insert(Scope::CloudPlatform.as_ref().to_string());
6151 }
6152
6153 #[allow(clippy::single_element_loop)]
6154 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6155 url = params.uri_replacement(url, param_name, find_this, true);
6156 }
6157 {
6158 let to_remove = ["parent"];
6159 params.remove_params(&to_remove);
6160 }
6161
6162 let url = params.parse_with_url(&url);
6163
6164 let mut json_mime_type = mime::APPLICATION_JSON;
6165 let mut request_value_reader = {
6166 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6167 common::remove_json_null_values(&mut value);
6168 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6169 serde_json::to_writer(&mut dst, &value).unwrap();
6170 dst
6171 };
6172 let request_size = request_value_reader
6173 .seek(std::io::SeekFrom::End(0))
6174 .unwrap();
6175 request_value_reader
6176 .seek(std::io::SeekFrom::Start(0))
6177 .unwrap();
6178
6179 loop {
6180 let token = match self
6181 .hub
6182 .auth
6183 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6184 .await
6185 {
6186 Ok(token) => token,
6187 Err(e) => match dlg.token(e) {
6188 Ok(token) => token,
6189 Err(e) => {
6190 dlg.finished(false);
6191 return Err(common::Error::MissingToken(e));
6192 }
6193 },
6194 };
6195 request_value_reader
6196 .seek(std::io::SeekFrom::Start(0))
6197 .unwrap();
6198 let mut req_result = {
6199 let client = &self.hub.client;
6200 dlg.pre_request();
6201 let mut req_builder = hyper::Request::builder()
6202 .method(hyper::Method::POST)
6203 .uri(url.as_str())
6204 .header(USER_AGENT, self.hub._user_agent.clone());
6205
6206 if let Some(token) = token.as_ref() {
6207 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6208 }
6209
6210 let request = req_builder
6211 .header(CONTENT_TYPE, json_mime_type.to_string())
6212 .header(CONTENT_LENGTH, request_size as u64)
6213 .body(common::to_body(
6214 request_value_reader.get_ref().clone().into(),
6215 ));
6216
6217 client.request(request.unwrap()).await
6218 };
6219
6220 match req_result {
6221 Err(err) => {
6222 if let common::Retry::After(d) = dlg.http_error(&err) {
6223 sleep(d).await;
6224 continue;
6225 }
6226 dlg.finished(false);
6227 return Err(common::Error::HttpError(err));
6228 }
6229 Ok(res) => {
6230 let (mut parts, body) = res.into_parts();
6231 let mut body = common::Body::new(body);
6232 if !parts.status.is_success() {
6233 let bytes = common::to_bytes(body).await.unwrap_or_default();
6234 let error = serde_json::from_str(&common::to_string(&bytes));
6235 let response = common::to_response(parts, bytes.into());
6236
6237 if let common::Retry::After(d) =
6238 dlg.http_failure(&response, error.as_ref().ok())
6239 {
6240 sleep(d).await;
6241 continue;
6242 }
6243
6244 dlg.finished(false);
6245
6246 return Err(match error {
6247 Ok(value) => common::Error::BadRequest(value),
6248 _ => common::Error::Failure(response),
6249 });
6250 }
6251 let response = {
6252 let bytes = common::to_bytes(body).await.unwrap_or_default();
6253 let encoded = common::to_string(&bytes);
6254 match serde_json::from_str(&encoded) {
6255 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6256 Err(error) => {
6257 dlg.response_json_decode_error(&encoded, &error);
6258 return Err(common::Error::JsonDecodeError(
6259 encoded.to_string(),
6260 error,
6261 ));
6262 }
6263 }
6264 };
6265
6266 dlg.finished(true);
6267 return Ok(response);
6268 }
6269 }
6270 }
6271 }
6272
6273 ///
6274 /// Sets the *request* property to the given value.
6275 ///
6276 /// Even though the property as already been set when instantiating this call,
6277 /// we provide this method for API completeness.
6278 pub fn request(mut self, new_value: SearchJobsRequest) -> ProjectJobSearchForAlertCall<'a, C> {
6279 self._request = new_value;
6280 self
6281 }
6282 /// Required. The resource name of the project to search within. The format is "projects/{project_id}", for example, "projects/api-test-project".
6283 ///
6284 /// Sets the *parent* path property to the given value.
6285 ///
6286 /// Even though the property as already been set when instantiating this call,
6287 /// we provide this method for API completeness.
6288 pub fn parent(mut self, new_value: &str) -> ProjectJobSearchForAlertCall<'a, C> {
6289 self._parent = new_value.to_string();
6290 self
6291 }
6292 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6293 /// while executing the actual API request.
6294 ///
6295 /// ````text
6296 /// It should be used to handle progress information, and to implement a certain level of resilience.
6297 /// ````
6298 ///
6299 /// Sets the *delegate* property to the given value.
6300 pub fn delegate(
6301 mut self,
6302 new_value: &'a mut dyn common::Delegate,
6303 ) -> ProjectJobSearchForAlertCall<'a, C> {
6304 self._delegate = Some(new_value);
6305 self
6306 }
6307
6308 /// Set any additional parameter of the query string used in the request.
6309 /// It should be used to set parameters which are not yet available through their own
6310 /// setters.
6311 ///
6312 /// Please note that this method must not be used to set any of the known parameters
6313 /// which have their own setter method. If done anyway, the request will fail.
6314 ///
6315 /// # Additional Parameters
6316 ///
6317 /// * *$.xgafv* (query-string) - V1 error format.
6318 /// * *access_token* (query-string) - OAuth access token.
6319 /// * *alt* (query-string) - Data format for response.
6320 /// * *callback* (query-string) - JSONP
6321 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6322 /// * *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.
6323 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6324 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6325 /// * *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.
6326 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6327 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6328 pub fn param<T>(mut self, name: T, value: T) -> ProjectJobSearchForAlertCall<'a, C>
6329 where
6330 T: AsRef<str>,
6331 {
6332 self._additional_params
6333 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6334 self
6335 }
6336
6337 /// Identifies the authorization scope for the method you are building.
6338 ///
6339 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6340 /// [`Scope::CloudPlatform`].
6341 ///
6342 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6343 /// tokens for more than one scope.
6344 ///
6345 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6346 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6347 /// sufficient, a read-write scope will do as well.
6348 pub fn add_scope<St>(mut self, scope: St) -> ProjectJobSearchForAlertCall<'a, C>
6349 where
6350 St: AsRef<str>,
6351 {
6352 self._scopes.insert(String::from(scope.as_ref()));
6353 self
6354 }
6355 /// Identifies the authorization scope(s) for the method you are building.
6356 ///
6357 /// See [`Self::add_scope()`] for details.
6358 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectJobSearchForAlertCall<'a, C>
6359 where
6360 I: IntoIterator<Item = St>,
6361 St: AsRef<str>,
6362 {
6363 self._scopes
6364 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6365 self
6366 }
6367
6368 /// Removes all scopes, and no default scope will be used either.
6369 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6370 /// for details).
6371 pub fn clear_scopes(mut self) -> ProjectJobSearchForAlertCall<'a, C> {
6372 self._scopes.clear();
6373 self
6374 }
6375}
6376
6377/// Completes the specified prefix with keyword suggestions. Intended for use by a job search auto-complete search box.
6378///
6379/// A builder for the *complete* method supported by a *project* resource.
6380/// It is not used directly, but through a [`ProjectMethods`] instance.
6381///
6382/// # Example
6383///
6384/// Instantiate a resource method builder
6385///
6386/// ```test_harness,no_run
6387/// # extern crate hyper;
6388/// # extern crate hyper_rustls;
6389/// # extern crate google_jobs3 as jobs3;
6390/// # async fn dox() {
6391/// # use jobs3::{CloudTalentSolution, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6392///
6393/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6394/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6395/// # .with_native_roots()
6396/// # .unwrap()
6397/// # .https_only()
6398/// # .enable_http2()
6399/// # .build();
6400///
6401/// # let executor = hyper_util::rt::TokioExecutor::new();
6402/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6403/// # secret,
6404/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6405/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6406/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6407/// # ),
6408/// # ).build().await.unwrap();
6409///
6410/// # let client = hyper_util::client::legacy::Client::builder(
6411/// # hyper_util::rt::TokioExecutor::new()
6412/// # )
6413/// # .build(
6414/// # hyper_rustls::HttpsConnectorBuilder::new()
6415/// # .with_native_roots()
6416/// # .unwrap()
6417/// # .https_or_http()
6418/// # .enable_http2()
6419/// # .build()
6420/// # );
6421/// # let mut hub = CloudTalentSolution::new(client, auth);
6422/// // You can configure optional parameters by calling the respective setters at will, and
6423/// // execute the final call using `doit()`.
6424/// // Values shown here are possibly random and not representative !
6425/// let result = hub.projects().complete("name")
6426/// .type_("gubergren")
6427/// .scope("rebum.")
6428/// .query("est")
6429/// .page_size(-50)
6430/// .add_language_codes("ipsum")
6431/// .language_code("est")
6432/// .company_name("gubergren")
6433/// .doit().await;
6434/// # }
6435/// ```
6436pub struct ProjectCompleteCall<'a, C>
6437where
6438 C: 'a,
6439{
6440 hub: &'a CloudTalentSolution<C>,
6441 _name: String,
6442 _type_: Option<String>,
6443 _scope: Option<String>,
6444 _query: Option<String>,
6445 _page_size: Option<i32>,
6446 _language_codes: Vec<String>,
6447 _language_code: Option<String>,
6448 _company_name: Option<String>,
6449 _delegate: Option<&'a mut dyn common::Delegate>,
6450 _additional_params: HashMap<String, String>,
6451 _scopes: BTreeSet<String>,
6452}
6453
6454impl<'a, C> common::CallBuilder for ProjectCompleteCall<'a, C> {}
6455
6456impl<'a, C> ProjectCompleteCall<'a, C>
6457where
6458 C: common::Connector,
6459{
6460 /// Perform the operation you have build so far.
6461 pub async fn doit(mut self) -> common::Result<(common::Response, CompleteQueryResponse)> {
6462 use std::borrow::Cow;
6463 use std::io::{Read, Seek};
6464
6465 use common::{url::Params, ToParts};
6466 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6467
6468 let mut dd = common::DefaultDelegate;
6469 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6470 dlg.begin(common::MethodInfo {
6471 id: "jobs.projects.complete",
6472 http_method: hyper::Method::GET,
6473 });
6474
6475 for &field in [
6476 "alt",
6477 "name",
6478 "type",
6479 "scope",
6480 "query",
6481 "pageSize",
6482 "languageCodes",
6483 "languageCode",
6484 "companyName",
6485 ]
6486 .iter()
6487 {
6488 if self._additional_params.contains_key(field) {
6489 dlg.finished(false);
6490 return Err(common::Error::FieldClash(field));
6491 }
6492 }
6493
6494 let mut params = Params::with_capacity(10 + self._additional_params.len());
6495 params.push("name", self._name);
6496 if let Some(value) = self._type_.as_ref() {
6497 params.push("type", value);
6498 }
6499 if let Some(value) = self._scope.as_ref() {
6500 params.push("scope", value);
6501 }
6502 if let Some(value) = self._query.as_ref() {
6503 params.push("query", value);
6504 }
6505 if let Some(value) = self._page_size.as_ref() {
6506 params.push("pageSize", value.to_string());
6507 }
6508 if !self._language_codes.is_empty() {
6509 for f in self._language_codes.iter() {
6510 params.push("languageCodes", f);
6511 }
6512 }
6513 if let Some(value) = self._language_code.as_ref() {
6514 params.push("languageCode", value);
6515 }
6516 if let Some(value) = self._company_name.as_ref() {
6517 params.push("companyName", value);
6518 }
6519
6520 params.extend(self._additional_params.iter());
6521
6522 params.push("alt", "json");
6523 let mut url = self.hub._base_url.clone() + "v3/{+name}:complete";
6524 if self._scopes.is_empty() {
6525 self._scopes
6526 .insert(Scope::CloudPlatform.as_ref().to_string());
6527 }
6528
6529 #[allow(clippy::single_element_loop)]
6530 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6531 url = params.uri_replacement(url, param_name, find_this, true);
6532 }
6533 {
6534 let to_remove = ["name"];
6535 params.remove_params(&to_remove);
6536 }
6537
6538 let url = params.parse_with_url(&url);
6539
6540 loop {
6541 let token = match self
6542 .hub
6543 .auth
6544 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6545 .await
6546 {
6547 Ok(token) => token,
6548 Err(e) => match dlg.token(e) {
6549 Ok(token) => token,
6550 Err(e) => {
6551 dlg.finished(false);
6552 return Err(common::Error::MissingToken(e));
6553 }
6554 },
6555 };
6556 let mut req_result = {
6557 let client = &self.hub.client;
6558 dlg.pre_request();
6559 let mut req_builder = hyper::Request::builder()
6560 .method(hyper::Method::GET)
6561 .uri(url.as_str())
6562 .header(USER_AGENT, self.hub._user_agent.clone());
6563
6564 if let Some(token) = token.as_ref() {
6565 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6566 }
6567
6568 let request = req_builder
6569 .header(CONTENT_LENGTH, 0_u64)
6570 .body(common::to_body::<String>(None));
6571
6572 client.request(request.unwrap()).await
6573 };
6574
6575 match req_result {
6576 Err(err) => {
6577 if let common::Retry::After(d) = dlg.http_error(&err) {
6578 sleep(d).await;
6579 continue;
6580 }
6581 dlg.finished(false);
6582 return Err(common::Error::HttpError(err));
6583 }
6584 Ok(res) => {
6585 let (mut parts, body) = res.into_parts();
6586 let mut body = common::Body::new(body);
6587 if !parts.status.is_success() {
6588 let bytes = common::to_bytes(body).await.unwrap_or_default();
6589 let error = serde_json::from_str(&common::to_string(&bytes));
6590 let response = common::to_response(parts, bytes.into());
6591
6592 if let common::Retry::After(d) =
6593 dlg.http_failure(&response, error.as_ref().ok())
6594 {
6595 sleep(d).await;
6596 continue;
6597 }
6598
6599 dlg.finished(false);
6600
6601 return Err(match error {
6602 Ok(value) => common::Error::BadRequest(value),
6603 _ => common::Error::Failure(response),
6604 });
6605 }
6606 let response = {
6607 let bytes = common::to_bytes(body).await.unwrap_or_default();
6608 let encoded = common::to_string(&bytes);
6609 match serde_json::from_str(&encoded) {
6610 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6611 Err(error) => {
6612 dlg.response_json_decode_error(&encoded, &error);
6613 return Err(common::Error::JsonDecodeError(
6614 encoded.to_string(),
6615 error,
6616 ));
6617 }
6618 }
6619 };
6620
6621 dlg.finished(true);
6622 return Ok(response);
6623 }
6624 }
6625 }
6626 }
6627
6628 /// Required. Resource name of project the completion is performed within. The format is "projects/{project_id}", for example, "projects/api-test-project".
6629 ///
6630 /// Sets the *name* path property to the given value.
6631 ///
6632 /// Even though the property as already been set when instantiating this call,
6633 /// we provide this method for API completeness.
6634 pub fn name(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6635 self._name = new_value.to_string();
6636 self
6637 }
6638 /// Optional. The completion topic. The default is CompletionType.COMBINED.
6639 ///
6640 /// Sets the *type* query property to the given value.
6641 pub fn type_(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6642 self._type_ = Some(new_value.to_string());
6643 self
6644 }
6645 /// Optional. The scope of the completion. The defaults is CompletionScope.PUBLIC.
6646 ///
6647 /// Sets the *scope* query property to the given value.
6648 pub fn scope(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6649 self._scope = Some(new_value.to_string());
6650 self
6651 }
6652 /// Required. The query used to generate suggestions. The maximum number of allowed characters is 255.
6653 ///
6654 /// Sets the *query* query property to the given value.
6655 pub fn query(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6656 self._query = Some(new_value.to_string());
6657 self
6658 }
6659 /// Required. Completion result count. The maximum allowed page size is 10.
6660 ///
6661 /// Sets the *page size* query property to the given value.
6662 pub fn page_size(mut self, new_value: i32) -> ProjectCompleteCall<'a, C> {
6663 self._page_size = Some(new_value);
6664 self
6665 }
6666 /// Optional. 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). For CompletionType.JOB_TITLE type, only open jobs with the same language_codes are returned. For CompletionType.COMPANY_NAME type, only companies having open jobs with the same language_codes are returned. For CompletionType.COMBINED type, only open jobs with the same language_codes or companies having open jobs with the same language_codes are returned. The maximum number of allowed characters is 255.
6667 ///
6668 /// Append the given value to the *language codes* query property.
6669 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6670 pub fn add_language_codes(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6671 self._language_codes.push(new_value.to_string());
6672 self
6673 }
6674 /// Deprecated. Use language_codes instead. Optional. The language 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). For CompletionType.JOB_TITLE type, only open jobs with the same language_code are returned. For CompletionType.COMPANY_NAME type, only companies having open jobs with the same language_code are returned. For CompletionType.COMBINED type, only open jobs with the same language_code or companies having open jobs with the same language_code are returned. The maximum number of allowed characters is 255.
6675 ///
6676 /// Sets the *language code* query property to the given value.
6677 pub fn language_code(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6678 self._language_code = Some(new_value.to_string());
6679 self
6680 }
6681 /// Optional. If provided, restricts completion to specified company. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".
6682 ///
6683 /// Sets the *company name* query property to the given value.
6684 pub fn company_name(mut self, new_value: &str) -> ProjectCompleteCall<'a, C> {
6685 self._company_name = Some(new_value.to_string());
6686 self
6687 }
6688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6689 /// while executing the actual API request.
6690 ///
6691 /// ````text
6692 /// It should be used to handle progress information, and to implement a certain level of resilience.
6693 /// ````
6694 ///
6695 /// Sets the *delegate* property to the given value.
6696 pub fn delegate(
6697 mut self,
6698 new_value: &'a mut dyn common::Delegate,
6699 ) -> ProjectCompleteCall<'a, C> {
6700 self._delegate = Some(new_value);
6701 self
6702 }
6703
6704 /// Set any additional parameter of the query string used in the request.
6705 /// It should be used to set parameters which are not yet available through their own
6706 /// setters.
6707 ///
6708 /// Please note that this method must not be used to set any of the known parameters
6709 /// which have their own setter method. If done anyway, the request will fail.
6710 ///
6711 /// # Additional Parameters
6712 ///
6713 /// * *$.xgafv* (query-string) - V1 error format.
6714 /// * *access_token* (query-string) - OAuth access token.
6715 /// * *alt* (query-string) - Data format for response.
6716 /// * *callback* (query-string) - JSONP
6717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6718 /// * *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.
6719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6721 /// * *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.
6722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6724 pub fn param<T>(mut self, name: T, value: T) -> ProjectCompleteCall<'a, C>
6725 where
6726 T: AsRef<str>,
6727 {
6728 self._additional_params
6729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6730 self
6731 }
6732
6733 /// Identifies the authorization scope for the method you are building.
6734 ///
6735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6736 /// [`Scope::CloudPlatform`].
6737 ///
6738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6739 /// tokens for more than one scope.
6740 ///
6741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6743 /// sufficient, a read-write scope will do as well.
6744 pub fn add_scope<St>(mut self, scope: St) -> ProjectCompleteCall<'a, C>
6745 where
6746 St: AsRef<str>,
6747 {
6748 self._scopes.insert(String::from(scope.as_ref()));
6749 self
6750 }
6751 /// Identifies the authorization scope(s) for the method you are building.
6752 ///
6753 /// See [`Self::add_scope()`] for details.
6754 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCompleteCall<'a, C>
6755 where
6756 I: IntoIterator<Item = St>,
6757 St: AsRef<str>,
6758 {
6759 self._scopes
6760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6761 self
6762 }
6763
6764 /// Removes all scopes, and no default scope will be used either.
6765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6766 /// for details).
6767 pub fn clear_scopes(mut self) -> ProjectCompleteCall<'a, C> {
6768 self._scopes.clear();
6769 self
6770 }
6771}