pub struct X402Client { /* private fields */ }Expand description
HTTP client with x402 payment support
Implementations§
Source§impl X402Client
impl X402Client
Sourcepub fn with_config(facilitator_config: FacilitatorConfig) -> Result<Self>
pub fn with_config(facilitator_config: FacilitatorConfig) -> Result<Self>
Create a new x402 client with custom configuration
Sourcepub fn get(&self, url: &str) -> X402RequestBuilder<'_>
pub fn get(&self, url: &str) -> X402RequestBuilder<'_>
Create a GET request
Sourcepub fn post(&self, url: &str) -> X402RequestBuilder<'_>
pub fn post(&self, url: &str) -> X402RequestBuilder<'_>
Create a POST request
Sourcepub fn put(&self, url: &str) -> X402RequestBuilder<'_>
pub fn put(&self, url: &str) -> X402RequestBuilder<'_>
Create a PUT request
Sourcepub fn delete(&self, url: &str) -> X402RequestBuilder<'_>
pub fn delete(&self, url: &str) -> X402RequestBuilder<'_>
Create a DELETE request
Sourcepub async fn handle_payment_required(
&self,
response: Response,
payment_payload: &PaymentPayload,
) -> Result<Response>
pub async fn handle_payment_required( &self, response: Response, payment_payload: &PaymentPayload, ) -> Result<Response>
Handle a 402 payment required response with automatic retry
Sourcepub async fn request_with_payment(
&self,
method: &str,
url: &str,
payment_payload: Option<&PaymentPayload>,
) -> Result<Response>
pub async fn request_with_payment( &self, method: &str, url: &str, payment_payload: Option<&PaymentPayload>, ) -> Result<Response>
Make a request with automatic payment handling
Sourcepub fn facilitator_config(&self) -> &FacilitatorConfig
pub fn facilitator_config(&self) -> &FacilitatorConfig
Get the facilitator configuration
Sourcepub fn with_facilitator_config(self, config: FacilitatorConfig) -> Self
pub fn with_facilitator_config(self, config: FacilitatorConfig) -> Self
Set a new facilitator configuration
Trait Implementations§
Source§impl Clone for X402Client
impl Clone for X402Client
Source§fn clone(&self) -> X402Client
fn clone(&self) -> X402Client
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for X402Client
impl Debug for X402Client
Auto Trait Implementations§
impl Freeze for X402Client
impl !RefUnwindSafe for X402Client
impl Send for X402Client
impl Sync for X402Client
impl Unpin for X402Client
impl !UnwindSafe for X402Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more