#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Account<'a> {
pub active: bool,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
pub seq: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub status: std::option::Option<AccountStatus<'a>>,
pub time: jacquard_common::types::string::Datetime,
}
pub mod account_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Seq;
type Active;
type Did;
type Time;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Seq = Unset;
type Active = Unset;
type Did = Unset;
type Time = Unset;
}
pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSeq<S> {}
impl<S: State> State for SetSeq<S> {
type Seq = Set<members::seq>;
type Active = S::Active;
type Did = S::Did;
type Time = S::Time;
}
pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetActive<S> {}
impl<S: State> State for SetActive<S> {
type Seq = S::Seq;
type Active = Set<members::active>;
type Did = S::Did;
type Time = S::Time;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Seq = S::Seq;
type Active = S::Active;
type Did = Set<members::did>;
type Time = S::Time;
}
pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTime<S> {}
impl<S: State> State for SetTime<S> {
type Seq = S::Seq;
type Active = S::Active;
type Did = S::Did;
type Time = Set<members::time>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct seq(());
pub struct active(());
pub struct did(());
pub struct time(());
}
}
pub struct AccountBuilder<'a, S: account_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<bool>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<i64>,
::core::option::Option<AccountStatus<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Account<'a> {
pub fn new() -> AccountBuilder<'a, account_state::Empty> {
AccountBuilder::new()
}
}
impl<'a> AccountBuilder<'a, account_state::Empty> {
pub fn new() -> Self {
AccountBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> AccountBuilder<'a, S>
where
S: account_state::State,
S::Active: account_state::IsUnset,
{
pub fn active(
mut self,
value: impl Into<bool>,
) -> AccountBuilder<'a, account_state::SetActive<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
AccountBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> AccountBuilder<'a, S>
where
S: account_state::State,
S::Did: account_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> AccountBuilder<'a, account_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
AccountBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> AccountBuilder<'a, S>
where
S: account_state::State,
S::Seq: account_state::IsUnset,
{
pub fn seq(
mut self,
value: impl Into<i64>,
) -> AccountBuilder<'a, account_state::SetSeq<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
AccountBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: account_state::State> AccountBuilder<'a, S> {
pub fn status(mut self, value: impl Into<Option<AccountStatus<'a>>>) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_status(mut self, value: Option<AccountStatus<'a>>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S> AccountBuilder<'a, S>
where
S: account_state::State,
S::Time: account_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> AccountBuilder<'a, account_state::SetTime<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
AccountBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> AccountBuilder<'a, S>
where
S: account_state::State,
S::Seq: account_state::IsSet,
S::Active: account_state::IsSet,
S::Did: account_state::IsSet,
S::Time: account_state::IsSet,
{
pub fn build(self) -> Account<'a> {
Account {
active: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
seq: self.__unsafe_private_named.2.unwrap(),
status: self.__unsafe_private_named.3,
time: self.__unsafe_private_named.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Account<'a> {
Account {
active: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
seq: self.__unsafe_private_named.2.unwrap(),
status: self.__unsafe_private_named.3,
time: self.__unsafe_private_named.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AccountStatus<'a> {
Takendown,
Suspended,
Deleted,
Deactivated,
Desynchronized,
Throttled,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> AccountStatus<'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 AccountStatus<'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<String> for AccountStatus<'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 AccountStatus<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for AccountStatus<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for AccountStatus<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for AccountStatus<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for AccountStatus<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for AccountStatus<'_> {
type Output = AccountStatus<'static>;
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()),
}
}
}
fn lexicon_doc_com_atproto_sync_subscribeRepos() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("com.atproto.sync.subscribeRepos"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("account"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::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![
::jacquard_common::deps::smol_str::SmolStr::new_static("seq"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("time"),
::jacquard_common::deps::smol_str::SmolStr::new_static("active")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::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::deps::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::deps::smol_str::SmolStr::new_static(
"seq",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::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 reason for why the account is not active.",
),
),
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::deps::smol_str::SmolStr::new_static(
"time",
),
::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
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("commit"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::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![
::jacquard_common::deps::smol_str::SmolStr::new_static("seq"),
::jacquard_common::deps::smol_str::SmolStr::new_static("rebase"),
::jacquard_common::deps::smol_str::SmolStr::new_static("tooBig"),
::jacquard_common::deps::smol_str::SmolStr::new_static("repo"),
::jacquard_common::deps::smol_str::SmolStr::new_static("commit"),
::jacquard_common::deps::smol_str::SmolStr::new_static("rev"),
::jacquard_common::deps::smol_str::SmolStr::new_static("since"),
::jacquard_common::deps::smol_str::SmolStr::new_static("blocks"),
::jacquard_common::deps::smol_str::SmolStr::new_static("ops"),
::jacquard_common::deps::smol_str::SmolStr::new_static("blobs"),
::jacquard_common::deps::smol_str::SmolStr::new_static("time")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"blobs",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::CidLink(::jacquard_lexicon::lexicon::LexCidLink {
description: None,
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"blocks",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes {
description: None,
max_length: Some(2000000usize),
min_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"commit",
),
::jacquard_lexicon::lexicon::LexObjectProperty::CidLink(::jacquard_lexicon::lexicon::LexCidLink {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"ops",
),
::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("#repoOp"),
}),
min_length: None,
max_length: Some(200usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"prevData",
),
::jacquard_lexicon::lexicon::LexObjectProperty::CidLink(::jacquard_lexicon::lexicon::LexCidLink {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"rebase",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"repo",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The repo this event comes from. Note that all other message types name this field 'did'.",
),
),
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::deps::smol_str::SmolStr::new_static(
"rev",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::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(
::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::deps::smol_str::SmolStr::new_static(
"seq",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"since",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The rev of the last emitted commit from this repo (if any).",
),
),
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::deps::smol_str::SmolStr::new_static(
"time",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Timestamp of when this message was originally broadcast.",
),
),
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::deps::smol_str::SmolStr::new_static(
"tooBig",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("identity"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::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![
::jacquard_common::deps::smol_str::SmolStr::new_static("seq"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("time")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::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::deps::smol_str::SmolStr::new_static(
"handle",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::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(
::jacquard_lexicon::lexicon::LexStringFormat::Handle,
),
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::deps::smol_str::SmolStr::new_static(
"seq",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"time",
),
::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
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("info"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"message",
),
::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.insert(
::jacquard_common::deps::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: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::XrpcSubscription(::jacquard_lexicon::lexicon::LexXrpcSubscription {
description: None,
parameters: Some(
::jacquard_lexicon::lexicon::LexXrpcSubscriptionParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
description: None,
required: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cursor",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
),
message: None,
infos: None,
errors: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("repoOp"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A repo operation, ie a mutation of a single record.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("action"),
::jacquard_common::deps::smol_str::SmolStr::new_static("path"),
::jacquard_common::deps::smol_str::SmolStr::new_static("cid")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"action",
),
::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.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cid",
),
::jacquard_lexicon::lexicon::LexObjectProperty::CidLink(::jacquard_lexicon::lexicon::LexCidLink {
description: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"path",
),
::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.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"prev",
),
::jacquard_lexicon::lexicon::LexObjectProperty::CidLink(::jacquard_lexicon::lexicon::LexCidLink {
description: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("sync"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::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![
::jacquard_common::deps::smol_str::SmolStr::new_static("seq"),
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("blocks"),
::jacquard_common::deps::smol_str::SmolStr::new_static("rev"),
::jacquard_common::deps::smol_str::SmolStr::new_static("time")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"blocks",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes {
description: None,
max_length: Some(10000usize),
min_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The account this repo event corresponds to. Must match that in the commit object.",
),
),
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::deps::smol_str::SmolStr::new_static(
"rev",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The rev of the commit. This value must match that in the commit object.",
),
),
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::deps::smol_str::SmolStr::new_static(
"seq",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"time",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Timestamp of when this message was originally broadcast.",
),
),
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
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Account<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"account"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Commit<'a> {
#[serde(borrow)]
pub blobs: Vec<jacquard_common::types::cid::CidLink<'a>>,
#[serde(with = "jacquard_common::serde_bytes_helper")]
pub blocks: jacquard_common::deps::bytes::Bytes,
#[serde(borrow)]
pub commit: jacquard_common::types::cid::CidLink<'a>,
#[serde(borrow)]
pub ops: Vec<crate::com_atproto::sync::subscribe_repos::RepoOp<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub prev_data: std::option::Option<jacquard_common::types::cid::CidLink<'a>>,
pub rebase: bool,
#[serde(borrow)]
pub repo: jacquard_common::types::string::Did<'a>,
pub rev: jacquard_common::types::string::Tid,
pub seq: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub since: std::option::Option<jacquard_common::types::string::Tid>,
pub time: jacquard_common::types::string::Datetime,
pub too_big: bool,
}
pub mod commit_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Time;
type Seq;
type Blobs;
type Rebase;
type Blocks;
type TooBig;
type Repo;
type Rev;
type Ops;
type Commit;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Time = Unset;
type Seq = Unset;
type Blobs = Unset;
type Rebase = Unset;
type Blocks = Unset;
type TooBig = Unset;
type Repo = Unset;
type Rev = Unset;
type Ops = Unset;
type Commit = Unset;
}
pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTime<S> {}
impl<S: State> State for SetTime<S> {
type Time = Set<members::time>;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSeq<S> {}
impl<S: State> State for SetSeq<S> {
type Time = S::Time;
type Seq = Set<members::seq>;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlobs<S> {}
impl<S: State> State for SetBlobs<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = Set<members::blobs>;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetRebase<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRebase<S> {}
impl<S: State> State for SetRebase<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = Set<members::rebase>;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlocks<S> {}
impl<S: State> State for SetBlocks<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = Set<members::blocks>;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetTooBig<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTooBig<S> {}
impl<S: State> State for SetTooBig<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = Set<members::too_big>;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRepo<S> {}
impl<S: State> State for SetRepo<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = Set<members::repo>;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRev<S> {}
impl<S: State> State for SetRev<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = Set<members::rev>;
type Ops = S::Ops;
type Commit = S::Commit;
}
pub struct SetOps<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetOps<S> {}
impl<S: State> State for SetOps<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = Set<members::ops>;
type Commit = S::Commit;
}
pub struct SetCommit<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCommit<S> {}
impl<S: State> State for SetCommit<S> {
type Time = S::Time;
type Seq = S::Seq;
type Blobs = S::Blobs;
type Rebase = S::Rebase;
type Blocks = S::Blocks;
type TooBig = S::TooBig;
type Repo = S::Repo;
type Rev = S::Rev;
type Ops = S::Ops;
type Commit = Set<members::commit>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct time(());
pub struct seq(());
pub struct blobs(());
pub struct rebase(());
pub struct blocks(());
pub struct too_big(());
pub struct repo(());
pub struct rev(());
pub struct ops(());
pub struct commit(());
}
}
pub struct CommitBuilder<'a, S: commit_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<Vec<jacquard_common::types::cid::CidLink<'a>>>,
::core::option::Option<jacquard_common::deps::bytes::Bytes>,
::core::option::Option<jacquard_common::types::cid::CidLink<'a>>,
::core::option::Option<
Vec<crate::com_atproto::sync::subscribe_repos::RepoOp<'a>>,
>,
::core::option::Option<jacquard_common::types::cid::CidLink<'a>>,
::core::option::Option<bool>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::types::string::Tid>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Tid>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<bool>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Commit<'a> {
pub fn new() -> CommitBuilder<'a, commit_state::Empty> {
CommitBuilder::new()
}
}
impl<'a> CommitBuilder<'a, commit_state::Empty> {
pub fn new() -> Self {
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Blobs: commit_state::IsUnset,
{
pub fn blobs(
mut self,
value: impl Into<Vec<jacquard_common::types::cid::CidLink<'a>>>,
) -> CommitBuilder<'a, commit_state::SetBlobs<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Blocks: commit_state::IsUnset,
{
pub fn blocks(
mut self,
value: impl Into<jacquard_common::deps::bytes::Bytes>,
) -> CommitBuilder<'a, commit_state::SetBlocks<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Commit: commit_state::IsUnset,
{
pub fn commit(
mut self,
value: impl Into<jacquard_common::types::cid::CidLink<'a>>,
) -> CommitBuilder<'a, commit_state::SetCommit<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Ops: commit_state::IsUnset,
{
pub fn ops(
mut self,
value: impl Into<Vec<crate::com_atproto::sync::subscribe_repos::RepoOp<'a>>>,
) -> CommitBuilder<'a, commit_state::SetOps<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: commit_state::State> CommitBuilder<'a, S> {
pub fn prev_data(
mut self,
value: impl Into<Option<jacquard_common::types::cid::CidLink<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_prev_data(
mut self,
value: Option<jacquard_common::types::cid::CidLink<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Rebase: commit_state::IsUnset,
{
pub fn rebase(
mut self,
value: impl Into<bool>,
) -> CommitBuilder<'a, commit_state::SetRebase<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Repo: commit_state::IsUnset,
{
pub fn repo(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> CommitBuilder<'a, commit_state::SetRepo<S>> {
self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Rev: commit_state::IsUnset,
{
pub fn rev(
mut self,
value: impl Into<jacquard_common::types::string::Tid>,
) -> CommitBuilder<'a, commit_state::SetRev<S>> {
self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Seq: commit_state::IsUnset,
{
pub fn seq(
mut self,
value: impl Into<i64>,
) -> CommitBuilder<'a, commit_state::SetSeq<S>> {
self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: commit_state::State> CommitBuilder<'a, S> {
pub fn since(
mut self,
value: impl Into<Option<jacquard_common::types::string::Tid>>,
) -> Self {
self.__unsafe_private_named.9 = value.into();
self
}
pub fn maybe_since(
mut self,
value: Option<jacquard_common::types::string::Tid>,
) -> Self {
self.__unsafe_private_named.9 = value;
self
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Time: commit_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> CommitBuilder<'a, commit_state::SetTime<S>> {
self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::TooBig: commit_state::IsUnset,
{
pub fn too_big(
mut self,
value: impl Into<bool>,
) -> CommitBuilder<'a, commit_state::SetTooBig<S>> {
self.__unsafe_private_named.11 = ::core::option::Option::Some(value.into());
CommitBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> CommitBuilder<'a, S>
where
S: commit_state::State,
S::Time: commit_state::IsSet,
S::Seq: commit_state::IsSet,
S::Blobs: commit_state::IsSet,
S::Rebase: commit_state::IsSet,
S::Blocks: commit_state::IsSet,
S::TooBig: commit_state::IsSet,
S::Repo: commit_state::IsSet,
S::Rev: commit_state::IsSet,
S::Ops: commit_state::IsSet,
S::Commit: commit_state::IsSet,
{
pub fn build(self) -> Commit<'a> {
Commit {
blobs: self.__unsafe_private_named.0.unwrap(),
blocks: self.__unsafe_private_named.1.unwrap(),
commit: self.__unsafe_private_named.2.unwrap(),
ops: self.__unsafe_private_named.3.unwrap(),
prev_data: self.__unsafe_private_named.4,
rebase: self.__unsafe_private_named.5.unwrap(),
repo: self.__unsafe_private_named.6.unwrap(),
rev: self.__unsafe_private_named.7.unwrap(),
seq: self.__unsafe_private_named.8.unwrap(),
since: self.__unsafe_private_named.9,
time: self.__unsafe_private_named.10.unwrap(),
too_big: self.__unsafe_private_named.11.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Commit<'a> {
Commit {
blobs: self.__unsafe_private_named.0.unwrap(),
blocks: self.__unsafe_private_named.1.unwrap(),
commit: self.__unsafe_private_named.2.unwrap(),
ops: self.__unsafe_private_named.3.unwrap(),
prev_data: self.__unsafe_private_named.4,
rebase: self.__unsafe_private_named.5.unwrap(),
repo: self.__unsafe_private_named.6.unwrap(),
rev: self.__unsafe_private_named.7.unwrap(),
seq: self.__unsafe_private_named.8.unwrap(),
since: self.__unsafe_private_named.9,
time: self.__unsafe_private_named.10.unwrap(),
too_big: self.__unsafe_private_named.11.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Commit<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"commit"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.ops;
#[allow(unused_comparisons)]
if value.len() > 200usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"ops",
),
max: 200usize,
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 Identity<'a> {
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub handle: std::option::Option<jacquard_common::types::string::Handle<'a>>,
pub seq: i64,
pub time: jacquard_common::types::string::Datetime,
}
pub mod identity_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Seq;
type Time;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Seq = Unset;
type Time = Unset;
type Did = Unset;
}
pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSeq<S> {}
impl<S: State> State for SetSeq<S> {
type Seq = Set<members::seq>;
type Time = S::Time;
type Did = S::Did;
}
pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTime<S> {}
impl<S: State> State for SetTime<S> {
type Seq = S::Seq;
type Time = Set<members::time>;
type Did = S::Did;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Seq = S::Seq;
type Time = S::Time;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct seq(());
pub struct time(());
pub struct did(());
}
}
pub struct IdentityBuilder<'a, S: identity_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::types::string::Handle<'a>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Identity<'a> {
pub fn new() -> IdentityBuilder<'a, identity_state::Empty> {
IdentityBuilder::new()
}
}
impl<'a> IdentityBuilder<'a, identity_state::Empty> {
pub fn new() -> Self {
IdentityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> IdentityBuilder<'a, S>
where
S: identity_state::State,
S::Did: identity_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> IdentityBuilder<'a, identity_state::SetDid<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
IdentityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: identity_state::State> IdentityBuilder<'a, S> {
pub fn handle(
mut self,
value: impl Into<Option<jacquard_common::types::string::Handle<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_handle(
mut self,
value: Option<jacquard_common::types::string::Handle<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> IdentityBuilder<'a, S>
where
S: identity_state::State,
S::Seq: identity_state::IsUnset,
{
pub fn seq(
mut self,
value: impl Into<i64>,
) -> IdentityBuilder<'a, identity_state::SetSeq<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
IdentityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> IdentityBuilder<'a, S>
where
S: identity_state::State,
S::Time: identity_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> IdentityBuilder<'a, identity_state::SetTime<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
IdentityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> IdentityBuilder<'a, S>
where
S: identity_state::State,
S::Seq: identity_state::IsSet,
S::Time: identity_state::IsSet,
S::Did: identity_state::IsSet,
{
pub fn build(self) -> Identity<'a> {
Identity {
did: self.__unsafe_private_named.0.unwrap(),
handle: self.__unsafe_private_named.1,
seq: self.__unsafe_private_named.2.unwrap(),
time: self.__unsafe_private_named.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Identity<'a> {
Identity {
did: self.__unsafe_private_named.0.unwrap(),
handle: self.__unsafe_private_named.1,
seq: self.__unsafe_private_named.2.unwrap(),
time: self.__unsafe_private_named.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Identity<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"identity"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct Info<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub message: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub name: InfoName<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InfoName<'a> {
OutdatedCursor,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> InfoName<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::OutdatedCursor => "OutdatedCursor",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for InfoName<'a> {
fn from(s: &'a str) -> Self {
match s {
"OutdatedCursor" => Self::OutdatedCursor,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for InfoName<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"OutdatedCursor" => Self::OutdatedCursor,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for InfoName<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for InfoName<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for InfoName<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for InfoName<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for InfoName<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for InfoName<'_> {
type Output = InfoName<'static>;
fn into_static(self) -> Self::Output {
match self {
InfoName::OutdatedCursor => InfoName::OutdatedCursor,
InfoName::Other(v) => InfoName::Other(v.into_static()),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Info<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"info"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct SubscribeRepos {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub cursor: std::option::Option<i64>,
}
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 {}
}
pub trait State: sealed::Sealed {}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {}
#[allow(non_camel_case_types)]
pub mod members {}
}
pub struct SubscribeReposBuilder<S: subscribe_repos_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<i64>,),
}
impl SubscribeRepos {
pub fn new() -> SubscribeReposBuilder<subscribe_repos_state::Empty> {
SubscribeReposBuilder::new()
}
}
impl SubscribeReposBuilder<subscribe_repos_state::Empty> {
pub fn new() -> Self {
SubscribeReposBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
}
}
}
impl<S: subscribe_repos_state::State> SubscribeReposBuilder<S> {
pub fn cursor(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<S> SubscribeReposBuilder<S>
where
S: subscribe_repos_state::State,
{
pub fn build(self) -> SubscribeRepos {
SubscribeRepos {
cursor: self.__unsafe_private_named.0,
}
}
}
#[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 SubscribeReposMessage<'a> {
#[serde(rename = "#commit")]
Commit(Box<crate::com_atproto::sync::subscribe_repos::Commit<'a>>),
#[serde(rename = "#sync")]
Sync(Box<crate::com_atproto::sync::subscribe_repos::Sync<'a>>),
#[serde(rename = "#identity")]
Identity(Box<crate::com_atproto::sync::subscribe_repos::Identity<'a>>),
#[serde(rename = "#account")]
Account(Box<crate::com_atproto::sync::subscribe_repos::Account<'a>>),
#[serde(rename = "#info")]
Info(Box<crate::com_atproto::sync::subscribe_repos::Info<'a>>),
}
impl<'a> SubscribeReposMessage<'a> {
pub fn decode_framed<'de: 'a>(
bytes: &'de [u8],
) -> Result<SubscribeReposMessage<'a>, jacquard_common::error::DecodeError> {
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()),
)
}
}
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
thiserror::Error,
miette::Diagnostic,
jacquard_derive::IntoStatic
)]
#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum SubscribeReposError<'a> {
#[serde(rename = "FutureCursor")]
FutureCursor(std::option::Option<jacquard_common::CowStr<'a>>),
#[serde(rename = "ConsumerTooSlow")]
ConsumerTooSlow(std::option::Option<jacquard_common::CowStr<'a>>),
}
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::Unknown(err) => write!(f, "Unknown error: {:?}", err),
}
}
}
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<'de> = SubscribeReposMessage<'de>;
type Error<'de> = SubscribeReposError<'de>;
fn decode_message<'de>(
bytes: &'de [u8],
) -> Result<Self::Message<'de>, jacquard_common::error::DecodeError> {
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<'de> = SubscribeRepos;
type Stream = SubscribeReposStream;
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct RepoOp<'a> {
#[serde(borrow)]
pub action: RepoOpAction<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::cid::CidLink<'a>>,
#[serde(borrow)]
pub path: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub prev: std::option::Option<jacquard_common::types::cid::CidLink<'a>>,
}
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 {}
}
pub trait State: sealed::Sealed {
type Path;
type Action;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Path = Unset;
type Action = Unset;
}
pub struct SetPath<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPath<S> {}
impl<S: State> State for SetPath<S> {
type Path = Set<members::path>;
type Action = S::Action;
}
pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAction<S> {}
impl<S: State> State for SetAction<S> {
type Path = S::Path;
type Action = Set<members::action>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct path(());
pub struct action(());
}
}
pub struct RepoOpBuilder<'a, S: repo_op_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<RepoOpAction<'a>>,
::core::option::Option<jacquard_common::types::cid::CidLink<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::cid::CidLink<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> RepoOp<'a> {
pub fn new() -> RepoOpBuilder<'a, repo_op_state::Empty> {
RepoOpBuilder::new()
}
}
impl<'a> RepoOpBuilder<'a, repo_op_state::Empty> {
pub fn new() -> Self {
RepoOpBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RepoOpBuilder<'a, S>
where
S: repo_op_state::State,
S::Action: repo_op_state::IsUnset,
{
pub fn action(
mut self,
value: impl Into<RepoOpAction<'a>>,
) -> RepoOpBuilder<'a, repo_op_state::SetAction<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
RepoOpBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: repo_op_state::State> RepoOpBuilder<'a, S> {
pub fn cid(
mut self,
value: impl Into<Option<jacquard_common::types::cid::CidLink<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_cid(
mut self,
value: Option<jacquard_common::types::cid::CidLink<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> RepoOpBuilder<'a, S>
where
S: repo_op_state::State,
S::Path: repo_op_state::IsUnset,
{
pub fn path(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> RepoOpBuilder<'a, repo_op_state::SetPath<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
RepoOpBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: repo_op_state::State> RepoOpBuilder<'a, S> {
pub fn prev(
mut self,
value: impl Into<Option<jacquard_common::types::cid::CidLink<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_prev(
mut self,
value: Option<jacquard_common::types::cid::CidLink<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S> RepoOpBuilder<'a, S>
where
S: repo_op_state::State,
S::Path: repo_op_state::IsSet,
S::Action: repo_op_state::IsSet,
{
pub fn build(self) -> RepoOp<'a> {
RepoOp {
action: self.__unsafe_private_named.0.unwrap(),
cid: self.__unsafe_private_named.1,
path: self.__unsafe_private_named.2.unwrap(),
prev: self.__unsafe_private_named.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RepoOp<'a> {
RepoOp {
action: self.__unsafe_private_named.0.unwrap(),
cid: self.__unsafe_private_named.1,
path: self.__unsafe_private_named.2.unwrap(),
prev: self.__unsafe_private_named.3,
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RepoOpAction<'a> {
Create,
Update,
Delete,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> RepoOpAction<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Create => "create",
Self::Update => "update",
Self::Delete => "delete",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for RepoOpAction<'a> {
fn from(s: &'a str) -> Self {
match s {
"create" => Self::Create,
"update" => Self::Update,
"delete" => Self::Delete,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for RepoOpAction<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"create" => Self::Create,
"update" => Self::Update,
"delete" => Self::Delete,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for RepoOpAction<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for RepoOpAction<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for RepoOpAction<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for RepoOpAction<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for RepoOpAction<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for RepoOpAction<'_> {
type Output = RepoOpAction<'static>;
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()),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RepoOp<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"repoOp"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Sync<'a> {
#[serde(with = "jacquard_common::serde_bytes_helper")]
pub blocks: jacquard_common::deps::bytes::Bytes,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub rev: jacquard_common::CowStr<'a>,
pub seq: i64,
pub time: jacquard_common::types::string::Datetime,
}
pub mod sync_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Rev;
type Did;
type Time;
type Blocks;
type Seq;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Rev = Unset;
type Did = Unset;
type Time = Unset;
type Blocks = Unset;
type Seq = Unset;
}
pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRev<S> {}
impl<S: State> State for SetRev<S> {
type Rev = Set<members::rev>;
type Did = S::Did;
type Time = S::Time;
type Blocks = S::Blocks;
type Seq = S::Seq;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Rev = S::Rev;
type Did = Set<members::did>;
type Time = S::Time;
type Blocks = S::Blocks;
type Seq = S::Seq;
}
pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTime<S> {}
impl<S: State> State for SetTime<S> {
type Rev = S::Rev;
type Did = S::Did;
type Time = Set<members::time>;
type Blocks = S::Blocks;
type Seq = S::Seq;
}
pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlocks<S> {}
impl<S: State> State for SetBlocks<S> {
type Rev = S::Rev;
type Did = S::Did;
type Time = S::Time;
type Blocks = Set<members::blocks>;
type Seq = S::Seq;
}
pub struct SetSeq<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSeq<S> {}
impl<S: State> State for SetSeq<S> {
type Rev = S::Rev;
type Did = S::Did;
type Time = S::Time;
type Blocks = S::Blocks;
type Seq = Set<members::seq>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct rev(());
pub struct did(());
pub struct time(());
pub struct blocks(());
pub struct seq(());
}
}
pub struct SyncBuilder<'a, S: sync_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::deps::bytes::Bytes>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Sync<'a> {
pub fn new() -> SyncBuilder<'a, sync_state::Empty> {
SyncBuilder::new()
}
}
impl<'a> SyncBuilder<'a, sync_state::Empty> {
pub fn new() -> Self {
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Blocks: sync_state::IsUnset,
{
pub fn blocks(
mut self,
value: impl Into<jacquard_common::deps::bytes::Bytes>,
) -> SyncBuilder<'a, sync_state::SetBlocks<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Did: sync_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> SyncBuilder<'a, sync_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Rev: sync_state::IsUnset,
{
pub fn rev(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> SyncBuilder<'a, sync_state::SetRev<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Seq: sync_state::IsUnset,
{
pub fn seq(
mut self,
value: impl Into<i64>,
) -> SyncBuilder<'a, sync_state::SetSeq<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Time: sync_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> SyncBuilder<'a, sync_state::SetTime<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
SyncBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> SyncBuilder<'a, S>
where
S: sync_state::State,
S::Rev: sync_state::IsSet,
S::Did: sync_state::IsSet,
S::Time: sync_state::IsSet,
S::Blocks: sync_state::IsSet,
S::Seq: sync_state::IsSet,
{
pub fn build(self) -> Sync<'a> {
Sync {
blocks: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
rev: self.__unsafe_private_named.2.unwrap(),
seq: self.__unsafe_private_named.3.unwrap(),
time: self.__unsafe_private_named.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Sync<'a> {
Sync {
blocks: self.__unsafe_private_named.0.unwrap(),
did: self.__unsafe_private_named.1.unwrap(),
rev: self.__unsafe_private_named.2.unwrap(),
seq: self.__unsafe_private_named.3.unwrap(),
time: self.__unsafe_private_named.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Sync<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.subscribeRepos"
}
fn def_name() -> &'static str {
"sync"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_subscribeRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}