userlib/async_remote/
user_remote.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use common::remote::async_remote::{ post, get};
use common::remote::{ services};
use hyper::HeaderMap;
use uuid::Uuid;
use crate::dto::short_user_reponse::ShortUserResponse;

pub async fn find_by_ids(
    ids: Vec<Uuid>,
    headers: HeaderMap,
) -> Result<Vec<ShortUserResponse>, String> {
    post::<_, Vec<ShortUserResponse>>(
        services::USER_API,
        String::from("/user/getUsersByListIds"),
        headers,
        ids,
    ).await
}

pub async fn find_parent_with_childs(id: Uuid, headers: HeaderMap) -> Result<Vec<ShortUserResponse>, String> {
    get::<Vec<ShortUserResponse>>(services::USER_API, format!("/user/findParentWithChilds/{}", id), headers).await
}