Something went wrong. Try again.
atproto Thingiverse but good
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: space.polymodel.actor.getSession//// 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::{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::{Did, Handle};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::space_polymodel::actor::ProfileView;use crate::space_polymodel::actor::get_session;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct GetSessionOutput<S: BosStr = DefaultStr> { #[serde(flatten)] pub value: get_session::SessionView<S>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/// Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct SessionAuthenticated<S: BosStr = DefaultStr> { pub authenticated: bool, pub did: Did<S>, pub handle: Handle<S>, pub profile: ProfileView<S>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/// Logged-out session marker. No identity fields are present when authenticated is false.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct SessionUnauthenticated<S: BosStr = DefaultStr> { pub authenticated: bool, #[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(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub enum SessionView<S: BosStr = DefaultStr> { #[serde(rename = "space.polymodel.actor.getSession#sessionUnauthenticated")] SessionUnauthenticated(Box<get_session::SessionUnauthenticated<S>>), #[serde(rename = "space.polymodel.actor.getSession#sessionAuthenticated")] SessionAuthenticated(Box<get_session::SessionAuthenticated<S>>),}
/** Request marker for the `space.polymodel.actor.getSession` query.
This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]pub struct GetSession;/** Response marker for the `space.polymodel.actor.getSession` query.
Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetSessionOutput<S>` for this endpoint.*/pub struct GetSessionResponse;impl jacquard_common::xrpc::XrpcResp for GetSessionResponse { const NSID: &'static str = "space.polymodel.actor.getSession"; const ENCODING: &'static str = "application/json"; type Output<S: BosStr> = GetSessionOutput<S>; type Err = jacquard_common::xrpc::GenericError;}
impl jacquard_common::xrpc::XrpcRequest for GetSession { const NSID: &'static str = "space.polymodel.actor.getSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = GetSessionResponse;}
/** Endpoint marker for the `space.polymodel.actor.getSession` query.
Path: `/xrpc/space.polymodel.actor.getSession`. The request payload type is `GetSession`; use this marker with lower-level `XrpcEndpoint` APIs when you need endpoint metadata.*/pub struct GetSessionRequest;impl jacquard_common::xrpc::XrpcEndpoint for GetSessionRequest { const PATH: &'static str = "/xrpc/space.polymodel.actor.getSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<S: BosStr> = GetSession; type Response = GetSessionResponse;}
impl<S: BosStr> LexiconSchema for SessionAuthenticated<S> { fn nsid() -> &'static str { "space.polymodel.actor.getSession" } fn def_name() -> &'static str { "sessionAuthenticated" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_space_polymodel_actor_getSession() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<S: BosStr> LexiconSchema for SessionUnauthenticated<S> { fn nsid() -> &'static str { "space.polymodel.actor.getSession" } fn def_name() -> &'static str { "sessionUnauthenticated" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_space_polymodel_actor_getSession() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
pub mod session_authenticated_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Authenticated; type Did; type Handle; type Profile; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Authenticated = Unset; type Did = Unset; type Handle = Unset; type Profile = Unset; } ///State transition - sets the `authenticated` field to Set pub struct SetAuthenticated<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetAuthenticated<St> {} impl<St: State> State for SetAuthenticated<St> { type Authenticated = Set<members::authenticated>; type Did = St::Did; type Handle = St::Handle; type Profile = St::Profile; } ///State transition - sets the `did` field to Set pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetDid<St> {} impl<St: State> State for SetDid<St> { type Authenticated = St::Authenticated; type Did = Set<members::did>; type Handle = St::Handle; type Profile = St::Profile; } ///State transition - sets the `handle` field to Set pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetHandle<St> {} impl<St: State> State for SetHandle<St> { type Authenticated = St::Authenticated; type Did = St::Did; type Handle = Set<members::handle>; type Profile = St::Profile; } ///State transition - sets the `profile` field to Set pub struct SetProfile<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetProfile<St> {} impl<St: State> State for SetProfile<St> { type Authenticated = St::Authenticated; type Did = St::Did; type Handle = St::Handle; type Profile = Set<members::profile>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `authenticated` field pub struct authenticated(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `handle` field pub struct handle(()); ///Marker type for the `profile` field pub struct profile(()); }}
/// Builder for constructing an instance of this type.pub struct SessionAuthenticatedBuilder< St: session_authenticated_state::State, S: BosStr = DefaultStr,> { _state: PhantomData<fn() -> St>, _fields: (Option<bool>, Option<Did<S>>, Option<Handle<S>>, Option<ProfileView<S>>), _type: PhantomData<fn() -> S>,}
impl SessionAuthenticated<DefaultStr> { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> SessionAuthenticatedBuilder< session_authenticated_state::Empty, DefaultStr, > { SessionAuthenticatedBuilder::new() }}
impl<S: BosStr> SessionAuthenticated<S> { /// Create a new builder for this type pub fn builder() -> SessionAuthenticatedBuilder< session_authenticated_state::Empty, S, > { SessionAuthenticatedBuilder::builder() }}
impl SessionAuthenticatedBuilder<session_authenticated_state::Empty, DefaultStr> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { SessionAuthenticatedBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } }}
impl<S: BosStr> SessionAuthenticatedBuilder<session_authenticated_state::Empty, S> { /// Create a new builder with all fields unset pub fn builder() -> Self { SessionAuthenticatedBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } }}
impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>where St: session_authenticated_state::State, St::Authenticated: session_authenticated_state::IsUnset,{ /// Set the `authenticated` field (required) pub fn authenticated( mut self, value: impl Into<bool>, ) -> SessionAuthenticatedBuilder< session_authenticated_state::SetAuthenticated<St>, S, > { self._fields.0 = Option::Some(value.into()); SessionAuthenticatedBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>where St: session_authenticated_state::State, St::Did: session_authenticated_state::IsUnset,{ /// Set the `did` field (required) pub fn did( mut self, value: impl Into<Did<S>>, ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetDid<St>, S> { self._fields.1 = Option::Some(value.into()); SessionAuthenticatedBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>where St: session_authenticated_state::State, St::Handle: session_authenticated_state::IsUnset,{ /// Set the `handle` field (required) pub fn handle( mut self, value: impl Into<Handle<S>>, ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetHandle<St>, S> { self._fields.2 = Option::Some(value.into()); SessionAuthenticatedBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>where St: session_authenticated_state::State, St::Profile: session_authenticated_state::IsUnset,{ /// Set the `profile` field (required) pub fn profile( mut self, value: impl Into<ProfileView<S>>, ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetProfile<St>, S> { self._fields.3 = Option::Some(value.into()); SessionAuthenticatedBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>where St: session_authenticated_state::State, St::Authenticated: session_authenticated_state::IsSet, St::Did: session_authenticated_state::IsSet, St::Handle: session_authenticated_state::IsSet, St::Profile: session_authenticated_state::IsSet,{ /// Build the final struct. pub fn build(self) -> SessionAuthenticated<S> { SessionAuthenticated { authenticated: self._fields.0.unwrap(), did: self._fields.1.unwrap(), handle: self._fields.2.unwrap(), profile: self._fields.3.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data( self, extra_data: BTreeMap<SmolStr, Data<S>>, ) -> SessionAuthenticated<S> { SessionAuthenticated { authenticated: self._fields.0.unwrap(), did: self._fields.1.unwrap(), handle: self._fields.2.unwrap(), profile: self._fields.3.unwrap(), extra_data: Some(extra_data), } }}
fn lexicon_doc_space_polymodel_actor_getSession() -> 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("space.polymodel.actor.getSession"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("main"), LexUserType::XrpcQuery(LexXrpcQuery { parameters: None, ..Default::default() }), ); map.insert( SmolStr::new_static("sessionAuthenticated"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.", ), ), required: Some( vec![ SmolStr::new_static("authenticated"), SmolStr::new_static("did"), SmolStr::new_static("handle"), SmolStr::new_static("profile") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("authenticated"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("handle"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Handle), ..Default::default() }), ); map.insert( SmolStr::new_static("profile"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static( "space.polymodel.actor.defs#profileView", ), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("sessionUnauthenticated"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Logged-out session marker. No identity fields are present when authenticated is false.", ), ), required: Some(vec![SmolStr::new_static("authenticated")]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("authenticated"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("sessionView"), LexUserType::Union(LexRefUnion { refs: vec![ CowStr::new_static("space.polymodel.actor.getSession#sessionUnauthenticated"), CowStr::new_static("space.polymodel.actor.getSession#sessionAuthenticated") ], closed: Some(true), ..Default::default() }), ); map }, ..Default::default() }}
pub mod session_unauthenticated_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Authenticated; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Authenticated = Unset; } ///State transition - sets the `authenticated` field to Set pub struct SetAuthenticated<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetAuthenticated<St> {} impl<St: State> State for SetAuthenticated<St> { type Authenticated = Set<members::authenticated>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `authenticated` field pub struct authenticated(()); }}
/// Builder for constructing an instance of this type.pub struct SessionUnauthenticatedBuilder< St: session_unauthenticated_state::State, S: BosStr = DefaultStr,> { _state: PhantomData<fn() -> St>, _fields: (Option<bool>,), _type: PhantomData<fn() -> S>,}
impl SessionUnauthenticated<DefaultStr> { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> SessionUnauthenticatedBuilder< session_unauthenticated_state::Empty, DefaultStr, > { SessionUnauthenticatedBuilder::new() }}
impl<S: BosStr> SessionUnauthenticated<S> { /// Create a new builder for this type pub fn builder() -> SessionUnauthenticatedBuilder< session_unauthenticated_state::Empty, S, > { SessionUnauthenticatedBuilder::builder() }}
impl SessionUnauthenticatedBuilder<session_unauthenticated_state::Empty, DefaultStr> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { SessionUnauthenticatedBuilder { _state: PhantomData, _fields: (None,), _type: PhantomData, } }}
impl<S: BosStr> SessionUnauthenticatedBuilder<session_unauthenticated_state::Empty, S> { /// Create a new builder with all fields unset pub fn builder() -> Self { SessionUnauthenticatedBuilder { _state: PhantomData, _fields: (None,), _type: PhantomData, } }}
impl<St, S: BosStr> SessionUnauthenticatedBuilder<St, S>where St: session_unauthenticated_state::State, St::Authenticated: session_unauthenticated_state::IsUnset,{ /// Set the `authenticated` field (required) pub fn authenticated( mut self, value: impl Into<bool>, ) -> SessionUnauthenticatedBuilder< session_unauthenticated_state::SetAuthenticated<St>, S, > { self._fields.0 = Option::Some(value.into()); SessionUnauthenticatedBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St, S: BosStr> SessionUnauthenticatedBuilder<St, S>where St: session_unauthenticated_state::State, St::Authenticated: session_unauthenticated_state::IsSet,{ /// Build the final struct. pub fn build(self) -> SessionUnauthenticated<S> { SessionUnauthenticated { authenticated: self._fields.0.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data( self, extra_data: BTreeMap<SmolStr, Data<S>>, ) -> SessionUnauthenticated<S> { SessionUnauthenticated { authenticated: self._fields.0.unwrap(), extra_data: Some(extra_data), } }}