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