pub struct WebHook { /* private fields */ }
Expand description
User-defined HTTP callbacks.
Implementations§
Source§impl WebHook
impl WebHook
Sourcepub fn try_new(config: &Table) -> Result<Self, Error>
pub fn try_new(config: &Table) -> Result<Self, Error>
Attempts to construct a new instance from the config.
Sourcepub fn query(self, key: &str, value: impl Into<JsonValue>) -> Self
pub fn query(self, key: &str, value: impl Into<JsonValue>) -> Self
Adds a key/value pair for the request query.
Sourcepub fn query_param(self, key: &str, param: Option<&str>) -> Self
pub fn query_param(self, key: &str, param: Option<&str>) -> Self
Adds a parameter for the request query.
Sourcepub fn build_query(self) -> Result<Self, Error>
pub fn build_query(self) -> Result<Self, Error>
Builds the request query.
Sourcepub fn header(self, key: &str, value: impl Into<JsonValue>) -> Self
pub fn header(self, key: &str, value: impl Into<JsonValue>) -> Self
Adds a key/value pair for the request headers.
Sourcepub fn set_params(&mut self, params: impl Into<JsonValue>)
pub fn set_params(&mut self, params: impl Into<JsonValue>)
Sets the request params.
Sourcepub async fn trigger<T: DeserializeOwned>(&self) -> Result<T, Error>
pub async fn trigger<T: DeserializeOwned>(&self) -> Result<T, Error>
Triggers the webhook and deserializes the response body via JSON.
Auto Trait Implementations§
impl Freeze for WebHook
impl RefUnwindSafe for WebHook
impl Send for WebHook
impl Sync for WebHook
impl Unpin for WebHook
impl UnwindSafe for WebHook
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