Skip to main content

google_cloud_bigquery_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 [DatasetService][crate::client::DatasetService].
18pub mod dataset_service {
19    use crate::Result;
20
21    /// A builder for [DatasetService][crate::client::DatasetService].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_bigquery_v2::*;
26    /// # use builder::dataset_service::ClientBuilder;
27    /// # use client::DatasetService;
28    /// let builder : ClientBuilder = DatasetService::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://bigquery.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::DatasetService;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = DatasetService;
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::DatasetService] 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::DatasetService>,
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::DatasetService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [DatasetService::get_dataset][crate::client::DatasetService::get_dataset] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_bigquery_v2::builder::dataset_service::GetDataset;
79    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> GetDataset {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct GetDataset(RequestBuilder<crate::model::GetDatasetRequest>);
92
93    impl GetDataset {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
96        ) -> Self {
97            Self(RequestBuilder::new(stub))
98        }
99
100        /// Sets the full request, replacing any prior values.
101        pub fn with_request<V: Into<crate::model::GetDatasetRequest>>(mut self, v: V) -> Self {
102            self.0.request = v.into();
103            self
104        }
105
106        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        pub async fn send(self) -> Result<crate::model::Dataset> {
114            (*self.0.stub)
115                .get_dataset(self.0.request, self.0.options)
116                .await
117                .map(crate::Response::into_body)
118        }
119
120        /// Sets the value of [project_id][crate::model::GetDatasetRequest::project_id].
121        ///
122        /// This is a **required** field for requests.
123        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
124            self.0.request.project_id = v.into();
125            self
126        }
127
128        /// Sets the value of [dataset_id][crate::model::GetDatasetRequest::dataset_id].
129        ///
130        /// This is a **required** field for requests.
131        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
132            self.0.request.dataset_id = v.into();
133            self
134        }
135
136        /// Sets the value of [dataset_view][crate::model::GetDatasetRequest::dataset_view].
137        pub fn set_dataset_view<T: Into<crate::model::get_dataset_request::DatasetView>>(
138            mut self,
139            v: T,
140        ) -> Self {
141            self.0.request.dataset_view = v.into();
142            self
143        }
144
145        /// Sets the value of [access_policy_version][crate::model::GetDatasetRequest::access_policy_version].
146        pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
147            self.0.request.access_policy_version = v.into();
148            self
149        }
150    }
151
152    #[doc(hidden)]
153    impl crate::RequestBuilder for GetDataset {
154        fn request_options(&mut self) -> &mut crate::RequestOptions {
155            &mut self.0.options
156        }
157    }
158
159    /// The request builder for [DatasetService::insert_dataset][crate::client::DatasetService::insert_dataset] calls.
160    ///
161    /// # Example
162    /// ```
163    /// # use google_cloud_bigquery_v2::builder::dataset_service::InsertDataset;
164    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
165    ///
166    /// let builder = prepare_request_builder();
167    /// let response = builder.send().await?;
168    /// # Ok(()) }
169    ///
170    /// fn prepare_request_builder() -> InsertDataset {
171    ///   # panic!();
172    ///   // ... details omitted ...
173    /// }
174    /// ```
175    #[derive(Clone, Debug)]
176    pub struct InsertDataset(RequestBuilder<crate::model::InsertDatasetRequest>);
177
178    impl InsertDataset {
179        pub(crate) fn new(
180            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
181        ) -> Self {
182            Self(RequestBuilder::new(stub))
183        }
184
185        /// Sets the full request, replacing any prior values.
186        pub fn with_request<V: Into<crate::model::InsertDatasetRequest>>(mut self, v: V) -> Self {
187            self.0.request = v.into();
188            self
189        }
190
191        /// Sets all the options, replacing any prior values.
192        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
193            self.0.options = v.into();
194            self
195        }
196
197        /// Sends the request.
198        pub async fn send(self) -> Result<crate::model::Dataset> {
199            (*self.0.stub)
200                .insert_dataset(self.0.request, self.0.options)
201                .await
202                .map(crate::Response::into_body)
203        }
204
205        /// Sets the value of [project_id][crate::model::InsertDatasetRequest::project_id].
206        ///
207        /// This is a **required** field for requests.
208        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
209            self.0.request.project_id = v.into();
210            self
211        }
212
213        /// Sets the value of [dataset][crate::model::InsertDatasetRequest::dataset].
214        ///
215        /// This is a **required** field for requests.
216        pub fn set_dataset<T>(mut self, v: T) -> Self
217        where
218            T: std::convert::Into<crate::model::Dataset>,
219        {
220            self.0.request.dataset = std::option::Option::Some(v.into());
221            self
222        }
223
224        /// Sets or clears the value of [dataset][crate::model::InsertDatasetRequest::dataset].
225        ///
226        /// This is a **required** field for requests.
227        pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
228        where
229            T: std::convert::Into<crate::model::Dataset>,
230        {
231            self.0.request.dataset = v.map(|x| x.into());
232            self
233        }
234
235        /// Sets the value of [access_policy_version][crate::model::InsertDatasetRequest::access_policy_version].
236        pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
237            self.0.request.access_policy_version = v.into();
238            self
239        }
240    }
241
242    #[doc(hidden)]
243    impl crate::RequestBuilder for InsertDataset {
244        fn request_options(&mut self) -> &mut crate::RequestOptions {
245            &mut self.0.options
246        }
247    }
248
249    /// The request builder for [DatasetService::patch_dataset][crate::client::DatasetService::patch_dataset] calls.
250    ///
251    /// # Example
252    /// ```
253    /// # use google_cloud_bigquery_v2::builder::dataset_service::PatchDataset;
254    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
255    ///
256    /// let builder = prepare_request_builder();
257    /// let response = builder.send().await?;
258    /// # Ok(()) }
259    ///
260    /// fn prepare_request_builder() -> PatchDataset {
261    ///   # panic!();
262    ///   // ... details omitted ...
263    /// }
264    /// ```
265    #[derive(Clone, Debug)]
266    pub struct PatchDataset(RequestBuilder<crate::model::UpdateOrPatchDatasetRequest>);
267
268    impl PatchDataset {
269        pub(crate) fn new(
270            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
271        ) -> Self {
272            Self(RequestBuilder::new(stub))
273        }
274
275        /// Sets the full request, replacing any prior values.
276        pub fn with_request<V: Into<crate::model::UpdateOrPatchDatasetRequest>>(
277            mut self,
278            v: V,
279        ) -> Self {
280            self.0.request = v.into();
281            self
282        }
283
284        /// Sets all the options, replacing any prior values.
285        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286            self.0.options = v.into();
287            self
288        }
289
290        /// Sends the request.
291        pub async fn send(self) -> Result<crate::model::Dataset> {
292            (*self.0.stub)
293                .patch_dataset(self.0.request, self.0.options)
294                .await
295                .map(crate::Response::into_body)
296        }
297
298        /// Sets the value of [project_id][crate::model::UpdateOrPatchDatasetRequest::project_id].
299        ///
300        /// This is a **required** field for requests.
301        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
302            self.0.request.project_id = v.into();
303            self
304        }
305
306        /// Sets the value of [dataset_id][crate::model::UpdateOrPatchDatasetRequest::dataset_id].
307        ///
308        /// This is a **required** field for requests.
309        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
310            self.0.request.dataset_id = v.into();
311            self
312        }
313
314        /// Sets the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
315        ///
316        /// This is a **required** field for requests.
317        pub fn set_dataset<T>(mut self, v: T) -> Self
318        where
319            T: std::convert::Into<crate::model::Dataset>,
320        {
321            self.0.request.dataset = std::option::Option::Some(v.into());
322            self
323        }
324
325        /// Sets or clears the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
326        ///
327        /// This is a **required** field for requests.
328        pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
329        where
330            T: std::convert::Into<crate::model::Dataset>,
331        {
332            self.0.request.dataset = v.map(|x| x.into());
333            self
334        }
335
336        /// Sets the value of [update_mode][crate::model::UpdateOrPatchDatasetRequest::update_mode].
337        pub fn set_update_mode<
338            T: Into<crate::model::update_or_patch_dataset_request::UpdateMode>,
339        >(
340            mut self,
341            v: T,
342        ) -> Self {
343            self.0.request.update_mode = v.into();
344            self
345        }
346
347        /// Sets the value of [access_policy_version][crate::model::UpdateOrPatchDatasetRequest::access_policy_version].
348        pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
349            self.0.request.access_policy_version = v.into();
350            self
351        }
352    }
353
354    #[doc(hidden)]
355    impl crate::RequestBuilder for PatchDataset {
356        fn request_options(&mut self) -> &mut crate::RequestOptions {
357            &mut self.0.options
358        }
359    }
360
361    /// The request builder for [DatasetService::update_dataset][crate::client::DatasetService::update_dataset] calls.
362    ///
363    /// # Example
364    /// ```
365    /// # use google_cloud_bigquery_v2::builder::dataset_service::UpdateDataset;
366    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
367    ///
368    /// let builder = prepare_request_builder();
369    /// let response = builder.send().await?;
370    /// # Ok(()) }
371    ///
372    /// fn prepare_request_builder() -> UpdateDataset {
373    ///   # panic!();
374    ///   // ... details omitted ...
375    /// }
376    /// ```
377    #[derive(Clone, Debug)]
378    pub struct UpdateDataset(RequestBuilder<crate::model::UpdateOrPatchDatasetRequest>);
379
380    impl UpdateDataset {
381        pub(crate) fn new(
382            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
383        ) -> Self {
384            Self(RequestBuilder::new(stub))
385        }
386
387        /// Sets the full request, replacing any prior values.
388        pub fn with_request<V: Into<crate::model::UpdateOrPatchDatasetRequest>>(
389            mut self,
390            v: V,
391        ) -> Self {
392            self.0.request = v.into();
393            self
394        }
395
396        /// Sets all the options, replacing any prior values.
397        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
398            self.0.options = v.into();
399            self
400        }
401
402        /// Sends the request.
403        pub async fn send(self) -> Result<crate::model::Dataset> {
404            (*self.0.stub)
405                .update_dataset(self.0.request, self.0.options)
406                .await
407                .map(crate::Response::into_body)
408        }
409
410        /// Sets the value of [project_id][crate::model::UpdateOrPatchDatasetRequest::project_id].
411        ///
412        /// This is a **required** field for requests.
413        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
414            self.0.request.project_id = v.into();
415            self
416        }
417
418        /// Sets the value of [dataset_id][crate::model::UpdateOrPatchDatasetRequest::dataset_id].
419        ///
420        /// This is a **required** field for requests.
421        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
422            self.0.request.dataset_id = v.into();
423            self
424        }
425
426        /// Sets the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
427        ///
428        /// This is a **required** field for requests.
429        pub fn set_dataset<T>(mut self, v: T) -> Self
430        where
431            T: std::convert::Into<crate::model::Dataset>,
432        {
433            self.0.request.dataset = std::option::Option::Some(v.into());
434            self
435        }
436
437        /// Sets or clears the value of [dataset][crate::model::UpdateOrPatchDatasetRequest::dataset].
438        ///
439        /// This is a **required** field for requests.
440        pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
441        where
442            T: std::convert::Into<crate::model::Dataset>,
443        {
444            self.0.request.dataset = v.map(|x| x.into());
445            self
446        }
447
448        /// Sets the value of [update_mode][crate::model::UpdateOrPatchDatasetRequest::update_mode].
449        pub fn set_update_mode<
450            T: Into<crate::model::update_or_patch_dataset_request::UpdateMode>,
451        >(
452            mut self,
453            v: T,
454        ) -> Self {
455            self.0.request.update_mode = v.into();
456            self
457        }
458
459        /// Sets the value of [access_policy_version][crate::model::UpdateOrPatchDatasetRequest::access_policy_version].
460        pub fn set_access_policy_version<T: Into<i32>>(mut self, v: T) -> Self {
461            self.0.request.access_policy_version = v.into();
462            self
463        }
464    }
465
466    #[doc(hidden)]
467    impl crate::RequestBuilder for UpdateDataset {
468        fn request_options(&mut self) -> &mut crate::RequestOptions {
469            &mut self.0.options
470        }
471    }
472
473    /// The request builder for [DatasetService::delete_dataset][crate::client::DatasetService::delete_dataset] calls.
474    ///
475    /// # Example
476    /// ```
477    /// # use google_cloud_bigquery_v2::builder::dataset_service::DeleteDataset;
478    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
479    ///
480    /// let builder = prepare_request_builder();
481    /// let response = builder.send().await?;
482    /// # Ok(()) }
483    ///
484    /// fn prepare_request_builder() -> DeleteDataset {
485    ///   # panic!();
486    ///   // ... details omitted ...
487    /// }
488    /// ```
489    #[derive(Clone, Debug)]
490    pub struct DeleteDataset(RequestBuilder<crate::model::DeleteDatasetRequest>);
491
492    impl DeleteDataset {
493        pub(crate) fn new(
494            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
495        ) -> Self {
496            Self(RequestBuilder::new(stub))
497        }
498
499        /// Sets the full request, replacing any prior values.
500        pub fn with_request<V: Into<crate::model::DeleteDatasetRequest>>(mut self, v: V) -> Self {
501            self.0.request = v.into();
502            self
503        }
504
505        /// Sets all the options, replacing any prior values.
506        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
507            self.0.options = v.into();
508            self
509        }
510
511        /// Sends the request.
512        pub async fn send(self) -> Result<()> {
513            (*self.0.stub)
514                .delete_dataset(self.0.request, self.0.options)
515                .await
516                .map(crate::Response::into_body)
517        }
518
519        /// Sets the value of [project_id][crate::model::DeleteDatasetRequest::project_id].
520        ///
521        /// This is a **required** field for requests.
522        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
523            self.0.request.project_id = v.into();
524            self
525        }
526
527        /// Sets the value of [dataset_id][crate::model::DeleteDatasetRequest::dataset_id].
528        ///
529        /// This is a **required** field for requests.
530        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
531            self.0.request.dataset_id = v.into();
532            self
533        }
534
535        /// Sets the value of [delete_contents][crate::model::DeleteDatasetRequest::delete_contents].
536        pub fn set_delete_contents<T: Into<bool>>(mut self, v: T) -> Self {
537            self.0.request.delete_contents = v.into();
538            self
539        }
540    }
541
542    #[doc(hidden)]
543    impl crate::RequestBuilder for DeleteDataset {
544        fn request_options(&mut self) -> &mut crate::RequestOptions {
545            &mut self.0.options
546        }
547    }
548
549    /// The request builder for [DatasetService::list_datasets][crate::client::DatasetService::list_datasets] calls.
550    ///
551    /// # Example
552    /// ```
553    /// # use google_cloud_bigquery_v2::builder::dataset_service::ListDatasets;
554    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
555    /// use google_cloud_gax::paginator::ItemPaginator;
556    ///
557    /// let builder = prepare_request_builder();
558    /// let mut items = builder.by_item();
559    /// while let Some(result) = items.next().await {
560    ///   let item = result?;
561    /// }
562    /// # Ok(()) }
563    ///
564    /// fn prepare_request_builder() -> ListDatasets {
565    ///   # panic!();
566    ///   // ... details omitted ...
567    /// }
568    /// ```
569    #[derive(Clone, Debug)]
570    pub struct ListDatasets(RequestBuilder<crate::model::ListDatasetsRequest>);
571
572    impl ListDatasets {
573        pub(crate) fn new(
574            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
575        ) -> Self {
576            Self(RequestBuilder::new(stub))
577        }
578
579        /// Sets the full request, replacing any prior values.
580        pub fn with_request<V: Into<crate::model::ListDatasetsRequest>>(mut self, v: V) -> Self {
581            self.0.request = v.into();
582            self
583        }
584
585        /// Sets all the options, replacing any prior values.
586        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
587            self.0.options = v.into();
588            self
589        }
590
591        /// Sends the request.
592        pub async fn send(self) -> Result<crate::model::DatasetList> {
593            (*self.0.stub)
594                .list_datasets(self.0.request, self.0.options)
595                .await
596                .map(crate::Response::into_body)
597        }
598
599        /// Streams each page in the collection.
600        pub fn by_page(
601            self,
602        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::DatasetList, crate::Error>
603        {
604            use std::clone::Clone;
605            let token = self.0.request.page_token.clone();
606            let execute = move |token: String| {
607                let mut builder = self.clone();
608                builder.0.request = builder.0.request.set_page_token(token);
609                builder.send()
610            };
611            google_cloud_gax::paginator::internal::new_paginator(token, execute)
612        }
613
614        /// Streams each item in the collection.
615        pub fn by_item(
616            self,
617        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::DatasetList, crate::Error>
618        {
619            use google_cloud_gax::paginator::Paginator;
620            self.by_page().items()
621        }
622
623        /// Sets the value of [project_id][crate::model::ListDatasetsRequest::project_id].
624        ///
625        /// This is a **required** field for requests.
626        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
627            self.0.request.project_id = v.into();
628            self
629        }
630
631        /// Sets the value of [max_results][crate::model::ListDatasetsRequest::max_results].
632        pub fn set_max_results<T>(mut self, v: T) -> Self
633        where
634            T: std::convert::Into<wkt::UInt32Value>,
635        {
636            self.0.request.max_results = std::option::Option::Some(v.into());
637            self
638        }
639
640        /// Sets or clears the value of [max_results][crate::model::ListDatasetsRequest::max_results].
641        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
642        where
643            T: std::convert::Into<wkt::UInt32Value>,
644        {
645            self.0.request.max_results = v.map(|x| x.into());
646            self
647        }
648
649        /// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
650        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
651            self.0.request.page_token = v.into();
652            self
653        }
654
655        /// Sets the value of [all][crate::model::ListDatasetsRequest::all].
656        pub fn set_all<T: Into<bool>>(mut self, v: T) -> Self {
657            self.0.request.all = v.into();
658            self
659        }
660
661        /// Sets the value of [filter][crate::model::ListDatasetsRequest::filter].
662        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
663            self.0.request.filter = v.into();
664            self
665        }
666    }
667
668    #[doc(hidden)]
669    impl crate::RequestBuilder for ListDatasets {
670        fn request_options(&mut self) -> &mut crate::RequestOptions {
671            &mut self.0.options
672        }
673    }
674
675    /// The request builder for [DatasetService::undelete_dataset][crate::client::DatasetService::undelete_dataset] calls.
676    ///
677    /// # Example
678    /// ```
679    /// # use google_cloud_bigquery_v2::builder::dataset_service::UndeleteDataset;
680    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
681    ///
682    /// let builder = prepare_request_builder();
683    /// let response = builder.send().await?;
684    /// # Ok(()) }
685    ///
686    /// fn prepare_request_builder() -> UndeleteDataset {
687    ///   # panic!();
688    ///   // ... details omitted ...
689    /// }
690    /// ```
691    #[derive(Clone, Debug)]
692    pub struct UndeleteDataset(RequestBuilder<crate::model::UndeleteDatasetRequest>);
693
694    impl UndeleteDataset {
695        pub(crate) fn new(
696            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
697        ) -> Self {
698            Self(RequestBuilder::new(stub))
699        }
700
701        /// Sets the full request, replacing any prior values.
702        pub fn with_request<V: Into<crate::model::UndeleteDatasetRequest>>(mut self, v: V) -> Self {
703            self.0.request = v.into();
704            self
705        }
706
707        /// Sets all the options, replacing any prior values.
708        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
709            self.0.options = v.into();
710            self
711        }
712
713        /// Sends the request.
714        pub async fn send(self) -> Result<crate::model::Dataset> {
715            (*self.0.stub)
716                .undelete_dataset(self.0.request, self.0.options)
717                .await
718                .map(crate::Response::into_body)
719        }
720
721        /// Sets the value of [project_id][crate::model::UndeleteDatasetRequest::project_id].
722        ///
723        /// This is a **required** field for requests.
724        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
725            self.0.request.project_id = v.into();
726            self
727        }
728
729        /// Sets the value of [dataset_id][crate::model::UndeleteDatasetRequest::dataset_id].
730        ///
731        /// This is a **required** field for requests.
732        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
733            self.0.request.dataset_id = v.into();
734            self
735        }
736
737        /// Sets the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
738        pub fn set_deletion_time<T>(mut self, v: T) -> Self
739        where
740            T: std::convert::Into<wkt::Timestamp>,
741        {
742            self.0.request.deletion_time = std::option::Option::Some(v.into());
743            self
744        }
745
746        /// Sets or clears the value of [deletion_time][crate::model::UndeleteDatasetRequest::deletion_time].
747        pub fn set_or_clear_deletion_time<T>(mut self, v: std::option::Option<T>) -> Self
748        where
749            T: std::convert::Into<wkt::Timestamp>,
750        {
751            self.0.request.deletion_time = v.map(|x| x.into());
752            self
753        }
754    }
755
756    #[doc(hidden)]
757    impl crate::RequestBuilder for UndeleteDataset {
758        fn request_options(&mut self) -> &mut crate::RequestOptions {
759            &mut self.0.options
760        }
761    }
762}
763
764/// Request and client builders for [JobService][crate::client::JobService].
765pub mod job_service {
766    use crate::Result;
767
768    /// A builder for [JobService][crate::client::JobService].
769    ///
770    /// ```
771    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
772    /// # use google_cloud_bigquery_v2::*;
773    /// # use builder::job_service::ClientBuilder;
774    /// # use client::JobService;
775    /// let builder : ClientBuilder = JobService::builder();
776    /// let client = builder
777    ///     .with_endpoint("https://bigquery.googleapis.com")
778    ///     .build().await?;
779    /// # Ok(()) }
780    /// ```
781    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
782
783    pub(crate) mod client {
784        use super::super::super::client::JobService;
785        pub struct Factory;
786        impl crate::ClientFactory for Factory {
787            type Client = JobService;
788            type Credentials = gaxi::options::Credentials;
789            async fn build(
790                self,
791                config: gaxi::options::ClientConfig,
792            ) -> crate::ClientBuilderResult<Self::Client> {
793                Self::Client::new(config).await
794            }
795        }
796    }
797
798    /// Common implementation for [crate::client::JobService] request builders.
799    #[derive(Clone, Debug)]
800    pub(crate) struct RequestBuilder<R: std::default::Default> {
801        stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
802        request: R,
803        options: crate::RequestOptions,
804    }
805
806    impl<R> RequestBuilder<R>
807    where
808        R: std::default::Default,
809    {
810        pub(crate) fn new(
811            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
812        ) -> Self {
813            Self {
814                stub,
815                request: R::default(),
816                options: crate::RequestOptions::default(),
817            }
818        }
819    }
820
821    /// The request builder for [JobService::cancel_job][crate::client::JobService::cancel_job] calls.
822    ///
823    /// # Example
824    /// ```
825    /// # use google_cloud_bigquery_v2::builder::job_service::CancelJob;
826    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
827    ///
828    /// let builder = prepare_request_builder();
829    /// let response = builder.send().await?;
830    /// # Ok(()) }
831    ///
832    /// fn prepare_request_builder() -> CancelJob {
833    ///   # panic!();
834    ///   // ... details omitted ...
835    /// }
836    /// ```
837    #[derive(Clone, Debug)]
838    pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
839
840    impl CancelJob {
841        pub(crate) fn new(
842            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
843        ) -> Self {
844            Self(RequestBuilder::new(stub))
845        }
846
847        /// Sets the full request, replacing any prior values.
848        pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
849            self.0.request = v.into();
850            self
851        }
852
853        /// Sets all the options, replacing any prior values.
854        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
855            self.0.options = v.into();
856            self
857        }
858
859        /// Sends the request.
860        pub async fn send(self) -> Result<crate::model::JobCancelResponse> {
861            (*self.0.stub)
862                .cancel_job(self.0.request, self.0.options)
863                .await
864                .map(crate::Response::into_body)
865        }
866
867        /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
868        ///
869        /// This is a **required** field for requests.
870        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
871            self.0.request.project_id = v.into();
872            self
873        }
874
875        /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
876        ///
877        /// This is a **required** field for requests.
878        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
879            self.0.request.job_id = v.into();
880            self
881        }
882
883        /// Sets the value of [location][crate::model::CancelJobRequest::location].
884        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
885            self.0.request.location = v.into();
886            self
887        }
888    }
889
890    #[doc(hidden)]
891    impl crate::RequestBuilder for CancelJob {
892        fn request_options(&mut self) -> &mut crate::RequestOptions {
893            &mut self.0.options
894        }
895    }
896
897    /// The request builder for [JobService::get_job][crate::client::JobService::get_job] calls.
898    ///
899    /// # Example
900    /// ```
901    /// # use google_cloud_bigquery_v2::builder::job_service::GetJob;
902    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
903    ///
904    /// let builder = prepare_request_builder();
905    /// let response = builder.send().await?;
906    /// # Ok(()) }
907    ///
908    /// fn prepare_request_builder() -> GetJob {
909    ///   # panic!();
910    ///   // ... details omitted ...
911    /// }
912    /// ```
913    #[derive(Clone, Debug)]
914    pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
915
916    impl GetJob {
917        pub(crate) fn new(
918            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
919        ) -> Self {
920            Self(RequestBuilder::new(stub))
921        }
922
923        /// Sets the full request, replacing any prior values.
924        pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
925            self.0.request = v.into();
926            self
927        }
928
929        /// Sets all the options, replacing any prior values.
930        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
931            self.0.options = v.into();
932            self
933        }
934
935        /// Sends the request.
936        pub async fn send(self) -> Result<crate::model::Job> {
937            (*self.0.stub)
938                .get_job(self.0.request, self.0.options)
939                .await
940                .map(crate::Response::into_body)
941        }
942
943        /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
944        ///
945        /// This is a **required** field for requests.
946        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
947            self.0.request.project_id = v.into();
948            self
949        }
950
951        /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
952        ///
953        /// This is a **required** field for requests.
954        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
955            self.0.request.job_id = v.into();
956            self
957        }
958
959        /// Sets the value of [location][crate::model::GetJobRequest::location].
960        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
961            self.0.request.location = v.into();
962            self
963        }
964    }
965
966    #[doc(hidden)]
967    impl crate::RequestBuilder for GetJob {
968        fn request_options(&mut self) -> &mut crate::RequestOptions {
969            &mut self.0.options
970        }
971    }
972
973    /// The request builder for [JobService::insert_job][crate::client::JobService::insert_job] calls.
974    ///
975    /// # Example
976    /// ```
977    /// # use google_cloud_bigquery_v2::builder::job_service::InsertJob;
978    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
979    ///
980    /// let builder = prepare_request_builder();
981    /// let response = builder.send().await?;
982    /// # Ok(()) }
983    ///
984    /// fn prepare_request_builder() -> InsertJob {
985    ///   # panic!();
986    ///   // ... details omitted ...
987    /// }
988    /// ```
989    #[derive(Clone, Debug)]
990    pub struct InsertJob(RequestBuilder<crate::model::InsertJobRequest>);
991
992    impl InsertJob {
993        pub(crate) fn new(
994            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
995        ) -> Self {
996            Self(RequestBuilder::new(stub))
997        }
998
999        /// Sets the full request, replacing any prior values.
1000        pub fn with_request<V: Into<crate::model::InsertJobRequest>>(mut self, v: V) -> Self {
1001            self.0.request = v.into();
1002            self
1003        }
1004
1005        /// Sets all the options, replacing any prior values.
1006        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1007            self.0.options = v.into();
1008            self
1009        }
1010
1011        /// Sends the request.
1012        pub async fn send(self) -> Result<crate::model::Job> {
1013            (*self.0.stub)
1014                .insert_job(self.0.request, self.0.options)
1015                .await
1016                .map(crate::Response::into_body)
1017        }
1018
1019        /// Creates a [Poller][google_cloud_lro::Poller] to work with `InsertJob`.
1020        pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
1021            let req = self.0.request.clone();
1022            let stub = self.0.stub.clone();
1023            let mut options = self.0.options.clone();
1024            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1025
1026            let polling_error_policy =
1027                std::sync::Arc::new(google_cloud_gax::polling_error_policy::AlwaysContinue);
1028            let polling_backoff_policy = std::sync::Arc::new(
1029                google_cloud_gax::exponential_backoff::ExponentialBackoff::default(),
1030            );
1031
1032            let shared_location = std::sync::Arc::new(std::sync::OnceLock::<String>::new());
1033            let shared_location_for_start = shared_location.clone();
1034            let shared_location_for_query = shared_location.clone();
1035
1036            let query = move |name: String| {
1037                let stub_clone = stub.clone();
1038                let options_clone = options.clone();
1039                let req_clone = req.clone();
1040                let shared_location_clone = shared_location_for_query.clone();
1041                async move {
1042                    let loc = shared_location_clone
1043                        .get()
1044                        .cloned()
1045                        .or_else(|| {
1046                            req_clone
1047                                .job
1048                                .as_ref()
1049                                .and_then(|j| j.job_reference.as_ref())
1050                                .and_then(|jr| jr.location.clone())
1051                        })
1052                        .unwrap_or_default();
1053
1054                    let get_req = crate::model::GetJobRequest {
1055                        project_id: req_clone.project_id.clone(),
1056                        job_id: name,
1057                        location: loc,
1058                        _unknown_fields: std::default::Default::default(),
1059                    };
1060                    let job = stub_clone
1061                        .get_job(get_req, options_clone)
1062                        .await
1063                        .map(crate::Response::into_body)?;
1064
1065                    Ok(job)
1066                }
1067            };
1068
1069            let start = move || {
1070                let shared_location_clone = shared_location_for_start.clone();
1071                async move {
1072                    let res = self.send().await;
1073                    if let Ok(ref job) = res
1074                        && let Some(ref jr) = job.job_reference
1075                        && let Some(ref loc) = jr.location
1076                    {
1077                        let _ = shared_location_clone.set(loc.clone());
1078                    }
1079                    res
1080                }
1081            };
1082
1083            google_cloud_lro::internal::new_discovery_poller(
1084                polling_error_policy,
1085                polling_backoff_policy,
1086                start,
1087                query,
1088            )
1089        }
1090
1091        /// Sets the value of [project_id][crate::model::InsertJobRequest::project_id].
1092        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1093            self.0.request.project_id = v.into();
1094            self
1095        }
1096
1097        /// Sets the value of [job][crate::model::InsertJobRequest::job].
1098        pub fn set_job<T>(mut self, v: T) -> Self
1099        where
1100            T: std::convert::Into<crate::model::Job>,
1101        {
1102            self.0.request.job = std::option::Option::Some(v.into());
1103            self
1104        }
1105
1106        /// Sets or clears the value of [job][crate::model::InsertJobRequest::job].
1107        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1108        where
1109            T: std::convert::Into<crate::model::Job>,
1110        {
1111            self.0.request.job = v.map(|x| x.into());
1112            self
1113        }
1114    }
1115
1116    #[doc(hidden)]
1117    impl crate::RequestBuilder for InsertJob {
1118        fn request_options(&mut self) -> &mut crate::RequestOptions {
1119            &mut self.0.options
1120        }
1121    }
1122
1123    /// The request builder for [JobService::delete_job][crate::client::JobService::delete_job] calls.
1124    ///
1125    /// # Example
1126    /// ```
1127    /// # use google_cloud_bigquery_v2::builder::job_service::DeleteJob;
1128    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1129    ///
1130    /// let builder = prepare_request_builder();
1131    /// let response = builder.send().await?;
1132    /// # Ok(()) }
1133    ///
1134    /// fn prepare_request_builder() -> DeleteJob {
1135    ///   # panic!();
1136    ///   // ... details omitted ...
1137    /// }
1138    /// ```
1139    #[derive(Clone, Debug)]
1140    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1141
1142    impl DeleteJob {
1143        pub(crate) fn new(
1144            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1145        ) -> Self {
1146            Self(RequestBuilder::new(stub))
1147        }
1148
1149        /// Sets the full request, replacing any prior values.
1150        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1151            self.0.request = v.into();
1152            self
1153        }
1154
1155        /// Sets all the options, replacing any prior values.
1156        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1157            self.0.options = v.into();
1158            self
1159        }
1160
1161        /// Sends the request.
1162        pub async fn send(self) -> Result<()> {
1163            (*self.0.stub)
1164                .delete_job(self.0.request, self.0.options)
1165                .await
1166                .map(crate::Response::into_body)
1167        }
1168
1169        /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
1170        ///
1171        /// This is a **required** field for requests.
1172        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1173            self.0.request.project_id = v.into();
1174            self
1175        }
1176
1177        /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
1178        ///
1179        /// This is a **required** field for requests.
1180        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1181            self.0.request.job_id = v.into();
1182            self
1183        }
1184
1185        /// Sets the value of [location][crate::model::DeleteJobRequest::location].
1186        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
1187            self.0.request.location = v.into();
1188            self
1189        }
1190    }
1191
1192    #[doc(hidden)]
1193    impl crate::RequestBuilder for DeleteJob {
1194        fn request_options(&mut self) -> &mut crate::RequestOptions {
1195            &mut self.0.options
1196        }
1197    }
1198
1199    /// The request builder for [JobService::list_jobs][crate::client::JobService::list_jobs] calls.
1200    ///
1201    /// # Example
1202    /// ```
1203    /// # use google_cloud_bigquery_v2::builder::job_service::ListJobs;
1204    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1205    /// use google_cloud_gax::paginator::ItemPaginator;
1206    ///
1207    /// let builder = prepare_request_builder();
1208    /// let mut items = builder.by_item();
1209    /// while let Some(result) = items.next().await {
1210    ///   let item = result?;
1211    /// }
1212    /// # Ok(()) }
1213    ///
1214    /// fn prepare_request_builder() -> ListJobs {
1215    ///   # panic!();
1216    ///   // ... details omitted ...
1217    /// }
1218    /// ```
1219    #[derive(Clone, Debug)]
1220    pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1221
1222    impl ListJobs {
1223        pub(crate) fn new(
1224            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1225        ) -> Self {
1226            Self(RequestBuilder::new(stub))
1227        }
1228
1229        /// Sets the full request, replacing any prior values.
1230        pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1231            self.0.request = v.into();
1232            self
1233        }
1234
1235        /// Sets all the options, replacing any prior values.
1236        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1237            self.0.options = v.into();
1238            self
1239        }
1240
1241        /// Sends the request.
1242        pub async fn send(self) -> Result<crate::model::JobList> {
1243            (*self.0.stub)
1244                .list_jobs(self.0.request, self.0.options)
1245                .await
1246                .map(crate::Response::into_body)
1247        }
1248
1249        /// Streams each page in the collection.
1250        pub fn by_page(
1251            self,
1252        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::JobList, crate::Error>
1253        {
1254            use std::clone::Clone;
1255            let token = self.0.request.page_token.clone();
1256            let execute = move |token: String| {
1257                let mut builder = self.clone();
1258                builder.0.request = builder.0.request.set_page_token(token);
1259                builder.send()
1260            };
1261            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1262        }
1263
1264        /// Streams each item in the collection.
1265        pub fn by_item(
1266            self,
1267        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::JobList, crate::Error>
1268        {
1269            use google_cloud_gax::paginator::Paginator;
1270            self.by_page().items()
1271        }
1272
1273        /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
1274        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1275            self.0.request.project_id = v.into();
1276            self
1277        }
1278
1279        /// Sets the value of [all_users][crate::model::ListJobsRequest::all_users].
1280        pub fn set_all_users<T: Into<bool>>(mut self, v: T) -> Self {
1281            self.0.request.all_users = v.into();
1282            self
1283        }
1284
1285        /// Sets the value of [max_results][crate::model::ListJobsRequest::max_results].
1286        pub fn set_max_results<T>(mut self, v: T) -> Self
1287        where
1288            T: std::convert::Into<wkt::Int32Value>,
1289        {
1290            self.0.request.max_results = std::option::Option::Some(v.into());
1291            self
1292        }
1293
1294        /// Sets or clears the value of [max_results][crate::model::ListJobsRequest::max_results].
1295        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1296        where
1297            T: std::convert::Into<wkt::Int32Value>,
1298        {
1299            self.0.request.max_results = v.map(|x| x.into());
1300            self
1301        }
1302
1303        /// Sets the value of [min_creation_time][crate::model::ListJobsRequest::min_creation_time].
1304        pub fn set_min_creation_time<T: Into<u64>>(mut self, v: T) -> Self {
1305            self.0.request.min_creation_time = v.into();
1306            self
1307        }
1308
1309        /// Sets the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
1310        pub fn set_max_creation_time<T>(mut self, v: T) -> Self
1311        where
1312            T: std::convert::Into<wkt::UInt64Value>,
1313        {
1314            self.0.request.max_creation_time = std::option::Option::Some(v.into());
1315            self
1316        }
1317
1318        /// Sets or clears the value of [max_creation_time][crate::model::ListJobsRequest::max_creation_time].
1319        pub fn set_or_clear_max_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
1320        where
1321            T: std::convert::Into<wkt::UInt64Value>,
1322        {
1323            self.0.request.max_creation_time = v.map(|x| x.into());
1324            self
1325        }
1326
1327        /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
1328        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1329            self.0.request.page_token = v.into();
1330            self
1331        }
1332
1333        /// Sets the value of [projection][crate::model::ListJobsRequest::projection].
1334        pub fn set_projection<T: Into<crate::model::list_jobs_request::Projection>>(
1335            mut self,
1336            v: T,
1337        ) -> Self {
1338            self.0.request.projection = v.into();
1339            self
1340        }
1341
1342        /// Sets the value of [state_filter][crate::model::ListJobsRequest::state_filter].
1343        pub fn set_state_filter<T, V>(mut self, v: T) -> Self
1344        where
1345            T: std::iter::IntoIterator<Item = V>,
1346            V: std::convert::Into<crate::model::list_jobs_request::StateFilter>,
1347        {
1348            use std::iter::Iterator;
1349            self.0.request.state_filter = v.into_iter().map(|i| i.into()).collect();
1350            self
1351        }
1352
1353        /// Sets the value of [parent_job_id][crate::model::ListJobsRequest::parent_job_id].
1354        pub fn set_parent_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1355            self.0.request.parent_job_id = v.into();
1356            self
1357        }
1358    }
1359
1360    #[doc(hidden)]
1361    impl crate::RequestBuilder for ListJobs {
1362        fn request_options(&mut self) -> &mut crate::RequestOptions {
1363            &mut self.0.options
1364        }
1365    }
1366
1367    /// The request builder for [JobService::get_query_results][crate::client::JobService::get_query_results] calls.
1368    ///
1369    /// # Example
1370    /// ```
1371    /// # use google_cloud_bigquery_v2::builder::job_service::GetQueryResults;
1372    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1373    ///
1374    /// let builder = prepare_request_builder();
1375    /// let response = builder.send().await?;
1376    /// # Ok(()) }
1377    ///
1378    /// fn prepare_request_builder() -> GetQueryResults {
1379    ///   # panic!();
1380    ///   // ... details omitted ...
1381    /// }
1382    /// ```
1383    #[derive(Clone, Debug)]
1384    pub struct GetQueryResults(RequestBuilder<crate::model::GetQueryResultsRequest>);
1385
1386    impl GetQueryResults {
1387        pub(crate) fn new(
1388            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1389        ) -> Self {
1390            Self(RequestBuilder::new(stub))
1391        }
1392
1393        /// Sets the full request, replacing any prior values.
1394        pub fn with_request<V: Into<crate::model::GetQueryResultsRequest>>(mut self, v: V) -> Self {
1395            self.0.request = v.into();
1396            self
1397        }
1398
1399        /// Sets all the options, replacing any prior values.
1400        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1401            self.0.options = v.into();
1402            self
1403        }
1404
1405        /// Sends the request.
1406        pub async fn send(self) -> Result<crate::model::GetQueryResultsResponse> {
1407            (*self.0.stub)
1408                .get_query_results(self.0.request, self.0.options)
1409                .await
1410                .map(crate::Response::into_body)
1411        }
1412
1413        /// Sets the value of [project_id][crate::model::GetQueryResultsRequest::project_id].
1414        ///
1415        /// This is a **required** field for requests.
1416        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1417            self.0.request.project_id = v.into();
1418            self
1419        }
1420
1421        /// Sets the value of [job_id][crate::model::GetQueryResultsRequest::job_id].
1422        ///
1423        /// This is a **required** field for requests.
1424        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1425            self.0.request.job_id = v.into();
1426            self
1427        }
1428
1429        /// Sets the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
1430        pub fn set_start_index<T>(mut self, v: T) -> Self
1431        where
1432            T: std::convert::Into<wkt::UInt64Value>,
1433        {
1434            self.0.request.start_index = std::option::Option::Some(v.into());
1435            self
1436        }
1437
1438        /// Sets or clears the value of [start_index][crate::model::GetQueryResultsRequest::start_index].
1439        pub fn set_or_clear_start_index<T>(mut self, v: std::option::Option<T>) -> Self
1440        where
1441            T: std::convert::Into<wkt::UInt64Value>,
1442        {
1443            self.0.request.start_index = v.map(|x| x.into());
1444            self
1445        }
1446
1447        /// Sets the value of [page_token][crate::model::GetQueryResultsRequest::page_token].
1448        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449            self.0.request.page_token = v.into();
1450            self
1451        }
1452
1453        /// Sets the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
1454        pub fn set_max_results<T>(mut self, v: T) -> Self
1455        where
1456            T: std::convert::Into<wkt::UInt32Value>,
1457        {
1458            self.0.request.max_results = std::option::Option::Some(v.into());
1459            self
1460        }
1461
1462        /// Sets or clears the value of [max_results][crate::model::GetQueryResultsRequest::max_results].
1463        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1464        where
1465            T: std::convert::Into<wkt::UInt32Value>,
1466        {
1467            self.0.request.max_results = v.map(|x| x.into());
1468            self
1469        }
1470
1471        /// Sets the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
1472        pub fn set_timeout_ms<T>(mut self, v: T) -> Self
1473        where
1474            T: std::convert::Into<wkt::UInt32Value>,
1475        {
1476            self.0.request.timeout_ms = std::option::Option::Some(v.into());
1477            self
1478        }
1479
1480        /// Sets or clears the value of [timeout_ms][crate::model::GetQueryResultsRequest::timeout_ms].
1481        pub fn set_or_clear_timeout_ms<T>(mut self, v: std::option::Option<T>) -> Self
1482        where
1483            T: std::convert::Into<wkt::UInt32Value>,
1484        {
1485            self.0.request.timeout_ms = v.map(|x| x.into());
1486            self
1487        }
1488
1489        /// Sets the value of [location][crate::model::GetQueryResultsRequest::location].
1490        pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
1491            self.0.request.location = v.into();
1492            self
1493        }
1494
1495        /// Sets the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
1496        pub fn set_format_options<T>(mut self, v: T) -> Self
1497        where
1498            T: std::convert::Into<crate::model::DataFormatOptions>,
1499        {
1500            self.0.request.format_options = std::option::Option::Some(v.into());
1501            self
1502        }
1503
1504        /// Sets or clears the value of [format_options][crate::model::GetQueryResultsRequest::format_options].
1505        pub fn set_or_clear_format_options<T>(mut self, v: std::option::Option<T>) -> Self
1506        where
1507            T: std::convert::Into<crate::model::DataFormatOptions>,
1508        {
1509            self.0.request.format_options = v.map(|x| x.into());
1510            self
1511        }
1512    }
1513
1514    #[doc(hidden)]
1515    impl crate::RequestBuilder for GetQueryResults {
1516        fn request_options(&mut self) -> &mut crate::RequestOptions {
1517            &mut self.0.options
1518        }
1519    }
1520
1521    /// The request builder for [JobService::query][crate::client::JobService::query] calls.
1522    ///
1523    /// # Example
1524    /// ```
1525    /// # use google_cloud_bigquery_v2::builder::job_service::Query;
1526    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1527    ///
1528    /// let builder = prepare_request_builder();
1529    /// let response = builder.send().await?;
1530    /// # Ok(()) }
1531    ///
1532    /// fn prepare_request_builder() -> Query {
1533    ///   # panic!();
1534    ///   // ... details omitted ...
1535    /// }
1536    /// ```
1537    #[derive(Clone, Debug)]
1538    pub struct Query(RequestBuilder<crate::model::PostQueryRequest>);
1539
1540    impl Query {
1541        pub(crate) fn new(
1542            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
1543        ) -> Self {
1544            Self(RequestBuilder::new(stub))
1545        }
1546
1547        /// Sets the full request, replacing any prior values.
1548        pub fn with_request<V: Into<crate::model::PostQueryRequest>>(mut self, v: V) -> Self {
1549            self.0.request = v.into();
1550            self
1551        }
1552
1553        /// Sets all the options, replacing any prior values.
1554        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1555            self.0.options = v.into();
1556            self
1557        }
1558
1559        /// Sends the request.
1560        pub async fn send(self) -> Result<crate::model::QueryResponse> {
1561            (*self.0.stub)
1562                .query(self.0.request, self.0.options)
1563                .await
1564                .map(crate::Response::into_body)
1565        }
1566
1567        /// Sets the value of [project_id][crate::model::PostQueryRequest::project_id].
1568        ///
1569        /// This is a **required** field for requests.
1570        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1571            self.0.request.project_id = v.into();
1572            self
1573        }
1574
1575        /// Sets the value of [query_request][crate::model::PostQueryRequest::query_request].
1576        pub fn set_query_request<T>(mut self, v: T) -> Self
1577        where
1578            T: std::convert::Into<crate::model::QueryRequest>,
1579        {
1580            self.0.request.query_request = std::option::Option::Some(v.into());
1581            self
1582        }
1583
1584        /// Sets or clears the value of [query_request][crate::model::PostQueryRequest::query_request].
1585        pub fn set_or_clear_query_request<T>(mut self, v: std::option::Option<T>) -> Self
1586        where
1587            T: std::convert::Into<crate::model::QueryRequest>,
1588        {
1589            self.0.request.query_request = v.map(|x| x.into());
1590            self
1591        }
1592    }
1593
1594    #[doc(hidden)]
1595    impl crate::RequestBuilder for Query {
1596        fn request_options(&mut self) -> &mut crate::RequestOptions {
1597            &mut self.0.options
1598        }
1599    }
1600}
1601
1602/// Request and client builders for [ModelService][crate::client::ModelService].
1603pub mod model_service {
1604    use crate::Result;
1605
1606    /// A builder for [ModelService][crate::client::ModelService].
1607    ///
1608    /// ```
1609    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1610    /// # use google_cloud_bigquery_v2::*;
1611    /// # use builder::model_service::ClientBuilder;
1612    /// # use client::ModelService;
1613    /// let builder : ClientBuilder = ModelService::builder();
1614    /// let client = builder
1615    ///     .with_endpoint("https://bigquery.googleapis.com")
1616    ///     .build().await?;
1617    /// # Ok(()) }
1618    /// ```
1619    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1620
1621    pub(crate) mod client {
1622        use super::super::super::client::ModelService;
1623        pub struct Factory;
1624        impl crate::ClientFactory for Factory {
1625            type Client = ModelService;
1626            type Credentials = gaxi::options::Credentials;
1627            async fn build(
1628                self,
1629                config: gaxi::options::ClientConfig,
1630            ) -> crate::ClientBuilderResult<Self::Client> {
1631                Self::Client::new(config).await
1632            }
1633        }
1634    }
1635
1636    /// Common implementation for [crate::client::ModelService] request builders.
1637    #[derive(Clone, Debug)]
1638    pub(crate) struct RequestBuilder<R: std::default::Default> {
1639        stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1640        request: R,
1641        options: crate::RequestOptions,
1642    }
1643
1644    impl<R> RequestBuilder<R>
1645    where
1646        R: std::default::Default,
1647    {
1648        pub(crate) fn new(
1649            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1650        ) -> Self {
1651            Self {
1652                stub,
1653                request: R::default(),
1654                options: crate::RequestOptions::default(),
1655            }
1656        }
1657    }
1658
1659    /// The request builder for [ModelService::get_model][crate::client::ModelService::get_model] calls.
1660    ///
1661    /// # Example
1662    /// ```
1663    /// # use google_cloud_bigquery_v2::builder::model_service::GetModel;
1664    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1665    ///
1666    /// let builder = prepare_request_builder();
1667    /// let response = builder.send().await?;
1668    /// # Ok(()) }
1669    ///
1670    /// fn prepare_request_builder() -> GetModel {
1671    ///   # panic!();
1672    ///   // ... details omitted ...
1673    /// }
1674    /// ```
1675    #[derive(Clone, Debug)]
1676    pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
1677
1678    impl GetModel {
1679        pub(crate) fn new(
1680            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1681        ) -> Self {
1682            Self(RequestBuilder::new(stub))
1683        }
1684
1685        /// Sets the full request, replacing any prior values.
1686        pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
1687            self.0.request = v.into();
1688            self
1689        }
1690
1691        /// Sets all the options, replacing any prior values.
1692        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1693            self.0.options = v.into();
1694            self
1695        }
1696
1697        /// Sends the request.
1698        pub async fn send(self) -> Result<crate::model::Model> {
1699            (*self.0.stub)
1700                .get_model(self.0.request, self.0.options)
1701                .await
1702                .map(crate::Response::into_body)
1703        }
1704
1705        /// Sets the value of [project_id][crate::model::GetModelRequest::project_id].
1706        ///
1707        /// This is a **required** field for requests.
1708        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709            self.0.request.project_id = v.into();
1710            self
1711        }
1712
1713        /// Sets the value of [dataset_id][crate::model::GetModelRequest::dataset_id].
1714        ///
1715        /// This is a **required** field for requests.
1716        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1717            self.0.request.dataset_id = v.into();
1718            self
1719        }
1720
1721        /// Sets the value of [model_id][crate::model::GetModelRequest::model_id].
1722        ///
1723        /// This is a **required** field for requests.
1724        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1725            self.0.request.model_id = v.into();
1726            self
1727        }
1728    }
1729
1730    #[doc(hidden)]
1731    impl crate::RequestBuilder for GetModel {
1732        fn request_options(&mut self) -> &mut crate::RequestOptions {
1733            &mut self.0.options
1734        }
1735    }
1736
1737    /// The request builder for [ModelService::list_models][crate::client::ModelService::list_models] calls.
1738    ///
1739    /// # Example
1740    /// ```
1741    /// # use google_cloud_bigquery_v2::builder::model_service::ListModels;
1742    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1743    /// use google_cloud_gax::paginator::ItemPaginator;
1744    ///
1745    /// let builder = prepare_request_builder();
1746    /// let mut items = builder.by_item();
1747    /// while let Some(result) = items.next().await {
1748    ///   let item = result?;
1749    /// }
1750    /// # Ok(()) }
1751    ///
1752    /// fn prepare_request_builder() -> ListModels {
1753    ///   # panic!();
1754    ///   // ... details omitted ...
1755    /// }
1756    /// ```
1757    #[derive(Clone, Debug)]
1758    pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
1759
1760    impl ListModels {
1761        pub(crate) fn new(
1762            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1763        ) -> Self {
1764            Self(RequestBuilder::new(stub))
1765        }
1766
1767        /// Sets the full request, replacing any prior values.
1768        pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
1769            self.0.request = v.into();
1770            self
1771        }
1772
1773        /// Sets all the options, replacing any prior values.
1774        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1775            self.0.options = v.into();
1776            self
1777        }
1778
1779        /// Sends the request.
1780        pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
1781            (*self.0.stub)
1782                .list_models(self.0.request, self.0.options)
1783                .await
1784                .map(crate::Response::into_body)
1785        }
1786
1787        /// Streams each page in the collection.
1788        pub fn by_page(
1789            self,
1790        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
1791        {
1792            use std::clone::Clone;
1793            let token = self.0.request.page_token.clone();
1794            let execute = move |token: String| {
1795                let mut builder = self.clone();
1796                builder.0.request = builder.0.request.set_page_token(token);
1797                builder.send()
1798            };
1799            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1800        }
1801
1802        /// Streams each item in the collection.
1803        pub fn by_item(
1804            self,
1805        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1806            crate::model::ListModelsResponse,
1807            crate::Error,
1808        > {
1809            use google_cloud_gax::paginator::Paginator;
1810            self.by_page().items()
1811        }
1812
1813        /// Sets the value of [project_id][crate::model::ListModelsRequest::project_id].
1814        ///
1815        /// This is a **required** field for requests.
1816        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1817            self.0.request.project_id = v.into();
1818            self
1819        }
1820
1821        /// Sets the value of [dataset_id][crate::model::ListModelsRequest::dataset_id].
1822        ///
1823        /// This is a **required** field for requests.
1824        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1825            self.0.request.dataset_id = v.into();
1826            self
1827        }
1828
1829        /// Sets the value of [max_results][crate::model::ListModelsRequest::max_results].
1830        pub fn set_max_results<T>(mut self, v: T) -> Self
1831        where
1832            T: std::convert::Into<wkt::UInt32Value>,
1833        {
1834            self.0.request.max_results = std::option::Option::Some(v.into());
1835            self
1836        }
1837
1838        /// Sets or clears the value of [max_results][crate::model::ListModelsRequest::max_results].
1839        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
1840        where
1841            T: std::convert::Into<wkt::UInt32Value>,
1842        {
1843            self.0.request.max_results = v.map(|x| x.into());
1844            self
1845        }
1846
1847        /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
1848        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1849            self.0.request.page_token = v.into();
1850            self
1851        }
1852    }
1853
1854    #[doc(hidden)]
1855    impl crate::RequestBuilder for ListModels {
1856        fn request_options(&mut self) -> &mut crate::RequestOptions {
1857            &mut self.0.options
1858        }
1859    }
1860
1861    /// The request builder for [ModelService::patch_model][crate::client::ModelService::patch_model] calls.
1862    ///
1863    /// # Example
1864    /// ```
1865    /// # use google_cloud_bigquery_v2::builder::model_service::PatchModel;
1866    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1867    ///
1868    /// let builder = prepare_request_builder();
1869    /// let response = builder.send().await?;
1870    /// # Ok(()) }
1871    ///
1872    /// fn prepare_request_builder() -> PatchModel {
1873    ///   # panic!();
1874    ///   // ... details omitted ...
1875    /// }
1876    /// ```
1877    #[derive(Clone, Debug)]
1878    pub struct PatchModel(RequestBuilder<crate::model::PatchModelRequest>);
1879
1880    impl PatchModel {
1881        pub(crate) fn new(
1882            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1883        ) -> Self {
1884            Self(RequestBuilder::new(stub))
1885        }
1886
1887        /// Sets the full request, replacing any prior values.
1888        pub fn with_request<V: Into<crate::model::PatchModelRequest>>(mut self, v: V) -> Self {
1889            self.0.request = v.into();
1890            self
1891        }
1892
1893        /// Sets all the options, replacing any prior values.
1894        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1895            self.0.options = v.into();
1896            self
1897        }
1898
1899        /// Sends the request.
1900        pub async fn send(self) -> Result<crate::model::Model> {
1901            (*self.0.stub)
1902                .patch_model(self.0.request, self.0.options)
1903                .await
1904                .map(crate::Response::into_body)
1905        }
1906
1907        /// Sets the value of [project_id][crate::model::PatchModelRequest::project_id].
1908        ///
1909        /// This is a **required** field for requests.
1910        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1911            self.0.request.project_id = v.into();
1912            self
1913        }
1914
1915        /// Sets the value of [dataset_id][crate::model::PatchModelRequest::dataset_id].
1916        ///
1917        /// This is a **required** field for requests.
1918        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1919            self.0.request.dataset_id = v.into();
1920            self
1921        }
1922
1923        /// Sets the value of [model_id][crate::model::PatchModelRequest::model_id].
1924        ///
1925        /// This is a **required** field for requests.
1926        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1927            self.0.request.model_id = v.into();
1928            self
1929        }
1930
1931        /// Sets the value of [model][crate::model::PatchModelRequest::model].
1932        ///
1933        /// This is a **required** field for requests.
1934        pub fn set_model<T>(mut self, v: T) -> Self
1935        where
1936            T: std::convert::Into<crate::model::Model>,
1937        {
1938            self.0.request.model = std::option::Option::Some(v.into());
1939            self
1940        }
1941
1942        /// Sets or clears the value of [model][crate::model::PatchModelRequest::model].
1943        ///
1944        /// This is a **required** field for requests.
1945        pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
1946        where
1947            T: std::convert::Into<crate::model::Model>,
1948        {
1949            self.0.request.model = v.map(|x| x.into());
1950            self
1951        }
1952    }
1953
1954    #[doc(hidden)]
1955    impl crate::RequestBuilder for PatchModel {
1956        fn request_options(&mut self) -> &mut crate::RequestOptions {
1957            &mut self.0.options
1958        }
1959    }
1960
1961    /// The request builder for [ModelService::delete_model][crate::client::ModelService::delete_model] calls.
1962    ///
1963    /// # Example
1964    /// ```
1965    /// # use google_cloud_bigquery_v2::builder::model_service::DeleteModel;
1966    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
1967    ///
1968    /// let builder = prepare_request_builder();
1969    /// let response = builder.send().await?;
1970    /// # Ok(()) }
1971    ///
1972    /// fn prepare_request_builder() -> DeleteModel {
1973    ///   # panic!();
1974    ///   // ... details omitted ...
1975    /// }
1976    /// ```
1977    #[derive(Clone, Debug)]
1978    pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
1979
1980    impl DeleteModel {
1981        pub(crate) fn new(
1982            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
1983        ) -> Self {
1984            Self(RequestBuilder::new(stub))
1985        }
1986
1987        /// Sets the full request, replacing any prior values.
1988        pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
1989            self.0.request = v.into();
1990            self
1991        }
1992
1993        /// Sets all the options, replacing any prior values.
1994        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1995            self.0.options = v.into();
1996            self
1997        }
1998
1999        /// Sends the request.
2000        pub async fn send(self) -> Result<()> {
2001            (*self.0.stub)
2002                .delete_model(self.0.request, self.0.options)
2003                .await
2004                .map(crate::Response::into_body)
2005        }
2006
2007        /// Sets the value of [project_id][crate::model::DeleteModelRequest::project_id].
2008        ///
2009        /// This is a **required** field for requests.
2010        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2011            self.0.request.project_id = v.into();
2012            self
2013        }
2014
2015        /// Sets the value of [dataset_id][crate::model::DeleteModelRequest::dataset_id].
2016        ///
2017        /// This is a **required** field for requests.
2018        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2019            self.0.request.dataset_id = v.into();
2020            self
2021        }
2022
2023        /// Sets the value of [model_id][crate::model::DeleteModelRequest::model_id].
2024        ///
2025        /// This is a **required** field for requests.
2026        pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2027            self.0.request.model_id = v.into();
2028            self
2029        }
2030    }
2031
2032    #[doc(hidden)]
2033    impl crate::RequestBuilder for DeleteModel {
2034        fn request_options(&mut self) -> &mut crate::RequestOptions {
2035            &mut self.0.options
2036        }
2037    }
2038}
2039
2040/// Request and client builders for [ProjectService][crate::client::ProjectService].
2041pub mod project_service {
2042    use crate::Result;
2043
2044    /// A builder for [ProjectService][crate::client::ProjectService].
2045    ///
2046    /// ```
2047    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2048    /// # use google_cloud_bigquery_v2::*;
2049    /// # use builder::project_service::ClientBuilder;
2050    /// # use client::ProjectService;
2051    /// let builder : ClientBuilder = ProjectService::builder();
2052    /// let client = builder
2053    ///     .with_endpoint("https://bigquery.googleapis.com")
2054    ///     .build().await?;
2055    /// # Ok(()) }
2056    /// ```
2057    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2058
2059    pub(crate) mod client {
2060        use super::super::super::client::ProjectService;
2061        pub struct Factory;
2062        impl crate::ClientFactory for Factory {
2063            type Client = ProjectService;
2064            type Credentials = gaxi::options::Credentials;
2065            async fn build(
2066                self,
2067                config: gaxi::options::ClientConfig,
2068            ) -> crate::ClientBuilderResult<Self::Client> {
2069                Self::Client::new(config).await
2070            }
2071        }
2072    }
2073
2074    /// Common implementation for [crate::client::ProjectService] request builders.
2075    #[derive(Clone, Debug)]
2076    pub(crate) struct RequestBuilder<R: std::default::Default> {
2077        stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2078        request: R,
2079        options: crate::RequestOptions,
2080    }
2081
2082    impl<R> RequestBuilder<R>
2083    where
2084        R: std::default::Default,
2085    {
2086        pub(crate) fn new(
2087            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2088        ) -> Self {
2089            Self {
2090                stub,
2091                request: R::default(),
2092                options: crate::RequestOptions::default(),
2093            }
2094        }
2095    }
2096
2097    /// The request builder for [ProjectService::get_service_account][crate::client::ProjectService::get_service_account] calls.
2098    ///
2099    /// # Example
2100    /// ```
2101    /// # use google_cloud_bigquery_v2::builder::project_service::GetServiceAccount;
2102    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2103    ///
2104    /// let builder = prepare_request_builder();
2105    /// let response = builder.send().await?;
2106    /// # Ok(()) }
2107    ///
2108    /// fn prepare_request_builder() -> GetServiceAccount {
2109    ///   # panic!();
2110    ///   // ... details omitted ...
2111    /// }
2112    /// ```
2113    #[derive(Clone, Debug)]
2114    pub struct GetServiceAccount(RequestBuilder<crate::model::GetServiceAccountRequest>);
2115
2116    impl GetServiceAccount {
2117        pub(crate) fn new(
2118            stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
2119        ) -> Self {
2120            Self(RequestBuilder::new(stub))
2121        }
2122
2123        /// Sets the full request, replacing any prior values.
2124        pub fn with_request<V: Into<crate::model::GetServiceAccountRequest>>(
2125            mut self,
2126            v: V,
2127        ) -> Self {
2128            self.0.request = v.into();
2129            self
2130        }
2131
2132        /// Sets all the options, replacing any prior values.
2133        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2134            self.0.options = v.into();
2135            self
2136        }
2137
2138        /// Sends the request.
2139        pub async fn send(self) -> Result<crate::model::GetServiceAccountResponse> {
2140            (*self.0.stub)
2141                .get_service_account(self.0.request, self.0.options)
2142                .await
2143                .map(crate::Response::into_body)
2144        }
2145
2146        /// Sets the value of [project_id][crate::model::GetServiceAccountRequest::project_id].
2147        ///
2148        /// This is a **required** field for requests.
2149        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2150            self.0.request.project_id = v.into();
2151            self
2152        }
2153    }
2154
2155    #[doc(hidden)]
2156    impl crate::RequestBuilder for GetServiceAccount {
2157        fn request_options(&mut self) -> &mut crate::RequestOptions {
2158            &mut self.0.options
2159        }
2160    }
2161}
2162
2163/// Request and client builders for [RoutineService][crate::client::RoutineService].
2164pub mod routine_service {
2165    use crate::Result;
2166
2167    /// A builder for [RoutineService][crate::client::RoutineService].
2168    ///
2169    /// ```
2170    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2171    /// # use google_cloud_bigquery_v2::*;
2172    /// # use builder::routine_service::ClientBuilder;
2173    /// # use client::RoutineService;
2174    /// let builder : ClientBuilder = RoutineService::builder();
2175    /// let client = builder
2176    ///     .with_endpoint("https://bigquery.googleapis.com")
2177    ///     .build().await?;
2178    /// # Ok(()) }
2179    /// ```
2180    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2181
2182    pub(crate) mod client {
2183        use super::super::super::client::RoutineService;
2184        pub struct Factory;
2185        impl crate::ClientFactory for Factory {
2186            type Client = RoutineService;
2187            type Credentials = gaxi::options::Credentials;
2188            async fn build(
2189                self,
2190                config: gaxi::options::ClientConfig,
2191            ) -> crate::ClientBuilderResult<Self::Client> {
2192                Self::Client::new(config).await
2193            }
2194        }
2195    }
2196
2197    /// Common implementation for [crate::client::RoutineService] request builders.
2198    #[derive(Clone, Debug)]
2199    pub(crate) struct RequestBuilder<R: std::default::Default> {
2200        stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2201        request: R,
2202        options: crate::RequestOptions,
2203    }
2204
2205    impl<R> RequestBuilder<R>
2206    where
2207        R: std::default::Default,
2208    {
2209        pub(crate) fn new(
2210            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2211        ) -> Self {
2212            Self {
2213                stub,
2214                request: R::default(),
2215                options: crate::RequestOptions::default(),
2216            }
2217        }
2218    }
2219
2220    /// The request builder for [RoutineService::get_routine][crate::client::RoutineService::get_routine] calls.
2221    ///
2222    /// # Example
2223    /// ```
2224    /// # use google_cloud_bigquery_v2::builder::routine_service::GetRoutine;
2225    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2226    ///
2227    /// let builder = prepare_request_builder();
2228    /// let response = builder.send().await?;
2229    /// # Ok(()) }
2230    ///
2231    /// fn prepare_request_builder() -> GetRoutine {
2232    ///   # panic!();
2233    ///   // ... details omitted ...
2234    /// }
2235    /// ```
2236    #[derive(Clone, Debug)]
2237    pub struct GetRoutine(RequestBuilder<crate::model::GetRoutineRequest>);
2238
2239    impl GetRoutine {
2240        pub(crate) fn new(
2241            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2242        ) -> Self {
2243            Self(RequestBuilder::new(stub))
2244        }
2245
2246        /// Sets the full request, replacing any prior values.
2247        pub fn with_request<V: Into<crate::model::GetRoutineRequest>>(mut self, v: V) -> Self {
2248            self.0.request = v.into();
2249            self
2250        }
2251
2252        /// Sets all the options, replacing any prior values.
2253        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2254            self.0.options = v.into();
2255            self
2256        }
2257
2258        /// Sends the request.
2259        pub async fn send(self) -> Result<crate::model::Routine> {
2260            (*self.0.stub)
2261                .get_routine(self.0.request, self.0.options)
2262                .await
2263                .map(crate::Response::into_body)
2264        }
2265
2266        /// Sets the value of [project_id][crate::model::GetRoutineRequest::project_id].
2267        ///
2268        /// This is a **required** field for requests.
2269        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2270            self.0.request.project_id = v.into();
2271            self
2272        }
2273
2274        /// Sets the value of [dataset_id][crate::model::GetRoutineRequest::dataset_id].
2275        ///
2276        /// This is a **required** field for requests.
2277        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278            self.0.request.dataset_id = v.into();
2279            self
2280        }
2281
2282        /// Sets the value of [routine_id][crate::model::GetRoutineRequest::routine_id].
2283        ///
2284        /// This is a **required** field for requests.
2285        pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2286            self.0.request.routine_id = v.into();
2287            self
2288        }
2289    }
2290
2291    #[doc(hidden)]
2292    impl crate::RequestBuilder for GetRoutine {
2293        fn request_options(&mut self) -> &mut crate::RequestOptions {
2294            &mut self.0.options
2295        }
2296    }
2297
2298    /// The request builder for [RoutineService::insert_routine][crate::client::RoutineService::insert_routine] calls.
2299    ///
2300    /// # Example
2301    /// ```
2302    /// # use google_cloud_bigquery_v2::builder::routine_service::InsertRoutine;
2303    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2304    ///
2305    /// let builder = prepare_request_builder();
2306    /// let response = builder.send().await?;
2307    /// # Ok(()) }
2308    ///
2309    /// fn prepare_request_builder() -> InsertRoutine {
2310    ///   # panic!();
2311    ///   // ... details omitted ...
2312    /// }
2313    /// ```
2314    #[derive(Clone, Debug)]
2315    pub struct InsertRoutine(RequestBuilder<crate::model::InsertRoutineRequest>);
2316
2317    impl InsertRoutine {
2318        pub(crate) fn new(
2319            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2320        ) -> Self {
2321            Self(RequestBuilder::new(stub))
2322        }
2323
2324        /// Sets the full request, replacing any prior values.
2325        pub fn with_request<V: Into<crate::model::InsertRoutineRequest>>(mut self, v: V) -> Self {
2326            self.0.request = v.into();
2327            self
2328        }
2329
2330        /// Sets all the options, replacing any prior values.
2331        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2332            self.0.options = v.into();
2333            self
2334        }
2335
2336        /// Sends the request.
2337        pub async fn send(self) -> Result<crate::model::Routine> {
2338            (*self.0.stub)
2339                .insert_routine(self.0.request, self.0.options)
2340                .await
2341                .map(crate::Response::into_body)
2342        }
2343
2344        /// Sets the value of [project_id][crate::model::InsertRoutineRequest::project_id].
2345        ///
2346        /// This is a **required** field for requests.
2347        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2348            self.0.request.project_id = v.into();
2349            self
2350        }
2351
2352        /// Sets the value of [dataset_id][crate::model::InsertRoutineRequest::dataset_id].
2353        ///
2354        /// This is a **required** field for requests.
2355        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2356            self.0.request.dataset_id = v.into();
2357            self
2358        }
2359
2360        /// Sets the value of [routine][crate::model::InsertRoutineRequest::routine].
2361        ///
2362        /// This is a **required** field for requests.
2363        pub fn set_routine<T>(mut self, v: T) -> Self
2364        where
2365            T: std::convert::Into<crate::model::Routine>,
2366        {
2367            self.0.request.routine = std::option::Option::Some(v.into());
2368            self
2369        }
2370
2371        /// Sets or clears the value of [routine][crate::model::InsertRoutineRequest::routine].
2372        ///
2373        /// This is a **required** field for requests.
2374        pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
2375        where
2376            T: std::convert::Into<crate::model::Routine>,
2377        {
2378            self.0.request.routine = v.map(|x| x.into());
2379            self
2380        }
2381    }
2382
2383    #[doc(hidden)]
2384    impl crate::RequestBuilder for InsertRoutine {
2385        fn request_options(&mut self) -> &mut crate::RequestOptions {
2386            &mut self.0.options
2387        }
2388    }
2389
2390    /// The request builder for [RoutineService::update_routine][crate::client::RoutineService::update_routine] calls.
2391    ///
2392    /// # Example
2393    /// ```
2394    /// # use google_cloud_bigquery_v2::builder::routine_service::UpdateRoutine;
2395    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2396    ///
2397    /// let builder = prepare_request_builder();
2398    /// let response = builder.send().await?;
2399    /// # Ok(()) }
2400    ///
2401    /// fn prepare_request_builder() -> UpdateRoutine {
2402    ///   # panic!();
2403    ///   // ... details omitted ...
2404    /// }
2405    /// ```
2406    #[derive(Clone, Debug)]
2407    pub struct UpdateRoutine(RequestBuilder<crate::model::UpdateRoutineRequest>);
2408
2409    impl UpdateRoutine {
2410        pub(crate) fn new(
2411            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2412        ) -> Self {
2413            Self(RequestBuilder::new(stub))
2414        }
2415
2416        /// Sets the full request, replacing any prior values.
2417        pub fn with_request<V: Into<crate::model::UpdateRoutineRequest>>(mut self, v: V) -> Self {
2418            self.0.request = v.into();
2419            self
2420        }
2421
2422        /// Sets all the options, replacing any prior values.
2423        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2424            self.0.options = v.into();
2425            self
2426        }
2427
2428        /// Sends the request.
2429        pub async fn send(self) -> Result<crate::model::Routine> {
2430            (*self.0.stub)
2431                .update_routine(self.0.request, self.0.options)
2432                .await
2433                .map(crate::Response::into_body)
2434        }
2435
2436        /// Sets the value of [project_id][crate::model::UpdateRoutineRequest::project_id].
2437        ///
2438        /// This is a **required** field for requests.
2439        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2440            self.0.request.project_id = v.into();
2441            self
2442        }
2443
2444        /// Sets the value of [dataset_id][crate::model::UpdateRoutineRequest::dataset_id].
2445        ///
2446        /// This is a **required** field for requests.
2447        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2448            self.0.request.dataset_id = v.into();
2449            self
2450        }
2451
2452        /// Sets the value of [routine_id][crate::model::UpdateRoutineRequest::routine_id].
2453        ///
2454        /// This is a **required** field for requests.
2455        pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2456            self.0.request.routine_id = v.into();
2457            self
2458        }
2459
2460        /// Sets the value of [routine][crate::model::UpdateRoutineRequest::routine].
2461        ///
2462        /// This is a **required** field for requests.
2463        pub fn set_routine<T>(mut self, v: T) -> Self
2464        where
2465            T: std::convert::Into<crate::model::Routine>,
2466        {
2467            self.0.request.routine = std::option::Option::Some(v.into());
2468            self
2469        }
2470
2471        /// Sets or clears the value of [routine][crate::model::UpdateRoutineRequest::routine].
2472        ///
2473        /// This is a **required** field for requests.
2474        pub fn set_or_clear_routine<T>(mut self, v: std::option::Option<T>) -> Self
2475        where
2476            T: std::convert::Into<crate::model::Routine>,
2477        {
2478            self.0.request.routine = v.map(|x| x.into());
2479            self
2480        }
2481    }
2482
2483    #[doc(hidden)]
2484    impl crate::RequestBuilder for UpdateRoutine {
2485        fn request_options(&mut self) -> &mut crate::RequestOptions {
2486            &mut self.0.options
2487        }
2488    }
2489
2490    /// The request builder for [RoutineService::delete_routine][crate::client::RoutineService::delete_routine] calls.
2491    ///
2492    /// # Example
2493    /// ```
2494    /// # use google_cloud_bigquery_v2::builder::routine_service::DeleteRoutine;
2495    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2496    ///
2497    /// let builder = prepare_request_builder();
2498    /// let response = builder.send().await?;
2499    /// # Ok(()) }
2500    ///
2501    /// fn prepare_request_builder() -> DeleteRoutine {
2502    ///   # panic!();
2503    ///   // ... details omitted ...
2504    /// }
2505    /// ```
2506    #[derive(Clone, Debug)]
2507    pub struct DeleteRoutine(RequestBuilder<crate::model::DeleteRoutineRequest>);
2508
2509    impl DeleteRoutine {
2510        pub(crate) fn new(
2511            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2512        ) -> Self {
2513            Self(RequestBuilder::new(stub))
2514        }
2515
2516        /// Sets the full request, replacing any prior values.
2517        pub fn with_request<V: Into<crate::model::DeleteRoutineRequest>>(mut self, v: V) -> Self {
2518            self.0.request = v.into();
2519            self
2520        }
2521
2522        /// Sets all the options, replacing any prior values.
2523        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2524            self.0.options = v.into();
2525            self
2526        }
2527
2528        /// Sends the request.
2529        pub async fn send(self) -> Result<()> {
2530            (*self.0.stub)
2531                .delete_routine(self.0.request, self.0.options)
2532                .await
2533                .map(crate::Response::into_body)
2534        }
2535
2536        /// Sets the value of [project_id][crate::model::DeleteRoutineRequest::project_id].
2537        ///
2538        /// This is a **required** field for requests.
2539        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2540            self.0.request.project_id = v.into();
2541            self
2542        }
2543
2544        /// Sets the value of [dataset_id][crate::model::DeleteRoutineRequest::dataset_id].
2545        ///
2546        /// This is a **required** field for requests.
2547        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2548            self.0.request.dataset_id = v.into();
2549            self
2550        }
2551
2552        /// Sets the value of [routine_id][crate::model::DeleteRoutineRequest::routine_id].
2553        ///
2554        /// This is a **required** field for requests.
2555        pub fn set_routine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2556            self.0.request.routine_id = v.into();
2557            self
2558        }
2559    }
2560
2561    #[doc(hidden)]
2562    impl crate::RequestBuilder for DeleteRoutine {
2563        fn request_options(&mut self) -> &mut crate::RequestOptions {
2564            &mut self.0.options
2565        }
2566    }
2567
2568    /// The request builder for [RoutineService::list_routines][crate::client::RoutineService::list_routines] calls.
2569    ///
2570    /// # Example
2571    /// ```
2572    /// # use google_cloud_bigquery_v2::builder::routine_service::ListRoutines;
2573    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2574    /// use google_cloud_gax::paginator::ItemPaginator;
2575    ///
2576    /// let builder = prepare_request_builder();
2577    /// let mut items = builder.by_item();
2578    /// while let Some(result) = items.next().await {
2579    ///   let item = result?;
2580    /// }
2581    /// # Ok(()) }
2582    ///
2583    /// fn prepare_request_builder() -> ListRoutines {
2584    ///   # panic!();
2585    ///   // ... details omitted ...
2586    /// }
2587    /// ```
2588    #[derive(Clone, Debug)]
2589    pub struct ListRoutines(RequestBuilder<crate::model::ListRoutinesRequest>);
2590
2591    impl ListRoutines {
2592        pub(crate) fn new(
2593            stub: std::sync::Arc<dyn super::super::stub::dynamic::RoutineService>,
2594        ) -> Self {
2595            Self(RequestBuilder::new(stub))
2596        }
2597
2598        /// Sets the full request, replacing any prior values.
2599        pub fn with_request<V: Into<crate::model::ListRoutinesRequest>>(mut self, v: V) -> Self {
2600            self.0.request = v.into();
2601            self
2602        }
2603
2604        /// Sets all the options, replacing any prior values.
2605        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2606            self.0.options = v.into();
2607            self
2608        }
2609
2610        /// Sends the request.
2611        pub async fn send(self) -> Result<crate::model::ListRoutinesResponse> {
2612            (*self.0.stub)
2613                .list_routines(self.0.request, self.0.options)
2614                .await
2615                .map(crate::Response::into_body)
2616        }
2617
2618        /// Streams each page in the collection.
2619        pub fn by_page(
2620            self,
2621        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRoutinesResponse, crate::Error>
2622        {
2623            use std::clone::Clone;
2624            let token = self.0.request.page_token.clone();
2625            let execute = move |token: String| {
2626                let mut builder = self.clone();
2627                builder.0.request = builder.0.request.set_page_token(token);
2628                builder.send()
2629            };
2630            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2631        }
2632
2633        /// Streams each item in the collection.
2634        pub fn by_item(
2635            self,
2636        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2637            crate::model::ListRoutinesResponse,
2638            crate::Error,
2639        > {
2640            use google_cloud_gax::paginator::Paginator;
2641            self.by_page().items()
2642        }
2643
2644        /// Sets the value of [project_id][crate::model::ListRoutinesRequest::project_id].
2645        ///
2646        /// This is a **required** field for requests.
2647        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2648            self.0.request.project_id = v.into();
2649            self
2650        }
2651
2652        /// Sets the value of [dataset_id][crate::model::ListRoutinesRequest::dataset_id].
2653        ///
2654        /// This is a **required** field for requests.
2655        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2656            self.0.request.dataset_id = v.into();
2657            self
2658        }
2659
2660        /// Sets the value of [max_results][crate::model::ListRoutinesRequest::max_results].
2661        pub fn set_max_results<T>(mut self, v: T) -> Self
2662        where
2663            T: std::convert::Into<wkt::UInt32Value>,
2664        {
2665            self.0.request.max_results = std::option::Option::Some(v.into());
2666            self
2667        }
2668
2669        /// Sets or clears the value of [max_results][crate::model::ListRoutinesRequest::max_results].
2670        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
2671        where
2672            T: std::convert::Into<wkt::UInt32Value>,
2673        {
2674            self.0.request.max_results = v.map(|x| x.into());
2675            self
2676        }
2677
2678        /// Sets the value of [page_token][crate::model::ListRoutinesRequest::page_token].
2679        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2680            self.0.request.page_token = v.into();
2681            self
2682        }
2683
2684        /// Sets the value of [filter][crate::model::ListRoutinesRequest::filter].
2685        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2686            self.0.request.filter = v.into();
2687            self
2688        }
2689    }
2690
2691    #[doc(hidden)]
2692    impl crate::RequestBuilder for ListRoutines {
2693        fn request_options(&mut self) -> &mut crate::RequestOptions {
2694            &mut self.0.options
2695        }
2696    }
2697}
2698
2699/// Request and client builders for [RowAccessPolicyService][crate::client::RowAccessPolicyService].
2700pub mod row_access_policy_service {
2701    use crate::Result;
2702
2703    /// A builder for [RowAccessPolicyService][crate::client::RowAccessPolicyService].
2704    ///
2705    /// ```
2706    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2707    /// # use google_cloud_bigquery_v2::*;
2708    /// # use builder::row_access_policy_service::ClientBuilder;
2709    /// # use client::RowAccessPolicyService;
2710    /// let builder : ClientBuilder = RowAccessPolicyService::builder();
2711    /// let client = builder
2712    ///     .with_endpoint("https://bigquery.googleapis.com")
2713    ///     .build().await?;
2714    /// # Ok(()) }
2715    /// ```
2716    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2717
2718    pub(crate) mod client {
2719        use super::super::super::client::RowAccessPolicyService;
2720        pub struct Factory;
2721        impl crate::ClientFactory for Factory {
2722            type Client = RowAccessPolicyService;
2723            type Credentials = gaxi::options::Credentials;
2724            async fn build(
2725                self,
2726                config: gaxi::options::ClientConfig,
2727            ) -> crate::ClientBuilderResult<Self::Client> {
2728                Self::Client::new(config).await
2729            }
2730        }
2731    }
2732
2733    /// Common implementation for [crate::client::RowAccessPolicyService] request builders.
2734    #[derive(Clone, Debug)]
2735    pub(crate) struct RequestBuilder<R: std::default::Default> {
2736        stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2737        request: R,
2738        options: crate::RequestOptions,
2739    }
2740
2741    impl<R> RequestBuilder<R>
2742    where
2743        R: std::default::Default,
2744    {
2745        pub(crate) fn new(
2746            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2747        ) -> Self {
2748            Self {
2749                stub,
2750                request: R::default(),
2751                options: crate::RequestOptions::default(),
2752            }
2753        }
2754    }
2755
2756    /// The request builder for [RowAccessPolicyService::list_row_access_policies][crate::client::RowAccessPolicyService::list_row_access_policies] calls.
2757    ///
2758    /// # Example
2759    /// ```
2760    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::ListRowAccessPolicies;
2761    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2762    /// use google_cloud_gax::paginator::ItemPaginator;
2763    ///
2764    /// let builder = prepare_request_builder();
2765    /// let mut items = builder.by_item();
2766    /// while let Some(result) = items.next().await {
2767    ///   let item = result?;
2768    /// }
2769    /// # Ok(()) }
2770    ///
2771    /// fn prepare_request_builder() -> ListRowAccessPolicies {
2772    ///   # panic!();
2773    ///   // ... details omitted ...
2774    /// }
2775    /// ```
2776    #[derive(Clone, Debug)]
2777    pub struct ListRowAccessPolicies(RequestBuilder<crate::model::ListRowAccessPoliciesRequest>);
2778
2779    impl ListRowAccessPolicies {
2780        pub(crate) fn new(
2781            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2782        ) -> Self {
2783            Self(RequestBuilder::new(stub))
2784        }
2785
2786        /// Sets the full request, replacing any prior values.
2787        pub fn with_request<V: Into<crate::model::ListRowAccessPoliciesRequest>>(
2788            mut self,
2789            v: V,
2790        ) -> Self {
2791            self.0.request = v.into();
2792            self
2793        }
2794
2795        /// Sets all the options, replacing any prior values.
2796        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2797            self.0.options = v.into();
2798            self
2799        }
2800
2801        /// Sends the request.
2802        pub async fn send(self) -> Result<crate::model::ListRowAccessPoliciesResponse> {
2803            (*self.0.stub)
2804                .list_row_access_policies(self.0.request, self.0.options)
2805                .await
2806                .map(crate::Response::into_body)
2807        }
2808
2809        /// Streams each page in the collection.
2810        pub fn by_page(
2811            self,
2812        ) -> impl google_cloud_gax::paginator::Paginator<
2813            crate::model::ListRowAccessPoliciesResponse,
2814            crate::Error,
2815        > {
2816            use std::clone::Clone;
2817            let token = self.0.request.page_token.clone();
2818            let execute = move |token: String| {
2819                let mut builder = self.clone();
2820                builder.0.request = builder.0.request.set_page_token(token);
2821                builder.send()
2822            };
2823            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2824        }
2825
2826        /// Streams each item in the collection.
2827        pub fn by_item(
2828            self,
2829        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2830            crate::model::ListRowAccessPoliciesResponse,
2831            crate::Error,
2832        > {
2833            use google_cloud_gax::paginator::Paginator;
2834            self.by_page().items()
2835        }
2836
2837        /// Sets the value of [project_id][crate::model::ListRowAccessPoliciesRequest::project_id].
2838        ///
2839        /// This is a **required** field for requests.
2840        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2841            self.0.request.project_id = v.into();
2842            self
2843        }
2844
2845        /// Sets the value of [dataset_id][crate::model::ListRowAccessPoliciesRequest::dataset_id].
2846        ///
2847        /// This is a **required** field for requests.
2848        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849            self.0.request.dataset_id = v.into();
2850            self
2851        }
2852
2853        /// Sets the value of [table_id][crate::model::ListRowAccessPoliciesRequest::table_id].
2854        ///
2855        /// This is a **required** field for requests.
2856        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2857            self.0.request.table_id = v.into();
2858            self
2859        }
2860
2861        /// Sets the value of [page_token][crate::model::ListRowAccessPoliciesRequest::page_token].
2862        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2863            self.0.request.page_token = v.into();
2864            self
2865        }
2866
2867        /// Sets the value of [page_size][crate::model::ListRowAccessPoliciesRequest::page_size].
2868        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2869            self.0.request.page_size = v.into();
2870            self
2871        }
2872    }
2873
2874    #[doc(hidden)]
2875    impl crate::RequestBuilder for ListRowAccessPolicies {
2876        fn request_options(&mut self) -> &mut crate::RequestOptions {
2877            &mut self.0.options
2878        }
2879    }
2880
2881    /// The request builder for [RowAccessPolicyService::get_row_access_policy][crate::client::RowAccessPolicyService::get_row_access_policy] calls.
2882    ///
2883    /// # Example
2884    /// ```
2885    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::GetRowAccessPolicy;
2886    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2887    ///
2888    /// let builder = prepare_request_builder();
2889    /// let response = builder.send().await?;
2890    /// # Ok(()) }
2891    ///
2892    /// fn prepare_request_builder() -> GetRowAccessPolicy {
2893    ///   # panic!();
2894    ///   // ... details omitted ...
2895    /// }
2896    /// ```
2897    #[derive(Clone, Debug)]
2898    pub struct GetRowAccessPolicy(RequestBuilder<crate::model::GetRowAccessPolicyRequest>);
2899
2900    impl GetRowAccessPolicy {
2901        pub(crate) fn new(
2902            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2903        ) -> Self {
2904            Self(RequestBuilder::new(stub))
2905        }
2906
2907        /// Sets the full request, replacing any prior values.
2908        pub fn with_request<V: Into<crate::model::GetRowAccessPolicyRequest>>(
2909            mut self,
2910            v: V,
2911        ) -> Self {
2912            self.0.request = v.into();
2913            self
2914        }
2915
2916        /// Sets all the options, replacing any prior values.
2917        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2918            self.0.options = v.into();
2919            self
2920        }
2921
2922        /// Sends the request.
2923        pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
2924            (*self.0.stub)
2925                .get_row_access_policy(self.0.request, self.0.options)
2926                .await
2927                .map(crate::Response::into_body)
2928        }
2929
2930        /// Sets the value of [project_id][crate::model::GetRowAccessPolicyRequest::project_id].
2931        ///
2932        /// This is a **required** field for requests.
2933        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2934            self.0.request.project_id = v.into();
2935            self
2936        }
2937
2938        /// Sets the value of [dataset_id][crate::model::GetRowAccessPolicyRequest::dataset_id].
2939        ///
2940        /// This is a **required** field for requests.
2941        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2942            self.0.request.dataset_id = v.into();
2943            self
2944        }
2945
2946        /// Sets the value of [table_id][crate::model::GetRowAccessPolicyRequest::table_id].
2947        ///
2948        /// This is a **required** field for requests.
2949        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2950            self.0.request.table_id = v.into();
2951            self
2952        }
2953
2954        /// Sets the value of [policy_id][crate::model::GetRowAccessPolicyRequest::policy_id].
2955        ///
2956        /// This is a **required** field for requests.
2957        pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2958            self.0.request.policy_id = v.into();
2959            self
2960        }
2961    }
2962
2963    #[doc(hidden)]
2964    impl crate::RequestBuilder for GetRowAccessPolicy {
2965        fn request_options(&mut self) -> &mut crate::RequestOptions {
2966            &mut self.0.options
2967        }
2968    }
2969
2970    /// The request builder for [RowAccessPolicyService::create_row_access_policy][crate::client::RowAccessPolicyService::create_row_access_policy] calls.
2971    ///
2972    /// # Example
2973    /// ```
2974    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::CreateRowAccessPolicy;
2975    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
2976    ///
2977    /// let builder = prepare_request_builder();
2978    /// let response = builder.send().await?;
2979    /// # Ok(()) }
2980    ///
2981    /// fn prepare_request_builder() -> CreateRowAccessPolicy {
2982    ///   # panic!();
2983    ///   // ... details omitted ...
2984    /// }
2985    /// ```
2986    #[derive(Clone, Debug)]
2987    pub struct CreateRowAccessPolicy(RequestBuilder<crate::model::CreateRowAccessPolicyRequest>);
2988
2989    impl CreateRowAccessPolicy {
2990        pub(crate) fn new(
2991            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
2992        ) -> Self {
2993            Self(RequestBuilder::new(stub))
2994        }
2995
2996        /// Sets the full request, replacing any prior values.
2997        pub fn with_request<V: Into<crate::model::CreateRowAccessPolicyRequest>>(
2998            mut self,
2999            v: V,
3000        ) -> Self {
3001            self.0.request = v.into();
3002            self
3003        }
3004
3005        /// Sets all the options, replacing any prior values.
3006        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3007            self.0.options = v.into();
3008            self
3009        }
3010
3011        /// Sends the request.
3012        pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
3013            (*self.0.stub)
3014                .create_row_access_policy(self.0.request, self.0.options)
3015                .await
3016                .map(crate::Response::into_body)
3017        }
3018
3019        /// Sets the value of [project_id][crate::model::CreateRowAccessPolicyRequest::project_id].
3020        ///
3021        /// This is a **required** field for requests.
3022        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3023            self.0.request.project_id = v.into();
3024            self
3025        }
3026
3027        /// Sets the value of [dataset_id][crate::model::CreateRowAccessPolicyRequest::dataset_id].
3028        ///
3029        /// This is a **required** field for requests.
3030        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031            self.0.request.dataset_id = v.into();
3032            self
3033        }
3034
3035        /// Sets the value of [table_id][crate::model::CreateRowAccessPolicyRequest::table_id].
3036        ///
3037        /// This is a **required** field for requests.
3038        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3039            self.0.request.table_id = v.into();
3040            self
3041        }
3042
3043        /// Sets the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
3044        ///
3045        /// This is a **required** field for requests.
3046        pub fn set_row_access_policy<T>(mut self, v: T) -> Self
3047        where
3048            T: std::convert::Into<crate::model::RowAccessPolicy>,
3049        {
3050            self.0.request.row_access_policy = std::option::Option::Some(v.into());
3051            self
3052        }
3053
3054        /// Sets or clears the value of [row_access_policy][crate::model::CreateRowAccessPolicyRequest::row_access_policy].
3055        ///
3056        /// This is a **required** field for requests.
3057        pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
3058        where
3059            T: std::convert::Into<crate::model::RowAccessPolicy>,
3060        {
3061            self.0.request.row_access_policy = v.map(|x| x.into());
3062            self
3063        }
3064    }
3065
3066    #[doc(hidden)]
3067    impl crate::RequestBuilder for CreateRowAccessPolicy {
3068        fn request_options(&mut self) -> &mut crate::RequestOptions {
3069            &mut self.0.options
3070        }
3071    }
3072
3073    /// The request builder for [RowAccessPolicyService::update_row_access_policy][crate::client::RowAccessPolicyService::update_row_access_policy] calls.
3074    ///
3075    /// # Example
3076    /// ```
3077    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::UpdateRowAccessPolicy;
3078    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3079    ///
3080    /// let builder = prepare_request_builder();
3081    /// let response = builder.send().await?;
3082    /// # Ok(()) }
3083    ///
3084    /// fn prepare_request_builder() -> UpdateRowAccessPolicy {
3085    ///   # panic!();
3086    ///   // ... details omitted ...
3087    /// }
3088    /// ```
3089    #[derive(Clone, Debug)]
3090    pub struct UpdateRowAccessPolicy(RequestBuilder<crate::model::UpdateRowAccessPolicyRequest>);
3091
3092    impl UpdateRowAccessPolicy {
3093        pub(crate) fn new(
3094            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3095        ) -> Self {
3096            Self(RequestBuilder::new(stub))
3097        }
3098
3099        /// Sets the full request, replacing any prior values.
3100        pub fn with_request<V: Into<crate::model::UpdateRowAccessPolicyRequest>>(
3101            mut self,
3102            v: V,
3103        ) -> Self {
3104            self.0.request = v.into();
3105            self
3106        }
3107
3108        /// Sets all the options, replacing any prior values.
3109        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3110            self.0.options = v.into();
3111            self
3112        }
3113
3114        /// Sends the request.
3115        pub async fn send(self) -> Result<crate::model::RowAccessPolicy> {
3116            (*self.0.stub)
3117                .update_row_access_policy(self.0.request, self.0.options)
3118                .await
3119                .map(crate::Response::into_body)
3120        }
3121
3122        /// Sets the value of [project_id][crate::model::UpdateRowAccessPolicyRequest::project_id].
3123        ///
3124        /// This is a **required** field for requests.
3125        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3126            self.0.request.project_id = v.into();
3127            self
3128        }
3129
3130        /// Sets the value of [dataset_id][crate::model::UpdateRowAccessPolicyRequest::dataset_id].
3131        ///
3132        /// This is a **required** field for requests.
3133        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3134            self.0.request.dataset_id = v.into();
3135            self
3136        }
3137
3138        /// Sets the value of [table_id][crate::model::UpdateRowAccessPolicyRequest::table_id].
3139        ///
3140        /// This is a **required** field for requests.
3141        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3142            self.0.request.table_id = v.into();
3143            self
3144        }
3145
3146        /// Sets the value of [policy_id][crate::model::UpdateRowAccessPolicyRequest::policy_id].
3147        ///
3148        /// This is a **required** field for requests.
3149        pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150            self.0.request.policy_id = v.into();
3151            self
3152        }
3153
3154        /// Sets the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
3155        ///
3156        /// This is a **required** field for requests.
3157        pub fn set_row_access_policy<T>(mut self, v: T) -> Self
3158        where
3159            T: std::convert::Into<crate::model::RowAccessPolicy>,
3160        {
3161            self.0.request.row_access_policy = std::option::Option::Some(v.into());
3162            self
3163        }
3164
3165        /// Sets or clears the value of [row_access_policy][crate::model::UpdateRowAccessPolicyRequest::row_access_policy].
3166        ///
3167        /// This is a **required** field for requests.
3168        pub fn set_or_clear_row_access_policy<T>(mut self, v: std::option::Option<T>) -> Self
3169        where
3170            T: std::convert::Into<crate::model::RowAccessPolicy>,
3171        {
3172            self.0.request.row_access_policy = v.map(|x| x.into());
3173            self
3174        }
3175    }
3176
3177    #[doc(hidden)]
3178    impl crate::RequestBuilder for UpdateRowAccessPolicy {
3179        fn request_options(&mut self) -> &mut crate::RequestOptions {
3180            &mut self.0.options
3181        }
3182    }
3183
3184    /// The request builder for [RowAccessPolicyService::delete_row_access_policy][crate::client::RowAccessPolicyService::delete_row_access_policy] calls.
3185    ///
3186    /// # Example
3187    /// ```
3188    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::DeleteRowAccessPolicy;
3189    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3190    ///
3191    /// let builder = prepare_request_builder();
3192    /// let response = builder.send().await?;
3193    /// # Ok(()) }
3194    ///
3195    /// fn prepare_request_builder() -> DeleteRowAccessPolicy {
3196    ///   # panic!();
3197    ///   // ... details omitted ...
3198    /// }
3199    /// ```
3200    #[derive(Clone, Debug)]
3201    pub struct DeleteRowAccessPolicy(RequestBuilder<crate::model::DeleteRowAccessPolicyRequest>);
3202
3203    impl DeleteRowAccessPolicy {
3204        pub(crate) fn new(
3205            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3206        ) -> Self {
3207            Self(RequestBuilder::new(stub))
3208        }
3209
3210        /// Sets the full request, replacing any prior values.
3211        pub fn with_request<V: Into<crate::model::DeleteRowAccessPolicyRequest>>(
3212            mut self,
3213            v: V,
3214        ) -> Self {
3215            self.0.request = v.into();
3216            self
3217        }
3218
3219        /// Sets all the options, replacing any prior values.
3220        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3221            self.0.options = v.into();
3222            self
3223        }
3224
3225        /// Sends the request.
3226        pub async fn send(self) -> Result<()> {
3227            (*self.0.stub)
3228                .delete_row_access_policy(self.0.request, self.0.options)
3229                .await
3230                .map(crate::Response::into_body)
3231        }
3232
3233        /// Sets the value of [project_id][crate::model::DeleteRowAccessPolicyRequest::project_id].
3234        ///
3235        /// This is a **required** field for requests.
3236        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3237            self.0.request.project_id = v.into();
3238            self
3239        }
3240
3241        /// Sets the value of [dataset_id][crate::model::DeleteRowAccessPolicyRequest::dataset_id].
3242        ///
3243        /// This is a **required** field for requests.
3244        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3245            self.0.request.dataset_id = v.into();
3246            self
3247        }
3248
3249        /// Sets the value of [table_id][crate::model::DeleteRowAccessPolicyRequest::table_id].
3250        ///
3251        /// This is a **required** field for requests.
3252        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3253            self.0.request.table_id = v.into();
3254            self
3255        }
3256
3257        /// Sets the value of [policy_id][crate::model::DeleteRowAccessPolicyRequest::policy_id].
3258        ///
3259        /// This is a **required** field for requests.
3260        pub fn set_policy_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3261            self.0.request.policy_id = v.into();
3262            self
3263        }
3264
3265        /// Sets the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
3266        pub fn set_force<T>(mut self, v: T) -> Self
3267        where
3268            T: std::convert::Into<bool>,
3269        {
3270            self.0.request.force = std::option::Option::Some(v.into());
3271            self
3272        }
3273
3274        /// Sets or clears the value of [force][crate::model::DeleteRowAccessPolicyRequest::force].
3275        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
3276        where
3277            T: std::convert::Into<bool>,
3278        {
3279            self.0.request.force = v.map(|x| x.into());
3280            self
3281        }
3282    }
3283
3284    #[doc(hidden)]
3285    impl crate::RequestBuilder for DeleteRowAccessPolicy {
3286        fn request_options(&mut self) -> &mut crate::RequestOptions {
3287            &mut self.0.options
3288        }
3289    }
3290
3291    /// The request builder for [RowAccessPolicyService::batch_delete_row_access_policies][crate::client::RowAccessPolicyService::batch_delete_row_access_policies] calls.
3292    ///
3293    /// # Example
3294    /// ```
3295    /// # use google_cloud_bigquery_v2::builder::row_access_policy_service::BatchDeleteRowAccessPolicies;
3296    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3297    ///
3298    /// let builder = prepare_request_builder();
3299    /// let response = builder.send().await?;
3300    /// # Ok(()) }
3301    ///
3302    /// fn prepare_request_builder() -> BatchDeleteRowAccessPolicies {
3303    ///   # panic!();
3304    ///   // ... details omitted ...
3305    /// }
3306    /// ```
3307    #[derive(Clone, Debug)]
3308    pub struct BatchDeleteRowAccessPolicies(
3309        RequestBuilder<crate::model::BatchDeleteRowAccessPoliciesRequest>,
3310    );
3311
3312    impl BatchDeleteRowAccessPolicies {
3313        pub(crate) fn new(
3314            stub: std::sync::Arc<dyn super::super::stub::dynamic::RowAccessPolicyService>,
3315        ) -> Self {
3316            Self(RequestBuilder::new(stub))
3317        }
3318
3319        /// Sets the full request, replacing any prior values.
3320        pub fn with_request<V: Into<crate::model::BatchDeleteRowAccessPoliciesRequest>>(
3321            mut self,
3322            v: V,
3323        ) -> Self {
3324            self.0.request = v.into();
3325            self
3326        }
3327
3328        /// Sets all the options, replacing any prior values.
3329        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3330            self.0.options = v.into();
3331            self
3332        }
3333
3334        /// Sends the request.
3335        pub async fn send(self) -> Result<()> {
3336            (*self.0.stub)
3337                .batch_delete_row_access_policies(self.0.request, self.0.options)
3338                .await
3339                .map(crate::Response::into_body)
3340        }
3341
3342        /// Sets the value of [project_id][crate::model::BatchDeleteRowAccessPoliciesRequest::project_id].
3343        ///
3344        /// This is a **required** field for requests.
3345        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3346            self.0.request.project_id = v.into();
3347            self
3348        }
3349
3350        /// Sets the value of [dataset_id][crate::model::BatchDeleteRowAccessPoliciesRequest::dataset_id].
3351        ///
3352        /// This is a **required** field for requests.
3353        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3354            self.0.request.dataset_id = v.into();
3355            self
3356        }
3357
3358        /// Sets the value of [table_id][crate::model::BatchDeleteRowAccessPoliciesRequest::table_id].
3359        ///
3360        /// This is a **required** field for requests.
3361        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3362            self.0.request.table_id = v.into();
3363            self
3364        }
3365
3366        /// Sets the value of [policy_ids][crate::model::BatchDeleteRowAccessPoliciesRequest::policy_ids].
3367        ///
3368        /// This is a **required** field for requests.
3369        pub fn set_policy_ids<T, V>(mut self, v: T) -> Self
3370        where
3371            T: std::iter::IntoIterator<Item = V>,
3372            V: std::convert::Into<std::string::String>,
3373        {
3374            use std::iter::Iterator;
3375            self.0.request.policy_ids = v.into_iter().map(|i| i.into()).collect();
3376            self
3377        }
3378
3379        /// Sets the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
3380        pub fn set_force<T>(mut self, v: T) -> Self
3381        where
3382            T: std::convert::Into<bool>,
3383        {
3384            self.0.request.force = std::option::Option::Some(v.into());
3385            self
3386        }
3387
3388        /// Sets or clears the value of [force][crate::model::BatchDeleteRowAccessPoliciesRequest::force].
3389        pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
3390        where
3391            T: std::convert::Into<bool>,
3392        {
3393            self.0.request.force = v.map(|x| x.into());
3394            self
3395        }
3396    }
3397
3398    #[doc(hidden)]
3399    impl crate::RequestBuilder for BatchDeleteRowAccessPolicies {
3400        fn request_options(&mut self) -> &mut crate::RequestOptions {
3401            &mut self.0.options
3402        }
3403    }
3404}
3405
3406/// Request and client builders for [TableService][crate::client::TableService].
3407pub mod table_service {
3408    use crate::Result;
3409
3410    /// A builder for [TableService][crate::client::TableService].
3411    ///
3412    /// ```
3413    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3414    /// # use google_cloud_bigquery_v2::*;
3415    /// # use builder::table_service::ClientBuilder;
3416    /// # use client::TableService;
3417    /// let builder : ClientBuilder = TableService::builder();
3418    /// let client = builder
3419    ///     .with_endpoint("https://bigquery.googleapis.com")
3420    ///     .build().await?;
3421    /// # Ok(()) }
3422    /// ```
3423    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3424
3425    pub(crate) mod client {
3426        use super::super::super::client::TableService;
3427        pub struct Factory;
3428        impl crate::ClientFactory for Factory {
3429            type Client = TableService;
3430            type Credentials = gaxi::options::Credentials;
3431            async fn build(
3432                self,
3433                config: gaxi::options::ClientConfig,
3434            ) -> crate::ClientBuilderResult<Self::Client> {
3435                Self::Client::new(config).await
3436            }
3437        }
3438    }
3439
3440    /// Common implementation for [crate::client::TableService] request builders.
3441    #[derive(Clone, Debug)]
3442    pub(crate) struct RequestBuilder<R: std::default::Default> {
3443        stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3444        request: R,
3445        options: crate::RequestOptions,
3446    }
3447
3448    impl<R> RequestBuilder<R>
3449    where
3450        R: std::default::Default,
3451    {
3452        pub(crate) fn new(
3453            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3454        ) -> Self {
3455            Self {
3456                stub,
3457                request: R::default(),
3458                options: crate::RequestOptions::default(),
3459            }
3460        }
3461    }
3462
3463    /// The request builder for [TableService::get_table][crate::client::TableService::get_table] calls.
3464    ///
3465    /// # Example
3466    /// ```
3467    /// # use google_cloud_bigquery_v2::builder::table_service::GetTable;
3468    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3469    ///
3470    /// let builder = prepare_request_builder();
3471    /// let response = builder.send().await?;
3472    /// # Ok(()) }
3473    ///
3474    /// fn prepare_request_builder() -> GetTable {
3475    ///   # panic!();
3476    ///   // ... details omitted ...
3477    /// }
3478    /// ```
3479    #[derive(Clone, Debug)]
3480    pub struct GetTable(RequestBuilder<crate::model::GetTableRequest>);
3481
3482    impl GetTable {
3483        pub(crate) fn new(
3484            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3485        ) -> Self {
3486            Self(RequestBuilder::new(stub))
3487        }
3488
3489        /// Sets the full request, replacing any prior values.
3490        pub fn with_request<V: Into<crate::model::GetTableRequest>>(mut self, v: V) -> Self {
3491            self.0.request = v.into();
3492            self
3493        }
3494
3495        /// Sets all the options, replacing any prior values.
3496        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3497            self.0.options = v.into();
3498            self
3499        }
3500
3501        /// Sends the request.
3502        pub async fn send(self) -> Result<crate::model::Table> {
3503            (*self.0.stub)
3504                .get_table(self.0.request, self.0.options)
3505                .await
3506                .map(crate::Response::into_body)
3507        }
3508
3509        /// Sets the value of [project_id][crate::model::GetTableRequest::project_id].
3510        ///
3511        /// This is a **required** field for requests.
3512        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3513            self.0.request.project_id = v.into();
3514            self
3515        }
3516
3517        /// Sets the value of [dataset_id][crate::model::GetTableRequest::dataset_id].
3518        ///
3519        /// This is a **required** field for requests.
3520        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3521            self.0.request.dataset_id = v.into();
3522            self
3523        }
3524
3525        /// Sets the value of [table_id][crate::model::GetTableRequest::table_id].
3526        ///
3527        /// This is a **required** field for requests.
3528        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3529            self.0.request.table_id = v.into();
3530            self
3531        }
3532
3533        /// Sets the value of [selected_fields][crate::model::GetTableRequest::selected_fields].
3534        pub fn set_selected_fields<T: Into<std::string::String>>(mut self, v: T) -> Self {
3535            self.0.request.selected_fields = v.into();
3536            self
3537        }
3538
3539        /// Sets the value of [view][crate::model::GetTableRequest::view].
3540        pub fn set_view<T: Into<crate::model::get_table_request::TableMetadataView>>(
3541            mut self,
3542            v: T,
3543        ) -> Self {
3544            self.0.request.view = v.into();
3545            self
3546        }
3547    }
3548
3549    #[doc(hidden)]
3550    impl crate::RequestBuilder for GetTable {
3551        fn request_options(&mut self) -> &mut crate::RequestOptions {
3552            &mut self.0.options
3553        }
3554    }
3555
3556    /// The request builder for [TableService::insert_table][crate::client::TableService::insert_table] calls.
3557    ///
3558    /// # Example
3559    /// ```
3560    /// # use google_cloud_bigquery_v2::builder::table_service::InsertTable;
3561    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3562    ///
3563    /// let builder = prepare_request_builder();
3564    /// let response = builder.send().await?;
3565    /// # Ok(()) }
3566    ///
3567    /// fn prepare_request_builder() -> InsertTable {
3568    ///   # panic!();
3569    ///   // ... details omitted ...
3570    /// }
3571    /// ```
3572    #[derive(Clone, Debug)]
3573    pub struct InsertTable(RequestBuilder<crate::model::InsertTableRequest>);
3574
3575    impl InsertTable {
3576        pub(crate) fn new(
3577            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3578        ) -> Self {
3579            Self(RequestBuilder::new(stub))
3580        }
3581
3582        /// Sets the full request, replacing any prior values.
3583        pub fn with_request<V: Into<crate::model::InsertTableRequest>>(mut self, v: V) -> Self {
3584            self.0.request = v.into();
3585            self
3586        }
3587
3588        /// Sets all the options, replacing any prior values.
3589        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3590            self.0.options = v.into();
3591            self
3592        }
3593
3594        /// Sends the request.
3595        pub async fn send(self) -> Result<crate::model::Table> {
3596            (*self.0.stub)
3597                .insert_table(self.0.request, self.0.options)
3598                .await
3599                .map(crate::Response::into_body)
3600        }
3601
3602        /// Sets the value of [project_id][crate::model::InsertTableRequest::project_id].
3603        ///
3604        /// This is a **required** field for requests.
3605        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3606            self.0.request.project_id = v.into();
3607            self
3608        }
3609
3610        /// Sets the value of [dataset_id][crate::model::InsertTableRequest::dataset_id].
3611        ///
3612        /// This is a **required** field for requests.
3613        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3614            self.0.request.dataset_id = v.into();
3615            self
3616        }
3617
3618        /// Sets the value of [table][crate::model::InsertTableRequest::table].
3619        ///
3620        /// This is a **required** field for requests.
3621        pub fn set_table<T>(mut self, v: T) -> Self
3622        where
3623            T: std::convert::Into<crate::model::Table>,
3624        {
3625            self.0.request.table = std::option::Option::Some(v.into());
3626            self
3627        }
3628
3629        /// Sets or clears the value of [table][crate::model::InsertTableRequest::table].
3630        ///
3631        /// This is a **required** field for requests.
3632        pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3633        where
3634            T: std::convert::Into<crate::model::Table>,
3635        {
3636            self.0.request.table = v.map(|x| x.into());
3637            self
3638        }
3639    }
3640
3641    #[doc(hidden)]
3642    impl crate::RequestBuilder for InsertTable {
3643        fn request_options(&mut self) -> &mut crate::RequestOptions {
3644            &mut self.0.options
3645        }
3646    }
3647
3648    /// The request builder for [TableService::patch_table][crate::client::TableService::patch_table] calls.
3649    ///
3650    /// # Example
3651    /// ```
3652    /// # use google_cloud_bigquery_v2::builder::table_service::PatchTable;
3653    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3654    ///
3655    /// let builder = prepare_request_builder();
3656    /// let response = builder.send().await?;
3657    /// # Ok(()) }
3658    ///
3659    /// fn prepare_request_builder() -> PatchTable {
3660    ///   # panic!();
3661    ///   // ... details omitted ...
3662    /// }
3663    /// ```
3664    #[derive(Clone, Debug)]
3665    pub struct PatchTable(RequestBuilder<crate::model::UpdateOrPatchTableRequest>);
3666
3667    impl PatchTable {
3668        pub(crate) fn new(
3669            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3670        ) -> Self {
3671            Self(RequestBuilder::new(stub))
3672        }
3673
3674        /// Sets the full request, replacing any prior values.
3675        pub fn with_request<V: Into<crate::model::UpdateOrPatchTableRequest>>(
3676            mut self,
3677            v: V,
3678        ) -> Self {
3679            self.0.request = v.into();
3680            self
3681        }
3682
3683        /// Sets all the options, replacing any prior values.
3684        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3685            self.0.options = v.into();
3686            self
3687        }
3688
3689        /// Sends the request.
3690        pub async fn send(self) -> Result<crate::model::Table> {
3691            (*self.0.stub)
3692                .patch_table(self.0.request, self.0.options)
3693                .await
3694                .map(crate::Response::into_body)
3695        }
3696
3697        /// Sets the value of [project_id][crate::model::UpdateOrPatchTableRequest::project_id].
3698        ///
3699        /// This is a **required** field for requests.
3700        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3701            self.0.request.project_id = v.into();
3702            self
3703        }
3704
3705        /// Sets the value of [dataset_id][crate::model::UpdateOrPatchTableRequest::dataset_id].
3706        ///
3707        /// This is a **required** field for requests.
3708        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3709            self.0.request.dataset_id = v.into();
3710            self
3711        }
3712
3713        /// Sets the value of [table_id][crate::model::UpdateOrPatchTableRequest::table_id].
3714        ///
3715        /// This is a **required** field for requests.
3716        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3717            self.0.request.table_id = v.into();
3718            self
3719        }
3720
3721        /// Sets the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3722        ///
3723        /// This is a **required** field for requests.
3724        pub fn set_table<T>(mut self, v: T) -> Self
3725        where
3726            T: std::convert::Into<crate::model::Table>,
3727        {
3728            self.0.request.table = std::option::Option::Some(v.into());
3729            self
3730        }
3731
3732        /// Sets or clears the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3733        ///
3734        /// This is a **required** field for requests.
3735        pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3736        where
3737            T: std::convert::Into<crate::model::Table>,
3738        {
3739            self.0.request.table = v.map(|x| x.into());
3740            self
3741        }
3742
3743        /// Sets the value of [autodetect_schema][crate::model::UpdateOrPatchTableRequest::autodetect_schema].
3744        pub fn set_autodetect_schema<T: Into<bool>>(mut self, v: T) -> Self {
3745            self.0.request.autodetect_schema = v.into();
3746            self
3747        }
3748    }
3749
3750    #[doc(hidden)]
3751    impl crate::RequestBuilder for PatchTable {
3752        fn request_options(&mut self) -> &mut crate::RequestOptions {
3753            &mut self.0.options
3754        }
3755    }
3756
3757    /// The request builder for [TableService::update_table][crate::client::TableService::update_table] calls.
3758    ///
3759    /// # Example
3760    /// ```
3761    /// # use google_cloud_bigquery_v2::builder::table_service::UpdateTable;
3762    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3763    ///
3764    /// let builder = prepare_request_builder();
3765    /// let response = builder.send().await?;
3766    /// # Ok(()) }
3767    ///
3768    /// fn prepare_request_builder() -> UpdateTable {
3769    ///   # panic!();
3770    ///   // ... details omitted ...
3771    /// }
3772    /// ```
3773    #[derive(Clone, Debug)]
3774    pub struct UpdateTable(RequestBuilder<crate::model::UpdateOrPatchTableRequest>);
3775
3776    impl UpdateTable {
3777        pub(crate) fn new(
3778            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3779        ) -> Self {
3780            Self(RequestBuilder::new(stub))
3781        }
3782
3783        /// Sets the full request, replacing any prior values.
3784        pub fn with_request<V: Into<crate::model::UpdateOrPatchTableRequest>>(
3785            mut self,
3786            v: V,
3787        ) -> Self {
3788            self.0.request = v.into();
3789            self
3790        }
3791
3792        /// Sets all the options, replacing any prior values.
3793        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3794            self.0.options = v.into();
3795            self
3796        }
3797
3798        /// Sends the request.
3799        pub async fn send(self) -> Result<crate::model::Table> {
3800            (*self.0.stub)
3801                .update_table(self.0.request, self.0.options)
3802                .await
3803                .map(crate::Response::into_body)
3804        }
3805
3806        /// Sets the value of [project_id][crate::model::UpdateOrPatchTableRequest::project_id].
3807        ///
3808        /// This is a **required** field for requests.
3809        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3810            self.0.request.project_id = v.into();
3811            self
3812        }
3813
3814        /// Sets the value of [dataset_id][crate::model::UpdateOrPatchTableRequest::dataset_id].
3815        ///
3816        /// This is a **required** field for requests.
3817        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3818            self.0.request.dataset_id = v.into();
3819            self
3820        }
3821
3822        /// Sets the value of [table_id][crate::model::UpdateOrPatchTableRequest::table_id].
3823        ///
3824        /// This is a **required** field for requests.
3825        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3826            self.0.request.table_id = v.into();
3827            self
3828        }
3829
3830        /// Sets the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3831        ///
3832        /// This is a **required** field for requests.
3833        pub fn set_table<T>(mut self, v: T) -> Self
3834        where
3835            T: std::convert::Into<crate::model::Table>,
3836        {
3837            self.0.request.table = std::option::Option::Some(v.into());
3838            self
3839        }
3840
3841        /// Sets or clears the value of [table][crate::model::UpdateOrPatchTableRequest::table].
3842        ///
3843        /// This is a **required** field for requests.
3844        pub fn set_or_clear_table<T>(mut self, v: std::option::Option<T>) -> Self
3845        where
3846            T: std::convert::Into<crate::model::Table>,
3847        {
3848            self.0.request.table = v.map(|x| x.into());
3849            self
3850        }
3851
3852        /// Sets the value of [autodetect_schema][crate::model::UpdateOrPatchTableRequest::autodetect_schema].
3853        pub fn set_autodetect_schema<T: Into<bool>>(mut self, v: T) -> Self {
3854            self.0.request.autodetect_schema = v.into();
3855            self
3856        }
3857    }
3858
3859    #[doc(hidden)]
3860    impl crate::RequestBuilder for UpdateTable {
3861        fn request_options(&mut self) -> &mut crate::RequestOptions {
3862            &mut self.0.options
3863        }
3864    }
3865
3866    /// The request builder for [TableService::delete_table][crate::client::TableService::delete_table] calls.
3867    ///
3868    /// # Example
3869    /// ```
3870    /// # use google_cloud_bigquery_v2::builder::table_service::DeleteTable;
3871    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3872    ///
3873    /// let builder = prepare_request_builder();
3874    /// let response = builder.send().await?;
3875    /// # Ok(()) }
3876    ///
3877    /// fn prepare_request_builder() -> DeleteTable {
3878    ///   # panic!();
3879    ///   // ... details omitted ...
3880    /// }
3881    /// ```
3882    #[derive(Clone, Debug)]
3883    pub struct DeleteTable(RequestBuilder<crate::model::DeleteTableRequest>);
3884
3885    impl DeleteTable {
3886        pub(crate) fn new(
3887            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3888        ) -> Self {
3889            Self(RequestBuilder::new(stub))
3890        }
3891
3892        /// Sets the full request, replacing any prior values.
3893        pub fn with_request<V: Into<crate::model::DeleteTableRequest>>(mut self, v: V) -> Self {
3894            self.0.request = v.into();
3895            self
3896        }
3897
3898        /// Sets all the options, replacing any prior values.
3899        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3900            self.0.options = v.into();
3901            self
3902        }
3903
3904        /// Sends the request.
3905        pub async fn send(self) -> Result<()> {
3906            (*self.0.stub)
3907                .delete_table(self.0.request, self.0.options)
3908                .await
3909                .map(crate::Response::into_body)
3910        }
3911
3912        /// Sets the value of [project_id][crate::model::DeleteTableRequest::project_id].
3913        ///
3914        /// This is a **required** field for requests.
3915        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3916            self.0.request.project_id = v.into();
3917            self
3918        }
3919
3920        /// Sets the value of [dataset_id][crate::model::DeleteTableRequest::dataset_id].
3921        ///
3922        /// This is a **required** field for requests.
3923        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3924            self.0.request.dataset_id = v.into();
3925            self
3926        }
3927
3928        /// Sets the value of [table_id][crate::model::DeleteTableRequest::table_id].
3929        ///
3930        /// This is a **required** field for requests.
3931        pub fn set_table_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3932            self.0.request.table_id = v.into();
3933            self
3934        }
3935    }
3936
3937    #[doc(hidden)]
3938    impl crate::RequestBuilder for DeleteTable {
3939        fn request_options(&mut self) -> &mut crate::RequestOptions {
3940            &mut self.0.options
3941        }
3942    }
3943
3944    /// The request builder for [TableService::list_tables][crate::client::TableService::list_tables] calls.
3945    ///
3946    /// # Example
3947    /// ```
3948    /// # use google_cloud_bigquery_v2::builder::table_service::ListTables;
3949    /// # async fn sample() -> google_cloud_bigquery_v2::Result<()> {
3950    /// use google_cloud_gax::paginator::ItemPaginator;
3951    ///
3952    /// let builder = prepare_request_builder();
3953    /// let mut items = builder.by_item();
3954    /// while let Some(result) = items.next().await {
3955    ///   let item = result?;
3956    /// }
3957    /// # Ok(()) }
3958    ///
3959    /// fn prepare_request_builder() -> ListTables {
3960    ///   # panic!();
3961    ///   // ... details omitted ...
3962    /// }
3963    /// ```
3964    #[derive(Clone, Debug)]
3965    pub struct ListTables(RequestBuilder<crate::model::ListTablesRequest>);
3966
3967    impl ListTables {
3968        pub(crate) fn new(
3969            stub: std::sync::Arc<dyn super::super::stub::dynamic::TableService>,
3970        ) -> Self {
3971            Self(RequestBuilder::new(stub))
3972        }
3973
3974        /// Sets the full request, replacing any prior values.
3975        pub fn with_request<V: Into<crate::model::ListTablesRequest>>(mut self, v: V) -> Self {
3976            self.0.request = v.into();
3977            self
3978        }
3979
3980        /// Sets all the options, replacing any prior values.
3981        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3982            self.0.options = v.into();
3983            self
3984        }
3985
3986        /// Sends the request.
3987        pub async fn send(self) -> Result<crate::model::TableList> {
3988            (*self.0.stub)
3989                .list_tables(self.0.request, self.0.options)
3990                .await
3991                .map(crate::Response::into_body)
3992        }
3993
3994        /// Streams each page in the collection.
3995        pub fn by_page(
3996            self,
3997        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::TableList, crate::Error>
3998        {
3999            use std::clone::Clone;
4000            let token = self.0.request.page_token.clone();
4001            let execute = move |token: String| {
4002                let mut builder = self.clone();
4003                builder.0.request = builder.0.request.set_page_token(token);
4004                builder.send()
4005            };
4006            google_cloud_gax::paginator::internal::new_paginator(token, execute)
4007        }
4008
4009        /// Streams each item in the collection.
4010        pub fn by_item(
4011            self,
4012        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::TableList, crate::Error>
4013        {
4014            use google_cloud_gax::paginator::Paginator;
4015            self.by_page().items()
4016        }
4017
4018        /// Sets the value of [project_id][crate::model::ListTablesRequest::project_id].
4019        ///
4020        /// This is a **required** field for requests.
4021        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4022            self.0.request.project_id = v.into();
4023            self
4024        }
4025
4026        /// Sets the value of [dataset_id][crate::model::ListTablesRequest::dataset_id].
4027        ///
4028        /// This is a **required** field for requests.
4029        pub fn set_dataset_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4030            self.0.request.dataset_id = v.into();
4031            self
4032        }
4033
4034        /// Sets the value of [max_results][crate::model::ListTablesRequest::max_results].
4035        pub fn set_max_results<T>(mut self, v: T) -> Self
4036        where
4037            T: std::convert::Into<wkt::UInt32Value>,
4038        {
4039            self.0.request.max_results = std::option::Option::Some(v.into());
4040            self
4041        }
4042
4043        /// Sets or clears the value of [max_results][crate::model::ListTablesRequest::max_results].
4044        pub fn set_or_clear_max_results<T>(mut self, v: std::option::Option<T>) -> Self
4045        where
4046            T: std::convert::Into<wkt::UInt32Value>,
4047        {
4048            self.0.request.max_results = v.map(|x| x.into());
4049            self
4050        }
4051
4052        /// Sets the value of [page_token][crate::model::ListTablesRequest::page_token].
4053        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4054            self.0.request.page_token = v.into();
4055            self
4056        }
4057    }
4058
4059    #[doc(hidden)]
4060    impl crate::RequestBuilder for ListTables {
4061        fn request_options(&mut self) -> &mut crate::RequestOptions {
4062            &mut self.0.options
4063        }
4064    }
4065}