enbbox 1.0.1

Notification infrastructure API — open-source alternative to Novu/Courier
Documentation
/*
 * 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,
        }
    }
}