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
/*
* enbbox API
*
* Notification infrastructure API — open-source alternative to Novu/Courier
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// CreateIntegration : Register a delivery provider integration. Each integration connects a provider (e.g. SendGrid) to a channel (e.g. email).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateIntegration {
/// Whether this integration is active and available for routing. Defaults to `true`.
#[serde(rename = "active", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub active: Option<Option<bool>>,
/// Channel this integration serves.
#[serde(rename = "channel")]
pub channel: models::ChannelType,
/// Routing conditions — JSON rules that control when this integration is selected.
#[serde(rename = "conditions")]
pub conditions: serde_json::Value,
/// Non-sensitive provider configuration (host, port, from, region, etc.).
#[serde(rename = "config", skip_serializing_if = "Option::is_none")]
pub config: Option<serde_json::Value>,
/// Sensitive provider credentials (API keys, tokens, secrets).
#[serde(rename = "credentials", skip_serializing_if = "Option::is_none")]
pub credentials: Option<serde_json::Value>,
/// Unique slug identifier for API references (lowercase alphanumeric + hyphens).
#[serde(rename = "identifier")]
pub identifier: String,
/// Human-readable display name for this integration.
#[serde(rename = "name")]
pub name: String,
/// Provider identifier string (e.g. `sendgrid`, `twilio`, `fcm`).
#[serde(rename = "provider_id")]
pub provider_id: String,
/// If true, test the connection before saving. Returns error if connection fails.
#[serde(rename = "test_connection", skip_serializing_if = "Option::is_none")]
pub test_connection: Option<bool>,
}
impl CreateIntegration {
/// Register a delivery provider integration. Each integration connects a provider (e.g. SendGrid) to a channel (e.g. email).
pub fn new(channel: models::ChannelType, conditions: serde_json::Value, identifier: String, name: String, provider_id: String) -> CreateIntegration {
CreateIntegration {
active: None,
channel,
conditions,
config: None,
credentials: None,
identifier,
name,
provider_id,
test_connection: None,
}
}
}