pub struct IronCoreRequest { /* private fields */ }
Expand description
A struct which holds the basic info that will be needed for making requests to an ironcore service. Currently just the base_url.
Implementations§
Source§impl IronCoreRequest
impl IronCoreRequest
pub const fn new(base_url: &'static str, client: Client) -> IronCoreRequest
pub fn base_url(&self) -> &str
Sourcepub async fn post_jwt_auth<A: Serialize, B: DeserializeOwned>(
&self,
relative_url: &str,
body: &A,
error_code: RequestErrorCode,
auth: &Authorization<'_>,
) -> Result<B, IronOxideErr>
pub async fn post_jwt_auth<A: Serialize, B: DeserializeOwned>( &self, relative_url: &str, body: &A, error_code: RequestErrorCode, auth: &Authorization<'_>, ) -> Result<B, IronOxideErr>
POST body to the resource at relative_url using auth for authorization. If the request fails a RequestError will be raised.
Sourcepub async fn post<A: Serialize, B: DeserializeOwned>(
&self,
relative_url: &str,
body: &A,
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
) -> Result<B, IronOxideErr>
pub async fn post<A: Serialize, B: DeserializeOwned>( &self, relative_url: &str, body: &A, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<B, IronOxideErr>
POST body to the resource at relative_url using IronCore authorization. If the request fails a RequestError will be raised.
pub async fn post_raw<B: DeserializeOwned>( &self, relative_url: &str, body: &[u8], error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<B, IronOxideErr>
Sourcepub async fn put<A: Serialize, B: DeserializeOwned>(
&self,
relative_url: &str,
body: &A,
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
) -> Result<B, IronOxideErr>
pub async fn put<A: Serialize, B: DeserializeOwned>( &self, relative_url: &str, body: &A, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<B, IronOxideErr>
PUT body to the resource at relative_url using auth for authorization. If the request fails a RequestError will be raised.
Sourcepub async fn get<A: DeserializeOwned>(
&self,
relative_url: &str,
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
) -> Result<A, IronOxideErr>
pub async fn get<A: DeserializeOwned>( &self, relative_url: &str, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<A, IronOxideErr>
GET the resource at relative_url using auth for authorization. If the request fails a RequestError will be raised.
Sourcepub async fn get_with_query_params<A: DeserializeOwned>(
&self,
relative_url: &str,
query_params: &[(String, PercentEncodedString)],
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
) -> Result<A, IronOxideErr>
pub async fn get_with_query_params<A: DeserializeOwned>( &self, relative_url: &str, query_params: &[(String, PercentEncodedString)], error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<A, IronOxideErr>
GET the resource at relative_url using auth for authorization. If the request fails a RequestError will be raised.
Sourcepub async fn get_with_empty_result_jwt_auth<A: DeserializeOwned>(
&self,
relative_url: &str,
error_code: RequestErrorCode,
auth: &Authorization<'_>,
) -> Result<Option<A>, IronOxideErr>
pub async fn get_with_empty_result_jwt_auth<A: DeserializeOwned>( &self, relative_url: &str, error_code: RequestErrorCode, auth: &Authorization<'_>, ) -> Result<Option<A>, IronOxideErr>
This should be used for a GET where the result can be empty. If the result is empty the returned value will be None.
Sourcepub async fn delete<A: Serialize, B: DeserializeOwned>(
&self,
relative_url: &str,
body: &A,
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
) -> Result<B, IronOxideErr>
pub async fn delete<A: Serialize, B: DeserializeOwned>( &self, relative_url: &str, body: &A, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<B, IronOxideErr>
DELETE body to the resource at relative_url using auth for authorization. If the request fails a RequestError will be raised.
Sourcepub async fn request<A, B, Q, F>(
&self,
relative_url: &str,
method: Method,
maybe_body: Option<&A>,
maybe_query_params: Option<&Q>,
error_code: RequestErrorCode,
headers: HeaderMap,
resp_handler: F,
) -> Result<B, IronOxideErr>where
A: Serialize,
B: DeserializeOwned,
Q: Serialize + ?Sized,
F: FnOnce(&Bytes) -> Result<B, IronOxideErr>,
pub async fn request<A, B, Q, F>(
&self,
relative_url: &str,
method: Method,
maybe_body: Option<&A>,
maybe_query_params: Option<&Q>,
error_code: RequestErrorCode,
headers: HeaderMap,
resp_handler: F,
) -> Result<B, IronOxideErr>where
A: Serialize,
B: DeserializeOwned,
Q: Serialize + ?Sized,
F: FnOnce(&Bytes) -> Result<B, IronOxideErr>,
Make a request to the url using the specified method. DEFAULT_HEADERS will be used as well as whatever headers are passed
in. The response will be sent to resp_handler
so the caller can make the received bytes however they want.
Sourcepub async fn request_ironcore_auth<A, B, F>(
&self,
relative_url: &str,
method: Method,
maybe_body: Option<&A>,
maybe_query_params: Option<&[(String, PercentEncodedString)]>,
error_code: RequestErrorCode,
auth_b: AuthV2Builder<'_>,
resp_handler: F,
) -> Result<B, IronOxideErr>
pub async fn request_ironcore_auth<A, B, F>( &self, relative_url: &str, method: Method, maybe_body: Option<&A>, maybe_query_params: Option<&[(String, PercentEncodedString)]>, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, resp_handler: F, ) -> Result<B, IronOxideErr>
Make a request to the url using the specified method. DEFAULT_HEADERS will be used as well as whatever headers are passed
in. The response will be sent to resp_handler
so the caller can make the received bytes however they want.
pub async fn delete_with_no_body<B: DeserializeOwned>( &self, relative_url: &str, error_code: RequestErrorCode, auth_b: AuthV2Builder<'_>, ) -> Result<B, IronOxideErr>
Trait Implementations§
Source§impl Clone for IronCoreRequest
impl Clone for IronCoreRequest
Source§fn clone(&self) -> IronCoreRequest
fn clone(&self) -> IronCoreRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for IronCoreRequest
impl Debug for IronCoreRequest
Source§impl Default for IronCoreRequest
impl Default for IronCoreRequest
Source§impl Deserialize<'static> for IronCoreRequest
impl Deserialize<'static> for IronCoreRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'static>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'static>,
Source§impl Hash for IronCoreRequest
impl Hash for IronCoreRequest
Source§impl PartialEq for IronCoreRequest
impl PartialEq for IronCoreRequest
Source§impl Serialize for IronCoreRequest
impl Serialize for IronCoreRequest
impl Eq for IronCoreRequest
Auto Trait Implementations§
impl Freeze for IronCoreRequest
impl !RefUnwindSafe for IronCoreRequest
impl Send for IronCoreRequest
impl Sync for IronCoreRequest
impl Unpin for IronCoreRequest
impl !UnwindSafe for IronCoreRequest
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
Source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
Source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more