jacquard-api 0.10.2

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

#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct GetUnreadCount {
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub seen_at: std::option::Option<jacquard_common::types::string::Datetime>,
}

pub mod get_unread_count_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 GetUnreadCountBuilder<S: get_unread_count_state::State> {
    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
    __unsafe_private_named: (
        ::core::option::Option<jacquard_common::types::string::Datetime>,
    ),
}

impl GetUnreadCount {
    /// Create a new builder for this type
    pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
        GetUnreadCountBuilder::new()
    }
}

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

impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
    /// Set the `seenAt` field (optional)
    pub fn seen_at(
        mut self,
        value: impl Into<Option<jacquard_common::types::string::Datetime>>,
    ) -> Self {
        self.__unsafe_private_named.0 = value.into();
        self
    }
    /// Set the `seenAt` field to an Option value (optional)
    pub fn maybe_seen_at(
        mut self,
        value: Option<jacquard_common::types::string::Datetime>,
    ) -> Self {
        self.__unsafe_private_named.0 = value;
        self
    }
}

impl<S> GetUnreadCountBuilder<S>
where
    S: get_unread_count_state::State,
{
    /// Build the final struct
    pub fn build(self) -> GetUnreadCount {
        GetUnreadCount {
            seen_at: 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 GetUnreadCountOutput<'a> {
    pub count: i64,
}

/// Response type for
///sh.weaver.notification.getUnreadCount
pub struct GetUnreadCountResponse;
impl jacquard_common::xrpc::XrpcResp for GetUnreadCountResponse {
    const NSID: &'static str = "sh.weaver.notification.getUnreadCount";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetUnreadCountOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl jacquard_common::xrpc::XrpcRequest for GetUnreadCount {
    const NSID: &'static str = "sh.weaver.notification.getUnreadCount";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetUnreadCountResponse;
}

/// Endpoint type for
///sh.weaver.notification.getUnreadCount
pub struct GetUnreadCountRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetUnreadCountRequest {
    const PATH: &'static str = "/xrpc/sh.weaver.notification.getUnreadCount";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetUnreadCount;
    type Response = GetUnreadCountResponse;
}