pub struct X402RequestBuilder<'a> { /* private fields */ }Expand description
Request builder for x402 client
Implementations§
Source§impl<'a> X402RequestBuilder<'a>
impl<'a> X402RequestBuilder<'a>
Sourcepub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
HeaderValue: TryFrom<V>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>,
pub fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
HeaderValue: TryFrom<V>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>,
Add a header to the request
Sourcepub fn payment(self, payment_payload: &PaymentPayload) -> Result<Self>
pub fn payment(self, payment_payload: &PaymentPayload) -> Result<Self>
Add a payment header to the request
Sourcepub async fn send_with_payment(
self,
payment_payload: &PaymentPayload,
) -> Result<Response>
pub async fn send_with_payment( self, payment_payload: &PaymentPayload, ) -> Result<Response>
Send the request and handle x402 payments automatically
Sourcepub async fn send_and_get_text(self) -> Result<String>
pub async fn send_and_get_text(self) -> Result<String>
Send the request and return the response as text
Sourcepub async fn send_and_get_json<T>(self) -> Result<T>where
T: DeserializeOwned,
pub async fn send_and_get_json<T>(self) -> Result<T>where
T: DeserializeOwned,
Send the request and return the response as JSON
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for X402RequestBuilder<'a>
impl<'a> !RefUnwindSafe for X402RequestBuilder<'a>
impl<'a> Send for X402RequestBuilder<'a>
impl<'a> Sync for X402RequestBuilder<'a>
impl<'a> Unpin for X402RequestBuilder<'a>
impl<'a> !UnwindSafe for X402RequestBuilder<'a>
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