stripe/model/
webhook_endpoint.rs

1use serde::{Serialize, Deserialize};
2/**You can configure [webhook endpoints](https://stripe.com/docs/webhooks/) via the API to be
3notified about events that happen in your Stripe account or connected
4accounts.
5
6Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
7
8Related guide: [Setting up webhooks](https://stripe.com/docs/webhooks/configure)*/
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10pub struct WebhookEndpoint {
11    ///The API version events are rendered as for this webhook endpoint.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub api_version: Option<String>,
14    ///The ID of the associated Connect application.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub application: Option<String>,
17    ///Time at which the object was created. Measured in seconds since the Unix epoch.
18    pub created: i64,
19    ///An optional description of what the webhook is used for.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub description: Option<String>,
22    ///The list of events to enable for this endpoint. `['*']` indicates that all events are enabled, except those that require explicit selection.
23    pub enabled_events: Vec<String>,
24    ///Unique identifier for the object.
25    pub id: String,
26    ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
27    pub livemode: bool,
28    ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
29    pub metadata: serde_json::Value,
30    ///String representing the object's type. Objects of the same type share the same value.
31    pub object: String,
32    ///The endpoint's secret, used to generate [webhook signatures](https://stripe.com/docs/webhooks/signatures). Only returned at creation.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub secret: Option<String>,
35    ///The status of the webhook. It can be `enabled` or `disabled`.
36    pub status: String,
37    ///The URL of the webhook endpoint.
38    pub url: String,
39}
40impl std::fmt::Display for WebhookEndpoint {
41    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
42        write!(f, "{}", serde_json::to_string(self).unwrap())
43    }
44}