pub struct Client { /* private fields */ }Expand description
Client for Compose x402
Canonical contract for Compose x402 settlement, reusable Compose Keys, session state, payments, and facilitator operations.
Version: 0.8.6
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 fn list(&self) -> List<'_>
pub fn list(&self) -> List<'_>
Sends a GET request to /api/keys
let response = client.list()
.x_chain_id(x_chain_id)
.x_session_user_address(x_session_user_address)
.send()
.await;Sourcepub fn create(&self) -> Create<'_>
pub fn create(&self) -> Create<'_>
Sends a POST request to /api/keys
let response = client.create()
.x_chain_id(x_chain_id)
.x_session_user_address(x_session_user_address)
.body(body)
.send()
.await;Sourcepub fn get(&self) -> Get<'_>
pub fn get(&self) -> Get<'_>
Sends a GET request to /api/keys/{keyId}
let response = client.get()
.key_id(key_id)
.send()
.await;Sourcepub fn revoke(&self) -> Revoke<'_>
pub fn revoke(&self) -> Revoke<'_>
Sends a DELETE request to /api/keys/{keyId}
let response = client.revoke()
.key_id(key_id)
.send()
.await;Sourcepub fn abort(&self) -> Abort<'_>
pub fn abort(&self) -> Abort<'_>
Sends a POST request to /api/payments/abort
let response = client.abort()
.body(body)
.send()
.await;Sourcepub fn model_meter(&self) -> ModelMeter<'_>
pub fn model_meter(&self) -> ModelMeter<'_>
Sends a POST request to /api/payments/meter/model
let response = client.model_meter()
.body(body)
.send()
.await;Sourcepub fn prepare(&self) -> Prepare<'_>
pub fn prepare(&self) -> Prepare<'_>
Sends a POST request to /api/payments/prepare
let response = client.prepare()
.x_chain_id(x_chain_id)
.x_session_user_address(x_session_user_address)
.x_x402_max_amount_wei(x_x402_max_amount_wei)
.body(body)
.send()
.await;Sourcepub fn settle(&self) -> Settle<'_>
pub fn settle(&self) -> Settle<'_>
Sends a POST request to /api/payments/settle
let response = client.settle()
.body(body)
.send()
.await;Sourcepub fn session_get_active(&self) -> SessionGetActive<'_>
pub fn session_get_active(&self) -> SessionGetActive<'_>
Sends a GET request to /api/session
let response = client.session_get_active()
.x_chain_id(x_chain_id)
.x_session_user_address(x_session_user_address)
.send()
.await;Sourcepub fn session_events_subscribe(&self) -> SessionEventsSubscribe<'_>
pub fn session_events_subscribe(&self) -> SessionEventsSubscribe<'_>
Sends a GET request to /api/session/events
let response = client.session_events_subscribe()
.chain_id(chain_id)
.user_address(user_address)
.send()
.await;Sourcepub fn chains_list(&self) -> ChainsList<'_>
pub fn chains_list(&self) -> ChainsList<'_>
Sends a GET request to /api/x402/facilitator/chains
let response = client.chains_list()
.send()
.await;Sourcepub fn payment_settle(&self) -> PaymentSettle<'_>
pub fn payment_settle(&self) -> PaymentSettle<'_>
Sends a POST request to /api/x402/facilitator/settle
let response = client.payment_settle()
.body(body)
.send()
.await;Sourcepub fn supported(&self) -> Supported<'_>
pub fn supported(&self) -> Supported<'_>
Sends a GET request to /api/x402/facilitator/supported
let response = client.supported()
.send()
.await;Sourcepub fn payment_verify(&self) -> PaymentVerify<'_>
pub fn payment_verify(&self) -> PaymentVerify<'_>
Sends a POST request to /api/x402/facilitator/verify
let response = client.payment_verify()
.body(body)
.send()
.await;Sourcepub fn check(&self) -> Check<'_>
pub fn check(&self) -> Check<'_>
Sends a GET request to /health
let response = client.check()
.send()
.await;Sourcepub fn feedback_list(&self) -> FeedbackList<'_>
pub fn feedback_list(&self) -> FeedbackList<'_>
Sends a GET request to /v1/feedback
let response = client.feedback_list()
.limit(limit)
.target_id(target_id)
.target_type(target_type)
.send()
.await;Sourcepub fn submit(&self) -> Submit<'_>
pub fn submit(&self) -> Submit<'_>
Sends a POST request to /v1/feedback
let response = client.submit()
.x_chain_id(x_chain_id)
.x_session_user_address(x_session_user_address)
.body(body)
.send()
.await;Sourcepub fn summary_get(&self) -> SummaryGet<'_>
pub fn summary_get(&self) -> SummaryGet<'_>
Sends a GET request to /v1/feedback/summary
let response = client.summary_get()
.recent_limit(recent_limit)
.target_id(target_id)
.target_type(target_type)
.send()
.await;