1use {
2 reqwest::Client,
3 smbcloud_model::{account::User, error_codes::ErrorResponse},
4 smbcloud_network::{environment::Environment, network::request},
5 smbcloud_networking::{constants::PATH_USERS_ME, smb_base_url_builder, smb_client::SmbClient},
6};
7
8pub async fn me(
9 env: Environment,
10 client: (&SmbClient, &str),
11 access_token: &str,
12) -> Result<User, ErrorResponse> {
13 let builder = Client::new()
14 .get(build_smb_info_url(env, client))
15 .header("Authorization", access_token)
16 .header("Accept", "application/json")
17 .header("Content-Type", "application/x-www-form-urlencoded");
18 request(builder).await
19}
20
21fn build_smb_info_url(env: Environment, client: (&SmbClient, &str)) -> String {
22 let mut url_builder = smb_base_url_builder(env, client);
23 url_builder.add_route(PATH_USERS_ME);
24 url_builder.build()
25}