jacquard-api 0.10.2

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: place.stream.branding.getBranding
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic,
    Default
)]
#[serde(rename_all = "camelCase")]
pub struct BrandingAsset<'a> {
    ///Inline data for text assets
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub data: std::option::Option<jacquard_common::CowStr<'a>>,
    ///Image height in pixels (optional, for images only)
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub height: std::option::Option<i64>,
    ///Asset key identifier
    #[serde(borrow)]
    pub key: jacquard_common::CowStr<'a>,
    ///MIME type of the asset
    #[serde(borrow)]
    pub mime_type: jacquard_common::CowStr<'a>,
    ///URL to fetch the asset blob (for images)
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub url: std::option::Option<jacquard_common::CowStr<'a>>,
    ///Image width in pixels (optional, for images only)
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub width: std::option::Option<i64>,
}

fn lexicon_doc_place_stream_branding_getBranding() -> ::jacquard_lexicon::lexicon::LexiconDoc<
    'static,
> {
    ::jacquard_lexicon::lexicon::LexiconDoc {
        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
        id: ::jacquard_common::CowStr::new_static("place.stream.branding.getBranding"),
        revision: None,
        description: None,
        defs: {
            let mut map = ::alloc::collections::BTreeMap::new();
            map.insert(
                ::jacquard_common::deps::smol_str::SmolStr::new_static("brandingAsset"),
                ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
                    description: None,
                    required: Some(
                        vec![
                            ::jacquard_common::deps::smol_str::SmolStr::new_static("key"),
                            ::jacquard_common::deps::smol_str::SmolStr::new_static("mimeType")
                        ],
                    ),
                    nullable: None,
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = ::alloc::collections::BTreeMap::new();
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "data",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                description: Some(
                                    ::jacquard_common::CowStr::new_static(
                                        "Inline data for text assets",
                                    ),
                                ),
                                format: None,
                                default: None,
                                min_length: None,
                                max_length: None,
                                min_graphemes: None,
                                max_graphemes: None,
                                r#enum: None,
                                r#const: None,
                                known_values: None,
                            }),
                        );
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "height",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
                                description: None,
                                default: None,
                                minimum: None,
                                maximum: None,
                                r#enum: None,
                                r#const: None,
                            }),
                        );
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "key",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                description: Some(
                                    ::jacquard_common::CowStr::new_static(
                                        "Asset key identifier",
                                    ),
                                ),
                                format: None,
                                default: None,
                                min_length: None,
                                max_length: None,
                                min_graphemes: None,
                                max_graphemes: None,
                                r#enum: None,
                                r#const: None,
                                known_values: None,
                            }),
                        );
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "mimeType",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                description: Some(
                                    ::jacquard_common::CowStr::new_static(
                                        "MIME type of the asset",
                                    ),
                                ),
                                format: None,
                                default: None,
                                min_length: None,
                                max_length: None,
                                min_graphemes: None,
                                max_graphemes: None,
                                r#enum: None,
                                r#const: None,
                                known_values: None,
                            }),
                        );
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "url",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                description: Some(
                                    ::jacquard_common::CowStr::new_static(
                                        "URL to fetch the asset blob (for images)",
                                    ),
                                ),
                                format: None,
                                default: None,
                                min_length: None,
                                max_length: None,
                                min_graphemes: None,
                                max_graphemes: None,
                                r#enum: None,
                                r#const: None,
                                known_values: None,
                            }),
                        );
                        map.insert(
                            ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                "width",
                            ),
                            ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
                                description: None,
                                default: None,
                                minimum: None,
                                maximum: None,
                                r#enum: None,
                                r#const: None,
                            }),
                        );
                        map
                    },
                }),
            );
            map.insert(
                ::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
                ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
                    description: None,
                    parameters: Some(
                        ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
                            description: None,
                            required: Some(vec![]),
                            properties: {
                                #[allow(unused_mut)]
                                let mut map = ::alloc::collections::BTreeMap::new();
                                map.insert(
                                    ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                        "broadcaster",
                                    ),
                                    ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
                                        description: Some(
                                            ::jacquard_common::CowStr::new_static(
                                                "DID of the broadcaster. If not provided, uses the server's default broadcaster.",
                                            ),
                                        ),
                                        format: Some(
                                            ::jacquard_lexicon::lexicon::LexStringFormat::Did,
                                        ),
                                        default: None,
                                        min_length: None,
                                        max_length: None,
                                        min_graphemes: None,
                                        max_graphemes: None,
                                        r#enum: None,
                                        r#const: None,
                                        known_values: None,
                                    }),
                                );
                                map
                            },
                        }),
                    ),
                    output: None,
                    errors: None,
                }),
            );
            map
        },
    }
}

impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BrandingAsset<'a> {
    fn nsid() -> &'static str {
        "place.stream.branding.getBranding"
    }
    fn def_name() -> &'static str {
        "brandingAsset"
    }
    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
        lexicon_doc_place_stream_branding_getBranding()
    }
    fn validate(
        &self,
    ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
        Ok(())
    }
}

#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct GetBranding<'a> {
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub broadcaster: std::option::Option<jacquard_common::types::string::Did<'a>>,
}

pub mod get_branding_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type
pub struct GetBrandingBuilder<'a, S: get_branding_state::State> {
    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
    __unsafe_private_named: (
        ::core::option::Option<jacquard_common::types::string::Did<'a>>,
    ),
    _phantom: ::core::marker::PhantomData<&'a ()>,
}

impl<'a> GetBranding<'a> {
    /// Create a new builder for this type
    pub fn new() -> GetBrandingBuilder<'a, get_branding_state::Empty> {
        GetBrandingBuilder::new()
    }
}

impl<'a> GetBrandingBuilder<'a, get_branding_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        GetBrandingBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: (None,),
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S: get_branding_state::State> GetBrandingBuilder<'a, S> {
    /// Set the `broadcaster` field (optional)
    pub fn broadcaster(
        mut self,
        value: impl Into<Option<jacquard_common::types::string::Did<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.0 = value.into();
        self
    }
    /// Set the `broadcaster` field to an Option value (optional)
    pub fn maybe_broadcaster(
        mut self,
        value: Option<jacquard_common::types::string::Did<'a>>,
    ) -> Self {
        self.__unsafe_private_named.0 = value;
        self
    }
}

impl<'a, S> GetBrandingBuilder<'a, S>
where
    S: get_branding_state::State,
{
    /// Build the final struct
    pub fn build(self) -> GetBranding<'a> {
        GetBranding {
            broadcaster: self.__unsafe_private_named.0,
        }
    }
}

#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct GetBrandingOutput<'a> {
    ///List of available branding assets
    #[serde(borrow)]
    pub assets: Vec<crate::place_stream::branding::get_branding::BrandingAsset<'a>>,
}

#[jacquard_derive::open_union]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    thiserror::Error,
    miette::Diagnostic,
    jacquard_derive::IntoStatic
)]
#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum GetBrandingError<'a> {}
impl core::fmt::Display for GetBrandingError<'_> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        match self {
            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
        }
    }
}

/// Response type for
///place.stream.branding.getBranding
pub struct GetBrandingResponse;
impl jacquard_common::xrpc::XrpcResp for GetBrandingResponse {
    const NSID: &'static str = "place.stream.branding.getBranding";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetBrandingOutput<'de>;
    type Err<'de> = GetBrandingError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for GetBranding<'a> {
    const NSID: &'static str = "place.stream.branding.getBranding";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetBrandingResponse;
}

/// Endpoint type for
///place.stream.branding.getBranding
pub struct GetBrandingRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetBrandingRequest {
    const PATH: &'static str = "/xrpc/place.stream.branding.getBranding";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetBranding<'de>;
    type Response = GetBrandingResponse;
}