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