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