use std::fmt::Write;
use crate::client::client;
use crate::model::role;
use crate::model::types;
pub async fn role(
client: &client::Client,
id: types::UUID,
) -> Result<role::Role, Box<dyn std::error::Error>> {
Ok(client
.read::<role::Role>(&format!("project-roles/{id}"), None)
.await?)
}
pub async fn roles(
client: &client::Client,
project: Option<types::UUID>,
) -> Result<role::Roles, Box<dyn std::error::Error>> {
let mut params = String::from("limit=100");
if let Some(project) = project {
write!(params, "&projectId={}", project)?;
}
Ok(client
.read::<role::Roles>("project-roles", Some(¶ms))
.await?)
}
#[cfg(test)]
mod tests;