Skip to main content

google_maps_mapsplatformdatasets_v1/
builder.rs

1// Copyright 2026 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 [MapsPlatformDatasets][crate::client::MapsPlatformDatasets].
18pub mod maps_platform_datasets {
19    use crate::Result;
20
21    /// A builder for [MapsPlatformDatasets][crate::client::MapsPlatformDatasets].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_maps_mapsplatformdatasets_v1::*;
26    /// # use builder::maps_platform_datasets::ClientBuilder;
27    /// # use client::MapsPlatformDatasets;
28    /// let builder : ClientBuilder = MapsPlatformDatasets::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://mapsplatformdatasets.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::MapsPlatformDatasets;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = MapsPlatformDatasets;
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::MapsPlatformDatasets] 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::MapsPlatformDatasets>,
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::MapsPlatformDatasets>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [MapsPlatformDatasets::create_dataset][crate::client::MapsPlatformDatasets::create_dataset] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::CreateDataset;
79    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> CreateDataset {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct CreateDataset(RequestBuilder<crate::model::CreateDatasetRequest>);
92
93    impl CreateDataset {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
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::CreateDatasetRequest>>(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                .create_dataset(self.0.request, self.0.options)
116                .await
117                .map(crate::Response::into_body)
118        }
119
120        /// Sets the value of [parent][crate::model::CreateDatasetRequest::parent].
121        ///
122        /// This is a **required** field for requests.
123        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
124            self.0.request.parent = v.into();
125            self
126        }
127
128        /// Sets the value of [dataset][crate::model::CreateDatasetRequest::dataset].
129        ///
130        /// This is a **required** field for requests.
131        pub fn set_dataset<T>(mut self, v: T) -> Self
132        where
133            T: std::convert::Into<crate::model::Dataset>,
134        {
135            self.0.request.dataset = std::option::Option::Some(v.into());
136            self
137        }
138
139        /// Sets or clears the value of [dataset][crate::model::CreateDatasetRequest::dataset].
140        ///
141        /// This is a **required** field for requests.
142        pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
143        where
144            T: std::convert::Into<crate::model::Dataset>,
145        {
146            self.0.request.dataset = v.map(|x| x.into());
147            self
148        }
149    }
150
151    #[doc(hidden)]
152    impl crate::RequestBuilder for CreateDataset {
153        fn request_options(&mut self) -> &mut crate::RequestOptions {
154            &mut self.0.options
155        }
156    }
157
158    /// The request builder for [MapsPlatformDatasets::update_dataset_metadata][crate::client::MapsPlatformDatasets::update_dataset_metadata] calls.
159    ///
160    /// # Example
161    /// ```
162    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::UpdateDatasetMetadata;
163    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
164    ///
165    /// let builder = prepare_request_builder();
166    /// let response = builder.send().await?;
167    /// # Ok(()) }
168    ///
169    /// fn prepare_request_builder() -> UpdateDatasetMetadata {
170    ///   # panic!();
171    ///   // ... details omitted ...
172    /// }
173    /// ```
174    #[derive(Clone, Debug)]
175    pub struct UpdateDatasetMetadata(RequestBuilder<crate::model::UpdateDatasetMetadataRequest>);
176
177    impl UpdateDatasetMetadata {
178        pub(crate) fn new(
179            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
180        ) -> Self {
181            Self(RequestBuilder::new(stub))
182        }
183
184        /// Sets the full request, replacing any prior values.
185        pub fn with_request<V: Into<crate::model::UpdateDatasetMetadataRequest>>(
186            mut self,
187            v: V,
188        ) -> Self {
189            self.0.request = v.into();
190            self
191        }
192
193        /// Sets all the options, replacing any prior values.
194        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
195            self.0.options = v.into();
196            self
197        }
198
199        /// Sends the request.
200        pub async fn send(self) -> Result<crate::model::Dataset> {
201            (*self.0.stub)
202                .update_dataset_metadata(self.0.request, self.0.options)
203                .await
204                .map(crate::Response::into_body)
205        }
206
207        /// Sets the value of [dataset][crate::model::UpdateDatasetMetadataRequest::dataset].
208        ///
209        /// This is a **required** field for requests.
210        pub fn set_dataset<T>(mut self, v: T) -> Self
211        where
212            T: std::convert::Into<crate::model::Dataset>,
213        {
214            self.0.request.dataset = std::option::Option::Some(v.into());
215            self
216        }
217
218        /// Sets or clears the value of [dataset][crate::model::UpdateDatasetMetadataRequest::dataset].
219        ///
220        /// This is a **required** field for requests.
221        pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
222        where
223            T: std::convert::Into<crate::model::Dataset>,
224        {
225            self.0.request.dataset = v.map(|x| x.into());
226            self
227        }
228
229        /// Sets the value of [update_mask][crate::model::UpdateDatasetMetadataRequest::update_mask].
230        pub fn set_update_mask<T>(mut self, v: T) -> Self
231        where
232            T: std::convert::Into<wkt::FieldMask>,
233        {
234            self.0.request.update_mask = std::option::Option::Some(v.into());
235            self
236        }
237
238        /// Sets or clears the value of [update_mask][crate::model::UpdateDatasetMetadataRequest::update_mask].
239        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
240        where
241            T: std::convert::Into<wkt::FieldMask>,
242        {
243            self.0.request.update_mask = v.map(|x| x.into());
244            self
245        }
246    }
247
248    #[doc(hidden)]
249    impl crate::RequestBuilder for UpdateDatasetMetadata {
250        fn request_options(&mut self) -> &mut crate::RequestOptions {
251            &mut self.0.options
252        }
253    }
254
255    /// The request builder for [MapsPlatformDatasets::get_dataset][crate::client::MapsPlatformDatasets::get_dataset] calls.
256    ///
257    /// # Example
258    /// ```
259    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::GetDataset;
260    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
261    ///
262    /// let builder = prepare_request_builder();
263    /// let response = builder.send().await?;
264    /// # Ok(()) }
265    ///
266    /// fn prepare_request_builder() -> GetDataset {
267    ///   # panic!();
268    ///   // ... details omitted ...
269    /// }
270    /// ```
271    #[derive(Clone, Debug)]
272    pub struct GetDataset(RequestBuilder<crate::model::GetDatasetRequest>);
273
274    impl GetDataset {
275        pub(crate) fn new(
276            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
277        ) -> Self {
278            Self(RequestBuilder::new(stub))
279        }
280
281        /// Sets the full request, replacing any prior values.
282        pub fn with_request<V: Into<crate::model::GetDatasetRequest>>(mut self, v: V) -> Self {
283            self.0.request = v.into();
284            self
285        }
286
287        /// Sets all the options, replacing any prior values.
288        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
289            self.0.options = v.into();
290            self
291        }
292
293        /// Sends the request.
294        pub async fn send(self) -> Result<crate::model::Dataset> {
295            (*self.0.stub)
296                .get_dataset(self.0.request, self.0.options)
297                .await
298                .map(crate::Response::into_body)
299        }
300
301        /// Sets the value of [name][crate::model::GetDatasetRequest::name].
302        ///
303        /// This is a **required** field for requests.
304        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
305            self.0.request.name = v.into();
306            self
307        }
308    }
309
310    #[doc(hidden)]
311    impl crate::RequestBuilder for GetDataset {
312        fn request_options(&mut self) -> &mut crate::RequestOptions {
313            &mut self.0.options
314        }
315    }
316
317    /// The request builder for [MapsPlatformDatasets::fetch_dataset_errors][crate::client::MapsPlatformDatasets::fetch_dataset_errors] calls.
318    ///
319    /// # Example
320    /// ```
321    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::FetchDatasetErrors;
322    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
323    /// use google_cloud_gax::paginator::ItemPaginator;
324    ///
325    /// let builder = prepare_request_builder();
326    /// let mut items = builder.by_item();
327    /// while let Some(result) = items.next().await {
328    ///   let item = result?;
329    /// }
330    /// # Ok(()) }
331    ///
332    /// fn prepare_request_builder() -> FetchDatasetErrors {
333    ///   # panic!();
334    ///   // ... details omitted ...
335    /// }
336    /// ```
337    #[derive(Clone, Debug)]
338    pub struct FetchDatasetErrors(RequestBuilder<crate::model::FetchDatasetErrorsRequest>);
339
340    impl FetchDatasetErrors {
341        pub(crate) fn new(
342            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
343        ) -> Self {
344            Self(RequestBuilder::new(stub))
345        }
346
347        /// Sets the full request, replacing any prior values.
348        pub fn with_request<V: Into<crate::model::FetchDatasetErrorsRequest>>(
349            mut self,
350            v: V,
351        ) -> Self {
352            self.0.request = v.into();
353            self
354        }
355
356        /// Sets all the options, replacing any prior values.
357        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
358            self.0.options = v.into();
359            self
360        }
361
362        /// Sends the request.
363        pub async fn send(self) -> Result<crate::model::FetchDatasetErrorsResponse> {
364            (*self.0.stub)
365                .fetch_dataset_errors(self.0.request, self.0.options)
366                .await
367                .map(crate::Response::into_body)
368        }
369
370        /// Streams each page in the collection.
371        pub fn by_page(
372            self,
373        ) -> impl google_cloud_gax::paginator::Paginator<
374            crate::model::FetchDatasetErrorsResponse,
375            crate::Error,
376        > {
377            use std::clone::Clone;
378            let token = self.0.request.page_token.clone();
379            let execute = move |token: String| {
380                let mut builder = self.clone();
381                builder.0.request = builder.0.request.set_page_token(token);
382                builder.send()
383            };
384            google_cloud_gax::paginator::internal::new_paginator(token, execute)
385        }
386
387        /// Streams each item in the collection.
388        pub fn by_item(
389            self,
390        ) -> impl google_cloud_gax::paginator::ItemPaginator<
391            crate::model::FetchDatasetErrorsResponse,
392            crate::Error,
393        > {
394            use google_cloud_gax::paginator::Paginator;
395            self.by_page().items()
396        }
397
398        /// Sets the value of [dataset][crate::model::FetchDatasetErrorsRequest::dataset].
399        ///
400        /// This is a **required** field for requests.
401        pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
402            self.0.request.dataset = v.into();
403            self
404        }
405
406        /// Sets the value of [page_size][crate::model::FetchDatasetErrorsRequest::page_size].
407        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
408            self.0.request.page_size = v.into();
409            self
410        }
411
412        /// Sets the value of [page_token][crate::model::FetchDatasetErrorsRequest::page_token].
413        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
414            self.0.request.page_token = v.into();
415            self
416        }
417    }
418
419    #[doc(hidden)]
420    impl crate::RequestBuilder for FetchDatasetErrors {
421        fn request_options(&mut self) -> &mut crate::RequestOptions {
422            &mut self.0.options
423        }
424    }
425
426    /// The request builder for [MapsPlatformDatasets::list_datasets][crate::client::MapsPlatformDatasets::list_datasets] calls.
427    ///
428    /// # Example
429    /// ```
430    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::ListDatasets;
431    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
432    /// use google_cloud_gax::paginator::ItemPaginator;
433    ///
434    /// let builder = prepare_request_builder();
435    /// let mut items = builder.by_item();
436    /// while let Some(result) = items.next().await {
437    ///   let item = result?;
438    /// }
439    /// # Ok(()) }
440    ///
441    /// fn prepare_request_builder() -> ListDatasets {
442    ///   # panic!();
443    ///   // ... details omitted ...
444    /// }
445    /// ```
446    #[derive(Clone, Debug)]
447    pub struct ListDatasets(RequestBuilder<crate::model::ListDatasetsRequest>);
448
449    impl ListDatasets {
450        pub(crate) fn new(
451            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
452        ) -> Self {
453            Self(RequestBuilder::new(stub))
454        }
455
456        /// Sets the full request, replacing any prior values.
457        pub fn with_request<V: Into<crate::model::ListDatasetsRequest>>(mut self, v: V) -> Self {
458            self.0.request = v.into();
459            self
460        }
461
462        /// Sets all the options, replacing any prior values.
463        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
464            self.0.options = v.into();
465            self
466        }
467
468        /// Sends the request.
469        pub async fn send(self) -> Result<crate::model::ListDatasetsResponse> {
470            (*self.0.stub)
471                .list_datasets(self.0.request, self.0.options)
472                .await
473                .map(crate::Response::into_body)
474        }
475
476        /// Streams each page in the collection.
477        pub fn by_page(
478            self,
479        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDatasetsResponse, crate::Error>
480        {
481            use std::clone::Clone;
482            let token = self.0.request.page_token.clone();
483            let execute = move |token: String| {
484                let mut builder = self.clone();
485                builder.0.request = builder.0.request.set_page_token(token);
486                builder.send()
487            };
488            google_cloud_gax::paginator::internal::new_paginator(token, execute)
489        }
490
491        /// Streams each item in the collection.
492        pub fn by_item(
493            self,
494        ) -> impl google_cloud_gax::paginator::ItemPaginator<
495            crate::model::ListDatasetsResponse,
496            crate::Error,
497        > {
498            use google_cloud_gax::paginator::Paginator;
499            self.by_page().items()
500        }
501
502        /// Sets the value of [parent][crate::model::ListDatasetsRequest::parent].
503        ///
504        /// This is a **required** field for requests.
505        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
506            self.0.request.parent = v.into();
507            self
508        }
509
510        /// Sets the value of [page_size][crate::model::ListDatasetsRequest::page_size].
511        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
512            self.0.request.page_size = v.into();
513            self
514        }
515
516        /// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
517        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
518            self.0.request.page_token = v.into();
519            self
520        }
521
522        /// Sets the value of [tag][crate::model::ListDatasetsRequest::tag].
523        pub fn set_tag<T: Into<std::string::String>>(mut self, v: T) -> Self {
524            self.0.request.tag = v.into();
525            self
526        }
527    }
528
529    #[doc(hidden)]
530    impl crate::RequestBuilder for ListDatasets {
531        fn request_options(&mut self) -> &mut crate::RequestOptions {
532            &mut self.0.options
533        }
534    }
535
536    /// The request builder for [MapsPlatformDatasets::delete_dataset][crate::client::MapsPlatformDatasets::delete_dataset] calls.
537    ///
538    /// # Example
539    /// ```
540    /// # use google_maps_mapsplatformdatasets_v1::builder::maps_platform_datasets::DeleteDataset;
541    /// # async fn sample() -> google_maps_mapsplatformdatasets_v1::Result<()> {
542    ///
543    /// let builder = prepare_request_builder();
544    /// let response = builder.send().await?;
545    /// # Ok(()) }
546    ///
547    /// fn prepare_request_builder() -> DeleteDataset {
548    ///   # panic!();
549    ///   // ... details omitted ...
550    /// }
551    /// ```
552    #[derive(Clone, Debug)]
553    pub struct DeleteDataset(RequestBuilder<crate::model::DeleteDatasetRequest>);
554
555    impl DeleteDataset {
556        pub(crate) fn new(
557            stub: std::sync::Arc<dyn super::super::stub::dynamic::MapsPlatformDatasets>,
558        ) -> Self {
559            Self(RequestBuilder::new(stub))
560        }
561
562        /// Sets the full request, replacing any prior values.
563        pub fn with_request<V: Into<crate::model::DeleteDatasetRequest>>(mut self, v: V) -> Self {
564            self.0.request = v.into();
565            self
566        }
567
568        /// Sets all the options, replacing any prior values.
569        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
570            self.0.options = v.into();
571            self
572        }
573
574        /// Sends the request.
575        pub async fn send(self) -> Result<()> {
576            (*self.0.stub)
577                .delete_dataset(self.0.request, self.0.options)
578                .await
579                .map(crate::Response::into_body)
580        }
581
582        /// Sets the value of [name][crate::model::DeleteDatasetRequest::name].
583        ///
584        /// This is a **required** field for requests.
585        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
586            self.0.request.name = v.into();
587            self
588        }
589    }
590
591    #[doc(hidden)]
592    impl crate::RequestBuilder for DeleteDataset {
593        fn request_options(&mut self) -> &mut crate::RequestOptions {
594            &mut self.0.options
595        }
596    }
597}