pub struct BankrAgentClient { /* private fields */ }Expand description
Client for the Bankr Agent API.
Uses hpx-transport’s RestClient with ApiKeyAuth to communicate
with https://api.bankr.bot.
Implementations§
Source§impl BankrAgentClient
impl BankrAgentClient
Sourcepub fn new(api_key: &str) -> Result<Self, BankrError>
pub fn new(api_key: &str) -> Result<Self, BankrError>
Create a new client with the given API key and the default base URL.
§Errors
Returns BankrError::Config if the underlying HTTP client cannot be
created.
Sourcepub fn with_base_url(api_key: &str, base_url: &str) -> Result<Self, BankrError>
pub fn with_base_url(api_key: &str, base_url: &str) -> Result<Self, BankrError>
Create a new client with a custom base URL.
§Errors
Returns BankrError::Config if the underlying HTTP client cannot be
created.
Sourcepub async fn get_me(&self) -> Result<UserInfoResponse, BankrError>
pub async fn get_me(&self) -> Result<UserInfoResponse, BankrError>
Retrieve the authenticated user’s profile.
GET /agent/me
Sourcepub async fn submit_prompt(
&self,
req: &PromptRequest,
) -> Result<PromptResponse, BankrError>
pub async fn submit_prompt( &self, req: &PromptRequest, ) -> Result<PromptResponse, BankrError>
Submit a natural language prompt to the Bankr AI agent.
POST /agent/prompt
Sourcepub async fn get_job(&self, job_id: &str) -> Result<JobResponse, BankrError>
pub async fn get_job(&self, job_id: &str) -> Result<JobResponse, BankrError>
Get the status of a previously submitted job.
GET /agent/job/{jobId}
Sourcepub async fn cancel_job(
&self,
job_id: &str,
) -> Result<CancelJobResponse, BankrError>
pub async fn cancel_job( &self, job_id: &str, ) -> Result<CancelJobResponse, BankrError>
Cancel a pending or processing job.
POST /agent/job/{jobId}/cancel
Sourcepub async fn sign(&self, req: &SignRequest) -> Result<SignResponse, BankrError>
pub async fn sign(&self, req: &SignRequest) -> Result<SignResponse, BankrError>
Sign a message, typed data, or transaction without broadcasting.
POST /agent/sign
Sourcepub async fn submit_transaction(
&self,
req: &SubmitRequest,
) -> Result<SubmitResponse, BankrError>
pub async fn submit_transaction( &self, req: &SubmitRequest, ) -> Result<SubmitResponse, BankrError>
Submit a raw EVM transaction to the blockchain.
POST /agent/submit
Sourcepub async fn prompt_and_wait(
&self,
req: &PromptRequest,
) -> Result<JobResponse, BankrError>
pub async fn prompt_and_wait( &self, req: &PromptRequest, ) -> Result<JobResponse, BankrError>
Submit a prompt and poll until the job completes (or fails / is cancelled).
Uses the default polling interval (2 s) and max attempts (60).
Sourcepub async fn prompt_and_wait_with(
&self,
req: &PromptRequest,
interval: Duration,
max_attempts: u32,
) -> Result<JobResponse, BankrError>
pub async fn prompt_and_wait_with( &self, req: &PromptRequest, interval: Duration, max_attempts: u32, ) -> Result<JobResponse, BankrError>
Submit a prompt and poll with custom interval and attempt count.
Sourcepub async fn poll_job(
&self,
job_id: &str,
interval: Duration,
max_attempts: u32,
) -> Result<JobResponse, BankrError>
pub async fn poll_job( &self, job_id: &str, interval: Duration, max_attempts: u32, ) -> Result<JobResponse, BankrError>
Poll a job until it reaches a terminal state.