render_api/request/
list_custom_domains.rs1use serde_json::json;
2use crate::model::*;
3use crate::RenderClient;
4use httpclient::InMemoryResponseExt;
5#[derive(Clone)]
9pub struct ListCustomDomainsRequest<'a> {
10 pub(crate) http_client: &'a RenderClient,
11 pub created_after: Option<String>,
12 pub created_before: Option<String>,
13 pub cursor: Option<String>,
14 pub domain_type: Option<String>,
15 pub limit: Option<String>,
16 pub name: Option<String>,
17 pub service_id: String,
18 pub verification_status: Option<String>,
19}
20impl<'a> ListCustomDomainsRequest<'a> {
21 pub async fn send(self) -> ::httpclient::InMemoryResult<Vec<serde_json::Value>> {
22 let mut r = self
23 .http_client
24 .client
25 .get(
26 &format!(
27 "/services/{service_id}/custom-domains", service_id = self.service_id
28 ),
29 );
30 if let Some(ref unwrapped) = self.created_after {
31 r = r.query("createdAfter", &unwrapped.to_string());
32 }
33 if let Some(ref unwrapped) = self.created_before {
34 r = r.query("createdBefore", &unwrapped.to_string());
35 }
36 if let Some(ref unwrapped) = self.cursor {
37 r = r.query("cursor", &unwrapped.to_string());
38 }
39 if let Some(ref unwrapped) = self.domain_type {
40 r = r.query("domainType", &unwrapped.to_string());
41 }
42 if let Some(ref unwrapped) = self.limit {
43 r = r.query("limit", &unwrapped.to_string());
44 }
45 if let Some(ref unwrapped) = self.name {
46 r = r.query("name", &unwrapped.to_string());
47 }
48 if let Some(ref unwrapped) = self.verification_status {
49 r = r.query("verificationStatus", &unwrapped.to_string());
50 }
51 r = self.http_client.authenticate(r);
52 let res = r.await?;
53 res.json().map_err(Into::into)
54 }
55 pub fn created_after(mut self, created_after: &str) -> Self {
56 self.created_after = Some(created_after.to_owned());
57 self
58 }
59 pub fn created_before(mut self, created_before: &str) -> Self {
60 self.created_before = Some(created_before.to_owned());
61 self
62 }
63 pub fn cursor(mut self, cursor: &str) -> Self {
64 self.cursor = Some(cursor.to_owned());
65 self
66 }
67 pub fn domain_type(mut self, domain_type: &str) -> Self {
68 self.domain_type = Some(domain_type.to_owned());
69 self
70 }
71 pub fn limit(mut self, limit: &str) -> Self {
72 self.limit = Some(limit.to_owned());
73 self
74 }
75 pub fn name(mut self, name: &str) -> Self {
76 self.name = Some(name.to_owned());
77 self
78 }
79 pub fn verification_status(mut self, verification_status: &str) -> Self {
80 self.verification_status = Some(verification_status.to_owned());
81 self
82 }
83}
84impl<'a> ::std::future::IntoFuture for ListCustomDomainsRequest<'a> {
85 type Output = httpclient::InMemoryResult<Vec<serde_json::Value>>;
86 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
87 fn into_future(self) -> Self::IntoFuture {
88 Box::pin(self.send())
89 }
90}