// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: place.wisp.fs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Directory<'a> { #[serde(borrow)] pub entries: Vec>, #[serde(borrow)] pub r#type: jacquard_common::CowStr<'a>, } pub mod directory_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 Type; type Entries; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Type = Unset; type Entries = Unset; } ///State transition - sets the `type` field to Set pub struct SetType(PhantomData S>); impl sealed::Sealed for SetType {} impl State for SetType { type Type = Set; type Entries = S::Entries; } ///State transition - sets the `entries` field to Set pub struct SetEntries(PhantomData S>); impl sealed::Sealed for SetEntries {} impl State for SetEntries { type Type = S::Type; type Entries = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `type` field pub struct r#type(()); ///Marker type for the `entries` field pub struct entries(()); } } /// Builder for constructing an instance of this type pub struct DirectoryBuilder<'a, S: directory_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Directory<'a> { /// Create a new builder for this type pub fn new() -> DirectoryBuilder<'a, directory_state::Empty> { DirectoryBuilder::new() } } impl<'a> DirectoryBuilder<'a, directory_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { DirectoryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DirectoryBuilder<'a, S> where S: directory_state::State, S::Entries: directory_state::IsUnset, { /// Set the `entries` field (required) pub fn entries( mut self, value: impl Into>>, ) -> DirectoryBuilder<'a, directory_state::SetEntries> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DirectoryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DirectoryBuilder<'a, S> where S: directory_state::State, S::Type: directory_state::IsUnset, { /// Set the `type` field (required) pub fn r#type( mut self, value: impl Into>, ) -> DirectoryBuilder<'a, directory_state::SetType> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); DirectoryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DirectoryBuilder<'a, S> where S: directory_state::State, S::Type: directory_state::IsSet, S::Entries: directory_state::IsSet, { /// Build the final struct pub fn build(self) -> Directory<'a> { Directory { entries: self.__unsafe_private_named.0.unwrap(), r#type: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Directory<'a> { Directory { entries: self.__unsafe_private_named.0.unwrap(), r#type: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_place_wisp_fs() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("place.wisp.fs"), revision: None, description: None, defs: { let mut map = ::std::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("directory"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("type"), ::jacquard_common::smol_str::SmolStr::new_static("entries") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::std::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entries"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#entry"), }), min_length: None, max_length: Some(500usize), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("type"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entry"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_common::smol_str::SmolStr::new_static("node") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::std::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: Some(255usize), min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("node"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("#file"), ::jacquard_common::CowStr::new_static("#directory") ], closed: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("file"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("type"), ::jacquard_common::smol_str::SmolStr::new_static("blob") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::std::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("base64"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blob"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { description: None, accept: None, max_size: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("encoding"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Content encoding (e.g., gzip for compressed files)", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("mimeType"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Original MIME type before compression", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("type"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { description: Some( ::jacquard_common::CowStr::new_static( "Virtual filesystem manifest for a Wisp site", ), ), key: None, record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("site"), ::jacquard_common::smol_str::SmolStr::new_static("root"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::std::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "fileCount", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: Some(0i64), maximum: Some(1000i64), r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("root"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#directory"), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("site"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Directory<'a> { fn nsid() -> &'static str { "place.wisp.fs" } fn def_name() -> &'static str { "directory" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_place_wisp_fs() } fn validate( &self, ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.entries; #[allow(unused_comparisons)] if value.len() > 500usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "entries", ), max: 500usize, actual: value.len(), }); } } Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Entry<'a> { #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, #[serde(borrow)] pub node: EntryNode<'a>, } pub mod entry_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 Name; type Node; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Name = Unset; type Node = Unset; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { type Name = Set; type Node = S::Node; } ///State transition - sets the `node` field to Set pub struct SetNode(PhantomData S>); impl sealed::Sealed for SetNode {} impl State for SetNode { type Name = S::Name; type Node = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `name` field pub struct name(()); ///Marker type for the `node` field pub struct node(()); } } /// Builder for constructing an instance of this type pub struct EntryBuilder<'a, S: entry_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Entry<'a> { /// Create a new builder for this type pub fn new() -> EntryBuilder<'a, entry_state::Empty> { EntryBuilder::new() } } impl<'a> EntryBuilder<'a, entry_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { EntryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, S::Name: entry_state::IsUnset, { /// Set the `name` field (required) pub fn name( mut self, value: impl Into>, ) -> EntryBuilder<'a, entry_state::SetName> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); EntryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, S::Node: entry_state::IsUnset, { /// Set the `node` field (required) pub fn node( mut self, value: impl Into>, ) -> EntryBuilder<'a, entry_state::SetNode> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); EntryBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> EntryBuilder<'a, S> where S: entry_state::State, S::Name: entry_state::IsSet, S::Node: entry_state::IsSet, { /// Build the final struct pub fn build(self) -> Entry<'a> { Entry { name: self.__unsafe_private_named.0.unwrap(), node: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Entry<'a> { Entry { name: self.__unsafe_private_named.0.unwrap(), node: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum EntryNode<'a> { #[serde(rename = "place.wisp.fs#file")] File(Box>), #[serde(rename = "place.wisp.fs#directory")] Directory(Box>), } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entry<'a> { fn nsid() -> &'static str { "place.wisp.fs" } fn def_name() -> &'static str { "entry" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_place_wisp_fs() } fn validate( &self, ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.name; #[allow(unused_comparisons)] if ::len(value.as_ref()) > 255usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "name", ), max: 255usize, actual: ::len(value.as_ref()), }); } } Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct File<'a> { /// True if blob content is base64-encoded (used to bypass PDS content sniffing) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub base64: Option, /// Content blob ref #[serde(borrow)] pub blob: jacquard_common::types::blob::BlobRef<'a>, /// Content encoding (e.g., gzip for compressed files) #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub encoding: Option>, /// Original MIME type before compression #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub mime_type: Option>, #[serde(borrow)] pub r#type: jacquard_common::CowStr<'a>, } pub mod file_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 Type; type Blob; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Type = Unset; type Blob = Unset; } ///State transition - sets the `type` field to Set pub struct SetType(PhantomData S>); impl sealed::Sealed for SetType {} impl State for SetType { type Type = Set; type Blob = S::Blob; } ///State transition - sets the `blob` field to Set pub struct SetBlob(PhantomData S>); impl sealed::Sealed for SetBlob {} impl State for SetBlob { type Type = S::Type; type Blob = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `type` field pub struct r#type(()); ///Marker type for the `blob` field pub struct blob(()); } } /// Builder for constructing an instance of this type pub struct FileBuilder<'a, S: file_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> File<'a> { /// Create a new builder for this type pub fn new() -> FileBuilder<'a, file_state::Empty> { FileBuilder::new() } } impl<'a> FileBuilder<'a, file_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FileBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: file_state::State> FileBuilder<'a, S> { /// Set the `base64` field (optional) pub fn base64(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `base64` field to an Option value (optional) pub fn maybe_base64(mut self, value: Option) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> FileBuilder<'a, S> where S: file_state::State, S::Blob: file_state::IsUnset, { /// Set the `blob` field (required) pub fn blob( mut self, value: impl Into>, ) -> FileBuilder<'a, file_state::SetBlob> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); FileBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: file_state::State> FileBuilder<'a, S> { /// Set the `encoding` field (optional) pub fn encoding( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `encoding` field to an Option value (optional) pub fn maybe_encoding(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: file_state::State> FileBuilder<'a, S> { /// Set the `mimeType` field (optional) pub fn mime_type( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `mimeType` field to an Option value (optional) pub fn maybe_mime_type( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> FileBuilder<'a, S> where S: file_state::State, S::Type: file_state::IsUnset, { /// Set the `type` field (required) pub fn r#type( mut self, value: impl Into>, ) -> FileBuilder<'a, file_state::SetType> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); FileBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FileBuilder<'a, S> where S: file_state::State, S::Type: file_state::IsSet, S::Blob: file_state::IsSet, { /// Build the final struct pub fn build(self) -> File<'a> { File { base64: self.__unsafe_private_named.0, blob: self.__unsafe_private_named.1.unwrap(), encoding: self.__unsafe_private_named.2, mime_type: self.__unsafe_private_named.3, r#type: self.__unsafe_private_named.4.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> File<'a> { File { base64: self.__unsafe_private_named.0, blob: self.__unsafe_private_named.1.unwrap(), encoding: self.__unsafe_private_named.2, mime_type: self.__unsafe_private_named.3, r#type: self.__unsafe_private_named.4.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for File<'a> { fn nsid() -> &'static str { "place.wisp.fs" } fn def_name() -> &'static str { "file" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_place_wisp_fs() } fn validate( &self, ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Virtual filesystem manifest for a Wisp site #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Fs<'a> { pub created_at: jacquard_common::types::string::Datetime, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub file_count: Option, #[serde(borrow)] pub root: crate::place_wisp::fs::Directory<'a>, #[serde(borrow)] pub site: jacquard_common::CowStr<'a>, } pub mod fs_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 Site; type Root; type CreatedAt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Site = Unset; type Root = Unset; type CreatedAt = Unset; } ///State transition - sets the `site` field to Set pub struct SetSite(PhantomData S>); impl sealed::Sealed for SetSite {} impl State for SetSite { type Site = Set; type Root = S::Root; type CreatedAt = S::CreatedAt; } ///State transition - sets the `root` field to Set pub struct SetRoot(PhantomData S>); impl sealed::Sealed for SetRoot {} impl State for SetRoot { type Site = S::Site; type Root = Set; type CreatedAt = S::CreatedAt; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Site = S::Site; type Root = S::Root; type CreatedAt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `site` field pub struct site(()); ///Marker type for the `root` field pub struct root(()); ///Marker type for the `created_at` field pub struct created_at(()); } } /// Builder for constructing an instance of this type pub struct FsBuilder<'a, S: fs_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Fs<'a> { /// Create a new builder for this type pub fn new() -> FsBuilder<'a, fs_state::Empty> { FsBuilder::new() } } impl<'a> FsBuilder<'a, fs_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FsBuilder<'a, S> where S: fs_state::State, S::CreatedAt: fs_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> FsBuilder<'a, fs_state::SetCreatedAt> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); FsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: fs_state::State> FsBuilder<'a, S> { /// Set the `fileCount` field (optional) pub fn file_count(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `fileCount` field to an Option value (optional) pub fn maybe_file_count(mut self, value: Option) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> FsBuilder<'a, S> where S: fs_state::State, S::Root: fs_state::IsUnset, { /// Set the `root` field (required) pub fn root( mut self, value: impl Into>, ) -> FsBuilder<'a, fs_state::SetRoot> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); FsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FsBuilder<'a, S> where S: fs_state::State, S::Site: fs_state::IsUnset, { /// Set the `site` field (required) pub fn site( mut self, value: impl Into>, ) -> FsBuilder<'a, fs_state::SetSite> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); FsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FsBuilder<'a, S> where S: fs_state::State, S::Site: fs_state::IsSet, S::Root: fs_state::IsSet, S::CreatedAt: fs_state::IsSet, { /// Build the final struct pub fn build(self) -> Fs<'a> { Fs { created_at: self.__unsafe_private_named.0.unwrap(), file_count: self.__unsafe_private_named.1, root: self.__unsafe_private_named.2.unwrap(), site: self.__unsafe_private_named.3.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Fs<'a> { Fs { created_at: self.__unsafe_private_named.0.unwrap(), file_count: self.__unsafe_private_named.1, root: self.__unsafe_private_named.2.unwrap(), site: self.__unsafe_private_named.3.unwrap(), extra_data: Some(extra_data), } } } impl<'a> Fs<'a> { pub fn uri( uri: impl Into>, ) -> Result< jacquard_common::types::uri::RecordUri<'a, FsRecord>, jacquard_common::types::uri::UriError, > { jacquard_common::types::uri::RecordUri::try_from_uri( jacquard_common::types::string::AtUri::new_cow(uri.into())?, ) } } /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct FsGetRecordOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cid: std::option::Option>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub value: Fs<'a>, } impl From> for Fs<'_> { fn from(output: FsGetRecordOutput<'_>) -> Self { use jacquard_common::IntoStatic; output.value.into_static() } } impl jacquard_common::types::collection::Collection for Fs<'_> { const NSID: &'static str = "place.wisp.fs"; type Record = FsRecord; } /// Marker type for deserializing records from this collection. #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct FsRecord; impl jacquard_common::xrpc::XrpcResp for FsRecord { const NSID: &'static str = "place.wisp.fs"; const ENCODING: &'static str = "application/json"; type Output<'de> = FsGetRecordOutput<'de>; type Err<'de> = jacquard_common::types::collection::RecordError<'de>; } impl jacquard_common::types::collection::Collection for FsRecord { const NSID: &'static str = "place.wisp.fs"; type Record = FsRecord; } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Fs<'a> { fn nsid() -> &'static str { "place.wisp.fs" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_place_wisp_fs() } fn validate( &self, ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.file_count { if *value > 1000i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "file_count", ), max: 1000i64, actual: *value, }); } } if let Some(ref value) = self.file_count { if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "file_count", ), min: 0i64, actual: *value, }); } } Ok(()) } }