#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::place_stream::branding::get_branding;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct BrandingAsset<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
pub key: S,
pub mime_type: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetBranding<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub broadcaster: Option<Did<S>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetBrandingOutput<S: BosStr = DefaultStr> {
pub assets: Vec<get_branding::BrandingAsset<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic,
)]
#[serde(tag = "error", content = "message")]
pub enum GetBrandingError {
#[serde(untagged)]
Other {
error: SmolStr,
message: Option<SmolStr>,
},
}
impl core::fmt::Display for GetBrandingError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Other { error, message } => {
write!(f, "{}", error)?;
if let Some(msg) = message {
write!(f, ": {}", msg)?;
}
Ok(())
}
}
}
}
impl<S: BosStr> LexiconSchema for BrandingAsset<S> {
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<S: BosStr> = GetBrandingOutput<S>;
type Err = GetBrandingError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetBranding<S> {
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<S: BosStr> = GetBranding<S>;
type Response = GetBrandingResponse;
}
fn lexicon_doc_place_stream_branding_getBranding() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
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::{IsSet, IsUnset, Set, Unset};
#[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<S: BosStr, St: get_branding_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetBranding<S> {
pub fn new() -> GetBrandingBuilder<S, get_branding_state::Empty> {
GetBrandingBuilder::new()
}
}
impl<S: BosStr> GetBrandingBuilder<S, get_branding_state::Empty> {
pub fn new() -> Self {
GetBrandingBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: get_branding_state::State> GetBrandingBuilder<S, St> {
pub fn broadcaster(mut self, value: impl Into<Option<Did<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_broadcaster(mut self, value: Option<Did<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> GetBrandingBuilder<S, St>
where
St: get_branding_state::State,
{
pub fn build(self) -> GetBranding<S> {
GetBranding {
broadcaster: self._fields.0,
}
}
}