Skip to main content

objectiveai_sdk/agent/
http.rs

1//! HTTP client functions for Agent endpoints.
2
3use crate::{HttpClient, HttpError};
4
5/// Lists all Agents that have been used.
6pub async fn list_agents(
7    client: &HttpClient,
8    params: super::request::ListAgentsRequest,
9) -> Result<super::response::ListAgentResponse, HttpError> {
10    client
11        .send_unary(reqwest::Method::POST, "agents/list", Some(params))
12        .await
13}
14
15/// Retrieves a specific Agent.
16pub async fn get_agent(
17    client: &HttpClient,
18    params: super::request::GetAgentRequest,
19) -> Result<super::response::GetAgentResponse, HttpError> {
20    client
21        .send_unary(reqwest::Method::POST, "agents", Some(params))
22        .await
23}
24
25/// Retrieves usage statistics for a specific Agent.
26pub async fn get_agent_usage(
27    client: &HttpClient,
28    params: super::request::GetAgentRequest,
29) -> Result<super::response::UsageAgentResponse, HttpError> {
30    client
31        .send_unary(reqwest::Method::POST, "agents/usage", Some(params))
32        .await
33}