1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use anyhow::Result;
use crate::Client;
pub struct Root {
pub client: Client,
}
impl Root {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
Root { client }
}
pub async fn get(
&self,
fields: &[String],
exclude_fields: &[String],
) -> Result<crate::types::ApiRoot> {
let mut query_args: Vec<(String, String)> = Default::default();
if !exclude_fields.is_empty() {
query_args.push(("exclude_fields".to_string(), exclude_fields.join(" ")));
}
if !fields.is_empty() {
query_args.push(("fields".to_string(), fields.join(" ")));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!("?{}", query_);
self.client.get(&url, None).await
}
}