render_api/request/
list_deploys.rs

1use serde_json::json;
2use crate::model::*;
3use crate::RenderClient;
4use httpclient::InMemoryResponseExt;
5/**Create this with the associated client method.
6
7That method takes required values as arguments. Set optional values using builder methods on this struct.*/
8#[derive(Clone)]
9pub struct ListDeploysRequest<'a> {
10    pub(crate) http_client: &'a RenderClient,
11    pub cursor: Option<String>,
12    pub end_time: Option<String>,
13    pub limit: Option<i64>,
14    pub service_id: String,
15    pub start_time: Option<String>,
16}
17impl<'a> ListDeploysRequest<'a> {
18    pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<DeployCursor>> {
19        let mut r = self
20            .http_client
21            .client
22            .get(
23                &format!("/services/{service_id}/deploys", service_id = self.service_id),
24            );
25        if let Some(ref unwrapped) = self.cursor {
26            r = r.query("cursor", &unwrapped.to_string());
27        }
28        if let Some(ref unwrapped) = self.end_time {
29            r = r.query("endTime", &unwrapped.to_string());
30        }
31        if let Some(ref unwrapped) = self.limit {
32            r = r.query("limit", &unwrapped.to_string());
33        }
34        if let Some(ref unwrapped) = self.start_time {
35            r = r.query("startTime", &unwrapped.to_string());
36        }
37        r = self.http_client.authenticate(r);
38        let res = r.await?;
39        res.json().map_err(Into::into)
40    }
41    pub fn cursor(mut self, cursor: &str) -> Self {
42        self.cursor = Some(cursor.to_owned());
43        self
44    }
45    pub fn end_time(mut self, end_time: &str) -> Self {
46        self.end_time = Some(end_time.to_owned());
47        self
48    }
49    pub fn limit(mut self, limit: i64) -> Self {
50        self.limit = Some(limit);
51        self
52    }
53    pub fn start_time(mut self, start_time: &str) -> Self {
54        self.start_time = Some(start_time.to_owned());
55        self
56    }
57}
58impl<'a> ::std::future::IntoFuture for ListDeploysRequest<'a> {
59    type Output = httpclient::InMemoryResult<Vec<DeployCursor>>;
60    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
61    fn into_future(self) -> Self::IntoFuture {
62        Box::pin(self.send())
63    }
64}