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