Skip to main content

supercode_interchange/world/
subscription.rs

1//! Webhook subscriptions (ยง2.6; Hermes `webhook_subscriptions.json`).
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6use super::Target;
7use crate::ontology::{Residue, SecretRef};
8
9/// One subscription: the route is `/webhooks/<name>`.
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
11pub struct WebhookSubscription {
12    /// The name.
13    pub name: String,
14    /// The HMAC secret, by reference.
15    #[serde(default)]
16    pub secret: Option<SecretRef>,
17    /// Accepted event names; all when absent.
18    #[serde(default)]
19    pub events: Option<Vec<String>>,
20    /// The prompt, rendered with the payload.
21    #[serde(default)]
22    pub prompt_template: String,
23    /// Where the answer goes.
24    #[serde(default)]
25    pub deliver: Option<Target>,
26    /// Skills to load.
27    #[serde(default)]
28    pub skills: Vec<String>,
29    /// Description.
30    #[serde(default)]
31    pub description: Option<String>,
32    /// Creation, RFC3339.
33    #[serde(default)]
34    pub created_at: Option<String>,
35    /// Unmodeled fields, verbatim.
36    #[serde(default)]
37    pub residue: Residue,
38}