// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.sync.listRepos // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ListRepos<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, ///(default: 500, min: 1, max: 1000) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub limit: std::option::Option, } pub mod list_repos_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 {} /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty {} /// Marker types for field names #[allow(non_camel_case_types)] pub mod members {} } /// Builder for constructing an instance of this type pub struct ListReposBuilder<'a, S: list_repos_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ListRepos<'a> { /// Create a new builder for this type pub fn new() -> ListReposBuilder<'a, list_repos_state::Empty> { ListReposBuilder::new() } } impl<'a> ListReposBuilder<'a, list_repos_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ListReposBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: list_repos_state::State> ListReposBuilder<'a, S> { /// Set the `cursor` field (optional) pub fn cursor( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `cursor` field to an Option value (optional) pub fn maybe_cursor(mut self, value: Option>) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S: list_repos_state::State> ListReposBuilder<'a, S> { /// Set the `limit` field (optional) pub fn limit(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `limit` field to an Option value (optional) pub fn maybe_limit(mut self, value: Option) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> ListReposBuilder<'a, S> where S: list_repos_state::State, { /// Build the final struct pub fn build(self) -> ListRepos<'a> { ListRepos { cursor: self.__unsafe_private_named.0, limit: self.__unsafe_private_named.1, } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ListReposOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, #[serde(borrow)] pub repos: Vec>, } /// Response type for ///com.atproto.sync.listRepos pub struct ListReposResponse; impl jacquard_common::xrpc::XrpcResp for ListReposResponse { const NSID: &'static str = "com.atproto.sync.listRepos"; const ENCODING: &'static str = "application/json"; type Output<'de> = ListReposOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for ListRepos<'a> { const NSID: &'static str = "com.atproto.sync.listRepos"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = ListReposResponse; } /// Endpoint type for ///com.atproto.sync.listRepos pub struct ListReposRequest; impl jacquard_common::xrpc::XrpcEndpoint for ListReposRequest { const PATH: &'static str = "/xrpc/com.atproto.sync.listRepos"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = ListRepos<'de>; type Response = ListReposResponse; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Repo<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] pub active: std::option::Option, #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, /// Current repo commit CID #[serde(borrow)] pub head: jacquard_common::types::string::Cid<'a>, pub rev: jacquard_common::types::string::Tid, /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub status: std::option::Option>, } pub mod repo_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 Did; type Rev; type Head; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; type Rev = Unset; type Head = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Did = Set; type Rev = S::Rev; type Head = S::Head; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData S>); impl sealed::Sealed for SetRev {} impl State for SetRev { type Did = S::Did; type Rev = Set; type Head = S::Head; } ///State transition - sets the `head` field to Set pub struct SetHead(PhantomData S>); impl sealed::Sealed for SetHead {} impl State for SetHead { type Did = S::Did; type Rev = S::Rev; type Head = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `head` field pub struct head(()); } } /// Builder for constructing an instance of this type pub struct RepoBuilder<'a, S: repo_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> Repo<'a> { /// Create a new builder for this type pub fn new() -> RepoBuilder<'a, repo_state::Empty> { RepoBuilder::new() } } impl<'a> RepoBuilder<'a, repo_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { RepoBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S: repo_state::State> RepoBuilder<'a, S> { /// Set the `active` field (optional) pub fn active(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.0 = value.into(); self } /// Set the `active` field to an Option value (optional) pub fn maybe_active(mut self, value: Option) -> Self { self.__unsafe_private_named.0 = value; self } } impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, S::Did: repo_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> RepoBuilder<'a, repo_state::SetDid> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); RepoBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, S::Head: repo_state::IsUnset, { /// Set the `head` field (required) pub fn head( mut self, value: impl Into>, ) -> RepoBuilder<'a, repo_state::SetHead> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); RepoBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, S::Rev: repo_state::IsUnset, { /// Set the `rev` field (required) pub fn rev( mut self, value: impl Into, ) -> RepoBuilder<'a, repo_state::SetRev> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); RepoBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: repo_state::State> RepoBuilder<'a, S> { /// Set the `status` field (optional) pub fn status(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `status` field to an Option value (optional) pub fn maybe_status(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> RepoBuilder<'a, S> where S: repo_state::State, S::Did: repo_state::IsSet, S::Rev: repo_state::IsSet, S::Head: repo_state::IsSet, { /// Build the final struct pub fn build(self) -> Repo<'a> { Repo { active: self.__unsafe_private_named.0, did: self.__unsafe_private_named.1.unwrap(), head: self.__unsafe_private_named.2.unwrap(), rev: self.__unsafe_private_named.3.unwrap(), status: self.__unsafe_private_named.4, 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>, >, ) -> Repo<'a> { Repo { active: self.__unsafe_private_named.0, did: self.__unsafe_private_named.1.unwrap(), head: self.__unsafe_private_named.2.unwrap(), rev: self.__unsafe_private_named.3.unwrap(), status: self.__unsafe_private_named.4, extra_data: Some(extra_data), } } } /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum RepoStatus<'a> { Takendown, Suspended, Deleted, Deactivated, Desynchronized, Throttled, Other(jacquard_common::CowStr<'a>), } impl<'a> RepoStatus<'a> { pub fn as_str(&self) -> &str { match self { Self::Takendown => "takendown", Self::Suspended => "suspended", Self::Deleted => "deleted", Self::Deactivated => "deactivated", Self::Desynchronized => "desynchronized", Self::Throttled => "throttled", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for RepoStatus<'a> { fn from(s: &'a str) -> Self { match s { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deleted" => Self::Deleted, "deactivated" => Self::Deactivated, "desynchronized" => Self::Desynchronized, "throttled" => Self::Throttled, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for RepoStatus<'a> { fn from(s: String) -> Self { match s.as_str() { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deleted" => Self::Deleted, "deactivated" => Self::Deactivated, "desynchronized" => Self::Desynchronized, "throttled" => Self::Throttled, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for RepoStatus<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for RepoStatus<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for RepoStatus<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for RepoStatus<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for RepoStatus<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for RepoStatus<'_> { type Output = RepoStatus<'static>; fn into_static(self) -> Self::Output { match self { RepoStatus::Takendown => RepoStatus::Takendown, RepoStatus::Suspended => RepoStatus::Suspended, RepoStatus::Deleted => RepoStatus::Deleted, RepoStatus::Deactivated => RepoStatus::Deactivated, RepoStatus::Desynchronized => RepoStatus::Desynchronized, RepoStatus::Throttled => RepoStatus::Throttled, RepoStatus::Other(v) => RepoStatus::Other(v.into_static()), } } } fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("com.atproto.sync.listRepos"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { description: None, parameters: Some( ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { description: None, required: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::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.insert( ::jacquard_common::smol_str::SmolStr::new_static("limit"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ), output: None, errors: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("repo"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_common::smol_str::SmolStr::new_static("head"), ::jacquard_common::smol_str::SmolStr::new_static("rev") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("active"), ::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("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), 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("head"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Current repo commit CID", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Cid, ), 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("rev"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Tid, ), 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("status"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.", ), ), 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 Repo<'a> { fn nsid() -> &'static str { "com.atproto.sync.listRepos" } fn def_name() -> &'static str { "repo" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_com_atproto_sync_listRepos() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }