use crate::api_client::ApiClient;
pub struct NodeClient {
api_client: ApiClient,
}
impl NodeClient {
pub fn new(api_client: ApiClient) -> Self {
Self { api_client }
}
pub async fn get_node(&self, name: &str) -> Result<serde_json::Value, reqwest::Error> {
let path = format!("api/v1/nodes/{}", name);
self.api_client.send_request(reqwest::Method::GET, &path, None).await
}
pub async fn list_nodes(&self) -> Result<serde_json::Value, reqwest::Error> {
let path = "api/v1/nodes";
self.api_client.send_request(reqwest::Method::GET, path, None).await
}
}