Skip to main content

SdkRequest

Struct SdkRequest 

Source
pub struct SdkRequest {
    pub body: Option<Vec<u8>>,
    pub requires_auth: bool,
    pub headers: BTreeMap<String, String>,
    pub method: String,
    pub path: String,
}
Expand description

Canonical SDK request passed to a transport implementation.

§Type Safety

The builder pattern ensures required fields are set at compile time. Use SdkRequest::builder() to construct requests with guaranteed validity.

Fields§

§body: Option<Vec<u8>>

Raw request body bytes.

§requires_auth: bool

Whether the request requires bearer authentication.

§headers: BTreeMap<String, String>

Header values to attach to the outgoing request.

§method: String

HTTP method to execute.

§path: String

Absolute or relative path for the request.

Implementations§

Source§

impl SdkRequest

Source

pub fn builder( method: impl Into<String>, path: impl Into<String>, ) -> SdkRequestBuilder<MethodSet, PathSet>

Create a typed builder for constructing requests.

§Examples
use ferriskey_sdk::SdkRequest;

let request = SdkRequest::builder("GET", "/api/users")
    .header("accept", "application/json")
    .auth_required(true)
    .build();
Source

pub fn new(method: impl Into<String>, path: impl Into<String>) -> Self

Construct a request with an HTTP method and request path. Prefer using Self::builder() for more complex requests.

Trait Implementations§

Source§

impl Clone for SdkRequest

Source§

fn clone(&self) -> SdkRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SdkRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SdkRequest

Source§

fn eq(&self, other: &SdkRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Service<SdkRequest> for HpxTransport

Implement tower::Service for HpxTransport.

This makes HpxTransport composable with any tower middleware.

Source§

type Response = SdkResponse

Responses given by the service.
Source§

type Error = TransportError

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<SdkResponse, TransportError>> + Send>>

The future response value.
Source§

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call(&mut self, request: SdkRequest) -> Self::Future

Process the request and return the response asynchronously. Read more
Source§

impl Eq for SdkRequest

Source§

impl StructuralPartialEq for SdkRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compares self with key and returns true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.