jacquard-api 0.11.0

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: chat.firehose.getUserChannels
//
// 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;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::chat_firehose::get_user_channels;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Channel<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub name: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub uri: Option<CowStr<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetUserChannelsOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub channels: Option<Vec<get_user_channels::Channel<'a>>>,
}

impl<'a> LexiconSchema for Channel<'a> {
    fn nsid() -> &'static str {
        "chat.firehose.getUserChannels"
    }
    fn def_name() -> &'static str {
        "channel"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_firehose_getUserChannels()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

/// XRPC request marker type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct GetUserChannels;
/// Response type for chat.firehose.getUserChannels
pub struct GetUserChannelsResponse;
impl jacquard_common::xrpc::XrpcResp for GetUserChannelsResponse {
    const NSID: &'static str = "chat.firehose.getUserChannels";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetUserChannelsOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl jacquard_common::xrpc::XrpcRequest for GetUserChannels {
    const NSID: &'static str = "chat.firehose.getUserChannels";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetUserChannelsResponse;
}

/// Endpoint type for chat.firehose.getUserChannels
pub struct GetUserChannelsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetUserChannelsRequest {
    const PATH: &'static str = "/xrpc/chat.firehose.getUserChannels";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetUserChannels;
    type Response = GetUserChannelsResponse;
}

fn lexicon_doc_chat_firehose_getUserChannels() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("chat.firehose.getUserChannels"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("channel"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcQuery(LexXrpcQuery {
                    parameters: None,
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}