pub struct WebhooksResource<'a> { /* private fields */ }Expand description
Webhooks resource for managing webhook endpoints.
Implementations§
Source§impl<'a> WebhooksResource<'a>
impl<'a> WebhooksResource<'a>
Sourcepub async fn create(
&self,
url: impl Into<String>,
events: Vec<impl Into<String>>,
) -> Result<WebhookCreatedResponse>
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 eventsevents- 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);Sourcepub async fn create_with_options(
&self,
request: CreateWebhookRequest,
) -> Result<WebhookCreatedResponse>
pub async fn create_with_options( &self, request: CreateWebhookRequest, ) -> Result<WebhookCreatedResponse>
Creates a new webhook with full options.
Sourcepub async fn list(&self) -> Result<Vec<Webhook>>
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);
}Sourcepub async fn update(
&self,
id: impl AsRef<str>,
request: UpdateWebhookRequest,
) -> Result<Webhook>
pub async fn update( &self, id: impl AsRef<str>, request: UpdateWebhookRequest, ) -> Result<Webhook>
Sourcepub async fn rotate_secret(
&self,
id: impl AsRef<str>,
) -> Result<WebhookSecretRotation>
pub async fn rotate_secret( &self, id: impl AsRef<str>, ) -> Result<WebhookSecretRotation>
Sourcepub async fn list_deliveries(
&self,
id: impl AsRef<str>,
options: Option<ListDeliveriesOptions>,
) -> Result<WebhookDeliveryList>
pub async fn list_deliveries( &self, id: impl AsRef<str>, options: Option<ListDeliveriesOptions>, ) -> Result<WebhookDeliveryList>
Sourcepub async fn get_delivery(
&self,
webhook_id: impl AsRef<str>,
delivery_id: impl AsRef<str>,
) -> Result<WebhookDelivery>
pub async fn get_delivery( &self, webhook_id: impl AsRef<str>, delivery_id: impl AsRef<str>, ) -> Result<WebhookDelivery>
Sourcepub async fn retry_delivery(
&self,
webhook_id: impl AsRef<str>,
delivery_id: impl AsRef<str>,
) -> Result<WebhookDelivery>
pub async fn retry_delivery( &self, webhook_id: impl AsRef<str>, delivery_id: impl AsRef<str>, ) -> Result<WebhookDelivery>
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> !UnwindSafe for WebhooksResource<'a>
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