render_api/request/
retrieve_environment_variables.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 RetrieveEnvironmentVariablesRequest<'a> {
10    pub(crate) http_client: &'a RenderClient,
11    pub cursor: Option<String>,
12    pub limit: Option<String>,
13    pub service_id: String,
14}
15impl<'a> RetrieveEnvironmentVariablesRequest<'a> {
16    pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<serde_json::Value>> {
17        let mut r = self
18            .http_client
19            .client
20            .get(
21                &format!("/services/{service_id}/env-vars", service_id = self.service_id),
22            );
23        if let Some(ref unwrapped) = self.cursor {
24            r = r.query("cursor", &unwrapped.to_string());
25        }
26        if let Some(ref unwrapped) = self.limit {
27            r = r.query("limit", &unwrapped.to_string());
28        }
29        r = self.http_client.authenticate(r);
30        let res = r.await?;
31        res.json().map_err(Into::into)
32    }
33    pub fn cursor(mut self, cursor: &str) -> Self {
34        self.cursor = Some(cursor.to_owned());
35        self
36    }
37    pub fn limit(mut self, limit: &str) -> Self {
38        self.limit = Some(limit.to_owned());
39        self
40    }
41}
42impl<'a> ::std::future::IntoFuture for RetrieveEnvironmentVariablesRequest<'a> {
43    type Output = httpclient::InMemoryResult<Vec<serde_json::Value>>;
44    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
45    fn into_future(self) -> Self::IntoFuture {
46        Box::pin(self.send())
47    }
48}