Skip to main content

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