pub struct WebhookSink { /* private fields */ }Expand description
Webhook sink — POSTs notification as JSON to a URL.
Implementations§
Source§impl WebhookSink
impl WebhookSink
Sourcepub fn new(url: impl Into<String>) -> Result<Self>
pub fn new(url: impl Into<String>) -> Result<Self>
Create a new webhook sink, validating the URL at construction time.
Rejects URLs that:
- Are not valid URLs
- Use a scheme other than http or https
- Target localhost or private/loopback IP addresses (SSRF mitigation)
pub async fn send(&self, notification: &Notification) -> Result<()>
Auto Trait Implementations§
impl Freeze for WebhookSink
impl !RefUnwindSafe for WebhookSink
impl Send for WebhookSink
impl Sync for WebhookSink
impl Unpin for WebhookSink
impl UnsafeUnpin for WebhookSink
impl !UnwindSafe for WebhookSink
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