use serde_json::Value;
use crate::client::GuacamoleClient;
use crate::error::Result;
impl GuacamoleClient {
async fn schema_request(
&self,
data_source: Option<&str>,
endpoint: &str,
description: &str,
) -> Result<Value> {
let ds = self.resolve_data_source(data_source)?;
let url = self.url(&format!("/api/session/data/{ds}/schema/{endpoint}"))?;
let response = self.http.get(&url).send().await?;
Self::parse_response(response, description).await
}
pub async fn list_user_attributes_schema(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(data_source, "userAttributes", "user attributes schema")
.await
}
pub async fn list_user_group_attributes_schema(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(data_source, "userGroupAttributes", "user group attributes schema")
.await
}
pub async fn list_connection_attributes_schema(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(data_source, "connectionAttributes", "connection attributes schema")
.await
}
pub async fn list_sharing_profile_attributes_schema(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(
data_source,
"sharingProfileAttributes",
"sharing profile attributes schema",
)
.await
}
pub async fn list_connection_group_attributes_schema(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(
data_source,
"connectionGroupAttributes",
"connection group attributes schema",
)
.await
}
pub async fn list_protocols(
&self,
data_source: Option<&str>,
) -> Result<Value> {
self.schema_request(data_source, "protocols", "protocols")
.await
}
}