google_cloud_webrisk_v1/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod web_risk_service {
18 use crate::Result;
19
20 /// A builder for [WebRiskService][crate::client::WebRiskService].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_webrisk_v1::*;
25 /// # use builder::web_risk_service::ClientBuilder;
26 /// # use client::WebRiskService;
27 /// let builder : ClientBuilder = WebRiskService::builder();
28 /// let client = builder
29 /// .with_endpoint("https://webrisk.googleapis.com")
30 /// .build().await?;
31 /// # gax::client_builder::Result::<()>::Ok(()) });
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::WebRiskService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = WebRiskService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::WebRiskService] request builders.
52 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [WebRiskService::compute_threat_list_diff][crate::client::WebRiskService::compute_threat_list_diff] calls.
75 ///
76 /// # Example
77 /// ```no_run
78 /// # use google_cloud_webrisk_v1::builder;
79 /// use builder::web_risk_service::ComputeThreatListDiff;
80 /// # tokio_test::block_on(async {
81 ///
82 /// let builder = prepare_request_builder();
83 /// let response = builder.send().await?;
84 /// # gax::Result::<()>::Ok(()) });
85 ///
86 /// fn prepare_request_builder() -> ComputeThreatListDiff {
87 /// # panic!();
88 /// // ... details omitted ...
89 /// }
90 /// ```
91 #[derive(Clone, Debug)]
92 pub struct ComputeThreatListDiff(RequestBuilder<crate::model::ComputeThreatListDiffRequest>);
93
94 impl ComputeThreatListDiff {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 /// Sets the full request, replacing any prior values.
102 pub fn with_request<V: Into<crate::model::ComputeThreatListDiffRequest>>(
103 mut self,
104 v: V,
105 ) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 /// Sets all the options, replacing any prior values.
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 /// Sends the request.
117 pub async fn send(self) -> Result<crate::model::ComputeThreatListDiffResponse> {
118 (*self.0.stub)
119 .compute_threat_list_diff(self.0.request, self.0.options)
120 .await
121 .map(gax::response::Response::into_body)
122 }
123
124 /// Sets the value of [threat_type][crate::model::ComputeThreatListDiffRequest::threat_type].
125 ///
126 /// This is a **required** field for requests.
127 pub fn set_threat_type<T: Into<crate::model::ThreatType>>(mut self, v: T) -> Self {
128 self.0.request.threat_type = v.into();
129 self
130 }
131
132 /// Sets the value of [version_token][crate::model::ComputeThreatListDiffRequest::version_token].
133 pub fn set_version_token<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
134 self.0.request.version_token = v.into();
135 self
136 }
137
138 /// Sets the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
139 ///
140 /// This is a **required** field for requests.
141 pub fn set_constraints<T>(mut self, v: T) -> Self
142 where
143 T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
144 {
145 self.0.request.constraints = std::option::Option::Some(v.into());
146 self
147 }
148
149 /// Sets or clears the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
150 ///
151 /// This is a **required** field for requests.
152 pub fn set_or_clear_constraints<T>(mut self, v: std::option::Option<T>) -> Self
153 where
154 T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
155 {
156 self.0.request.constraints = v.map(|x| x.into());
157 self
158 }
159 }
160
161 #[doc(hidden)]
162 impl gax::options::internal::RequestBuilder for ComputeThreatListDiff {
163 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
164 &mut self.0.options
165 }
166 }
167
168 /// The request builder for [WebRiskService::search_uris][crate::client::WebRiskService::search_uris] calls.
169 ///
170 /// # Example
171 /// ```no_run
172 /// # use google_cloud_webrisk_v1::builder;
173 /// use builder::web_risk_service::SearchUris;
174 /// # tokio_test::block_on(async {
175 ///
176 /// let builder = prepare_request_builder();
177 /// let response = builder.send().await?;
178 /// # gax::Result::<()>::Ok(()) });
179 ///
180 /// fn prepare_request_builder() -> SearchUris {
181 /// # panic!();
182 /// // ... details omitted ...
183 /// }
184 /// ```
185 #[derive(Clone, Debug)]
186 pub struct SearchUris(RequestBuilder<crate::model::SearchUrisRequest>);
187
188 impl SearchUris {
189 pub(crate) fn new(
190 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
191 ) -> Self {
192 Self(RequestBuilder::new(stub))
193 }
194
195 /// Sets the full request, replacing any prior values.
196 pub fn with_request<V: Into<crate::model::SearchUrisRequest>>(mut self, v: V) -> Self {
197 self.0.request = v.into();
198 self
199 }
200
201 /// Sets all the options, replacing any prior values.
202 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
203 self.0.options = v.into();
204 self
205 }
206
207 /// Sends the request.
208 pub async fn send(self) -> Result<crate::model::SearchUrisResponse> {
209 (*self.0.stub)
210 .search_uris(self.0.request, self.0.options)
211 .await
212 .map(gax::response::Response::into_body)
213 }
214
215 /// Sets the value of [uri][crate::model::SearchUrisRequest::uri].
216 ///
217 /// This is a **required** field for requests.
218 pub fn set_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
219 self.0.request.uri = v.into();
220 self
221 }
222
223 /// Sets the value of [threat_types][crate::model::SearchUrisRequest::threat_types].
224 ///
225 /// This is a **required** field for requests.
226 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
227 where
228 T: std::iter::IntoIterator<Item = V>,
229 V: std::convert::Into<crate::model::ThreatType>,
230 {
231 use std::iter::Iterator;
232 self.0.request.threat_types = v.into_iter().map(|i| i.into()).collect();
233 self
234 }
235 }
236
237 #[doc(hidden)]
238 impl gax::options::internal::RequestBuilder for SearchUris {
239 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
240 &mut self.0.options
241 }
242 }
243
244 /// The request builder for [WebRiskService::search_hashes][crate::client::WebRiskService::search_hashes] calls.
245 ///
246 /// # Example
247 /// ```no_run
248 /// # use google_cloud_webrisk_v1::builder;
249 /// use builder::web_risk_service::SearchHashes;
250 /// # tokio_test::block_on(async {
251 ///
252 /// let builder = prepare_request_builder();
253 /// let response = builder.send().await?;
254 /// # gax::Result::<()>::Ok(()) });
255 ///
256 /// fn prepare_request_builder() -> SearchHashes {
257 /// # panic!();
258 /// // ... details omitted ...
259 /// }
260 /// ```
261 #[derive(Clone, Debug)]
262 pub struct SearchHashes(RequestBuilder<crate::model::SearchHashesRequest>);
263
264 impl SearchHashes {
265 pub(crate) fn new(
266 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
267 ) -> Self {
268 Self(RequestBuilder::new(stub))
269 }
270
271 /// Sets the full request, replacing any prior values.
272 pub fn with_request<V: Into<crate::model::SearchHashesRequest>>(mut self, v: V) -> Self {
273 self.0.request = v.into();
274 self
275 }
276
277 /// Sets all the options, replacing any prior values.
278 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
279 self.0.options = v.into();
280 self
281 }
282
283 /// Sends the request.
284 pub async fn send(self) -> Result<crate::model::SearchHashesResponse> {
285 (*self.0.stub)
286 .search_hashes(self.0.request, self.0.options)
287 .await
288 .map(gax::response::Response::into_body)
289 }
290
291 /// Sets the value of [hash_prefix][crate::model::SearchHashesRequest::hash_prefix].
292 pub fn set_hash_prefix<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
293 self.0.request.hash_prefix = v.into();
294 self
295 }
296
297 /// Sets the value of [threat_types][crate::model::SearchHashesRequest::threat_types].
298 ///
299 /// This is a **required** field for requests.
300 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
301 where
302 T: std::iter::IntoIterator<Item = V>,
303 V: std::convert::Into<crate::model::ThreatType>,
304 {
305 use std::iter::Iterator;
306 self.0.request.threat_types = v.into_iter().map(|i| i.into()).collect();
307 self
308 }
309 }
310
311 #[doc(hidden)]
312 impl gax::options::internal::RequestBuilder for SearchHashes {
313 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
314 &mut self.0.options
315 }
316 }
317
318 /// The request builder for [WebRiskService::create_submission][crate::client::WebRiskService::create_submission] calls.
319 ///
320 /// # Example
321 /// ```no_run
322 /// # use google_cloud_webrisk_v1::builder;
323 /// use builder::web_risk_service::CreateSubmission;
324 /// # tokio_test::block_on(async {
325 ///
326 /// let builder = prepare_request_builder();
327 /// let response = builder.send().await?;
328 /// # gax::Result::<()>::Ok(()) });
329 ///
330 /// fn prepare_request_builder() -> CreateSubmission {
331 /// # panic!();
332 /// // ... details omitted ...
333 /// }
334 /// ```
335 #[derive(Clone, Debug)]
336 pub struct CreateSubmission(RequestBuilder<crate::model::CreateSubmissionRequest>);
337
338 impl CreateSubmission {
339 pub(crate) fn new(
340 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
341 ) -> Self {
342 Self(RequestBuilder::new(stub))
343 }
344
345 /// Sets the full request, replacing any prior values.
346 pub fn with_request<V: Into<crate::model::CreateSubmissionRequest>>(
347 mut self,
348 v: V,
349 ) -> Self {
350 self.0.request = v.into();
351 self
352 }
353
354 /// Sets all the options, replacing any prior values.
355 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
356 self.0.options = v.into();
357 self
358 }
359
360 /// Sends the request.
361 pub async fn send(self) -> Result<crate::model::Submission> {
362 (*self.0.stub)
363 .create_submission(self.0.request, self.0.options)
364 .await
365 .map(gax::response::Response::into_body)
366 }
367
368 /// Sets the value of [parent][crate::model::CreateSubmissionRequest::parent].
369 ///
370 /// This is a **required** field for requests.
371 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
372 self.0.request.parent = v.into();
373 self
374 }
375
376 /// Sets the value of [submission][crate::model::CreateSubmissionRequest::submission].
377 ///
378 /// This is a **required** field for requests.
379 pub fn set_submission<T>(mut self, v: T) -> Self
380 where
381 T: std::convert::Into<crate::model::Submission>,
382 {
383 self.0.request.submission = std::option::Option::Some(v.into());
384 self
385 }
386
387 /// Sets or clears the value of [submission][crate::model::CreateSubmissionRequest::submission].
388 ///
389 /// This is a **required** field for requests.
390 pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
391 where
392 T: std::convert::Into<crate::model::Submission>,
393 {
394 self.0.request.submission = v.map(|x| x.into());
395 self
396 }
397 }
398
399 #[doc(hidden)]
400 impl gax::options::internal::RequestBuilder for CreateSubmission {
401 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
402 &mut self.0.options
403 }
404 }
405
406 /// The request builder for [WebRiskService::submit_uri][crate::client::WebRiskService::submit_uri] calls.
407 ///
408 /// # Example
409 /// ```no_run
410 /// # use google_cloud_webrisk_v1::builder;
411 /// use builder::web_risk_service::SubmitUri;
412 /// # tokio_test::block_on(async {
413 /// use lro::Poller;
414 ///
415 /// let builder = prepare_request_builder();
416 /// let response = builder.poller().until_done().await?;
417 /// # gax::Result::<()>::Ok(()) });
418 ///
419 /// fn prepare_request_builder() -> SubmitUri {
420 /// # panic!();
421 /// // ... details omitted ...
422 /// }
423 /// ```
424 #[derive(Clone, Debug)]
425 pub struct SubmitUri(RequestBuilder<crate::model::SubmitUriRequest>);
426
427 impl SubmitUri {
428 pub(crate) fn new(
429 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
430 ) -> Self {
431 Self(RequestBuilder::new(stub))
432 }
433
434 /// Sets the full request, replacing any prior values.
435 pub fn with_request<V: Into<crate::model::SubmitUriRequest>>(mut self, v: V) -> Self {
436 self.0.request = v.into();
437 self
438 }
439
440 /// Sets all the options, replacing any prior values.
441 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
442 self.0.options = v.into();
443 self
444 }
445
446 /// Sends the request.
447 ///
448 /// # Long running operations
449 ///
450 /// This starts, but does not poll, a longrunning operation. More information
451 /// on [submit_uri][crate::client::WebRiskService::submit_uri].
452 pub async fn send(self) -> Result<longrunning::model::Operation> {
453 (*self.0.stub)
454 .submit_uri(self.0.request, self.0.options)
455 .await
456 .map(gax::response::Response::into_body)
457 }
458
459 /// Creates a [Poller][lro::Poller] to work with `submit_uri`.
460 pub fn poller(
461 self,
462 ) -> impl lro::Poller<crate::model::Submission, crate::model::SubmitUriMetadata> {
463 type Operation =
464 lro::internal::Operation<crate::model::Submission, crate::model::SubmitUriMetadata>;
465 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
466 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
467
468 let stub = self.0.stub.clone();
469 let mut options = self.0.options.clone();
470 options.set_retry_policy(gax::retry_policy::NeverRetry);
471 let query = move |name| {
472 let stub = stub.clone();
473 let options = options.clone();
474 async {
475 let op = GetOperation::new(stub)
476 .set_name(name)
477 .with_options(options)
478 .send()
479 .await?;
480 Ok(Operation::new(op))
481 }
482 };
483
484 let start = move || async {
485 let op = self.send().await?;
486 Ok(Operation::new(op))
487 };
488
489 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
490 }
491
492 /// Sets the value of [parent][crate::model::SubmitUriRequest::parent].
493 ///
494 /// This is a **required** field for requests.
495 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
496 self.0.request.parent = v.into();
497 self
498 }
499
500 /// Sets the value of [submission][crate::model::SubmitUriRequest::submission].
501 ///
502 /// This is a **required** field for requests.
503 pub fn set_submission<T>(mut self, v: T) -> Self
504 where
505 T: std::convert::Into<crate::model::Submission>,
506 {
507 self.0.request.submission = std::option::Option::Some(v.into());
508 self
509 }
510
511 /// Sets or clears the value of [submission][crate::model::SubmitUriRequest::submission].
512 ///
513 /// This is a **required** field for requests.
514 pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
515 where
516 T: std::convert::Into<crate::model::Submission>,
517 {
518 self.0.request.submission = v.map(|x| x.into());
519 self
520 }
521
522 /// Sets the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
523 pub fn set_threat_info<T>(mut self, v: T) -> Self
524 where
525 T: std::convert::Into<crate::model::ThreatInfo>,
526 {
527 self.0.request.threat_info = std::option::Option::Some(v.into());
528 self
529 }
530
531 /// Sets or clears the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
532 pub fn set_or_clear_threat_info<T>(mut self, v: std::option::Option<T>) -> Self
533 where
534 T: std::convert::Into<crate::model::ThreatInfo>,
535 {
536 self.0.request.threat_info = v.map(|x| x.into());
537 self
538 }
539
540 /// Sets the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
541 pub fn set_threat_discovery<T>(mut self, v: T) -> Self
542 where
543 T: std::convert::Into<crate::model::ThreatDiscovery>,
544 {
545 self.0.request.threat_discovery = std::option::Option::Some(v.into());
546 self
547 }
548
549 /// Sets or clears the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
550 pub fn set_or_clear_threat_discovery<T>(mut self, v: std::option::Option<T>) -> Self
551 where
552 T: std::convert::Into<crate::model::ThreatDiscovery>,
553 {
554 self.0.request.threat_discovery = v.map(|x| x.into());
555 self
556 }
557 }
558
559 #[doc(hidden)]
560 impl gax::options::internal::RequestBuilder for SubmitUri {
561 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
562 &mut self.0.options
563 }
564 }
565
566 /// The request builder for [WebRiskService::list_operations][crate::client::WebRiskService::list_operations] calls.
567 ///
568 /// # Example
569 /// ```no_run
570 /// # use google_cloud_webrisk_v1::builder;
571 /// use builder::web_risk_service::ListOperations;
572 /// # tokio_test::block_on(async {
573 /// use gax::paginator::ItemPaginator;
574 ///
575 /// let builder = prepare_request_builder();
576 /// let mut items = builder.by_item();
577 /// while let Some(result) = items.next().await {
578 /// let item = result?;
579 /// }
580 /// # gax::Result::<()>::Ok(()) });
581 ///
582 /// fn prepare_request_builder() -> ListOperations {
583 /// # panic!();
584 /// // ... details omitted ...
585 /// }
586 /// ```
587 #[derive(Clone, Debug)]
588 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
589
590 impl ListOperations {
591 pub(crate) fn new(
592 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
593 ) -> Self {
594 Self(RequestBuilder::new(stub))
595 }
596
597 /// Sets the full request, replacing any prior values.
598 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
599 mut self,
600 v: V,
601 ) -> Self {
602 self.0.request = v.into();
603 self
604 }
605
606 /// Sets all the options, replacing any prior values.
607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
608 self.0.options = v.into();
609 self
610 }
611
612 /// Sends the request.
613 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
614 (*self.0.stub)
615 .list_operations(self.0.request, self.0.options)
616 .await
617 .map(gax::response::Response::into_body)
618 }
619
620 /// Streams each page in the collection.
621 pub fn by_page(
622 self,
623 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
624 {
625 use std::clone::Clone;
626 let token = self.0.request.page_token.clone();
627 let execute = move |token: String| {
628 let mut builder = self.clone();
629 builder.0.request = builder.0.request.set_page_token(token);
630 builder.send()
631 };
632 gax::paginator::internal::new_paginator(token, execute)
633 }
634
635 /// Streams each item in the collection.
636 pub fn by_item(
637 self,
638 ) -> impl gax::paginator::ItemPaginator<
639 longrunning::model::ListOperationsResponse,
640 gax::error::Error,
641 > {
642 use gax::paginator::Paginator;
643 self.by_page().items()
644 }
645
646 /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
648 self.0.request.name = v.into();
649 self
650 }
651
652 /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
653 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
654 self.0.request.filter = v.into();
655 self
656 }
657
658 /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
659 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
660 self.0.request.page_size = v.into();
661 self
662 }
663
664 /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
665 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
666 self.0.request.page_token = v.into();
667 self
668 }
669
670 /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
671 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
672 self.0.request.return_partial_success = v.into();
673 self
674 }
675 }
676
677 #[doc(hidden)]
678 impl gax::options::internal::RequestBuilder for ListOperations {
679 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
680 &mut self.0.options
681 }
682 }
683
684 /// The request builder for [WebRiskService::get_operation][crate::client::WebRiskService::get_operation] calls.
685 ///
686 /// # Example
687 /// ```no_run
688 /// # use google_cloud_webrisk_v1::builder;
689 /// use builder::web_risk_service::GetOperation;
690 /// # tokio_test::block_on(async {
691 ///
692 /// let builder = prepare_request_builder();
693 /// let response = builder.send().await?;
694 /// # gax::Result::<()>::Ok(()) });
695 ///
696 /// fn prepare_request_builder() -> GetOperation {
697 /// # panic!();
698 /// // ... details omitted ...
699 /// }
700 /// ```
701 #[derive(Clone, Debug)]
702 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
703
704 impl GetOperation {
705 pub(crate) fn new(
706 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
707 ) -> Self {
708 Self(RequestBuilder::new(stub))
709 }
710
711 /// Sets the full request, replacing any prior values.
712 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
713 mut self,
714 v: V,
715 ) -> Self {
716 self.0.request = v.into();
717 self
718 }
719
720 /// Sets all the options, replacing any prior values.
721 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
722 self.0.options = v.into();
723 self
724 }
725
726 /// Sends the request.
727 pub async fn send(self) -> Result<longrunning::model::Operation> {
728 (*self.0.stub)
729 .get_operation(self.0.request, self.0.options)
730 .await
731 .map(gax::response::Response::into_body)
732 }
733
734 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
735 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
736 self.0.request.name = v.into();
737 self
738 }
739 }
740
741 #[doc(hidden)]
742 impl gax::options::internal::RequestBuilder for GetOperation {
743 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
744 &mut self.0.options
745 }
746 }
747
748 /// The request builder for [WebRiskService::delete_operation][crate::client::WebRiskService::delete_operation] calls.
749 ///
750 /// # Example
751 /// ```no_run
752 /// # use google_cloud_webrisk_v1::builder;
753 /// use builder::web_risk_service::DeleteOperation;
754 /// # tokio_test::block_on(async {
755 ///
756 /// let builder = prepare_request_builder();
757 /// let response = builder.send().await?;
758 /// # gax::Result::<()>::Ok(()) });
759 ///
760 /// fn prepare_request_builder() -> DeleteOperation {
761 /// # panic!();
762 /// // ... details omitted ...
763 /// }
764 /// ```
765 #[derive(Clone, Debug)]
766 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
767
768 impl DeleteOperation {
769 pub(crate) fn new(
770 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
771 ) -> Self {
772 Self(RequestBuilder::new(stub))
773 }
774
775 /// Sets the full request, replacing any prior values.
776 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
777 mut self,
778 v: V,
779 ) -> Self {
780 self.0.request = v.into();
781 self
782 }
783
784 /// Sets all the options, replacing any prior values.
785 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
786 self.0.options = v.into();
787 self
788 }
789
790 /// Sends the request.
791 pub async fn send(self) -> Result<()> {
792 (*self.0.stub)
793 .delete_operation(self.0.request, self.0.options)
794 .await
795 .map(gax::response::Response::into_body)
796 }
797
798 /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
799 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
800 self.0.request.name = v.into();
801 self
802 }
803 }
804
805 #[doc(hidden)]
806 impl gax::options::internal::RequestBuilder for DeleteOperation {
807 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
808 &mut self.0.options
809 }
810 }
811
812 /// The request builder for [WebRiskService::cancel_operation][crate::client::WebRiskService::cancel_operation] calls.
813 ///
814 /// # Example
815 /// ```no_run
816 /// # use google_cloud_webrisk_v1::builder;
817 /// use builder::web_risk_service::CancelOperation;
818 /// # tokio_test::block_on(async {
819 ///
820 /// let builder = prepare_request_builder();
821 /// let response = builder.send().await?;
822 /// # gax::Result::<()>::Ok(()) });
823 ///
824 /// fn prepare_request_builder() -> CancelOperation {
825 /// # panic!();
826 /// // ... details omitted ...
827 /// }
828 /// ```
829 #[derive(Clone, Debug)]
830 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
831
832 impl CancelOperation {
833 pub(crate) fn new(
834 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebRiskService>,
835 ) -> Self {
836 Self(RequestBuilder::new(stub))
837 }
838
839 /// Sets the full request, replacing any prior values.
840 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
841 mut self,
842 v: V,
843 ) -> Self {
844 self.0.request = v.into();
845 self
846 }
847
848 /// Sets all the options, replacing any prior values.
849 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
850 self.0.options = v.into();
851 self
852 }
853
854 /// Sends the request.
855 pub async fn send(self) -> Result<()> {
856 (*self.0.stub)
857 .cancel_operation(self.0.request, self.0.options)
858 .await
859 .map(gax::response::Response::into_body)
860 }
861
862 /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
863 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
864 self.0.request.name = v.into();
865 self
866 }
867 }
868
869 #[doc(hidden)]
870 impl gax::options::internal::RequestBuilder for CancelOperation {
871 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
872 &mut self.0.options
873 }
874 }
875}