pub mod invite;
pub mod request;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Did, AtUri, Datetime};
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::app_bsky::actor::ProfileViewBasic;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct InviteView<'a> {
pub created_at: Datetime,
#[serde(borrow)]
pub did: Did<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub profile: Option<ProfileViewBasic<'a>>,
#[serde(borrow)]
pub slice: AtUri<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub uri: Option<AtUri<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RequestView<'a> {
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub profile: Option<ProfileViewBasic<'a>>,
#[serde(borrow)]
pub slice: AtUri<'a>,
}
impl<'a> LexiconSchema for InviteView<'a> {
fn nsid() -> &'static str {
"network.slices.waitlist.defs"
}
fn def_name() -> &'static str {
"inviteView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_waitlist_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for RequestView<'a> {
fn nsid() -> &'static str {
"network.slices.waitlist.defs"
}
fn def_name() -> &'static str {
"requestView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_waitlist_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod invite_view_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 Slice;
type Did;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Slice = Unset;
type Did = Unset;
type CreatedAt = Unset;
}
pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSlice<S> {}
impl<S: State> State for SetSlice<S> {
type Slice = Set<members::slice>;
type Did = S::Did;
type CreatedAt = S::CreatedAt;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Slice = S::Slice;
type Did = Set<members::did>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Slice = S::Slice;
type Did = S::Did;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct slice(());
pub struct did(());
pub struct created_at(());
}
}
pub struct InviteViewBuilder<'a, S: invite_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Datetime>,
Option<Did<'a>>,
Option<Datetime>,
Option<ProfileViewBasic<'a>>,
Option<AtUri<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> InviteView<'a> {
pub fn new() -> InviteViewBuilder<'a, invite_view_state::Empty> {
InviteViewBuilder::new()
}
}
impl<'a> InviteViewBuilder<'a, invite_view_state::Empty> {
pub fn new() -> Self {
InviteViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> InviteViewBuilder<'a, S>
where
S: invite_view_state::State,
S::CreatedAt: invite_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> InviteViewBuilder<'a, invite_view_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> InviteViewBuilder<'a, S>
where
S: invite_view_state::State,
S::Did: invite_view_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<'a>>,
) -> InviteViewBuilder<'a, invite_view_state::SetDid<S>> {
self._fields.1 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
pub fn expires_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_expires_at(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
pub fn profile(mut self, value: impl Into<Option<ProfileViewBasic<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_profile(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> InviteViewBuilder<'a, S>
where
S: invite_view_state::State,
S::Slice: invite_view_state::IsUnset,
{
pub fn slice(
mut self,
value: impl Into<AtUri<'a>>,
) -> InviteViewBuilder<'a, invite_view_state::SetSlice<S>> {
self._fields.4 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
pub fn uri(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_uri(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S> InviteViewBuilder<'a, S>
where
S: invite_view_state::State,
S::Slice: invite_view_state::IsSet,
S::Did: invite_view_state::IsSet,
S::CreatedAt: invite_view_state::IsSet,
{
pub fn build(self) -> InviteView<'a> {
InviteView {
created_at: self._fields.0.unwrap(),
did: self._fields.1.unwrap(),
expires_at: self._fields.2,
profile: self._fields.3,
slice: self._fields.4.unwrap(),
uri: self._fields.5,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> InviteView<'a> {
InviteView {
created_at: self._fields.0.unwrap(),
did: self._fields.1.unwrap(),
expires_at: self._fields.2,
profile: self._fields.3,
slice: self._fields.4.unwrap(),
uri: self._fields.5,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_network_slices_waitlist_defs() -> 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("network.slices.waitlist.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("inviteView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"An invite granting a DID access with profile information",
),
),
required: Some(
vec![
SmolStr::new_static("did"), SmolStr::new_static("slice"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When this invitation was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The DID being invited"),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expiresAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Optional expiration date for this invitation",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("profile"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("slice"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The AT URI of the slice this invite is for",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The AT URI of this invite record"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("requestView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A request to join the waitlist with profile information",
),
),
required: Some(
vec![
SmolStr::new_static("slice"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the user joined the waitlist"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("profile"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("slice"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The AT URI of the slice being requested access to",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod request_view_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 CreatedAt;
type Slice;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Slice = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type Slice = S::Slice;
}
pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSlice<S> {}
impl<S: State> State for SetSlice<S> {
type CreatedAt = S::CreatedAt;
type Slice = Set<members::slice>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct slice(());
}
}
pub struct RequestViewBuilder<'a, S: request_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<ProfileViewBasic<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RequestView<'a> {
pub fn new() -> RequestViewBuilder<'a, request_view_state::Empty> {
RequestViewBuilder::new()
}
}
impl<'a> RequestViewBuilder<'a, request_view_state::Empty> {
pub fn new() -> Self {
RequestViewBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::CreatedAt: request_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RequestViewBuilder<'a, request_view_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
pub fn profile(mut self, value: impl Into<Option<ProfileViewBasic<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_profile(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::Slice: request_view_state::IsUnset,
{
pub fn slice(
mut self,
value: impl Into<AtUri<'a>>,
) -> RequestViewBuilder<'a, request_view_state::SetSlice<S>> {
self._fields.2 = Option::Some(value.into());
RequestViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RequestViewBuilder<'a, S>
where
S: request_view_state::State,
S::CreatedAt: request_view_state::IsSet,
S::Slice: request_view_state::IsSet,
{
pub fn build(self) -> RequestView<'a> {
RequestView {
created_at: self._fields.0.unwrap(),
profile: self._fields.1,
slice: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RequestView<'a> {
RequestView {
created_at: self._fields.0.unwrap(),
profile: self._fields.1,
slice: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}