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}
1315
1316/// Request and client builders for [SupportEventSubscriptionService][crate::client::SupportEventSubscriptionService].
1317pub mod support_event_subscription_service {
1318    use crate::Result;
1319
1320    /// A builder for [SupportEventSubscriptionService][crate::client::SupportEventSubscriptionService].
1321    ///
1322    /// ```
1323    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1324    /// # use google_cloud_support_v2::*;
1325    /// # use builder::support_event_subscription_service::ClientBuilder;
1326    /// # use client::SupportEventSubscriptionService;
1327    /// let builder : ClientBuilder = SupportEventSubscriptionService::builder();
1328    /// let client = builder
1329    ///     .with_endpoint("https://cloudsupport.googleapis.com")
1330    ///     .build().await?;
1331    /// # Ok(()) }
1332    /// ```
1333    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1334
1335    pub(crate) mod client {
1336        use super::super::super::client::SupportEventSubscriptionService;
1337        pub struct Factory;
1338        impl crate::ClientFactory for Factory {
1339            type Client = SupportEventSubscriptionService;
1340            type Credentials = gaxi::options::Credentials;
1341            async fn build(
1342                self,
1343                config: gaxi::options::ClientConfig,
1344            ) -> crate::ClientBuilderResult<Self::Client> {
1345                Self::Client::new(config).await
1346            }
1347        }
1348    }
1349
1350    /// Common implementation for [crate::client::SupportEventSubscriptionService] request builders.
1351    #[derive(Clone, Debug)]
1352    pub(crate) struct RequestBuilder<R: std::default::Default> {
1353        stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1354        request: R,
1355        options: crate::RequestOptions,
1356    }
1357
1358    impl<R> RequestBuilder<R>
1359    where
1360        R: std::default::Default,
1361    {
1362        pub(crate) fn new(
1363            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1364        ) -> Self {
1365            Self {
1366                stub,
1367                request: R::default(),
1368                options: crate::RequestOptions::default(),
1369            }
1370        }
1371    }
1372
1373    /// The request builder for [SupportEventSubscriptionService::create_support_event_subscription][crate::client::SupportEventSubscriptionService::create_support_event_subscription] calls.
1374    ///
1375    /// # Example
1376    /// ```
1377    /// # use google_cloud_support_v2::builder::support_event_subscription_service::CreateSupportEventSubscription;
1378    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1379    ///
1380    /// let builder = prepare_request_builder();
1381    /// let response = builder.send().await?;
1382    /// # Ok(()) }
1383    ///
1384    /// fn prepare_request_builder() -> CreateSupportEventSubscription {
1385    ///   # panic!();
1386    ///   // ... details omitted ...
1387    /// }
1388    /// ```
1389    #[derive(Clone, Debug)]
1390    pub struct CreateSupportEventSubscription(
1391        RequestBuilder<crate::model::CreateSupportEventSubscriptionRequest>,
1392    );
1393
1394    impl CreateSupportEventSubscription {
1395        pub(crate) fn new(
1396            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1397        ) -> Self {
1398            Self(RequestBuilder::new(stub))
1399        }
1400
1401        /// Sets the full request, replacing any prior values.
1402        pub fn with_request<V: Into<crate::model::CreateSupportEventSubscriptionRequest>>(
1403            mut self,
1404            v: V,
1405        ) -> Self {
1406            self.0.request = v.into();
1407            self
1408        }
1409
1410        /// Sets all the options, replacing any prior values.
1411        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1412            self.0.options = v.into();
1413            self
1414        }
1415
1416        /// Sends the request.
1417        pub async fn send(self) -> Result<crate::model::SupportEventSubscription> {
1418            (*self.0.stub)
1419                .create_support_event_subscription(self.0.request, self.0.options)
1420                .await
1421                .map(crate::Response::into_body)
1422        }
1423
1424        /// Sets the value of [parent][crate::model::CreateSupportEventSubscriptionRequest::parent].
1425        ///
1426        /// This is a **required** field for requests.
1427        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1428            self.0.request.parent = v.into();
1429            self
1430        }
1431
1432        /// Sets the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
1433        ///
1434        /// This is a **required** field for requests.
1435        pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
1436        where
1437            T: std::convert::Into<crate::model::SupportEventSubscription>,
1438        {
1439            self.0.request.support_event_subscription = std::option::Option::Some(v.into());
1440            self
1441        }
1442
1443        /// Sets or clears the value of [support_event_subscription][crate::model::CreateSupportEventSubscriptionRequest::support_event_subscription].
1444        ///
1445        /// This is a **required** field for requests.
1446        pub fn set_or_clear_support_event_subscription<T>(
1447            mut self,
1448            v: std::option::Option<T>,
1449        ) -> Self
1450        where
1451            T: std::convert::Into<crate::model::SupportEventSubscription>,
1452        {
1453            self.0.request.support_event_subscription = v.map(|x| x.into());
1454            self
1455        }
1456    }
1457
1458    #[doc(hidden)]
1459    impl crate::RequestBuilder for CreateSupportEventSubscription {
1460        fn request_options(&mut self) -> &mut crate::RequestOptions {
1461            &mut self.0.options
1462        }
1463    }
1464
1465    /// The request builder for [SupportEventSubscriptionService::get_support_event_subscription][crate::client::SupportEventSubscriptionService::get_support_event_subscription] calls.
1466    ///
1467    /// # Example
1468    /// ```
1469    /// # use google_cloud_support_v2::builder::support_event_subscription_service::GetSupportEventSubscription;
1470    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1471    ///
1472    /// let builder = prepare_request_builder();
1473    /// let response = builder.send().await?;
1474    /// # Ok(()) }
1475    ///
1476    /// fn prepare_request_builder() -> GetSupportEventSubscription {
1477    ///   # panic!();
1478    ///   // ... details omitted ...
1479    /// }
1480    /// ```
1481    #[derive(Clone, Debug)]
1482    pub struct GetSupportEventSubscription(
1483        RequestBuilder<crate::model::GetSupportEventSubscriptionRequest>,
1484    );
1485
1486    impl GetSupportEventSubscription {
1487        pub(crate) fn new(
1488            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1489        ) -> Self {
1490            Self(RequestBuilder::new(stub))
1491        }
1492
1493        /// Sets the full request, replacing any prior values.
1494        pub fn with_request<V: Into<crate::model::GetSupportEventSubscriptionRequest>>(
1495            mut self,
1496            v: V,
1497        ) -> Self {
1498            self.0.request = v.into();
1499            self
1500        }
1501
1502        /// Sets all the options, replacing any prior values.
1503        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1504            self.0.options = v.into();
1505            self
1506        }
1507
1508        /// Sends the request.
1509        pub async fn send(self) -> Result<crate::model::SupportEventSubscription> {
1510            (*self.0.stub)
1511                .get_support_event_subscription(self.0.request, self.0.options)
1512                .await
1513                .map(crate::Response::into_body)
1514        }
1515
1516        /// Sets the value of [name][crate::model::GetSupportEventSubscriptionRequest::name].
1517        ///
1518        /// This is a **required** field for requests.
1519        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1520            self.0.request.name = v.into();
1521            self
1522        }
1523    }
1524
1525    #[doc(hidden)]
1526    impl crate::RequestBuilder for GetSupportEventSubscription {
1527        fn request_options(&mut self) -> &mut crate::RequestOptions {
1528            &mut self.0.options
1529        }
1530    }
1531
1532    /// The request builder for [SupportEventSubscriptionService::list_support_event_subscriptions][crate::client::SupportEventSubscriptionService::list_support_event_subscriptions] calls.
1533    ///
1534    /// # Example
1535    /// ```
1536    /// # use google_cloud_support_v2::builder::support_event_subscription_service::ListSupportEventSubscriptions;
1537    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1538    /// use google_cloud_gax::paginator::ItemPaginator;
1539    ///
1540    /// let builder = prepare_request_builder();
1541    /// let mut items = builder.by_item();
1542    /// while let Some(result) = items.next().await {
1543    ///   let item = result?;
1544    /// }
1545    /// # Ok(()) }
1546    ///
1547    /// fn prepare_request_builder() -> ListSupportEventSubscriptions {
1548    ///   # panic!();
1549    ///   // ... details omitted ...
1550    /// }
1551    /// ```
1552    #[derive(Clone, Debug)]
1553    pub struct ListSupportEventSubscriptions(
1554        RequestBuilder<crate::model::ListSupportEventSubscriptionsRequest>,
1555    );
1556
1557    impl ListSupportEventSubscriptions {
1558        pub(crate) fn new(
1559            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1560        ) -> Self {
1561            Self(RequestBuilder::new(stub))
1562        }
1563
1564        /// Sets the full request, replacing any prior values.
1565        pub fn with_request<V: Into<crate::model::ListSupportEventSubscriptionsRequest>>(
1566            mut self,
1567            v: V,
1568        ) -> Self {
1569            self.0.request = v.into();
1570            self
1571        }
1572
1573        /// Sets all the options, replacing any prior values.
1574        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1575            self.0.options = v.into();
1576            self
1577        }
1578
1579        /// Sends the request.
1580        pub async fn send(self) -> Result<crate::model::ListSupportEventSubscriptionsResponse> {
1581            (*self.0.stub)
1582                .list_support_event_subscriptions(self.0.request, self.0.options)
1583                .await
1584                .map(crate::Response::into_body)
1585        }
1586
1587        /// Streams each page in the collection.
1588        pub fn by_page(
1589            self,
1590        ) -> impl google_cloud_gax::paginator::Paginator<
1591            crate::model::ListSupportEventSubscriptionsResponse,
1592            crate::Error,
1593        > {
1594            use std::clone::Clone;
1595            let token = self.0.request.page_token.clone();
1596            let execute = move |token: String| {
1597                let mut builder = self.clone();
1598                builder.0.request = builder.0.request.set_page_token(token);
1599                builder.send()
1600            };
1601            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1602        }
1603
1604        /// Streams each item in the collection.
1605        pub fn by_item(
1606            self,
1607        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1608            crate::model::ListSupportEventSubscriptionsResponse,
1609            crate::Error,
1610        > {
1611            use google_cloud_gax::paginator::Paginator;
1612            self.by_page().items()
1613        }
1614
1615        /// Sets the value of [parent][crate::model::ListSupportEventSubscriptionsRequest::parent].
1616        ///
1617        /// This is a **required** field for requests.
1618        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1619            self.0.request.parent = v.into();
1620            self
1621        }
1622
1623        /// Sets the value of [filter][crate::model::ListSupportEventSubscriptionsRequest::filter].
1624        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1625            self.0.request.filter = v.into();
1626            self
1627        }
1628
1629        /// Sets the value of [show_deleted][crate::model::ListSupportEventSubscriptionsRequest::show_deleted].
1630        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1631            self.0.request.show_deleted = v.into();
1632            self
1633        }
1634
1635        /// Sets the value of [page_size][crate::model::ListSupportEventSubscriptionsRequest::page_size].
1636        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1637            self.0.request.page_size = v.into();
1638            self
1639        }
1640
1641        /// Sets the value of [page_token][crate::model::ListSupportEventSubscriptionsRequest::page_token].
1642        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1643            self.0.request.page_token = v.into();
1644            self
1645        }
1646    }
1647
1648    #[doc(hidden)]
1649    impl crate::RequestBuilder for ListSupportEventSubscriptions {
1650        fn request_options(&mut self) -> &mut crate::RequestOptions {
1651            &mut self.0.options
1652        }
1653    }
1654
1655    /// The request builder for [SupportEventSubscriptionService::update_support_event_subscription][crate::client::SupportEventSubscriptionService::update_support_event_subscription] calls.
1656    ///
1657    /// # Example
1658    /// ```
1659    /// # use google_cloud_support_v2::builder::support_event_subscription_service::UpdateSupportEventSubscription;
1660    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1661    ///
1662    /// let builder = prepare_request_builder();
1663    /// let response = builder.send().await?;
1664    /// # Ok(()) }
1665    ///
1666    /// fn prepare_request_builder() -> UpdateSupportEventSubscription {
1667    ///   # panic!();
1668    ///   // ... details omitted ...
1669    /// }
1670    /// ```
1671    #[derive(Clone, Debug)]
1672    pub struct UpdateSupportEventSubscription(
1673        RequestBuilder<crate::model::UpdateSupportEventSubscriptionRequest>,
1674    );
1675
1676    impl UpdateSupportEventSubscription {
1677        pub(crate) fn new(
1678            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1679        ) -> Self {
1680            Self(RequestBuilder::new(stub))
1681        }
1682
1683        /// Sets the full request, replacing any prior values.
1684        pub fn with_request<V: Into<crate::model::UpdateSupportEventSubscriptionRequest>>(
1685            mut self,
1686            v: V,
1687        ) -> Self {
1688            self.0.request = v.into();
1689            self
1690        }
1691
1692        /// Sets all the options, replacing any prior values.
1693        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1694            self.0.options = v.into();
1695            self
1696        }
1697
1698        /// Sends the request.
1699        pub async fn send(self) -> Result<crate::model::SupportEventSubscription> {
1700            (*self.0.stub)
1701                .update_support_event_subscription(self.0.request, self.0.options)
1702                .await
1703                .map(crate::Response::into_body)
1704        }
1705
1706        /// Sets the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
1707        ///
1708        /// This is a **required** field for requests.
1709        pub fn set_support_event_subscription<T>(mut self, v: T) -> Self
1710        where
1711            T: std::convert::Into<crate::model::SupportEventSubscription>,
1712        {
1713            self.0.request.support_event_subscription = std::option::Option::Some(v.into());
1714            self
1715        }
1716
1717        /// Sets or clears the value of [support_event_subscription][crate::model::UpdateSupportEventSubscriptionRequest::support_event_subscription].
1718        ///
1719        /// This is a **required** field for requests.
1720        pub fn set_or_clear_support_event_subscription<T>(
1721            mut self,
1722            v: std::option::Option<T>,
1723        ) -> Self
1724        where
1725            T: std::convert::Into<crate::model::SupportEventSubscription>,
1726        {
1727            self.0.request.support_event_subscription = v.map(|x| x.into());
1728            self
1729        }
1730
1731        /// Sets the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
1732        pub fn set_update_mask<T>(mut self, v: T) -> Self
1733        where
1734            T: std::convert::Into<wkt::FieldMask>,
1735        {
1736            self.0.request.update_mask = std::option::Option::Some(v.into());
1737            self
1738        }
1739
1740        /// Sets or clears the value of [update_mask][crate::model::UpdateSupportEventSubscriptionRequest::update_mask].
1741        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1742        where
1743            T: std::convert::Into<wkt::FieldMask>,
1744        {
1745            self.0.request.update_mask = v.map(|x| x.into());
1746            self
1747        }
1748    }
1749
1750    #[doc(hidden)]
1751    impl crate::RequestBuilder for UpdateSupportEventSubscription {
1752        fn request_options(&mut self) -> &mut crate::RequestOptions {
1753            &mut self.0.options
1754        }
1755    }
1756
1757    /// The request builder for [SupportEventSubscriptionService::delete_support_event_subscription][crate::client::SupportEventSubscriptionService::delete_support_event_subscription] calls.
1758    ///
1759    /// # Example
1760    /// ```
1761    /// # use google_cloud_support_v2::builder::support_event_subscription_service::DeleteSupportEventSubscription;
1762    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1763    ///
1764    /// let builder = prepare_request_builder();
1765    /// let response = builder.send().await?;
1766    /// # Ok(()) }
1767    ///
1768    /// fn prepare_request_builder() -> DeleteSupportEventSubscription {
1769    ///   # panic!();
1770    ///   // ... details omitted ...
1771    /// }
1772    /// ```
1773    #[derive(Clone, Debug)]
1774    pub struct DeleteSupportEventSubscription(
1775        RequestBuilder<crate::model::DeleteSupportEventSubscriptionRequest>,
1776    );
1777
1778    impl DeleteSupportEventSubscription {
1779        pub(crate) fn new(
1780            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1781        ) -> Self {
1782            Self(RequestBuilder::new(stub))
1783        }
1784
1785        /// Sets the full request, replacing any prior values.
1786        pub fn with_request<V: Into<crate::model::DeleteSupportEventSubscriptionRequest>>(
1787            mut self,
1788            v: V,
1789        ) -> Self {
1790            self.0.request = v.into();
1791            self
1792        }
1793
1794        /// Sets all the options, replacing any prior values.
1795        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1796            self.0.options = v.into();
1797            self
1798        }
1799
1800        /// Sends the request.
1801        pub async fn send(self) -> Result<crate::model::SupportEventSubscription> {
1802            (*self.0.stub)
1803                .delete_support_event_subscription(self.0.request, self.0.options)
1804                .await
1805                .map(crate::Response::into_body)
1806        }
1807
1808        /// Sets the value of [name][crate::model::DeleteSupportEventSubscriptionRequest::name].
1809        ///
1810        /// This is a **required** field for requests.
1811        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1812            self.0.request.name = v.into();
1813            self
1814        }
1815    }
1816
1817    #[doc(hidden)]
1818    impl crate::RequestBuilder for DeleteSupportEventSubscription {
1819        fn request_options(&mut self) -> &mut crate::RequestOptions {
1820            &mut self.0.options
1821        }
1822    }
1823
1824    /// The request builder for [SupportEventSubscriptionService::undelete_support_event_subscription][crate::client::SupportEventSubscriptionService::undelete_support_event_subscription] calls.
1825    ///
1826    /// # Example
1827    /// ```
1828    /// # use google_cloud_support_v2::builder::support_event_subscription_service::UndeleteSupportEventSubscription;
1829    /// # async fn sample() -> google_cloud_support_v2::Result<()> {
1830    ///
1831    /// let builder = prepare_request_builder();
1832    /// let response = builder.send().await?;
1833    /// # Ok(()) }
1834    ///
1835    /// fn prepare_request_builder() -> UndeleteSupportEventSubscription {
1836    ///   # panic!();
1837    ///   // ... details omitted ...
1838    /// }
1839    /// ```
1840    #[derive(Clone, Debug)]
1841    pub struct UndeleteSupportEventSubscription(
1842        RequestBuilder<crate::model::UndeleteSupportEventSubscriptionRequest>,
1843    );
1844
1845    impl UndeleteSupportEventSubscription {
1846        pub(crate) fn new(
1847            stub: std::sync::Arc<dyn super::super::stub::dynamic::SupportEventSubscriptionService>,
1848        ) -> Self {
1849            Self(RequestBuilder::new(stub))
1850        }
1851
1852        /// Sets the full request, replacing any prior values.
1853        pub fn with_request<V: Into<crate::model::UndeleteSupportEventSubscriptionRequest>>(
1854            mut self,
1855            v: V,
1856        ) -> Self {
1857            self.0.request = v.into();
1858            self
1859        }
1860
1861        /// Sets all the options, replacing any prior values.
1862        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1863            self.0.options = v.into();
1864            self
1865        }
1866
1867        /// Sends the request.
1868        pub async fn send(self) -> Result<crate::model::SupportEventSubscription> {
1869            (*self.0.stub)
1870                .undelete_support_event_subscription(self.0.request, self.0.options)
1871                .await
1872                .map(crate::Response::into_body)
1873        }
1874
1875        /// Sets the value of [name][crate::model::UndeleteSupportEventSubscriptionRequest::name].
1876        ///
1877        /// This is a **required** field for requests.
1878        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1879            self.0.request.name = v.into();
1880            self
1881        }
1882    }
1883
1884    #[doc(hidden)]
1885    impl crate::RequestBuilder for UndeleteSupportEventSubscription {
1886        fn request_options(&mut self) -> &mut crate::RequestOptions {
1887            &mut self.0.options
1888        }
1889    }
1890}