pub struct Client { /* private fields */ }Expand description
Client for Coral Server API
Version: 1.0
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
pub fn new_with_client(baseurl: &str, client: Client) -> Self
Construct a new client with an existing reqwest::Client,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub async fn get_sessions_in_namespace<'a>(
&'a self,
namespace: &'a str,
) -> Result<ResponseValue<Vec<BasicSession>>, Error<RouteException>>
pub async fn get_sessions_in_namespace<'a>( &'a self, namespace: &'a str, ) -> Result<ResponseValue<Vec<BasicSession>>, Error<RouteException>>
List sessions in namespace
Returns a list of all sessions in a specific namespace
Sends a GET request to /api/v1/sessions/{namespace}
Arguments:
namespace: The namespace to list sessions from
Sourcepub async fn create_session<'a>(
&'a self,
namespace: &'a str,
body: &'a SessionRequest,
) -> Result<ResponseValue<SessionIdentifier>, Error<RouteException>>
pub async fn create_session<'a>( &'a self, namespace: &'a str, body: &'a SessionRequest, ) -> Result<ResponseValue<SessionIdentifier>, Error<RouteException>>
Create session
Creates a new session in a given namespace
Sends a POST request to /api/v1/sessions/{namespace}
Arguments:
namespace: The namespace this session should be created in. This namespace will be created if it does not exist.body: The session request body, containing the agents to use in the session and other settings
Sourcepub async fn get_all_sessions<'a>(
&'a self,
) -> Result<ResponseValue<Vec<BasicNamespace>>, Error<()>>
pub async fn get_all_sessions<'a>( &'a self, ) -> Result<ResponseValue<Vec<BasicNamespace>>, Error<()>>
Get all sessions from all namespaces
Returns a list of namespaces containing their respective sessions
Sends a GET request to /api/v1/sessions
Sourcepub async fn get_session_state<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
) -> Result<ResponseValue<SessionState>, Error<RouteException>>
pub async fn get_session_state<'a>( &'a self, namespace: &'a str, session_id: &'a str, ) -> Result<ResponseValue<SessionState>, Error<RouteException>>
Get session state
Returns the current state of a session, the agents, threads and their messages
Sends a GET request to /api/v1/sessions/{namespace}/{sessionId}
Arguments:
namespace: The namespace of the sessionsession_id: The sessionId of the session
Sourcepub async fn close_session<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
) -> Result<ResponseValue<()>, Error<RouteException>>
pub async fn close_session<'a>( &'a self, namespace: &'a str, session_id: &'a str, ) -> Result<ResponseValue<()>, Error<RouteException>>
Close an active session
Closes an active session, cancelling all running agents
Sends a DELETE request to /api/v1/sessions/{namespace}/{sessionId}
Arguments:
namespace: The namespace of the session to closesession_id: The sessionId of the session to close
Sourcepub async fn get_registry_agents<'a>(
&'a self,
) -> Result<ResponseValue<Vec<AgentRegistrySource>>, Error<()>>
pub async fn get_registry_agents<'a>( &'a self, ) -> Result<ResponseValue<Vec<AgentRegistrySource>>, Error<()>>
Get registry agents
Returns a list of all agents available in this servers registry
Sends a GET request to /api/v1/registry
Sourcepub async fn inspect_local_agent<'a>(
&'a self,
agent_name: &'a str,
agent_version: &'a str,
) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
pub async fn inspect_local_agent<'a>( &'a self, agent_name: &'a str, agent_version: &'a str, ) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
Inspect local registry agent
Returns all details about a specific agent in the local registry
Sends a GET request to /api/v1/registry/local/{agentName}/{agentVersion}
Arguments:
agent_name: The name of the agentagent_version: The version of the agent
Sourcepub async fn inspect_marketplace_agent<'a>(
&'a self,
agent_name: &'a str,
agent_version: &'a str,
) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
pub async fn inspect_marketplace_agent<'a>( &'a self, agent_name: &'a str, agent_version: &'a str, ) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
Inspect marketplace registry agent
Returns all details about a specific agent in the marketplace
Sends a GET request to /api/v1/registry/marketplace/{agentName}/{agentVersion}
Arguments:
agent_name: The name of the agentagent_version: The version of the agent
Sourcepub async fn inspect_linked_server_agent<'a>(
&'a self,
linked_server_name: &'a str,
agent_name: &'a str,
agent_version: &'a str,
) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
pub async fn inspect_linked_server_agent<'a>( &'a self, linked_server_name: &'a str, agent_name: &'a str, agent_version: &'a str, ) -> Result<ResponseValue<RestrictedRegistryAgent>, Error<RouteException>>
Inspect linked server registry agent
Returns all details about a specific agent from a specific linked server
Sends a GET request to /api/v1/registry/linked/{linkedServerName}/{agentName}/{agentVersion}
Arguments:
linked_server_name: The name of the linked server to source the details of this agent fromagent_name: The name of the agentagent_version: The version of the agent
Sourcepub async fn puppet_create_thread<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
body: &'a CreateThreadInput,
) -> Result<ResponseValue<CreateThreadOutput>, Error<RouteException>>
pub async fn puppet_create_thread<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, body: &'a CreateThreadInput, ) -> Result<ResponseValue<CreateThreadOutput>, Error<RouteException>>
Create thread
Creates a new thread masquerading as the specified agent
Sends a POST request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}/thread
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s namebody: Thread creation input
Sourcepub async fn puppet_close_thread<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
body: &'a CloseThreadInput,
) -> Result<ResponseValue<()>, Error<RouteException>>
pub async fn puppet_close_thread<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, body: &'a CloseThreadInput, ) -> Result<ResponseValue<()>, Error<RouteException>>
Close thread
Closes a thread masquerading as the specified agent
Sends a DELETE request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}/thread
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s namebody: Thread close input
Sourcepub async fn puppet_send_message<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
body: &'a SendMessageInput,
) -> Result<ResponseValue<SendMessageOutput>, Error<RouteException>>
pub async fn puppet_send_message<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, body: &'a SendMessageInput, ) -> Result<ResponseValue<SendMessageOutput>, Error<RouteException>>
Send message
Sends a message in a thread masquerading as the specified agent
Sends a POST request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}/thread/message
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s namebody: Message input
Sourcepub async fn puppet_add_thread_participant<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
body: &'a AddParticipantInput,
) -> Result<ResponseValue<()>, Error<RouteException>>
pub async fn puppet_add_thread_participant<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, body: &'a AddParticipantInput, ) -> Result<ResponseValue<()>, Error<RouteException>>
Add thread participant
Adds an agent to a thread masquerading as the specified agent
Sends a POST request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}/thread/participant
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s namebody: Thread and participant information details
Sourcepub async fn puppet_remove_thread_participant<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
body: &'a RemoveParticipantInput,
) -> Result<ResponseValue<()>, Error<RouteException>>
pub async fn puppet_remove_thread_participant<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, body: &'a RemoveParticipantInput, ) -> Result<ResponseValue<()>, Error<RouteException>>
Remove thread participant
Removes an agent from a thread masquerading as the specified agent
Sends a DELETE request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}/thread/participant
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s namebody: Thread and participant information details
Sourcepub async fn puppet_kill_agent<'a>(
&'a self,
namespace: &'a str,
session_id: &'a str,
agent_name: &'a str,
) -> Result<ResponseValue<()>, Error<RouteException>>
pub async fn puppet_kill_agent<'a>( &'a self, namespace: &'a str, session_id: &'a str, agent_name: &'a str, ) -> Result<ResponseValue<()>, Error<RouteException>>
End agent runtime
Forcefully cause an agent to exit it’s own runtime
Sends a DELETE request to /api/v1/puppet/{namespace}/{sessionId}/{agentName}
Arguments:
namespace: The session’s namespacesession_id: The session’s IDagent_name: The agent’s name
Sourcepub async fn submit_rental_claim<'a>(
&'a self,
remote_session_id: &'a str,
body: &'a AgentPaymentClaimRequest,
) -> Result<ResponseValue<AgentRemainingBudget>, Error<RouteException>>
pub async fn submit_rental_claim<'a>( &'a self, remote_session_id: &'a str, body: &'a AgentPaymentClaimRequest, ) -> Result<ResponseValue<AgentRemainingBudget>, Error<RouteException>>
Submit rental agent claim
Requests a certain amount of money to be paid for a work done by a rental agent
Sends a POST request to /api/v1/agent-rpc/rental-claim
Arguments:
remote_session_id: The remote session IDbody: A description of the work done and the payment required
Sourcepub async fn request_x402_proxy<'a>(
&'a self,
agent_secret: &'a str,
body: &'a X402ProxyRequest,
) -> Result<ResponseValue<X402ProxiedResponse>, Error<()>>
pub async fn request_x402_proxy<'a>( &'a self, agent_secret: &'a str, body: &'a X402ProxyRequest, ) -> Result<ResponseValue<X402ProxiedResponse>, Error<()>>
Request for x402 proxying
Allows an agent to request that the server pays for an x402 service by proxy
Sends a POST request to /api/v1/agent-rpc/x402
Arguments:
agent_secret: The agent’s unique secretbody: The request to be proxied
Sourcepub async fn reserve_agents<'a>(
&'a self,
body: &'a PaidGraphAgentRequest,
) -> Result<ResponseValue<String>, Error<RouteException>>
pub async fn reserve_agents<'a>( &'a self, body: &'a PaidGraphAgentRequest, ) -> Result<ResponseValue<String>, Error<RouteException>>
Reserve a list of rental agents
Reserves a list of rental agents
Sends a POST request to /api/v1/agent-rental/reserve
Arguments:
body: A list of agents to claim
Sourcepub async fn get_public_wallet<'a>(
&'a self,
) -> Result<ResponseValue<String>, Error<RouteException>>
pub async fn get_public_wallet<'a>( &'a self, ) -> Result<ResponseValue<String>, Error<RouteException>>
Get wallet address for rental agents
Returns the wallet address payments should be made to for renting agents from this server
Sends a GET request to /api/v1/agent-rental/wallet
Sourcepub async fn get_rental_agents<'a>(
&'a self,
) -> Result<ResponseValue<Vec<PublicRestrictedRegistryAgent>>, Error<()>>
pub async fn get_rental_agents<'a>( &'a self, ) -> Result<ResponseValue<Vec<PublicRestrictedRegistryAgent>>, Error<()>>
Get available rental agents
Returns a list of all agents available to rent from this server
Sends a GET request to /api/v1/agent-rental/catalog