// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.sync.subscribeRepos // // 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::{CowStr, BosStr, DefaultStr, FromStaticStr}; use jacquard_common::deps::bytes::Bytes; #[allow(unused_imports)] use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation; use jacquard_common::deps::smol_str::SmolStr; use jacquard_common::types::cid::CidLink; use jacquard_common::types::string::{Did, Handle, Tid, Datetime}; use jacquard_common::types::value::Data; use jacquard_derive::{IntoStatic, open_union}; 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::com_atproto::sync::subscribe_repos; /// Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Account { ///Indicates that the account has a repository which can be fetched from the host that emitted this event. pub active: bool, pub did: Did, pub seq: i64, ///If active=false, this optional field indicates a reason for why the account is not active. #[serde(skip_serializing_if = "Option::is_none")] pub status: Option>, pub time: Datetime, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } /// If active=false, this optional field indicates a reason for why the account is not active. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AccountStatus { Takendown, Suspended, Deleted, Deactivated, Desynchronized, Throttled, Other(S), } impl AccountStatus { 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(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deleted" => Self::Deleted, "deactivated" => Self::Deactivated, "desynchronized" => Self::Desynchronized, "throttled" => Self::Throttled, _ => Self::Other(s), } } } impl core::fmt::Display for AccountStatus { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl AsRef for AccountStatus { fn as_ref(&self) -> &str { self.as_str() } } impl Serialize for AccountStatus { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for AccountStatus { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl Default for AccountStatus { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for AccountStatus where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = AccountStatus; fn into_static(self) -> Self::Output { match self { AccountStatus::Takendown => AccountStatus::Takendown, AccountStatus::Suspended => AccountStatus::Suspended, AccountStatus::Deleted => AccountStatus::Deleted, AccountStatus::Deactivated => AccountStatus::Deactivated, AccountStatus::Desynchronized => AccountStatus::Desynchronized, AccountStatus::Throttled => AccountStatus::Throttled, AccountStatus::Other(v) => AccountStatus::Other(v.into_static()), } } } /// Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Commit { pub blobs: Vec>, ///CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list. #[serde(with = "jacquard_common::serde_bytes_helper")] pub blocks: Bytes, ///Repo commit object CID. pub commit: CidLink, pub ops: Vec>, ///The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose. #[serde(skip_serializing_if = "Option::is_none")] pub prev_data: Option>, ///DEPRECATED -- unused pub rebase: bool, ///The repo this event comes from. Note that all other message types name this field 'did'. pub repo: Did, ///The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event. pub rev: Tid, ///The stream sequence number of this message. pub seq: i64, ///The rev of the last emitted commit from this repo (if any). #[serde(skip_serializing_if = "Option::is_none")] pub since: Option, ///Timestamp of when this message was originally broadcast. pub time: Datetime, ///DEPRECATED -- replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data. pub too_big: bool, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } /// Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Identity { pub did: Did, ///The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details. #[serde(skip_serializing_if = "Option::is_none")] pub handle: Option>, pub seq: i64, pub time: Datetime, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Info { #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, pub name: InfoName, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum InfoName { OutdatedCursor, Other(S), } impl InfoName { pub fn as_str(&self) -> &str { match self { Self::OutdatedCursor => "OutdatedCursor", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "OutdatedCursor" => Self::OutdatedCursor, _ => Self::Other(s), } } } impl core::fmt::Display for InfoName { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl AsRef for InfoName { fn as_ref(&self) -> &str { self.as_str() } } impl Serialize for InfoName { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for InfoName { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl Default for InfoName { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for InfoName where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = InfoName; fn into_static(self) -> Self::Output { match self { InfoName::OutdatedCursor => InfoName::OutdatedCursor, InfoName::Other(v) => InfoName::Other(v.into_static()), } } } #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase")] pub struct SubscribeRepos { #[serde(skip_serializing_if = "Option::is_none")] pub cursor: Option, } #[open_union] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub enum SubscribeReposMessage { #[serde(rename = "#commit")] Commit(Box>), #[serde(rename = "#sync")] Sync(Box>), #[serde(rename = "#identity")] Identity(Box>), #[serde(rename = "#account")] Account(Box>), #[serde(rename = "#info")] Info(Box>), } impl SubscribeReposMessage { /// Decode a framed DAG-CBOR message (header + body). pub fn decode_framed<'de>( bytes: &'de [u8], ) -> Result, jacquard_common::error::DecodeError> where S: serde::Deserialize<'de>, { let (header, body) = jacquard_common::xrpc::subscription::parse_event_header( bytes, )?; match header.t.as_str() { "#commit" => { let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( body, )?; Ok(Self::Commit(Box::new(variant))) } "#sync" => { let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( body, )?; Ok(Self::Sync(Box::new(variant))) } "#identity" => { let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( body, )?; Ok(Self::Identity(Box::new(variant))) } "#account" => { let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( body, )?; Ok(Self::Account(Box::new(variant))) } "#info" => { let variant = jacquard_common::deps::codegen::serde_ipld_dagcbor::from_slice( body, )?; Ok(Self::Info(Box::new(variant))) } unknown => { Err( jacquard_common::error::DecodeError::UnknownEventType(unknown.into()), ) } } } } #[derive( Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] pub enum SubscribeReposError { #[serde(rename = "FutureCursor")] FutureCursor(Option), /// If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection. #[serde(rename = "ConsumerTooSlow")] ConsumerTooSlow(Option), /// Catch-all for unknown error codes. #[serde(untagged)] Other { error: SmolStr, message: Option }, } impl core::fmt::Display for SubscribeReposError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::FutureCursor(msg) => { write!(f, "FutureCursor")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::ConsumerTooSlow(msg) => { write!(f, "ConsumerTooSlow")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Other { error, message } => { write!(f, "{}", error)?; if let Some(msg) = message { write!(f, ": {}", msg)?; } Ok(()) } } } } /// A repo operation, ie a mutation of a single record. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct RepoOp { pub action: RepoOpAction, ///For creates and updates, the new record CID. For deletions, null. #[serde(skip_serializing_if = "Option::is_none")] pub cid: Option>, pub path: S, ///For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined. #[serde(skip_serializing_if = "Option::is_none")] pub prev: Option>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum RepoOpAction { Create, Update, Delete, Other(S), } impl RepoOpAction { pub fn as_str(&self) -> &str { match self { Self::Create => "create", Self::Update => "update", Self::Delete => "delete", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "create" => Self::Create, "update" => Self::Update, "delete" => Self::Delete, _ => Self::Other(s), } } } impl core::fmt::Display for RepoOpAction { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl AsRef for RepoOpAction { fn as_ref(&self) -> &str { self.as_str() } } impl Serialize for RepoOpAction { fn serialize(&self, serializer: Ser) -> Result where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for RepoOpAction { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) } } impl Default for RepoOpAction { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for RepoOpAction where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr, { type Output = RepoOpAction; fn into_static(self) -> Self::Output { match self { RepoOpAction::Create => RepoOpAction::Create, RepoOpAction::Update => RepoOpAction::Update, RepoOpAction::Delete => RepoOpAction::Delete, RepoOpAction::Other(v) => RepoOpAction::Other(v.into_static()), } } } /// Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)] #[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))] pub struct Sync { ///CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'. #[serde(with = "jacquard_common::serde_bytes_helper")] pub blocks: Bytes, ///The account this repo event corresponds to. Must match that in the commit object. pub did: Did, ///The rev of the commit. This value must match that in the commit object. pub rev: S, ///The stream sequence number of this message. pub seq: i64, ///Timestamp of when this message was originally broadcast. pub time: Datetime, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option>>, } impl LexiconSchema for Account { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "account" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for Commit { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "commit" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { { let value = &self.ops; #[allow(unused_comparisons)] if value.len() > 200usize { return Err(ConstraintError::MaxLength { path: ValidationPath::from_field("ops"), max: 200usize, actual: value.len(), }); } } Ok(()) } } impl LexiconSchema for Identity { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "identity" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for Info { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "info" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } ///Stream response type for ///com.atproto.sync.subscribeRepos pub struct SubscribeReposStream; impl jacquard_common::xrpc::SubscriptionResp for SubscribeReposStream { const NSID: &'static str = "com.atproto.sync.subscribeRepos"; const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Message = SubscribeReposMessage; type Error = SubscribeReposError; fn decode_message<'de, S>( bytes: &'de [u8], ) -> Result, jacquard_common::error::DecodeError> where S: BosStr + serde::Deserialize<'de>, Self::Message: serde::Deserialize<'de>, { SubscribeReposMessage::decode_framed(bytes) } } impl jacquard_common::xrpc::XrpcSubscription for SubscribeRepos { const NSID: &'static str = "com.atproto.sync.subscribeRepos"; const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Stream = SubscribeReposStream; } pub struct SubscribeReposEndpoint; impl jacquard_common::xrpc::SubscriptionEndpoint for SubscribeReposEndpoint { const PATH: &'static str = "/xrpc/com.atproto.sync.subscribeRepos"; const ENCODING: jacquard_common::xrpc::MessageEncoding = jacquard_common::xrpc::MessageEncoding::DagCbor; type Params = SubscribeRepos; type Stream = SubscribeReposStream; } impl LexiconSchema for RepoOp { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "repoOp" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } impl LexiconSchema for Sync { fn nsid() -> &'static str { "com.atproto.sync.subscribeRepos" } fn def_name() -> &'static str { "sync" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_com_atproto_sync_subscribeRepos() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) } } pub mod account_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 Active; type Did; type Seq; type Time; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Active = Unset; type Did = Unset; type Seq = Unset; type Time = Unset; } ///State transition - sets the `active` field to Set pub struct SetActive(PhantomData St>); impl sealed::Sealed for SetActive {} impl State for SetActive { type Active = Set; type Did = St::Did; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData St>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Active = St::Active; type Did = Set; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData St>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { type Active = St::Active; type Did = St::Did; type Seq = Set; type Time = St::Time; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData St>); impl sealed::Sealed for SetTime {} impl State for SetTime { type Active = St::Active; type Did = St::Did; type Seq = St::Seq; type Time = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `active` field pub struct active(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `seq` field pub struct seq(()); ///Marker type for the `time` field pub struct time(()); } } /// Builder for constructing an instance of this type. pub struct AccountBuilder { _state: PhantomData St>, _fields: ( Option, Option>, Option, Option>, Option, ), _type: PhantomData S>, } impl Account { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> AccountBuilder { AccountBuilder::new() } } impl Account { /// Create a new builder for this type pub fn builder() -> AccountBuilder { AccountBuilder::builder() } } impl AccountBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { AccountBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl AccountBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { AccountBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl AccountBuilder where St: account_state::State, St::Active: account_state::IsUnset, { /// Set the `active` field (required) pub fn active( mut self, value: impl Into, ) -> AccountBuilder, S> { self._fields.0 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl AccountBuilder where St: account_state::State, St::Did: account_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> AccountBuilder, S> { self._fields.1 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl AccountBuilder where St: account_state::State, St::Seq: account_state::IsUnset, { /// Set the `seq` field (required) pub fn seq( mut self, value: impl Into, ) -> AccountBuilder, S> { self._fields.2 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl AccountBuilder { /// Set the `status` field (optional) pub fn status(mut self, value: impl Into>>) -> Self { self._fields.3 = value.into(); self } /// Set the `status` field to an Option value (optional) pub fn maybe_status(mut self, value: Option>) -> Self { self._fields.3 = value; self } } impl AccountBuilder where St: account_state::State, St::Time: account_state::IsUnset, { /// Set the `time` field (required) pub fn time( mut self, value: impl Into, ) -> AccountBuilder, S> { self._fields.4 = Option::Some(value.into()); AccountBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl AccountBuilder where St: account_state::State, St::Active: account_state::IsSet, St::Did: account_state::IsSet, St::Seq: account_state::IsSet, St::Time: account_state::IsSet, { /// Build the final struct. pub fn build(self) -> Account { Account { active: self._fields.0.unwrap(), did: self._fields.1.unwrap(), seq: self._fields.2.unwrap(), status: self._fields.3, time: self._fields.4.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Account { Account { active: self._fields.0.unwrap(), did: self._fields.1.unwrap(), seq: self._fields.2.unwrap(), status: self._fields.3, time: self._fields.4.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_com_atproto_sync_subscribeRepos() -> 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("com.atproto.sync.subscribeRepos"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("account"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.", ), ), required: Some( vec![ SmolStr::new_static("seq"), SmolStr::new_static("did"), SmolStr::new_static("time"), SmolStr::new_static("active") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("active"), 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("seq"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("status"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "If active=false, this optional field indicates a reason for why the account is not active.", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("time"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("commit"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature.", ), ), required: Some( vec![ SmolStr::new_static("seq"), SmolStr::new_static("rebase"), SmolStr::new_static("tooBig"), SmolStr::new_static("repo"), SmolStr::new_static("commit"), SmolStr::new_static("rev"), SmolStr::new_static("since"), SmolStr::new_static("blocks"), SmolStr::new_static("ops"), SmolStr::new_static("blobs"), SmolStr::new_static("time") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("blobs"), LexObjectProperty::Array(LexArray { items: LexArrayItem::CidLink(LexCidLink { ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("blocks"), LexObjectProperty::Bytes(LexBytes { max_length: Some(2000000usize), ..Default::default() }), ); map.insert( SmolStr::new_static("commit"), LexObjectProperty::CidLink(LexCidLink { ..Default::default() }), ); map.insert( SmolStr::new_static("ops"), LexObjectProperty::Array(LexArray { items: LexArrayItem::Ref(LexRef { r#ref: CowStr::new_static("#repoOp"), ..Default::default() }), max_length: Some(200usize), ..Default::default() }), ); map.insert( SmolStr::new_static("prevData"), LexObjectProperty::CidLink(LexCidLink { ..Default::default() }), ); map.insert( SmolStr::new_static("rebase"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("repo"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The repo this event comes from. Note that all other message types name this field 'did'.", ), ), format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("rev"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.", ), ), format: Some(LexStringFormat::Tid), ..Default::default() }), ); map.insert( SmolStr::new_static("seq"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("since"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The rev of the last emitted commit from this repo (if any).", ), ), format: Some(LexStringFormat::Tid), ..Default::default() }), ); map.insert( SmolStr::new_static("time"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Timestamp of when this message was originally broadcast.", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("tooBig"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("identity"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.", ), ), required: Some( vec![ SmolStr::new_static("seq"), SmolStr::new_static("did"), SmolStr::new_static("time") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("handle"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.", ), ), format: Some(LexStringFormat::Handle), ..Default::default() }), ); map.insert( SmolStr::new_static("seq"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("time"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("info"), LexUserType::Object(LexObject { required: Some(vec![SmolStr::new_static("name")]), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("message"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("name"), LexObjectProperty::String(LexString { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("main"), LexUserType::XrpcSubscription(LexXrpcSubscription { parameters: Some( LexXrpcSubscriptionParameter::Params(LexXrpcParameters { properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("cursor"), LexXrpcParametersProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ), ..Default::default() }), ); map.insert( SmolStr::new_static("repoOp"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "A repo operation, ie a mutation of a single record.", ), ), required: Some( vec![ SmolStr::new_static("action"), SmolStr::new_static("path"), SmolStr::new_static("cid") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("action"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("cid"), LexObjectProperty::CidLink(LexCidLink { ..Default::default() }), ); map.insert( SmolStr::new_static("path"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("prev"), LexObjectProperty::CidLink(LexCidLink { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("sync"), LexUserType::Object(LexObject { description: Some( CowStr::new_static( "Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository.", ), ), required: Some( vec![ SmolStr::new_static("seq"), SmolStr::new_static("did"), SmolStr::new_static("blocks"), SmolStr::new_static("rev"), SmolStr::new_static("time") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("blocks"), LexObjectProperty::Bytes(LexBytes { max_length: Some(10000usize), ..Default::default() }), ); map.insert( SmolStr::new_static("did"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The account this repo event corresponds to. Must match that in the commit object.", ), ), format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("rev"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The rev of the commit. This value must match that in the commit object.", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("seq"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("time"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "Timestamp of when this message was originally broadcast.", ), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map }, ..Default::default() }), ); map }, ..Default::default() } } pub mod commit_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 Blobs; type Blocks; type Commit; type Ops; type Rebase; type Repo; type Rev; type Seq; type Time; type TooBig; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Blobs = Unset; type Blocks = Unset; type Commit = Unset; type Ops = Unset; type Rebase = Unset; type Repo = Unset; type Rev = Unset; type Seq = Unset; type Time = Unset; type TooBig = Unset; } ///State transition - sets the `blobs` field to Set pub struct SetBlobs(PhantomData St>); impl sealed::Sealed for SetBlobs {} impl State for SetBlobs { type Blobs = Set; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks(PhantomData St>); impl sealed::Sealed for SetBlocks {} impl State for SetBlocks { type Blobs = St::Blobs; type Blocks = Set; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `commit` field to Set pub struct SetCommit(PhantomData St>); impl sealed::Sealed for SetCommit {} impl State for SetCommit { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = Set; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `ops` field to Set pub struct SetOps(PhantomData St>); impl sealed::Sealed for SetOps {} impl State for SetOps { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = Set; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `rebase` field to Set pub struct SetRebase(PhantomData St>); impl sealed::Sealed for SetRebase {} impl State for SetRebase { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = Set; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `repo` field to Set pub struct SetRepo(PhantomData St>); impl sealed::Sealed for SetRepo {} impl State for SetRepo { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = Set; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData St>); impl sealed::Sealed for SetRev {} impl State for SetRev { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = Set; type Seq = St::Seq; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData St>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = Set; type Time = St::Time; type TooBig = St::TooBig; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData St>); impl sealed::Sealed for SetTime {} impl State for SetTime { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = Set; type TooBig = St::TooBig; } ///State transition - sets the `too_big` field to Set pub struct SetTooBig(PhantomData St>); impl sealed::Sealed for SetTooBig {} impl State for SetTooBig { type Blobs = St::Blobs; type Blocks = St::Blocks; type Commit = St::Commit; type Ops = St::Ops; type Rebase = St::Rebase; type Repo = St::Repo; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; type TooBig = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `blobs` field pub struct blobs(()); ///Marker type for the `blocks` field pub struct blocks(()); ///Marker type for the `commit` field pub struct commit(()); ///Marker type for the `ops` field pub struct ops(()); ///Marker type for the `rebase` field pub struct rebase(()); ///Marker type for the `repo` field pub struct repo(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `seq` field pub struct seq(()); ///Marker type for the `time` field pub struct time(()); ///Marker type for the `too_big` field pub struct too_big(()); } } /// Builder for constructing an instance of this type. pub struct CommitBuilder { _state: PhantomData St>, _fields: ( Option>>, Option, Option>, Option>>, Option>, Option, Option>, Option, Option, Option, Option, Option, ), _type: PhantomData S>, } impl Commit { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> CommitBuilder { CommitBuilder::new() } } impl Commit { /// Create a new builder for this type pub fn builder() -> CommitBuilder { CommitBuilder::builder() } } impl CommitBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { CommitBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } } } impl CommitBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { CommitBuilder { _state: PhantomData, _fields: ( None, None, None, None, None, None, None, None, None, None, None, None, ), _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Blobs: commit_state::IsUnset, { /// Set the `blobs` field (required) pub fn blobs( mut self, value: impl Into>>, ) -> CommitBuilder, S> { self._fields.0 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Blocks: commit_state::IsUnset, { /// Set the `blocks` field (required) pub fn blocks( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.1 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Commit: commit_state::IsUnset, { /// Set the `commit` field (required) pub fn commit( mut self, value: impl Into>, ) -> CommitBuilder, S> { self._fields.2 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Ops: commit_state::IsUnset, { /// Set the `ops` field (required) pub fn ops( mut self, value: impl Into>>, ) -> CommitBuilder, S> { self._fields.3 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder { /// Set the `prevData` field (optional) pub fn prev_data(mut self, value: impl Into>>) -> Self { self._fields.4 = value.into(); self } /// Set the `prevData` field to an Option value (optional) pub fn maybe_prev_data(mut self, value: Option>) -> Self { self._fields.4 = value; self } } impl CommitBuilder where St: commit_state::State, St::Rebase: commit_state::IsUnset, { /// Set the `rebase` field (required) pub fn rebase( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.5 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Repo: commit_state::IsUnset, { /// Set the `repo` field (required) pub fn repo( mut self, value: impl Into>, ) -> CommitBuilder, S> { self._fields.6 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Rev: commit_state::IsUnset, { /// Set the `rev` field (required) pub fn rev( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.7 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Seq: commit_state::IsUnset, { /// Set the `seq` field (required) pub fn seq( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.8 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder { /// Set the `since` field (optional) pub fn since(mut self, value: impl Into>) -> Self { self._fields.9 = value.into(); self } /// Set the `since` field to an Option value (optional) pub fn maybe_since(mut self, value: Option) -> Self { self._fields.9 = value; self } } impl CommitBuilder where St: commit_state::State, St::Time: commit_state::IsUnset, { /// Set the `time` field (required) pub fn time( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.10 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::TooBig: commit_state::IsUnset, { /// Set the `tooBig` field (required) pub fn too_big( mut self, value: impl Into, ) -> CommitBuilder, S> { self._fields.11 = Option::Some(value.into()); CommitBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl CommitBuilder where St: commit_state::State, St::Blobs: commit_state::IsSet, St::Blocks: commit_state::IsSet, St::Commit: commit_state::IsSet, St::Ops: commit_state::IsSet, St::Rebase: commit_state::IsSet, St::Repo: commit_state::IsSet, St::Rev: commit_state::IsSet, St::Seq: commit_state::IsSet, St::Time: commit_state::IsSet, St::TooBig: commit_state::IsSet, { /// Build the final struct. pub fn build(self) -> Commit { Commit { blobs: self._fields.0.unwrap(), blocks: self._fields.1.unwrap(), commit: self._fields.2.unwrap(), ops: self._fields.3.unwrap(), prev_data: self._fields.4, rebase: self._fields.5.unwrap(), repo: self._fields.6.unwrap(), rev: self._fields.7.unwrap(), seq: self._fields.8.unwrap(), since: self._fields.9, time: self._fields.10.unwrap(), too_big: self._fields.11.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Commit { Commit { blobs: self._fields.0.unwrap(), blocks: self._fields.1.unwrap(), commit: self._fields.2.unwrap(), ops: self._fields.3.unwrap(), prev_data: self._fields.4, rebase: self._fields.5.unwrap(), repo: self._fields.6.unwrap(), rev: self._fields.7.unwrap(), seq: self._fields.8.unwrap(), since: self._fields.9, time: self._fields.10.unwrap(), too_big: self._fields.11.unwrap(), extra_data: Some(extra_data), } } } pub mod identity_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 Seq; type Time; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; type Seq = Unset; type Time = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData St>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Did = Set; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData St>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { type Did = St::Did; type Seq = Set; type Time = St::Time; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData St>); impl sealed::Sealed for SetTime {} impl State for SetTime { type Did = St::Did; type Seq = St::Seq; type Time = 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 `seq` field pub struct seq(()); ///Marker type for the `time` field pub struct time(()); } } /// Builder for constructing an instance of this type. pub struct IdentityBuilder { _state: PhantomData St>, _fields: (Option>, Option>, Option, Option), _type: PhantomData S>, } impl Identity { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> IdentityBuilder { IdentityBuilder::new() } } impl Identity { /// Create a new builder for this type pub fn builder() -> IdentityBuilder { IdentityBuilder::builder() } } impl IdentityBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { IdentityBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } } } impl IdentityBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { IdentityBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } } } impl IdentityBuilder where St: identity_state::State, St::Did: identity_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> IdentityBuilder, S> { self._fields.0 = Option::Some(value.into()); IdentityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl IdentityBuilder { /// Set the `handle` field (optional) pub fn handle(mut self, value: impl Into>>) -> Self { self._fields.1 = value.into(); self } /// Set the `handle` field to an Option value (optional) pub fn maybe_handle(mut self, value: Option>) -> Self { self._fields.1 = value; self } } impl IdentityBuilder where St: identity_state::State, St::Seq: identity_state::IsUnset, { /// Set the `seq` field (required) pub fn seq( mut self, value: impl Into, ) -> IdentityBuilder, S> { self._fields.2 = Option::Some(value.into()); IdentityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl IdentityBuilder where St: identity_state::State, St::Time: identity_state::IsUnset, { /// Set the `time` field (required) pub fn time( mut self, value: impl Into, ) -> IdentityBuilder, S> { self._fields.3 = Option::Some(value.into()); IdentityBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl IdentityBuilder where St: identity_state::State, St::Did: identity_state::IsSet, St::Seq: identity_state::IsSet, St::Time: identity_state::IsSet, { /// Build the final struct. pub fn build(self) -> Identity { Identity { did: self._fields.0.unwrap(), handle: self._fields.1, seq: self._fields.2.unwrap(), time: 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>) -> Identity { Identity { did: self._fields.0.unwrap(), handle: self._fields.1, seq: self._fields.2.unwrap(), time: self._fields.3.unwrap(), extra_data: Some(extra_data), } } } pub mod subscribe_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 SubscribeReposBuilder { _state: PhantomData St>, _fields: (Option,), } impl SubscribeRepos { /// Create a new builder for this type. pub fn new() -> SubscribeReposBuilder { SubscribeReposBuilder::new() } } impl SubscribeReposBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { SubscribeReposBuilder { _state: PhantomData, _fields: (None,), } } } impl SubscribeReposBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { SubscribeReposBuilder { _state: PhantomData, _fields: (None,), } } } impl SubscribeReposBuilder { /// Set the `cursor` field (optional) pub fn cursor(mut self, value: impl Into>) -> Self { self._fields.0 = value.into(); self } /// Set the `cursor` field to an Option value (optional) pub fn maybe_cursor(mut self, value: Option) -> Self { self._fields.0 = value; self } } impl SubscribeReposBuilder where St: subscribe_repos_state::State, { /// Build the final struct. pub fn build(self) -> SubscribeRepos { SubscribeRepos { cursor: self._fields.0, } } } pub mod repo_op_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 Action; type Path; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Action = Unset; type Path = Unset; } ///State transition - sets the `action` field to Set pub struct SetAction(PhantomData St>); impl sealed::Sealed for SetAction {} impl State for SetAction { type Action = Set; type Path = St::Path; } ///State transition - sets the `path` field to Set pub struct SetPath(PhantomData St>); impl sealed::Sealed for SetPath {} impl State for SetPath { type Action = St::Action; type Path = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `action` field pub struct action(()); ///Marker type for the `path` field pub struct path(()); } } /// Builder for constructing an instance of this type. pub struct RepoOpBuilder { _state: PhantomData St>, _fields: ( Option>, Option>, Option, Option>, ), _type: PhantomData S>, } impl RepoOp { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> RepoOpBuilder { RepoOpBuilder::new() } } impl RepoOp { /// Create a new builder for this type pub fn builder() -> RepoOpBuilder { RepoOpBuilder::builder() } } impl RepoOpBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { RepoOpBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } } } impl RepoOpBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { RepoOpBuilder { _state: PhantomData, _fields: (None, None, None, None), _type: PhantomData, } } } impl RepoOpBuilder where St: repo_op_state::State, St::Action: repo_op_state::IsUnset, { /// Set the `action` field (required) pub fn action( mut self, value: impl Into>, ) -> RepoOpBuilder, S> { self._fields.0 = Option::Some(value.into()); RepoOpBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl RepoOpBuilder { /// Set the `cid` field (optional) pub fn cid(mut self, value: impl Into>>) -> Self { self._fields.1 = value.into(); self } /// Set the `cid` field to an Option value (optional) pub fn maybe_cid(mut self, value: Option>) -> Self { self._fields.1 = value; self } } impl RepoOpBuilder where St: repo_op_state::State, St::Path: repo_op_state::IsUnset, { /// Set the `path` field (required) pub fn path( mut self, value: impl Into, ) -> RepoOpBuilder, S> { self._fields.2 = Option::Some(value.into()); RepoOpBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl RepoOpBuilder { /// Set the `prev` field (optional) pub fn prev(mut self, value: impl Into>>) -> Self { self._fields.3 = value.into(); self } /// Set the `prev` field to an Option value (optional) pub fn maybe_prev(mut self, value: Option>) -> Self { self._fields.3 = value; self } } impl RepoOpBuilder where St: repo_op_state::State, St::Action: repo_op_state::IsSet, St::Path: repo_op_state::IsSet, { /// Build the final struct. pub fn build(self) -> RepoOp { RepoOp { action: self._fields.0.unwrap(), cid: self._fields.1, path: self._fields.2.unwrap(), prev: self._fields.3, extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> RepoOp { RepoOp { action: self._fields.0.unwrap(), cid: self._fields.1, path: self._fields.2.unwrap(), prev: self._fields.3, extra_data: Some(extra_data), } } } pub mod sync_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 Blocks; type Did; type Rev; type Seq; type Time; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Blocks = Unset; type Did = Unset; type Rev = Unset; type Seq = Unset; type Time = Unset; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks(PhantomData St>); impl sealed::Sealed for SetBlocks {} impl State for SetBlocks { type Blocks = Set; type Did = St::Did; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData St>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Blocks = St::Blocks; type Did = Set; type Rev = St::Rev; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `rev` field to Set pub struct SetRev(PhantomData St>); impl sealed::Sealed for SetRev {} impl State for SetRev { type Blocks = St::Blocks; type Did = St::Did; type Rev = Set; type Seq = St::Seq; type Time = St::Time; } ///State transition - sets the `seq` field to Set pub struct SetSeq(PhantomData St>); impl sealed::Sealed for SetSeq {} impl State for SetSeq { type Blocks = St::Blocks; type Did = St::Did; type Rev = St::Rev; type Seq = Set; type Time = St::Time; } ///State transition - sets the `time` field to Set pub struct SetTime(PhantomData St>); impl sealed::Sealed for SetTime {} impl State for SetTime { type Blocks = St::Blocks; type Did = St::Did; type Rev = St::Rev; type Seq = St::Seq; type Time = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `blocks` field pub struct blocks(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `rev` field pub struct rev(()); ///Marker type for the `seq` field pub struct seq(()); ///Marker type for the `time` field pub struct time(()); } } /// Builder for constructing an instance of this type. pub struct SyncBuilder { _state: PhantomData St>, _fields: (Option, Option>, Option, Option, Option), _type: PhantomData S>, } impl Sync { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> SyncBuilder { SyncBuilder::new() } } impl Sync { /// Create a new builder for this type pub fn builder() -> SyncBuilder { SyncBuilder::builder() } } impl SyncBuilder { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { SyncBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl SyncBuilder { /// Create a new builder with all fields unset pub fn builder() -> Self { SyncBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Blocks: sync_state::IsUnset, { /// Set the `blocks` field (required) pub fn blocks( mut self, value: impl Into, ) -> SyncBuilder, S> { self._fields.0 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Did: sync_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> SyncBuilder, S> { self._fields.1 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Rev: sync_state::IsUnset, { /// Set the `rev` field (required) pub fn rev(mut self, value: impl Into) -> SyncBuilder, S> { self._fields.2 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Seq: sync_state::IsUnset, { /// Set the `seq` field (required) pub fn seq( mut self, value: impl Into, ) -> SyncBuilder, S> { self._fields.3 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Time: sync_state::IsUnset, { /// Set the `time` field (required) pub fn time( mut self, value: impl Into, ) -> SyncBuilder, S> { self._fields.4 = Option::Some(value.into()); SyncBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } } } impl SyncBuilder where St: sync_state::State, St::Blocks: sync_state::IsSet, St::Did: sync_state::IsSet, St::Rev: sync_state::IsSet, St::Seq: sync_state::IsSet, St::Time: sync_state::IsSet, { /// Build the final struct. pub fn build(self) -> Sync { Sync { blocks: self._fields.0.unwrap(), did: self._fields.1.unwrap(), rev: self._fields.2.unwrap(), seq: self._fields.3.unwrap(), time: self._fields.4.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap>) -> Sync { Sync { blocks: self._fields.0.unwrap(), did: self._fields.1.unwrap(), rev: self._fields.2.unwrap(), seq: self._fields.3.unwrap(), time: self._fields.4.unwrap(), extra_data: Some(extra_data), } } }