use serde_json::json;
use crate::authentification::{Credentials, PartialProfile, Profile};
use crate::error::Result;
use crate::http::{client, ok};
pub async fn query(credentials: &Credentials, profile: &PartialProfile) -> Result<Vec<Profile>> {
let response = client()
.post(format!("{}/authentification/query", crate::get_url()))
.header("Authorization", format!("Token {}", credentials.token))
.json(&json!({ "email": profile.email, "displayName": profile.display_name }))
.send()
.await?;
Ok(ok(response).await?.json().await?)
}