#[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_common::types::string::Did;
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::place_stream::branding::get_branding;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct BrandingAsset<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub data: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(borrow)]
pub key: CowStr<'a>,
#[serde(borrow)]
pub mime_type: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub url: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetBranding<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub broadcaster: Option<Did<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetBrandingOutput<'a> {
#[serde(borrow)]
pub assets: Vec<get_branding::BrandingAsset<'a>>,
}
#[jacquard_derive::open_union]
#[derive(
Serialize,
Deserialize,
Debug,
Clone,
PartialEq,
Eq,
thiserror::Error,
miette::Diagnostic,
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),
}
}
}
impl<'a> LexiconSchema for BrandingAsset<'a> {
fn nsid() -> &'static str {
"place.stream.branding.getBranding"
}
fn def_name() -> &'static str {
"brandingAsset"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_branding_getBranding()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
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;
}
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;
}
fn lexicon_doc_place_stream_branding_getBranding() -> 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("place.stream.branding.getBranding"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("brandingAsset"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("key"), SmolStr::new_static("mimeType")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("data"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Inline data for text assets"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("height"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("key"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Asset key identifier"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mimeType"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("MIME type of the asset"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("url"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"URL to fetch the asset blob (for images)",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("width"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("broadcaster"),
LexXrpcParametersProperty::String(LexString {
description: Some(
CowStr::new_static(
"DID of the broadcaster. If not provided, uses the server's default broadcaster.",
),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map
},
..Default::default()
}
}
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 {}
}
pub trait State: sealed::Sealed {}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {}
#[allow(non_camel_case_types)]
pub mod members {}
}
pub struct GetBrandingBuilder<'a, S: get_branding_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Did<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> GetBranding<'a> {
pub fn new() -> GetBrandingBuilder<'a, get_branding_state::Empty> {
GetBrandingBuilder::new()
}
}
impl<'a> GetBrandingBuilder<'a, get_branding_state::Empty> {
pub fn new() -> Self {
GetBrandingBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S: get_branding_state::State> GetBrandingBuilder<'a, S> {
pub fn broadcaster(mut self, value: impl Into<Option<Did<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_broadcaster(mut self, value: Option<Did<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> GetBrandingBuilder<'a, S>
where
S: get_branding_state::State,
{
pub fn build(self) -> GetBranding<'a> {
GetBranding {
broadcaster: self._fields.0,
}
}
}