1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Webhook subscription and delivery models.
use serde::{Deserialize, Serialize};
/// Workspace webhook subscription.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct WebhookSubscription {
/// Subscription identifier, when returned by the API.
#[serde(default)]
pub id: Option<String>,
/// Destination URL.
#[serde(default)]
pub url: Option<String>,
/// Contact email for delivery failures and ownership.
#[serde(default)]
pub email: Option<String>,
/// Event names that trigger delivery.
#[serde(default)]
pub events: Vec<String>,
/// Whether delivery is active.
#[serde(default)]
pub is_active: bool,
/// Creation timestamp.
#[serde(default)]
pub created_at: Option<serde_json::Value>,
/// Last-modification timestamp.
#[serde(default)]
pub updated_at: Option<serde_json::Value>,
}
/// Supported webhook event type.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct WebhookEventTypeInfo {
/// Event identifier.
pub id: String,
/// Human-readable event description.
#[serde(default)]
pub description: String,
}
/// Webhook delivery history row.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct WebhookDispatch {
/// Resource discriminator, when returned by single-resource endpoints.
#[serde(default)]
pub resource: Option<String>,
/// Dispatch identifier.
pub id: String,
/// Event name.
pub event: String,
/// Source activity identifier.
#[serde(default)]
pub activity_id: Option<i64>,
/// Delivery endpoint URL.
#[serde(default)]
pub endpoint: Option<String>,
/// Payload sent to the endpoint.
#[serde(default)]
pub payload: Option<serde_json::Value>,
/// Whether delivery succeeded.
#[serde(default)]
pub delivered: bool,
/// HTTP status returned by the endpoint, when available.
#[serde(default)]
pub http_status: Option<u16>,
/// Response body returned by the endpoint, when available.
#[serde(default)]
pub response_body: Option<String>,
/// Delivery error, when available.
#[serde(default)]
pub error: Option<String>,
/// Creation timestamp.
#[serde(default)]
pub created_at: Option<serde_json::Value>,
/// Last-modification timestamp.
#[serde(default)]
pub updated_at: Option<serde_json::Value>,
}