#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, 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::{AtUri, Cid};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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::multistream::TargetView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListTargets<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListTargetsOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
pub targets: Vec<TargetView<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, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Record<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub uri: AtUri<S>,
pub value: Data<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct ListTargetsResponse;
impl jacquard_common::xrpc::XrpcResp for ListTargetsResponse {
const NSID: &'static str = "place.stream.multistream.listTargets";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ListTargetsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for ListTargets<S> {
const NSID: &'static str = "place.stream.multistream.listTargets";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = ListTargetsResponse;
}
pub struct ListTargetsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListTargetsRequest {
const PATH: &'static str = "/xrpc/place.stream.multistream.listTargets";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = ListTargets<S>;
type Response = ListTargetsResponse;
}
impl<S: BosStr> LexiconSchema for Record<S> {
fn nsid() -> &'static str {
"place.stream.multistream.listTargets"
}
fn def_name() -> &'static str {
"record"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_place_stream_multistream_listTargets()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn _default_limit() -> Option<i64> {
Some(50i64)
}
pub mod list_targets_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 ListTargetsBuilder<S: BosStr, St: list_targets_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ListTargets<S> {
pub fn new() -> ListTargetsBuilder<S, list_targets_state::Empty> {
ListTargetsBuilder::new()
}
}
impl<S: BosStr> ListTargetsBuilder<S, list_targets_state::Empty> {
pub fn new() -> Self {
ListTargetsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: list_targets_state::State> ListTargetsBuilder<S, St> {
pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: list_targets_state::State> ListTargetsBuilder<S, St> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> ListTargetsBuilder<S, St>
where
St: list_targets_state::State,
{
pub fn build(self) -> ListTargets<S> {
ListTargets {
cursor: self._fields.0,
limit: self._fields.1,
}
}
}
pub mod record_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 {
type Uri;
type Cid;
type Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
type Value = Unset;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Uri = Set<members::uri>;
type Cid = St::Cid;
type Value = St::Value;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Uri = St::Uri;
type Cid = Set<members::cid>;
type Value = St::Value;
}
pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetValue<St> {}
impl<St: State> State for SetValue<St> {
type Uri = St::Uri;
type Cid = St::Cid;
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
pub struct value(());
}
}
pub struct RecordBuilder<S: BosStr, St: record_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Cid<S>>, Option<AtUri<S>>, Option<Data<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Record<S> {
pub fn new() -> RecordBuilder<S, record_state::Empty> {
RecordBuilder::new()
}
}
impl<S: BosStr> RecordBuilder<S, record_state::Empty> {
pub fn new() -> Self {
RecordBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Cid: record_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> RecordBuilder<S, record_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
RecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Uri: record_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> RecordBuilder<S, record_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
RecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Value: record_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<Data<S>>,
) -> RecordBuilder<S, record_state::SetValue<St>> {
self._fields.2 = Option::Some(value.into());
RecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordBuilder<S, St>
where
St: record_state::State,
St::Uri: record_state::IsSet,
St::Cid: record_state::IsSet,
St::Value: record_state::IsSet,
{
pub fn build(self) -> Record<S> {
Record {
cid: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
value: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Record<S> {
Record {
cid: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
value: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_place_stream_multistream_listTargets() -> 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.multistream.listTargets"),
defs: {
let mut map = BTreeMap::new();
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("cursor"),
LexXrpcParametersProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("limit"),
LexXrpcParametersProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("value")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}