pub struct ProviderResponse {
pub status: u16,
pub body: Value,
pub headers: Option<Vec<(String, String)>>,
}Expand description
Opaque provider-specific response.
This type encapsulates the raw HTTP response from a provider.
Fields§
§status: u16HTTP status code
body: ValueResponse body (JSON)
headers: Option<Vec<(String, String)>>Optional response headers
Implementations§
Source§impl ProviderResponse
impl ProviderResponse
Sourcepub fn new(status: u16, body: Value) -> ProviderResponse
pub fn new(status: u16, body: Value) -> ProviderResponse
Create a new provider response.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if response is successful (2xx).
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if response is a client error (4xx).
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if response is a server error (5xx).
Sourcepub fn with_headers(self, headers: Vec<(String, String)>) -> ProviderResponse
pub fn with_headers(self, headers: Vec<(String, String)>) -> ProviderResponse
Add headers.
Trait Implementations§
Source§impl Clone for ProviderResponse
impl Clone for ProviderResponse
Source§fn clone(&self) -> ProviderResponse
fn clone(&self) -> ProviderResponse
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 ProviderResponse
impl Debug for ProviderResponse
Source§impl<'de> Deserialize<'de> for ProviderResponse
impl<'de> Deserialize<'de> for ProviderResponse
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ProviderResponse
impl PartialEq for ProviderResponse
Source§impl Serialize for ProviderResponse
impl Serialize for ProviderResponse
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ProviderResponse
Auto Trait Implementations§
impl Freeze for ProviderResponse
impl RefUnwindSafe for ProviderResponse
impl Send for ProviderResponse
impl Sync for ProviderResponse
impl Unpin for ProviderResponse
impl UnwindSafe for ProviderResponse
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