pub struct WebhookClient { /* private fields */ }Expand description
SSRF-guarded HTTP client that POSTs JSON payloads to a webhook URL.
See the module docs for the security posture (host validation, IP pinning, redirects disabled).
Implementations§
Source§impl WebhookClient
impl WebhookClient
Sourcepub fn from_config(config: &SeerConfig) -> Self
pub fn from_config(config: &SeerConfig) -> Self
Builds a client honoring ~/.seer/config.toml settings.
Reads timeouts.http_secs (already clamped to 1–120s by
crate::config::SeerConfig::load) — webhook delivery is an HTTP
operation, so it shares the HTTP timeout knob. Sugar over
WebhookClient::with_timeout.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the per-delivery timeout.
Sourcepub async fn post_json<T: Serialize + ?Sized>(
&self,
url: &str,
payload: &T,
) -> Result<WebhookDelivery>
pub async fn post_json<T: Serialize + ?Sized>( &self, url: &str, payload: &T, ) -> Result<WebhookDelivery>
POSTs payload as JSON to url.
§Arguments
url- Webhook endpoint; must behttp/httpswith a public hostpayload- Any serializable value; sent as the JSON request body
§Returns
Ok(WebhookDelivery)- the endpoint answered 2xxErr(SeerError::InvalidInput)- bad URL shape or SSRF-blocked hostErr(SeerError::JsonError)- payload failed to serializeErr(SeerError::HttpError)- endpoint answered non-2xx (the error names the status; the response body is untrusted and never read)Err(SeerError::ReqwestError)- transport failure (connect/timeout)
Trait Implementations§
Source§impl Clone for WebhookClient
impl Clone for WebhookClient
Source§fn clone(&self) -> WebhookClient
fn clone(&self) -> WebhookClient
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 moreSource§impl Debug for WebhookClient
impl Debug for WebhookClient
Auto Trait Implementations§
impl Freeze for WebhookClient
impl RefUnwindSafe for WebhookClient
impl Send for WebhookClient
impl Sync for WebhookClient
impl Unpin for WebhookClient
impl UnsafeUnpin for WebhookClient
impl UnwindSafe for WebhookClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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