pub struct RequestBuilder { /* private fields */ }Expand description
Builder for typed requests.
Implementations§
Source§impl RequestBuilder
impl RequestBuilder
pub fn new(method: FetchMethod, url: impl Into<String>) -> Self
pub fn get(url: impl Into<String>) -> Self
pub fn post(url: impl Into<String>) -> Self
pub fn put(url: impl Into<String>) -> Self
pub fn patch(url: impl Into<String>) -> Self
pub fn delete(url: impl Into<String>) -> Self
pub fn body(self, body: RequestBody) -> Self
pub fn get_bearer_auth(&self) -> Computed<Option<String>>
pub fn bearer_auth(self, token: impl Into<Computed<Option<String>>>) -> Self
pub fn set_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn body_json(self, body: impl JsJsonSerialize) -> Self
pub fn headers(self, headers: BTreeMap<String, String>) -> Self
pub fn ttl_seconds(self, seconds: u64) -> Self
pub fn ttl_minutes(self, minutes: u64) -> Self
pub fn ttl_hours(self, hours: u64) -> Self
pub fn ttl_days(self, days: u64) -> Self
pub fn get_ttl(&self) -> Option<Duration>
pub fn to_request(self, token: Option<String>) -> SsrFetchRequest
pub fn to_request_context(self, context: &Context) -> SsrFetchRequest
pub async fn call(self) -> RequestResponse
Sourcepub fn lazy_cache<T: PartialEq>(
self,
map_response: impl Fn(u32, RequestBody) -> Option<Result<T, String>> + 'static,
) -> LazyCache<T>
pub fn lazy_cache<T: PartialEq>( self, map_response: impl Fn(u32, RequestBody) -> Option<Result<T, String>> + 'static, ) -> LazyCache<T>
Create a LazyCache that deserializes T from the given URL.
Sourcepub fn lazy_list_cache<T: CollectionKey + PartialEq>(
self,
map_response: impl Fn(u32, RequestBody) -> Option<Result<Vec<T::Value>, String>> + 'static,
) -> LazyListCache<T>
pub fn lazy_list_cache<T: CollectionKey + PartialEq>( self, map_response: impl Fn(u32, RequestBody) -> Option<Result<Vec<T::Value>, String>> + 'static, ) -> LazyListCache<T>
Create a LazyListCache that deserializes Vec<T::Value> from the given URL.
Trait Implementations§
Source§impl Clone for RequestBuilder
impl Clone for RequestBuilder
Source§fn clone(&self) -> RequestBuilder
fn clone(&self) -> RequestBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RequestBuilder
impl !Send for RequestBuilder
impl !Sync for RequestBuilder
impl !UnwindSafe for RequestBuilder
impl Freeze for RequestBuilder
impl Unpin for RequestBuilder
impl UnsafeUnpin for RequestBuilder
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