Skip to main content

WebhooksResource

Struct WebhooksResource 

Source
pub struct WebhooksResource<'a> { /* private fields */ }
Expand description

Webhooks resource for managing webhook endpoints.

Implementations§

Source§

impl<'a> WebhooksResource<'a>

Source

pub async fn create( &self, url: impl Into<String>, events: Vec<impl Into<String>>, ) -> Result<WebhookCreatedResponse>

Creates a new webhook.

§Arguments
  • url - URL to receive webhook events
  • events - List of event types to subscribe to
§Example
use sendly::Sendly;

let client = Sendly::new("sk_live_v1_xxx");

let response = client.webhooks().create(
    "https://example.com/webhook",
    vec!["message.delivered", "message.failed"],
).await?;

println!("Webhook created: {:?}", response.get_webhook());
println!("Secret: {}", response.secret);
Source

pub async fn create_with_options( &self, request: CreateWebhookRequest, ) -> Result<WebhookCreatedResponse>

Creates a new webhook with full options.

Source

pub async fn list(&self) -> Result<Vec<Webhook>>

Lists all webhooks.

§Example
use sendly::Sendly;

let client = Sendly::new("sk_live_v1_xxx");

let webhooks = client.webhooks().list().await?;
for webhook in webhooks {
    println!("Webhook: {} -> {}", webhook.id, webhook.url);
}
Source

pub async fn get(&self, id: impl AsRef<str>) -> Result<Webhook>

Gets a webhook by ID.

§Arguments
  • id - Webhook ID
Source

pub async fn update( &self, id: impl AsRef<str>, request: UpdateWebhookRequest, ) -> Result<Webhook>

Updates a webhook.

§Arguments
  • id - Webhook ID
  • request - Update options
Source

pub async fn delete(&self, id: impl AsRef<str>) -> Result<()>

Deletes a webhook.

§Arguments
  • id - Webhook ID
Source

pub async fn test(&self, id: impl AsRef<str>) -> Result<WebhookTestResult>

Tests a webhook endpoint.

§Arguments
  • id - Webhook ID
Source

pub async fn reset_circuit(&self, id: impl AsRef<str>) -> Result<Value>

Resets the circuit breaker for a webhook.

§Arguments
  • id - Webhook ID
Source

pub async fn rotate_secret( &self, id: impl AsRef<str>, ) -> Result<WebhookSecretRotation>

Rotates a webhook’s secret.

§Arguments
  • id - Webhook ID
Source

pub async fn list_deliveries( &self, id: impl AsRef<str>, options: Option<ListDeliveriesOptions>, ) -> Result<WebhookDeliveryList>

Lists delivery attempts for a webhook.

§Arguments
  • id - Webhook ID
  • options - Query options
Source

pub async fn get_delivery( &self, webhook_id: impl AsRef<str>, delivery_id: impl AsRef<str>, ) -> Result<WebhookDelivery>

Gets a specific delivery attempt.

§Arguments
  • webhook_id - Webhook ID
  • delivery_id - Delivery ID
Source

pub async fn retry_delivery( &self, webhook_id: impl AsRef<str>, delivery_id: impl AsRef<str>, ) -> Result<WebhookDelivery>

Retries a failed delivery.

§Arguments
  • webhook_id - Webhook ID
  • delivery_id - Delivery ID
Source

pub async fn list_event_types(&self) -> Result<Vec<String>>

Lists available webhook event types.

§Example
use sendly::Sendly;

let client = Sendly::new("sk_live_v1_xxx");

let event_types = client.webhooks().list_event_types().await?;
for event_type in event_types {
    println!("Event type: {}", event_type);
}

Auto Trait Implementations§

§

impl<'a> Freeze for WebhooksResource<'a>

§

impl<'a> !RefUnwindSafe for WebhooksResource<'a>

§

impl<'a> Send for WebhooksResource<'a>

§

impl<'a> Sync for WebhooksResource<'a>

§

impl<'a> Unpin for WebhooksResource<'a>

§

impl<'a> UnsafeUnpin for WebhooksResource<'a>

§

impl<'a> !UnwindSafe for WebhooksResource<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more