atrium-api 0.25.8

API library for AT Protocol (Bluesky)
Documentation
// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `tools.ozone.safelink.addRule` namespace.
pub const NSID: &str = "tools.ozone.safelink.addRule";
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct InputData {
    pub action: crate::tools::ozone::safelink::defs::ActionType,
    ///Optional comment about the decision
    #[serde(skip_serializing_if = "core::option::Option::is_none")]
    pub comment: core::option::Option<String>,
    ///Author DID. Only respected when using admin auth
    #[serde(skip_serializing_if = "core::option::Option::is_none")]
    pub created_by: core::option::Option<crate::types::string::Did>,
    pub pattern: crate::tools::ozone::safelink::defs::PatternType,
    pub reason: crate::tools::ozone::safelink::defs::ReasonType,
    ///The URL or domain to apply the rule to
    pub url: String,
}
pub type Input = crate::types::Object<InputData>;
pub type Output = crate::tools::ozone::safelink::defs::Event;
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
    ///The provided URL is invalid
    InvalidUrl(Option<String>),
    ///A rule for this URL/domain already exists
    RuleAlreadyExists(Option<String>),
}
impl std::fmt::Display for Error {
    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Error::InvalidUrl(msg) => {
                write!(_f, "InvalidUrl")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::RuleAlreadyExists(msg) => {
                write!(_f, "RuleAlreadyExists")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
        }
        Ok(())
    }
}