jacquard-api 0.12.0-beta.1

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

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use serde::{Serialize, Deserialize};
use crate::chat_bsky::convo::LogAcceptConvo;
use crate::chat_bsky::convo::LogAddReaction;
use crate::chat_bsky::convo::LogBeginConvo;
use crate::chat_bsky::convo::LogCreateMessage;
use crate::chat_bsky::convo::LogDeleteMessage;
use crate::chat_bsky::convo::LogLeaveConvo;
use crate::chat_bsky::convo::LogMuteConvo;
use crate::chat_bsky::convo::LogReadMessage;
use crate::chat_bsky::convo::LogRemoveReaction;
use crate::chat_bsky::convo::LogUnmuteConvo;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetLog<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor: Option<S>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetLogOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor: Option<S>,
    pub logs: Vec<GetLogOutputLogsItem<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum GetLogOutputLogsItem<S: BosStr = DefaultStr> {
    #[serde(rename = "chat.bsky.convo.defs#logBeginConvo")]
    LogBeginConvo(Box<LogBeginConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logAcceptConvo")]
    LogAcceptConvo(Box<LogAcceptConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logLeaveConvo")]
    LogLeaveConvo(Box<LogLeaveConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logMuteConvo")]
    LogMuteConvo(Box<LogMuteConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logUnmuteConvo")]
    LogUnmuteConvo(Box<LogUnmuteConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logCreateMessage")]
    LogCreateMessage(Box<LogCreateMessage<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logDeleteMessage")]
    LogDeleteMessage(Box<LogDeleteMessage<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logReadMessage")]
    LogReadMessage(Box<LogReadMessage<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logAddReaction")]
    LogAddReaction(Box<LogAddReaction<S>>),
    #[serde(rename = "chat.bsky.convo.defs#logRemoveReaction")]
    LogRemoveReaction(Box<LogRemoveReaction<S>>),
}

/// Response type for chat.bsky.convo.getLog
pub struct GetLogResponse;
impl jacquard_common::xrpc::XrpcResp for GetLogResponse {
    const NSID: &'static str = "chat.bsky.convo.getLog";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = GetLogOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetLog<S> {
    const NSID: &'static str = "chat.bsky.convo.getLog";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetLogResponse;
}

/// Endpoint type for chat.bsky.convo.getLog
pub struct GetLogRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetLogRequest {
    const PATH: &'static str = "/xrpc/chat.bsky.convo.getLog";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<S: BosStr> = GetLog<S>;
    type Response = GetLogResponse;
}

pub mod get_log_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 GetLogBuilder<S: BosStr, St: get_log_state::State> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>,),
    _type: PhantomData<fn() -> S>,
}

impl<S: BosStr> GetLog<S> {
    /// Create a new builder for this type.
    pub fn new() -> GetLogBuilder<S, get_log_state::Empty> {
        GetLogBuilder::new()
    }
}

impl<S: BosStr> GetLogBuilder<S, get_log_state::Empty> {
    /// Create a new builder with all fields unset.
    pub fn new() -> Self {
        GetLogBuilder {
            _state: PhantomData,
            _fields: (None,),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr, St: get_log_state::State> GetLogBuilder<S, St> {
    /// Set the `cursor` field (optional)
    pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `cursor` field to an Option value (optional)
    pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<S: BosStr, St> GetLogBuilder<S, St>
where
    St: get_log_state::State,
{
    /// Build the final struct.
    pub fn build(self) -> GetLog<S> {
        GetLog { cursor: self._fields.0 }
    }
}