google_cloud_support_v2/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
17/// Request and client builders for [CaseAttachmentService][crate::client::CaseAttachmentService].
18pub mod case_attachment_service {
19 use crate::Result;
20
21 /// A builder for [CaseAttachmentService][crate::client::CaseAttachmentService].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_support_v2::*;
26 /// # use builder::case_attachment_service::ClientBuilder;
27 /// # use client::CaseAttachmentService;
28 /// let builder : ClientBuilder = CaseAttachmentService::builder();
29 /// let client = builder
30 /// .with_endpoint("https://cloudsupport.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::CaseAttachmentService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = CaseAttachmentService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::CaseAttachmentService] 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::CaseAttachmentService>,
55 request: R,
56 options: crate::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::CaseAttachmentService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [CaseAttachmentService::list_attachments][crate::client::CaseAttachmentService::list_attachments] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_support_v2::builder::case_attachment_service::ListAttachments;
79 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
80 /// use google_cloud_gax::paginator::ItemPaginator;
81 ///
82 /// let builder = prepare_request_builder();
83 /// let mut items = builder.by_item();
84 /// while let Some(result) = items.next().await {
85 /// let item = result?;
86 /// }
87 /// # Ok(()) }
88 ///
89 /// fn prepare_request_builder() -> ListAttachments {
90 /// # panic!();
91 /// // ... details omitted ...
92 /// }
93 /// ```
94 #[derive(Clone, Debug)]
95 pub struct ListAttachments(RequestBuilder<crate::model::ListAttachmentsRequest>);
96
97 impl ListAttachments {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseAttachmentService>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 /// Sets the full request, replacing any prior values.
105 pub fn with_request<V: Into<crate::model::ListAttachmentsRequest>>(mut self, v: V) -> 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<crate::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::ListAttachmentsResponse> {
118 (*self.0.stub)
119 .list_attachments(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 /// Streams each page in the collection.
125 pub fn by_page(
126 self,
127 ) -> impl google_cloud_gax::paginator::Paginator<
128 crate::model::ListAttachmentsResponse,
129 crate::Error,
130 > {
131 use std::clone::Clone;
132 let token = self.0.request.page_token.clone();
133 let execute = move |token: String| {
134 let mut builder = self.clone();
135 builder.0.request = builder.0.request.set_page_token(token);
136 builder.send()
137 };
138 google_cloud_gax::paginator::internal::new_paginator(token, execute)
139 }
140
141 /// Streams each item in the collection.
142 pub fn by_item(
143 self,
144 ) -> impl google_cloud_gax::paginator::ItemPaginator<
145 crate::model::ListAttachmentsResponse,
146 crate::Error,
147 > {
148 use google_cloud_gax::paginator::Paginator;
149 self.by_page().items()
150 }
151
152 /// Sets the value of [parent][crate::model::ListAttachmentsRequest::parent].
153 ///
154 /// This is a **required** field for requests.
155 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
156 self.0.request.parent = v.into();
157 self
158 }
159
160 /// Sets the value of [page_size][crate::model::ListAttachmentsRequest::page_size].
161 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
162 self.0.request.page_size = v.into();
163 self
164 }
165
166 /// Sets the value of [page_token][crate::model::ListAttachmentsRequest::page_token].
167 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
168 self.0.request.page_token = v.into();
169 self
170 }
171 }
172
173 #[doc(hidden)]
174 impl crate::RequestBuilder for ListAttachments {
175 fn request_options(&mut self) -> &mut crate::RequestOptions {
176 &mut self.0.options
177 }
178 }
179}
180
181/// Request and client builders for [CaseService][crate::client::CaseService].
182pub mod case_service {
183 use crate::Result;
184
185 /// A builder for [CaseService][crate::client::CaseService].
186 ///
187 /// ```
188 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
189 /// # use google_cloud_support_v2::*;
190 /// # use builder::case_service::ClientBuilder;
191 /// # use client::CaseService;
192 /// let builder : ClientBuilder = CaseService::builder();
193 /// let client = builder
194 /// .with_endpoint("https://cloudsupport.googleapis.com")
195 /// .build().await?;
196 /// # Ok(()) }
197 /// ```
198 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
199
200 pub(crate) mod client {
201 use super::super::super::client::CaseService;
202 pub struct Factory;
203 impl crate::ClientFactory for Factory {
204 type Client = CaseService;
205 type Credentials = gaxi::options::Credentials;
206 async fn build(
207 self,
208 config: gaxi::options::ClientConfig,
209 ) -> crate::ClientBuilderResult<Self::Client> {
210 Self::Client::new(config).await
211 }
212 }
213 }
214
215 /// Common implementation for [crate::client::CaseService] request builders.
216 #[derive(Clone, Debug)]
217 pub(crate) struct RequestBuilder<R: std::default::Default> {
218 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
219 request: R,
220 options: crate::RequestOptions,
221 }
222
223 impl<R> RequestBuilder<R>
224 where
225 R: std::default::Default,
226 {
227 pub(crate) fn new(
228 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
229 ) -> Self {
230 Self {
231 stub,
232 request: R::default(),
233 options: crate::RequestOptions::default(),
234 }
235 }
236 }
237
238 /// The request builder for [CaseService::get_case][crate::client::CaseService::get_case] calls.
239 ///
240 /// # Example
241 /// ```
242 /// # use google_cloud_support_v2::builder::case_service::GetCase;
243 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
244 ///
245 /// let builder = prepare_request_builder();
246 /// let response = builder.send().await?;
247 /// # Ok(()) }
248 ///
249 /// fn prepare_request_builder() -> GetCase {
250 /// # panic!();
251 /// // ... details omitted ...
252 /// }
253 /// ```
254 #[derive(Clone, Debug)]
255 pub struct GetCase(RequestBuilder<crate::model::GetCaseRequest>);
256
257 impl GetCase {
258 pub(crate) fn new(
259 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
260 ) -> Self {
261 Self(RequestBuilder::new(stub))
262 }
263
264 /// Sets the full request, replacing any prior values.
265 pub fn with_request<V: Into<crate::model::GetCaseRequest>>(mut self, v: V) -> Self {
266 self.0.request = v.into();
267 self
268 }
269
270 /// Sets all the options, replacing any prior values.
271 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
272 self.0.options = v.into();
273 self
274 }
275
276 /// Sends the request.
277 pub async fn send(self) -> Result<crate::model::Case> {
278 (*self.0.stub)
279 .get_case(self.0.request, self.0.options)
280 .await
281 .map(crate::Response::into_body)
282 }
283
284 /// Sets the value of [name][crate::model::GetCaseRequest::name].
285 ///
286 /// This is a **required** field for requests.
287 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
288 self.0.request.name = v.into();
289 self
290 }
291 }
292
293 #[doc(hidden)]
294 impl crate::RequestBuilder for GetCase {
295 fn request_options(&mut self) -> &mut crate::RequestOptions {
296 &mut self.0.options
297 }
298 }
299
300 /// The request builder for [CaseService::list_cases][crate::client::CaseService::list_cases] calls.
301 ///
302 /// # Example
303 /// ```
304 /// # use google_cloud_support_v2::builder::case_service::ListCases;
305 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
306 /// use google_cloud_gax::paginator::ItemPaginator;
307 ///
308 /// let builder = prepare_request_builder();
309 /// let mut items = builder.by_item();
310 /// while let Some(result) = items.next().await {
311 /// let item = result?;
312 /// }
313 /// # Ok(()) }
314 ///
315 /// fn prepare_request_builder() -> ListCases {
316 /// # panic!();
317 /// // ... details omitted ...
318 /// }
319 /// ```
320 #[derive(Clone, Debug)]
321 pub struct ListCases(RequestBuilder<crate::model::ListCasesRequest>);
322
323 impl ListCases {
324 pub(crate) fn new(
325 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
326 ) -> Self {
327 Self(RequestBuilder::new(stub))
328 }
329
330 /// Sets the full request, replacing any prior values.
331 pub fn with_request<V: Into<crate::model::ListCasesRequest>>(mut self, v: V) -> Self {
332 self.0.request = v.into();
333 self
334 }
335
336 /// Sets all the options, replacing any prior values.
337 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
338 self.0.options = v.into();
339 self
340 }
341
342 /// Sends the request.
343 pub async fn send(self) -> Result<crate::model::ListCasesResponse> {
344 (*self.0.stub)
345 .list_cases(self.0.request, self.0.options)
346 .await
347 .map(crate::Response::into_body)
348 }
349
350 /// Streams each page in the collection.
351 pub fn by_page(
352 self,
353 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListCasesResponse, crate::Error>
354 {
355 use std::clone::Clone;
356 let token = self.0.request.page_token.clone();
357 let execute = move |token: String| {
358 let mut builder = self.clone();
359 builder.0.request = builder.0.request.set_page_token(token);
360 builder.send()
361 };
362 google_cloud_gax::paginator::internal::new_paginator(token, execute)
363 }
364
365 /// Streams each item in the collection.
366 pub fn by_item(
367 self,
368 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListCasesResponse, crate::Error>
369 {
370 use google_cloud_gax::paginator::Paginator;
371 self.by_page().items()
372 }
373
374 /// Sets the value of [parent][crate::model::ListCasesRequest::parent].
375 ///
376 /// This is a **required** field for requests.
377 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
378 self.0.request.parent = v.into();
379 self
380 }
381
382 /// Sets the value of [filter][crate::model::ListCasesRequest::filter].
383 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
384 self.0.request.filter = v.into();
385 self
386 }
387
388 /// Sets the value of [page_size][crate::model::ListCasesRequest::page_size].
389 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
390 self.0.request.page_size = v.into();
391 self
392 }
393
394 /// Sets the value of [page_token][crate::model::ListCasesRequest::page_token].
395 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
396 self.0.request.page_token = v.into();
397 self
398 }
399 }
400
401 #[doc(hidden)]
402 impl crate::RequestBuilder for ListCases {
403 fn request_options(&mut self) -> &mut crate::RequestOptions {
404 &mut self.0.options
405 }
406 }
407
408 /// The request builder for [CaseService::search_cases][crate::client::CaseService::search_cases] calls.
409 ///
410 /// # Example
411 /// ```
412 /// # use google_cloud_support_v2::builder::case_service::SearchCases;
413 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
414 /// use google_cloud_gax::paginator::ItemPaginator;
415 ///
416 /// let builder = prepare_request_builder();
417 /// let mut items = builder.by_item();
418 /// while let Some(result) = items.next().await {
419 /// let item = result?;
420 /// }
421 /// # Ok(()) }
422 ///
423 /// fn prepare_request_builder() -> SearchCases {
424 /// # panic!();
425 /// // ... details omitted ...
426 /// }
427 /// ```
428 #[derive(Clone, Debug)]
429 pub struct SearchCases(RequestBuilder<crate::model::SearchCasesRequest>);
430
431 impl SearchCases {
432 pub(crate) fn new(
433 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
434 ) -> Self {
435 Self(RequestBuilder::new(stub))
436 }
437
438 /// Sets the full request, replacing any prior values.
439 pub fn with_request<V: Into<crate::model::SearchCasesRequest>>(mut self, v: V) -> Self {
440 self.0.request = v.into();
441 self
442 }
443
444 /// Sets all the options, replacing any prior values.
445 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
446 self.0.options = v.into();
447 self
448 }
449
450 /// Sends the request.
451 pub async fn send(self) -> Result<crate::model::SearchCasesResponse> {
452 (*self.0.stub)
453 .search_cases(self.0.request, self.0.options)
454 .await
455 .map(crate::Response::into_body)
456 }
457
458 /// Streams each page in the collection.
459 pub fn by_page(
460 self,
461 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchCasesResponse, crate::Error>
462 {
463 use std::clone::Clone;
464 let token = self.0.request.page_token.clone();
465 let execute = move |token: String| {
466 let mut builder = self.clone();
467 builder.0.request = builder.0.request.set_page_token(token);
468 builder.send()
469 };
470 google_cloud_gax::paginator::internal::new_paginator(token, execute)
471 }
472
473 /// Streams each item in the collection.
474 pub fn by_item(
475 self,
476 ) -> impl google_cloud_gax::paginator::ItemPaginator<
477 crate::model::SearchCasesResponse,
478 crate::Error,
479 > {
480 use google_cloud_gax::paginator::Paginator;
481 self.by_page().items()
482 }
483
484 /// Sets the value of [parent][crate::model::SearchCasesRequest::parent].
485 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
486 self.0.request.parent = v.into();
487 self
488 }
489
490 /// Sets the value of [query][crate::model::SearchCasesRequest::query].
491 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
492 self.0.request.query = v.into();
493 self
494 }
495
496 /// Sets the value of [page_size][crate::model::SearchCasesRequest::page_size].
497 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
498 self.0.request.page_size = v.into();
499 self
500 }
501
502 /// Sets the value of [page_token][crate::model::SearchCasesRequest::page_token].
503 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
504 self.0.request.page_token = v.into();
505 self
506 }
507 }
508
509 #[doc(hidden)]
510 impl crate::RequestBuilder for SearchCases {
511 fn request_options(&mut self) -> &mut crate::RequestOptions {
512 &mut self.0.options
513 }
514 }
515
516 /// The request builder for [CaseService::create_case][crate::client::CaseService::create_case] calls.
517 ///
518 /// # Example
519 /// ```
520 /// # use google_cloud_support_v2::builder::case_service::CreateCase;
521 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
522 ///
523 /// let builder = prepare_request_builder();
524 /// let response = builder.send().await?;
525 /// # Ok(()) }
526 ///
527 /// fn prepare_request_builder() -> CreateCase {
528 /// # panic!();
529 /// // ... details omitted ...
530 /// }
531 /// ```
532 #[derive(Clone, Debug)]
533 pub struct CreateCase(RequestBuilder<crate::model::CreateCaseRequest>);
534
535 impl CreateCase {
536 pub(crate) fn new(
537 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
538 ) -> Self {
539 Self(RequestBuilder::new(stub))
540 }
541
542 /// Sets the full request, replacing any prior values.
543 pub fn with_request<V: Into<crate::model::CreateCaseRequest>>(mut self, v: V) -> Self {
544 self.0.request = v.into();
545 self
546 }
547
548 /// Sets all the options, replacing any prior values.
549 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
550 self.0.options = v.into();
551 self
552 }
553
554 /// Sends the request.
555 pub async fn send(self) -> Result<crate::model::Case> {
556 (*self.0.stub)
557 .create_case(self.0.request, self.0.options)
558 .await
559 .map(crate::Response::into_body)
560 }
561
562 /// Sets the value of [parent][crate::model::CreateCaseRequest::parent].
563 ///
564 /// This is a **required** field for requests.
565 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
566 self.0.request.parent = v.into();
567 self
568 }
569
570 /// Sets the value of [case][crate::model::CreateCaseRequest::case].
571 ///
572 /// This is a **required** field for requests.
573 pub fn set_case<T>(mut self, v: T) -> Self
574 where
575 T: std::convert::Into<crate::model::Case>,
576 {
577 self.0.request.case = std::option::Option::Some(v.into());
578 self
579 }
580
581 /// Sets or clears the value of [case][crate::model::CreateCaseRequest::case].
582 ///
583 /// This is a **required** field for requests.
584 pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
585 where
586 T: std::convert::Into<crate::model::Case>,
587 {
588 self.0.request.case = v.map(|x| x.into());
589 self
590 }
591 }
592
593 #[doc(hidden)]
594 impl crate::RequestBuilder for CreateCase {
595 fn request_options(&mut self) -> &mut crate::RequestOptions {
596 &mut self.0.options
597 }
598 }
599
600 /// The request builder for [CaseService::update_case][crate::client::CaseService::update_case] calls.
601 ///
602 /// # Example
603 /// ```
604 /// # use google_cloud_support_v2::builder::case_service::UpdateCase;
605 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
606 ///
607 /// let builder = prepare_request_builder();
608 /// let response = builder.send().await?;
609 /// # Ok(()) }
610 ///
611 /// fn prepare_request_builder() -> UpdateCase {
612 /// # panic!();
613 /// // ... details omitted ...
614 /// }
615 /// ```
616 #[derive(Clone, Debug)]
617 pub struct UpdateCase(RequestBuilder<crate::model::UpdateCaseRequest>);
618
619 impl UpdateCase {
620 pub(crate) fn new(
621 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
622 ) -> Self {
623 Self(RequestBuilder::new(stub))
624 }
625
626 /// Sets the full request, replacing any prior values.
627 pub fn with_request<V: Into<crate::model::UpdateCaseRequest>>(mut self, v: V) -> Self {
628 self.0.request = v.into();
629 self
630 }
631
632 /// Sets all the options, replacing any prior values.
633 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
634 self.0.options = v.into();
635 self
636 }
637
638 /// Sends the request.
639 pub async fn send(self) -> Result<crate::model::Case> {
640 (*self.0.stub)
641 .update_case(self.0.request, self.0.options)
642 .await
643 .map(crate::Response::into_body)
644 }
645
646 /// Sets the value of [case][crate::model::UpdateCaseRequest::case].
647 ///
648 /// This is a **required** field for requests.
649 pub fn set_case<T>(mut self, v: T) -> Self
650 where
651 T: std::convert::Into<crate::model::Case>,
652 {
653 self.0.request.case = std::option::Option::Some(v.into());
654 self
655 }
656
657 /// Sets or clears the value of [case][crate::model::UpdateCaseRequest::case].
658 ///
659 /// This is a **required** field for requests.
660 pub fn set_or_clear_case<T>(mut self, v: std::option::Option<T>) -> Self
661 where
662 T: std::convert::Into<crate::model::Case>,
663 {
664 self.0.request.case = v.map(|x| x.into());
665 self
666 }
667
668 /// Sets the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
669 pub fn set_update_mask<T>(mut self, v: T) -> Self
670 where
671 T: std::convert::Into<wkt::FieldMask>,
672 {
673 self.0.request.update_mask = std::option::Option::Some(v.into());
674 self
675 }
676
677 /// Sets or clears the value of [update_mask][crate::model::UpdateCaseRequest::update_mask].
678 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
679 where
680 T: std::convert::Into<wkt::FieldMask>,
681 {
682 self.0.request.update_mask = v.map(|x| x.into());
683 self
684 }
685 }
686
687 #[doc(hidden)]
688 impl crate::RequestBuilder for UpdateCase {
689 fn request_options(&mut self) -> &mut crate::RequestOptions {
690 &mut self.0.options
691 }
692 }
693
694 /// The request builder for [CaseService::escalate_case][crate::client::CaseService::escalate_case] calls.
695 ///
696 /// # Example
697 /// ```
698 /// # use google_cloud_support_v2::builder::case_service::EscalateCase;
699 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
700 ///
701 /// let builder = prepare_request_builder();
702 /// let response = builder.send().await?;
703 /// # Ok(()) }
704 ///
705 /// fn prepare_request_builder() -> EscalateCase {
706 /// # panic!();
707 /// // ... details omitted ...
708 /// }
709 /// ```
710 #[derive(Clone, Debug)]
711 pub struct EscalateCase(RequestBuilder<crate::model::EscalateCaseRequest>);
712
713 impl EscalateCase {
714 pub(crate) fn new(
715 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
716 ) -> Self {
717 Self(RequestBuilder::new(stub))
718 }
719
720 /// Sets the full request, replacing any prior values.
721 pub fn with_request<V: Into<crate::model::EscalateCaseRequest>>(mut self, v: V) -> Self {
722 self.0.request = v.into();
723 self
724 }
725
726 /// Sets all the options, replacing any prior values.
727 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
728 self.0.options = v.into();
729 self
730 }
731
732 /// Sends the request.
733 pub async fn send(self) -> Result<crate::model::Case> {
734 (*self.0.stub)
735 .escalate_case(self.0.request, self.0.options)
736 .await
737 .map(crate::Response::into_body)
738 }
739
740 /// Sets the value of [name][crate::model::EscalateCaseRequest::name].
741 ///
742 /// This is a **required** field for requests.
743 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
744 self.0.request.name = v.into();
745 self
746 }
747
748 /// Sets the value of [escalation][crate::model::EscalateCaseRequest::escalation].
749 pub fn set_escalation<T>(mut self, v: T) -> Self
750 where
751 T: std::convert::Into<crate::model::Escalation>,
752 {
753 self.0.request.escalation = std::option::Option::Some(v.into());
754 self
755 }
756
757 /// Sets or clears the value of [escalation][crate::model::EscalateCaseRequest::escalation].
758 pub fn set_or_clear_escalation<T>(mut self, v: std::option::Option<T>) -> Self
759 where
760 T: std::convert::Into<crate::model::Escalation>,
761 {
762 self.0.request.escalation = v.map(|x| x.into());
763 self
764 }
765 }
766
767 #[doc(hidden)]
768 impl crate::RequestBuilder for EscalateCase {
769 fn request_options(&mut self) -> &mut crate::RequestOptions {
770 &mut self.0.options
771 }
772 }
773
774 /// The request builder for [CaseService::close_case][crate::client::CaseService::close_case] calls.
775 ///
776 /// # Example
777 /// ```
778 /// # use google_cloud_support_v2::builder::case_service::CloseCase;
779 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
780 ///
781 /// let builder = prepare_request_builder();
782 /// let response = builder.send().await?;
783 /// # Ok(()) }
784 ///
785 /// fn prepare_request_builder() -> CloseCase {
786 /// # panic!();
787 /// // ... details omitted ...
788 /// }
789 /// ```
790 #[derive(Clone, Debug)]
791 pub struct CloseCase(RequestBuilder<crate::model::CloseCaseRequest>);
792
793 impl CloseCase {
794 pub(crate) fn new(
795 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
796 ) -> Self {
797 Self(RequestBuilder::new(stub))
798 }
799
800 /// Sets the full request, replacing any prior values.
801 pub fn with_request<V: Into<crate::model::CloseCaseRequest>>(mut self, v: V) -> Self {
802 self.0.request = v.into();
803 self
804 }
805
806 /// Sets all the options, replacing any prior values.
807 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
808 self.0.options = v.into();
809 self
810 }
811
812 /// Sends the request.
813 pub async fn send(self) -> Result<crate::model::Case> {
814 (*self.0.stub)
815 .close_case(self.0.request, self.0.options)
816 .await
817 .map(crate::Response::into_body)
818 }
819
820 /// Sets the value of [name][crate::model::CloseCaseRequest::name].
821 ///
822 /// This is a **required** field for requests.
823 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
824 self.0.request.name = v.into();
825 self
826 }
827 }
828
829 #[doc(hidden)]
830 impl crate::RequestBuilder for CloseCase {
831 fn request_options(&mut self) -> &mut crate::RequestOptions {
832 &mut self.0.options
833 }
834 }
835
836 /// The request builder for [CaseService::search_case_classifications][crate::client::CaseService::search_case_classifications] calls.
837 ///
838 /// # Example
839 /// ```
840 /// # use google_cloud_support_v2::builder::case_service::SearchCaseClassifications;
841 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
842 /// use google_cloud_gax::paginator::ItemPaginator;
843 ///
844 /// let builder = prepare_request_builder();
845 /// let mut items = builder.by_item();
846 /// while let Some(result) = items.next().await {
847 /// let item = result?;
848 /// }
849 /// # Ok(()) }
850 ///
851 /// fn prepare_request_builder() -> SearchCaseClassifications {
852 /// # panic!();
853 /// // ... details omitted ...
854 /// }
855 /// ```
856 #[derive(Clone, Debug)]
857 pub struct SearchCaseClassifications(
858 RequestBuilder<crate::model::SearchCaseClassificationsRequest>,
859 );
860
861 impl SearchCaseClassifications {
862 pub(crate) fn new(
863 stub: std::sync::Arc<dyn super::super::stub::dynamic::CaseService>,
864 ) -> Self {
865 Self(RequestBuilder::new(stub))
866 }
867
868 /// Sets the full request, replacing any prior values.
869 pub fn with_request<V: Into<crate::model::SearchCaseClassificationsRequest>>(
870 mut self,
871 v: V,
872 ) -> Self {
873 self.0.request = v.into();
874 self
875 }
876
877 /// Sets all the options, replacing any prior values.
878 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
879 self.0.options = v.into();
880 self
881 }
882
883 /// Sends the request.
884 pub async fn send(self) -> Result<crate::model::SearchCaseClassificationsResponse> {
885 (*self.0.stub)
886 .search_case_classifications(self.0.request, self.0.options)
887 .await
888 .map(crate::Response::into_body)
889 }
890
891 /// Streams each page in the collection.
892 pub fn by_page(
893 self,
894 ) -> impl google_cloud_gax::paginator::Paginator<
895 crate::model::SearchCaseClassificationsResponse,
896 crate::Error,
897 > {
898 use std::clone::Clone;
899 let token = self.0.request.page_token.clone();
900 let execute = move |token: String| {
901 let mut builder = self.clone();
902 builder.0.request = builder.0.request.set_page_token(token);
903 builder.send()
904 };
905 google_cloud_gax::paginator::internal::new_paginator(token, execute)
906 }
907
908 /// Streams each item in the collection.
909 pub fn by_item(
910 self,
911 ) -> impl google_cloud_gax::paginator::ItemPaginator<
912 crate::model::SearchCaseClassificationsResponse,
913 crate::Error,
914 > {
915 use google_cloud_gax::paginator::Paginator;
916 self.by_page().items()
917 }
918
919 /// Sets the value of [query][crate::model::SearchCaseClassificationsRequest::query].
920 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
921 self.0.request.query = v.into();
922 self
923 }
924
925 /// Sets the value of [page_size][crate::model::SearchCaseClassificationsRequest::page_size].
926 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
927 self.0.request.page_size = v.into();
928 self
929 }
930
931 /// Sets the value of [page_token][crate::model::SearchCaseClassificationsRequest::page_token].
932 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
933 self.0.request.page_token = v.into();
934 self
935 }
936 }
937
938 #[doc(hidden)]
939 impl crate::RequestBuilder for SearchCaseClassifications {
940 fn request_options(&mut self) -> &mut crate::RequestOptions {
941 &mut self.0.options
942 }
943 }
944}
945
946/// Request and client builders for [CommentService][crate::client::CommentService].
947pub mod comment_service {
948 use crate::Result;
949
950 /// A builder for [CommentService][crate::client::CommentService].
951 ///
952 /// ```
953 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
954 /// # use google_cloud_support_v2::*;
955 /// # use builder::comment_service::ClientBuilder;
956 /// # use client::CommentService;
957 /// let builder : ClientBuilder = CommentService::builder();
958 /// let client = builder
959 /// .with_endpoint("https://cloudsupport.googleapis.com")
960 /// .build().await?;
961 /// # Ok(()) }
962 /// ```
963 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
964
965 pub(crate) mod client {
966 use super::super::super::client::CommentService;
967 pub struct Factory;
968 impl crate::ClientFactory for Factory {
969 type Client = CommentService;
970 type Credentials = gaxi::options::Credentials;
971 async fn build(
972 self,
973 config: gaxi::options::ClientConfig,
974 ) -> crate::ClientBuilderResult<Self::Client> {
975 Self::Client::new(config).await
976 }
977 }
978 }
979
980 /// Common implementation for [crate::client::CommentService] request builders.
981 #[derive(Clone, Debug)]
982 pub(crate) struct RequestBuilder<R: std::default::Default> {
983 stub: std::sync::Arc<dyn super::super::stub::dynamic::CommentService>,
984 request: R,
985 options: crate::RequestOptions,
986 }
987
988 impl<R> RequestBuilder<R>
989 where
990 R: std::default::Default,
991 {
992 pub(crate) fn new(
993 stub: std::sync::Arc<dyn super::super::stub::dynamic::CommentService>,
994 ) -> Self {
995 Self {
996 stub,
997 request: R::default(),
998 options: crate::RequestOptions::default(),
999 }
1000 }
1001 }
1002
1003 /// The request builder for [CommentService::list_comments][crate::client::CommentService::list_comments] calls.
1004 ///
1005 /// # Example
1006 /// ```
1007 /// # use google_cloud_support_v2::builder::comment_service::ListComments;
1008 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1009 /// use google_cloud_gax::paginator::ItemPaginator;
1010 ///
1011 /// let builder = prepare_request_builder();
1012 /// let mut items = builder.by_item();
1013 /// while let Some(result) = items.next().await {
1014 /// let item = result?;
1015 /// }
1016 /// # Ok(()) }
1017 ///
1018 /// fn prepare_request_builder() -> ListComments {
1019 /// # panic!();
1020 /// // ... details omitted ...
1021 /// }
1022 /// ```
1023 #[derive(Clone, Debug)]
1024 pub struct ListComments(RequestBuilder<crate::model::ListCommentsRequest>);
1025
1026 impl ListComments {
1027 pub(crate) fn new(
1028 stub: std::sync::Arc<dyn super::super::stub::dynamic::CommentService>,
1029 ) -> Self {
1030 Self(RequestBuilder::new(stub))
1031 }
1032
1033 /// Sets the full request, replacing any prior values.
1034 pub fn with_request<V: Into<crate::model::ListCommentsRequest>>(mut self, v: V) -> Self {
1035 self.0.request = v.into();
1036 self
1037 }
1038
1039 /// Sets all the options, replacing any prior values.
1040 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1041 self.0.options = v.into();
1042 self
1043 }
1044
1045 /// Sends the request.
1046 pub async fn send(self) -> Result<crate::model::ListCommentsResponse> {
1047 (*self.0.stub)
1048 .list_comments(self.0.request, self.0.options)
1049 .await
1050 .map(crate::Response::into_body)
1051 }
1052
1053 /// Streams each page in the collection.
1054 pub fn by_page(
1055 self,
1056 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListCommentsResponse, crate::Error>
1057 {
1058 use std::clone::Clone;
1059 let token = self.0.request.page_token.clone();
1060 let execute = move |token: String| {
1061 let mut builder = self.clone();
1062 builder.0.request = builder.0.request.set_page_token(token);
1063 builder.send()
1064 };
1065 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1066 }
1067
1068 /// Streams each item in the collection.
1069 pub fn by_item(
1070 self,
1071 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1072 crate::model::ListCommentsResponse,
1073 crate::Error,
1074 > {
1075 use google_cloud_gax::paginator::Paginator;
1076 self.by_page().items()
1077 }
1078
1079 /// Sets the value of [parent][crate::model::ListCommentsRequest::parent].
1080 ///
1081 /// This is a **required** field for requests.
1082 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1083 self.0.request.parent = v.into();
1084 self
1085 }
1086
1087 /// Sets the value of [page_size][crate::model::ListCommentsRequest::page_size].
1088 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1089 self.0.request.page_size = v.into();
1090 self
1091 }
1092
1093 /// Sets the value of [page_token][crate::model::ListCommentsRequest::page_token].
1094 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1095 self.0.request.page_token = v.into();
1096 self
1097 }
1098 }
1099
1100 #[doc(hidden)]
1101 impl crate::RequestBuilder for ListComments {
1102 fn request_options(&mut self) -> &mut crate::RequestOptions {
1103 &mut self.0.options
1104 }
1105 }
1106
1107 /// The request builder for [CommentService::create_comment][crate::client::CommentService::create_comment] calls.
1108 ///
1109 /// # Example
1110 /// ```
1111 /// # use google_cloud_support_v2::builder::comment_service::CreateComment;
1112 /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1113 ///
1114 /// let builder = prepare_request_builder();
1115 /// let response = builder.send().await?;
1116 /// # Ok(()) }
1117 ///
1118 /// fn prepare_request_builder() -> CreateComment {
1119 /// # panic!();
1120 /// // ... details omitted ...
1121 /// }
1122 /// ```
1123 #[derive(Clone, Debug)]
1124 pub struct CreateComment(RequestBuilder<crate::model::CreateCommentRequest>);
1125
1126 impl CreateComment {
1127 pub(crate) fn new(
1128 stub: std::sync::Arc<dyn super::super::stub::dynamic::CommentService>,
1129 ) -> Self {
1130 Self(RequestBuilder::new(stub))
1131 }
1132
1133 /// Sets the full request, replacing any prior values.
1134 pub fn with_request<V: Into<crate::model::CreateCommentRequest>>(mut self, v: V) -> Self {
1135 self.0.request = v.into();
1136 self
1137 }
1138
1139 /// Sets all the options, replacing any prior values.
1140 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1141 self.0.options = v.into();
1142 self
1143 }
1144
1145 /// Sends the request.
1146 pub async fn send(self) -> Result<crate::model::Comment> {
1147 (*self.0.stub)
1148 .create_comment(self.0.request, self.0.options)
1149 .await
1150 .map(crate::Response::into_body)
1151 }
1152
1153 /// Sets the value of [parent][crate::model::CreateCommentRequest::parent].
1154 ///
1155 /// This is a **required** field for requests.
1156 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1157 self.0.request.parent = v.into();
1158 self
1159 }
1160
1161 /// Sets the value of [comment][crate::model::CreateCommentRequest::comment].
1162 ///
1163 /// This is a **required** field for requests.
1164 pub fn set_comment<T>(mut self, v: T) -> Self
1165 where
1166 T: std::convert::Into<crate::model::Comment>,
1167 {
1168 self.0.request.comment = std::option::Option::Some(v.into());
1169 self
1170 }
1171
1172 /// Sets or clears the value of [comment][crate::model::CreateCommentRequest::comment].
1173 ///
1174 /// This is a **required** field for requests.
1175 pub fn set_or_clear_comment<T>(mut self, v: std::option::Option<T>) -> Self
1176 where
1177 T: std::convert::Into<crate::model::Comment>,
1178 {
1179 self.0.request.comment = v.map(|x| x.into());
1180 self
1181 }
1182 }
1183
1184 #[doc(hidden)]
1185 impl crate::RequestBuilder for CreateComment {
1186 fn request_options(&mut self) -> &mut crate::RequestOptions {
1187 &mut self.0.options
1188 }
1189 }
1190}