1use serde::Deserialize;
2
3#[async_trait::async_trait]
5pub trait Query {
6 type Scheme;
8 type Args;
10 async fn send(_: Self::Args) -> Result<Self::Scheme, crate::ErrorType>;
12}
13
14pub struct UserByUsername;
16#[async_trait::async_trait]
17impl Query for UserByUsername {
18 type Scheme = UsersScheme;
19 type Args = &'static str;
21 async fn send(username: Self::Args) -> Result<Self::Scheme, crate::ErrorType> {
22 let url = format!("{}/search/{}", crate::endpoints::BASE_URL, username);
23 crate::endpoint!(UsersScheme,url)
24 }
25}
26
27#[derive(Deserialize, PartialEq, Clone, Debug)]
28#[serde(rename_all = "camelCase")]
29pub struct UsersScheme {
31 items: Vec<crate::endpoints::User>,
32}