google_cloud_timeseriesinsights_v1/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod timeseries_insights_controller {
18 use crate::Result;
19
20 /// A builder for [TimeseriesInsightsController][crate::client::TimeseriesInsightsController].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_timeseriesinsights_v1::*;
25 /// # use builder::timeseries_insights_controller::ClientBuilder;
26 /// # use client::TimeseriesInsightsController;
27 /// let builder : ClientBuilder = TimeseriesInsightsController::builder();
28 /// let client = builder
29 /// .with_endpoint("https://timeseriesinsights.googleapis.com")
30 /// .build().await?;
31 /// # gax::client_builder::Result::<()>::Ok(()) });
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::TimeseriesInsightsController;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = TimeseriesInsightsController;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::TimeseriesInsightsController] 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::TimeseriesInsightsController>,
55 request: R,
56 options: gax::options::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::TimeseriesInsightsController>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [TimeseriesInsightsController::list_data_sets][crate::client::TimeseriesInsightsController::list_data_sets] calls.
75 ///
76 /// # Example
77 /// ```no_run
78 /// # use google_cloud_timeseriesinsights_v1::builder;
79 /// use builder::timeseries_insights_controller::ListDataSets;
80 /// # tokio_test::block_on(async {
81 /// use gax::paginator::ItemPaginator;
82 ///
83 /// let builder = prepare_request_builder();
84 /// let mut items = builder.by_item();
85 /// while let Some(result) = items.next().await {
86 /// let item = result?;
87 /// }
88 /// # gax::Result::<()>::Ok(()) });
89 ///
90 /// fn prepare_request_builder() -> ListDataSets {
91 /// # panic!();
92 /// // ... details omitted ...
93 /// }
94 /// ```
95 #[derive(Clone, Debug)]
96 pub struct ListDataSets(RequestBuilder<crate::model::ListDataSetsRequest>);
97
98 impl ListDataSets {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 /// Sets the full request, replacing any prior values.
106 pub fn with_request<V: Into<crate::model::ListDataSetsRequest>>(mut self, v: V) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 /// Sets all the options, replacing any prior values.
112 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 /// Sends the request.
118 pub async fn send(self) -> Result<crate::model::ListDataSetsResponse> {
119 (*self.0.stub)
120 .list_data_sets(self.0.request, self.0.options)
121 .await
122 .map(gax::response::Response::into_body)
123 }
124
125 /// Streams each page in the collection.
126 pub fn by_page(
127 self,
128 ) -> impl gax::paginator::Paginator<crate::model::ListDataSetsResponse, gax::error::Error>
129 {
130 use std::clone::Clone;
131 let token = self.0.request.page_token.clone();
132 let execute = move |token: String| {
133 let mut builder = self.clone();
134 builder.0.request = builder.0.request.set_page_token(token);
135 builder.send()
136 };
137 gax::paginator::internal::new_paginator(token, execute)
138 }
139
140 /// Streams each item in the collection.
141 pub fn by_item(
142 self,
143 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataSetsResponse, gax::error::Error>
144 {
145 use gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 /// Sets the value of [parent][crate::model::ListDataSetsRequest::parent].
150 ///
151 /// This is a **required** field for requests.
152 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153 self.0.request.parent = v.into();
154 self
155 }
156
157 /// Sets the value of [page_size][crate::model::ListDataSetsRequest::page_size].
158 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159 self.0.request.page_size = v.into();
160 self
161 }
162
163 /// Sets the value of [page_token][crate::model::ListDataSetsRequest::page_token].
164 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.page_token = v.into();
166 self
167 }
168 }
169
170 #[doc(hidden)]
171 impl gax::options::internal::RequestBuilder for ListDataSets {
172 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
173 &mut self.0.options
174 }
175 }
176
177 /// The request builder for [TimeseriesInsightsController::create_data_set][crate::client::TimeseriesInsightsController::create_data_set] calls.
178 ///
179 /// # Example
180 /// ```no_run
181 /// # use google_cloud_timeseriesinsights_v1::builder;
182 /// use builder::timeseries_insights_controller::CreateDataSet;
183 /// # tokio_test::block_on(async {
184 ///
185 /// let builder = prepare_request_builder();
186 /// let response = builder.send().await?;
187 /// # gax::Result::<()>::Ok(()) });
188 ///
189 /// fn prepare_request_builder() -> CreateDataSet {
190 /// # panic!();
191 /// // ... details omitted ...
192 /// }
193 /// ```
194 #[derive(Clone, Debug)]
195 pub struct CreateDataSet(RequestBuilder<crate::model::CreateDataSetRequest>);
196
197 impl CreateDataSet {
198 pub(crate) fn new(
199 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
200 ) -> Self {
201 Self(RequestBuilder::new(stub))
202 }
203
204 /// Sets the full request, replacing any prior values.
205 pub fn with_request<V: Into<crate::model::CreateDataSetRequest>>(mut self, v: V) -> Self {
206 self.0.request = v.into();
207 self
208 }
209
210 /// Sets all the options, replacing any prior values.
211 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
212 self.0.options = v.into();
213 self
214 }
215
216 /// Sends the request.
217 pub async fn send(self) -> Result<crate::model::DataSet> {
218 (*self.0.stub)
219 .create_data_set(self.0.request, self.0.options)
220 .await
221 .map(gax::response::Response::into_body)
222 }
223
224 /// Sets the value of [parent][crate::model::CreateDataSetRequest::parent].
225 ///
226 /// This is a **required** field for requests.
227 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
228 self.0.request.parent = v.into();
229 self
230 }
231
232 /// Sets the value of [dataset][crate::model::CreateDataSetRequest::dataset].
233 ///
234 /// This is a **required** field for requests.
235 pub fn set_dataset<T>(mut self, v: T) -> Self
236 where
237 T: std::convert::Into<crate::model::DataSet>,
238 {
239 self.0.request.dataset = std::option::Option::Some(v.into());
240 self
241 }
242
243 /// Sets or clears the value of [dataset][crate::model::CreateDataSetRequest::dataset].
244 ///
245 /// This is a **required** field for requests.
246 pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
247 where
248 T: std::convert::Into<crate::model::DataSet>,
249 {
250 self.0.request.dataset = v.map(|x| x.into());
251 self
252 }
253 }
254
255 #[doc(hidden)]
256 impl gax::options::internal::RequestBuilder for CreateDataSet {
257 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
258 &mut self.0.options
259 }
260 }
261
262 /// The request builder for [TimeseriesInsightsController::delete_data_set][crate::client::TimeseriesInsightsController::delete_data_set] calls.
263 ///
264 /// # Example
265 /// ```no_run
266 /// # use google_cloud_timeseriesinsights_v1::builder;
267 /// use builder::timeseries_insights_controller::DeleteDataSet;
268 /// # tokio_test::block_on(async {
269 ///
270 /// let builder = prepare_request_builder();
271 /// let response = builder.send().await?;
272 /// # gax::Result::<()>::Ok(()) });
273 ///
274 /// fn prepare_request_builder() -> DeleteDataSet {
275 /// # panic!();
276 /// // ... details omitted ...
277 /// }
278 /// ```
279 #[derive(Clone, Debug)]
280 pub struct DeleteDataSet(RequestBuilder<crate::model::DeleteDataSetRequest>);
281
282 impl DeleteDataSet {
283 pub(crate) fn new(
284 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
285 ) -> Self {
286 Self(RequestBuilder::new(stub))
287 }
288
289 /// Sets the full request, replacing any prior values.
290 pub fn with_request<V: Into<crate::model::DeleteDataSetRequest>>(mut self, v: V) -> Self {
291 self.0.request = v.into();
292 self
293 }
294
295 /// Sets all the options, replacing any prior values.
296 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
297 self.0.options = v.into();
298 self
299 }
300
301 /// Sends the request.
302 pub async fn send(self) -> Result<()> {
303 (*self.0.stub)
304 .delete_data_set(self.0.request, self.0.options)
305 .await
306 .map(gax::response::Response::into_body)
307 }
308
309 /// Sets the value of [name][crate::model::DeleteDataSetRequest::name].
310 ///
311 /// This is a **required** field for requests.
312 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
313 self.0.request.name = v.into();
314 self
315 }
316 }
317
318 #[doc(hidden)]
319 impl gax::options::internal::RequestBuilder for DeleteDataSet {
320 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
321 &mut self.0.options
322 }
323 }
324
325 /// The request builder for [TimeseriesInsightsController::append_events][crate::client::TimeseriesInsightsController::append_events] calls.
326 ///
327 /// # Example
328 /// ```no_run
329 /// # use google_cloud_timeseriesinsights_v1::builder;
330 /// use builder::timeseries_insights_controller::AppendEvents;
331 /// # tokio_test::block_on(async {
332 ///
333 /// let builder = prepare_request_builder();
334 /// let response = builder.send().await?;
335 /// # gax::Result::<()>::Ok(()) });
336 ///
337 /// fn prepare_request_builder() -> AppendEvents {
338 /// # panic!();
339 /// // ... details omitted ...
340 /// }
341 /// ```
342 #[derive(Clone, Debug)]
343 pub struct AppendEvents(RequestBuilder<crate::model::AppendEventsRequest>);
344
345 impl AppendEvents {
346 pub(crate) fn new(
347 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
348 ) -> Self {
349 Self(RequestBuilder::new(stub))
350 }
351
352 /// Sets the full request, replacing any prior values.
353 pub fn with_request<V: Into<crate::model::AppendEventsRequest>>(mut self, v: V) -> Self {
354 self.0.request = v.into();
355 self
356 }
357
358 /// Sets all the options, replacing any prior values.
359 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
360 self.0.options = v.into();
361 self
362 }
363
364 /// Sends the request.
365 pub async fn send(self) -> Result<crate::model::AppendEventsResponse> {
366 (*self.0.stub)
367 .append_events(self.0.request, self.0.options)
368 .await
369 .map(gax::response::Response::into_body)
370 }
371
372 /// Sets the value of [events][crate::model::AppendEventsRequest::events].
373 pub fn set_events<T, V>(mut self, v: T) -> Self
374 where
375 T: std::iter::IntoIterator<Item = V>,
376 V: std::convert::Into<crate::model::Event>,
377 {
378 use std::iter::Iterator;
379 self.0.request.events = v.into_iter().map(|i| i.into()).collect();
380 self
381 }
382
383 /// Sets the value of [dataset][crate::model::AppendEventsRequest::dataset].
384 ///
385 /// This is a **required** field for requests.
386 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
387 self.0.request.dataset = v.into();
388 self
389 }
390 }
391
392 #[doc(hidden)]
393 impl gax::options::internal::RequestBuilder for AppendEvents {
394 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
395 &mut self.0.options
396 }
397 }
398
399 /// The request builder for [TimeseriesInsightsController::query_data_set][crate::client::TimeseriesInsightsController::query_data_set] calls.
400 ///
401 /// # Example
402 /// ```no_run
403 /// # use google_cloud_timeseriesinsights_v1::builder;
404 /// use builder::timeseries_insights_controller::QueryDataSet;
405 /// # tokio_test::block_on(async {
406 ///
407 /// let builder = prepare_request_builder();
408 /// let response = builder.send().await?;
409 /// # gax::Result::<()>::Ok(()) });
410 ///
411 /// fn prepare_request_builder() -> QueryDataSet {
412 /// # panic!();
413 /// // ... details omitted ...
414 /// }
415 /// ```
416 #[derive(Clone, Debug)]
417 pub struct QueryDataSet(RequestBuilder<crate::model::QueryDataSetRequest>);
418
419 impl QueryDataSet {
420 pub(crate) fn new(
421 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
422 ) -> Self {
423 Self(RequestBuilder::new(stub))
424 }
425
426 /// Sets the full request, replacing any prior values.
427 pub fn with_request<V: Into<crate::model::QueryDataSetRequest>>(mut self, v: V) -> Self {
428 self.0.request = v.into();
429 self
430 }
431
432 /// Sets all the options, replacing any prior values.
433 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
434 self.0.options = v.into();
435 self
436 }
437
438 /// Sends the request.
439 pub async fn send(self) -> Result<crate::model::QueryDataSetResponse> {
440 (*self.0.stub)
441 .query_data_set(self.0.request, self.0.options)
442 .await
443 .map(gax::response::Response::into_body)
444 }
445
446 /// Sets the value of [name][crate::model::QueryDataSetRequest::name].
447 ///
448 /// This is a **required** field for requests.
449 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
450 self.0.request.name = v.into();
451 self
452 }
453
454 /// Sets the value of [detection_time][crate::model::QueryDataSetRequest::detection_time].
455 ///
456 /// This is a **required** field for requests.
457 pub fn set_detection_time<T>(mut self, v: T) -> Self
458 where
459 T: std::convert::Into<wkt::Timestamp>,
460 {
461 self.0.request.detection_time = std::option::Option::Some(v.into());
462 self
463 }
464
465 /// Sets or clears the value of [detection_time][crate::model::QueryDataSetRequest::detection_time].
466 ///
467 /// This is a **required** field for requests.
468 pub fn set_or_clear_detection_time<T>(mut self, v: std::option::Option<T>) -> Self
469 where
470 T: std::convert::Into<wkt::Timestamp>,
471 {
472 self.0.request.detection_time = v.map(|x| x.into());
473 self
474 }
475
476 /// Sets the value of [num_returned_slices][crate::model::QueryDataSetRequest::num_returned_slices].
477 pub fn set_num_returned_slices<T>(mut self, v: T) -> Self
478 where
479 T: std::convert::Into<i32>,
480 {
481 self.0.request.num_returned_slices = std::option::Option::Some(v.into());
482 self
483 }
484
485 /// Sets or clears the value of [num_returned_slices][crate::model::QueryDataSetRequest::num_returned_slices].
486 pub fn set_or_clear_num_returned_slices<T>(mut self, v: std::option::Option<T>) -> Self
487 where
488 T: std::convert::Into<i32>,
489 {
490 self.0.request.num_returned_slices = v.map(|x| x.into());
491 self
492 }
493
494 /// Sets the value of [slicing_params][crate::model::QueryDataSetRequest::slicing_params].
495 pub fn set_slicing_params<T>(mut self, v: T) -> Self
496 where
497 T: std::convert::Into<crate::model::SlicingParams>,
498 {
499 self.0.request.slicing_params = std::option::Option::Some(v.into());
500 self
501 }
502
503 /// Sets or clears the value of [slicing_params][crate::model::QueryDataSetRequest::slicing_params].
504 pub fn set_or_clear_slicing_params<T>(mut self, v: std::option::Option<T>) -> Self
505 where
506 T: std::convert::Into<crate::model::SlicingParams>,
507 {
508 self.0.request.slicing_params = v.map(|x| x.into());
509 self
510 }
511
512 /// Sets the value of [timeseries_params][crate::model::QueryDataSetRequest::timeseries_params].
513 pub fn set_timeseries_params<T>(mut self, v: T) -> Self
514 where
515 T: std::convert::Into<crate::model::TimeseriesParams>,
516 {
517 self.0.request.timeseries_params = std::option::Option::Some(v.into());
518 self
519 }
520
521 /// Sets or clears the value of [timeseries_params][crate::model::QueryDataSetRequest::timeseries_params].
522 pub fn set_or_clear_timeseries_params<T>(mut self, v: std::option::Option<T>) -> Self
523 where
524 T: std::convert::Into<crate::model::TimeseriesParams>,
525 {
526 self.0.request.timeseries_params = v.map(|x| x.into());
527 self
528 }
529
530 /// Sets the value of [forecast_params][crate::model::QueryDataSetRequest::forecast_params].
531 pub fn set_forecast_params<T>(mut self, v: T) -> Self
532 where
533 T: std::convert::Into<crate::model::ForecastParams>,
534 {
535 self.0.request.forecast_params = std::option::Option::Some(v.into());
536 self
537 }
538
539 /// Sets or clears the value of [forecast_params][crate::model::QueryDataSetRequest::forecast_params].
540 pub fn set_or_clear_forecast_params<T>(mut self, v: std::option::Option<T>) -> Self
541 where
542 T: std::convert::Into<crate::model::ForecastParams>,
543 {
544 self.0.request.forecast_params = v.map(|x| x.into());
545 self
546 }
547
548 /// Sets the value of [return_timeseries][crate::model::QueryDataSetRequest::return_timeseries].
549 pub fn set_return_timeseries<T: Into<bool>>(mut self, v: T) -> Self {
550 self.0.request.return_timeseries = v.into();
551 self
552 }
553 }
554
555 #[doc(hidden)]
556 impl gax::options::internal::RequestBuilder for QueryDataSet {
557 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
558 &mut self.0.options
559 }
560 }
561
562 /// The request builder for [TimeseriesInsightsController::evaluate_slice][crate::client::TimeseriesInsightsController::evaluate_slice] calls.
563 ///
564 /// # Example
565 /// ```no_run
566 /// # use google_cloud_timeseriesinsights_v1::builder;
567 /// use builder::timeseries_insights_controller::EvaluateSlice;
568 /// # tokio_test::block_on(async {
569 ///
570 /// let builder = prepare_request_builder();
571 /// let response = builder.send().await?;
572 /// # gax::Result::<()>::Ok(()) });
573 ///
574 /// fn prepare_request_builder() -> EvaluateSlice {
575 /// # panic!();
576 /// // ... details omitted ...
577 /// }
578 /// ```
579 #[derive(Clone, Debug)]
580 pub struct EvaluateSlice(RequestBuilder<crate::model::EvaluateSliceRequest>);
581
582 impl EvaluateSlice {
583 pub(crate) fn new(
584 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
585 ) -> Self {
586 Self(RequestBuilder::new(stub))
587 }
588
589 /// Sets the full request, replacing any prior values.
590 pub fn with_request<V: Into<crate::model::EvaluateSliceRequest>>(mut self, v: V) -> Self {
591 self.0.request = v.into();
592 self
593 }
594
595 /// Sets all the options, replacing any prior values.
596 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
597 self.0.options = v.into();
598 self
599 }
600
601 /// Sends the request.
602 pub async fn send(self) -> Result<crate::model::EvaluatedSlice> {
603 (*self.0.stub)
604 .evaluate_slice(self.0.request, self.0.options)
605 .await
606 .map(gax::response::Response::into_body)
607 }
608
609 /// Sets the value of [dataset][crate::model::EvaluateSliceRequest::dataset].
610 ///
611 /// This is a **required** field for requests.
612 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
613 self.0.request.dataset = v.into();
614 self
615 }
616
617 /// Sets the value of [pinned_dimensions][crate::model::EvaluateSliceRequest::pinned_dimensions].
618 ///
619 /// This is a **required** field for requests.
620 pub fn set_pinned_dimensions<T, V>(mut self, v: T) -> Self
621 where
622 T: std::iter::IntoIterator<Item = V>,
623 V: std::convert::Into<crate::model::PinnedDimension>,
624 {
625 use std::iter::Iterator;
626 self.0.request.pinned_dimensions = v.into_iter().map(|i| i.into()).collect();
627 self
628 }
629
630 /// Sets the value of [detection_time][crate::model::EvaluateSliceRequest::detection_time].
631 ///
632 /// This is a **required** field for requests.
633 pub fn set_detection_time<T>(mut self, v: T) -> Self
634 where
635 T: std::convert::Into<wkt::Timestamp>,
636 {
637 self.0.request.detection_time = std::option::Option::Some(v.into());
638 self
639 }
640
641 /// Sets or clears the value of [detection_time][crate::model::EvaluateSliceRequest::detection_time].
642 ///
643 /// This is a **required** field for requests.
644 pub fn set_or_clear_detection_time<T>(mut self, v: std::option::Option<T>) -> Self
645 where
646 T: std::convert::Into<wkt::Timestamp>,
647 {
648 self.0.request.detection_time = v.map(|x| x.into());
649 self
650 }
651
652 /// Sets the value of [timeseries_params][crate::model::EvaluateSliceRequest::timeseries_params].
653 pub fn set_timeseries_params<T>(mut self, v: T) -> Self
654 where
655 T: std::convert::Into<crate::model::TimeseriesParams>,
656 {
657 self.0.request.timeseries_params = std::option::Option::Some(v.into());
658 self
659 }
660
661 /// Sets or clears the value of [timeseries_params][crate::model::EvaluateSliceRequest::timeseries_params].
662 pub fn set_or_clear_timeseries_params<T>(mut self, v: std::option::Option<T>) -> Self
663 where
664 T: std::convert::Into<crate::model::TimeseriesParams>,
665 {
666 self.0.request.timeseries_params = v.map(|x| x.into());
667 self
668 }
669
670 /// Sets the value of [forecast_params][crate::model::EvaluateSliceRequest::forecast_params].
671 pub fn set_forecast_params<T>(mut self, v: T) -> Self
672 where
673 T: std::convert::Into<crate::model::ForecastParams>,
674 {
675 self.0.request.forecast_params = std::option::Option::Some(v.into());
676 self
677 }
678
679 /// Sets or clears the value of [forecast_params][crate::model::EvaluateSliceRequest::forecast_params].
680 pub fn set_or_clear_forecast_params<T>(mut self, v: std::option::Option<T>) -> Self
681 where
682 T: std::convert::Into<crate::model::ForecastParams>,
683 {
684 self.0.request.forecast_params = v.map(|x| x.into());
685 self
686 }
687 }
688
689 #[doc(hidden)]
690 impl gax::options::internal::RequestBuilder for EvaluateSlice {
691 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
692 &mut self.0.options
693 }
694 }
695
696 /// The request builder for [TimeseriesInsightsController::evaluate_timeseries][crate::client::TimeseriesInsightsController::evaluate_timeseries] calls.
697 ///
698 /// # Example
699 /// ```no_run
700 /// # use google_cloud_timeseriesinsights_v1::builder;
701 /// use builder::timeseries_insights_controller::EvaluateTimeseries;
702 /// # tokio_test::block_on(async {
703 ///
704 /// let builder = prepare_request_builder();
705 /// let response = builder.send().await?;
706 /// # gax::Result::<()>::Ok(()) });
707 ///
708 /// fn prepare_request_builder() -> EvaluateTimeseries {
709 /// # panic!();
710 /// // ... details omitted ...
711 /// }
712 /// ```
713 #[derive(Clone, Debug)]
714 pub struct EvaluateTimeseries(RequestBuilder<crate::model::EvaluateTimeseriesRequest>);
715
716 impl EvaluateTimeseries {
717 pub(crate) fn new(
718 stub: std::sync::Arc<dyn super::super::stub::dynamic::TimeseriesInsightsController>,
719 ) -> Self {
720 Self(RequestBuilder::new(stub))
721 }
722
723 /// Sets the full request, replacing any prior values.
724 pub fn with_request<V: Into<crate::model::EvaluateTimeseriesRequest>>(
725 mut self,
726 v: V,
727 ) -> Self {
728 self.0.request = v.into();
729 self
730 }
731
732 /// Sets all the options, replacing any prior values.
733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
734 self.0.options = v.into();
735 self
736 }
737
738 /// Sends the request.
739 pub async fn send(self) -> Result<crate::model::EvaluatedSlice> {
740 (*self.0.stub)
741 .evaluate_timeseries(self.0.request, self.0.options)
742 .await
743 .map(gax::response::Response::into_body)
744 }
745
746 /// Sets the value of [parent][crate::model::EvaluateTimeseriesRequest::parent].
747 ///
748 /// This is a **required** field for requests.
749 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
750 self.0.request.parent = v.into();
751 self
752 }
753
754 /// Sets the value of [timeseries][crate::model::EvaluateTimeseriesRequest::timeseries].
755 pub fn set_timeseries<T>(mut self, v: T) -> Self
756 where
757 T: std::convert::Into<crate::model::Timeseries>,
758 {
759 self.0.request.timeseries = std::option::Option::Some(v.into());
760 self
761 }
762
763 /// Sets or clears the value of [timeseries][crate::model::EvaluateTimeseriesRequest::timeseries].
764 pub fn set_or_clear_timeseries<T>(mut self, v: std::option::Option<T>) -> Self
765 where
766 T: std::convert::Into<crate::model::Timeseries>,
767 {
768 self.0.request.timeseries = v.map(|x| x.into());
769 self
770 }
771
772 /// Sets the value of [granularity][crate::model::EvaluateTimeseriesRequest::granularity].
773 pub fn set_granularity<T>(mut self, v: T) -> Self
774 where
775 T: std::convert::Into<wkt::Duration>,
776 {
777 self.0.request.granularity = std::option::Option::Some(v.into());
778 self
779 }
780
781 /// Sets or clears the value of [granularity][crate::model::EvaluateTimeseriesRequest::granularity].
782 pub fn set_or_clear_granularity<T>(mut self, v: std::option::Option<T>) -> Self
783 where
784 T: std::convert::Into<wkt::Duration>,
785 {
786 self.0.request.granularity = v.map(|x| x.into());
787 self
788 }
789
790 /// Sets the value of [forecast_params][crate::model::EvaluateTimeseriesRequest::forecast_params].
791 pub fn set_forecast_params<T>(mut self, v: T) -> Self
792 where
793 T: std::convert::Into<crate::model::ForecastParams>,
794 {
795 self.0.request.forecast_params = std::option::Option::Some(v.into());
796 self
797 }
798
799 /// Sets or clears the value of [forecast_params][crate::model::EvaluateTimeseriesRequest::forecast_params].
800 pub fn set_or_clear_forecast_params<T>(mut self, v: std::option::Option<T>) -> Self
801 where
802 T: std::convert::Into<crate::model::ForecastParams>,
803 {
804 self.0.request.forecast_params = v.map(|x| x.into());
805 self
806 }
807 }
808
809 #[doc(hidden)]
810 impl gax::options::internal::RequestBuilder for EvaluateTimeseries {
811 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
812 &mut self.0.options
813 }
814 }
815}