use crate::{HttpClient, HttpError};
pub async fn list_profiles(
client: &HttpClient,
) -> Result<super::response::ListProfile, HttpError> {
client
.send_unary(reqwest::Method::GET, "functions/profiles", None::<String>)
.await
}
pub async fn get_profile(
client: &HttpClient,
owner: &str,
repository: &str,
commit: Option<&str>,
) -> Result<super::response::GetProfile, HttpError> {
let path = match commit {
Some(commit) => {
format!("functions/profiles/{}/{}/{}", owner, repository, commit)
}
None => format!("functions/profiles/{}/{}", owner, repository),
};
client
.send_unary(reqwest::Method::GET, &path, None::<String>)
.await
}
pub async fn get_profile_usage(
client: &HttpClient,
powner: &str,
prepository: &str,
pcommit: Option<&str>,
) -> Result<super::response::UsageProfile, HttpError> {
let path = match pcommit {
Some(pcommit) => {
format!(
"functions/profiles/{}/{}/{}/usage",
powner, prepository, pcommit
)
}
None => format!("functions/profiles/{}/{}/usage", powner, prepository),
};
client
.send_unary(reqwest::Method::GET, &path, None::<String>)
.await
}