pub mod dismiss_match;
pub mod get_matches;
pub mod get_sync_status;
pub mod import_contacts;
pub mod remove_data;
pub mod send_notification;
pub mod start_phone_verification;
pub mod verify_phone;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Did, Datetime};
use jacquard_derive::{IntoStatic, lexicon};
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::app_bsky::actor::ProfileView;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct MatchAndContactIndex<'a> {
pub contact_index: i64,
#[serde(borrow)]
pub r#match: ProfileView<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Notification<'a> {
#[serde(borrow)]
pub from: Did<'a>,
#[serde(borrow)]
pub to: Did<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SyncStatus<'a> {
pub matches_count: i64,
pub synced_at: Datetime,
}
impl<'a> LexiconSchema for MatchAndContactIndex<'a> {
fn nsid() -> &'static str {
"app.bsky.contact.defs"
}
fn def_name() -> &'static str {
"matchAndContactIndex"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_contact_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.contact_index;
if *value > 999i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("contact_index"),
max: 999i64,
actual: *value,
});
}
}
{
let value = &self.contact_index;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("contact_index"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for Notification<'a> {
fn nsid() -> &'static str {
"app.bsky.contact.defs"
}
fn def_name() -> &'static str {
"notification"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_contact_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for SyncStatus<'a> {
fn nsid() -> &'static str {
"app.bsky.contact.defs"
}
fn def_name() -> &'static str {
"syncStatus"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_contact_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.matches_count;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("matches_count"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
pub mod match_and_contact_index_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 Match;
type ContactIndex;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Match = Unset;
type ContactIndex = Unset;
}
pub struct SetMatch<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMatch<S> {}
impl<S: State> State for SetMatch<S> {
type Match = Set<members::r#match>;
type ContactIndex = S::ContactIndex;
}
pub struct SetContactIndex<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContactIndex<S> {}
impl<S: State> State for SetContactIndex<S> {
type Match = S::Match;
type ContactIndex = Set<members::contact_index>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct r#match(());
pub struct contact_index(());
}
}
pub struct MatchAndContactIndexBuilder<'a, S: match_and_contact_index_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<ProfileView<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> MatchAndContactIndex<'a> {
pub fn new() -> MatchAndContactIndexBuilder<
'a,
match_and_contact_index_state::Empty,
> {
MatchAndContactIndexBuilder::new()
}
}
impl<'a> MatchAndContactIndexBuilder<'a, match_and_contact_index_state::Empty> {
pub fn new() -> Self {
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> MatchAndContactIndexBuilder<'a, S>
where
S: match_and_contact_index_state::State,
S::ContactIndex: match_and_contact_index_state::IsUnset,
{
pub fn contact_index(
mut self,
value: impl Into<i64>,
) -> MatchAndContactIndexBuilder<
'a,
match_and_contact_index_state::SetContactIndex<S>,
> {
self._fields.0 = Option::Some(value.into());
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> MatchAndContactIndexBuilder<'a, S>
where
S: match_and_contact_index_state::State,
S::Match: match_and_contact_index_state::IsUnset,
{
pub fn r#match(
mut self,
value: impl Into<ProfileView<'a>>,
) -> MatchAndContactIndexBuilder<'a, match_and_contact_index_state::SetMatch<S>> {
self._fields.1 = Option::Some(value.into());
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> MatchAndContactIndexBuilder<'a, S>
where
S: match_and_contact_index_state::State,
S::Match: match_and_contact_index_state::IsSet,
S::ContactIndex: match_and_contact_index_state::IsSet,
{
pub fn build(self) -> MatchAndContactIndex<'a> {
MatchAndContactIndex {
contact_index: self._fields.0.unwrap(),
r#match: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> MatchAndContactIndex<'a> {
MatchAndContactIndex {
contact_index: self._fields.0.unwrap(),
r#match: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_contact_defs() -> 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("app.bsky.contact.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("matchAndContactIndex"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Associates a profile with the positional index of the contact import input in the call to `app.bsky.contact.importContacts`, so clients can know which phone caused a particular match.",
),
),
required: Some(
vec![
SmolStr::new_static("match"),
SmolStr::new_static("contactIndex")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("contactIndex"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(999i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("match"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.actor.defs#profileView",
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notification"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A stash object to be sent via bsync representing a notification to be created.",
),
),
required: Some(
vec![SmolStr::new_static("from"), SmolStr::new_static("to")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("from"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The DID of who this notification comes from.",
),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("to"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The DID of who this notification should go to.",
),
),
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("syncStatus"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("syncedAt"),
SmolStr::new_static("matchesCount")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("matchesCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("syncedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Last date when contacts where imported.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod notification_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 From;
type To;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type From = Unset;
type To = Unset;
}
pub struct SetFrom<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFrom<S> {}
impl<S: State> State for SetFrom<S> {
type From = Set<members::from>;
type To = S::To;
}
pub struct SetTo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTo<S> {}
impl<S: State> State for SetTo<S> {
type From = S::From;
type To = Set<members::to>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct from(());
pub struct to(());
}
}
pub struct NotificationBuilder<'a, S: notification_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Did<'a>>, Option<Did<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Notification<'a> {
pub fn new() -> NotificationBuilder<'a, notification_state::Empty> {
NotificationBuilder::new()
}
}
impl<'a> NotificationBuilder<'a, notification_state::Empty> {
pub fn new() -> Self {
NotificationBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationBuilder<'a, S>
where
S: notification_state::State,
S::From: notification_state::IsUnset,
{
pub fn from(
mut self,
value: impl Into<Did<'a>>,
) -> NotificationBuilder<'a, notification_state::SetFrom<S>> {
self._fields.0 = Option::Some(value.into());
NotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationBuilder<'a, S>
where
S: notification_state::State,
S::To: notification_state::IsUnset,
{
pub fn to(
mut self,
value: impl Into<Did<'a>>,
) -> NotificationBuilder<'a, notification_state::SetTo<S>> {
self._fields.1 = Option::Some(value.into());
NotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotificationBuilder<'a, S>
where
S: notification_state::State,
S::From: notification_state::IsSet,
S::To: notification_state::IsSet,
{
pub fn build(self) -> Notification<'a> {
Notification {
from: self._fields.0.unwrap(),
to: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Notification<'a> {
Notification {
from: self._fields.0.unwrap(),
to: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod sync_status_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 MatchesCount;
type SyncedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type MatchesCount = Unset;
type SyncedAt = Unset;
}
pub struct SetMatchesCount<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMatchesCount<S> {}
impl<S: State> State for SetMatchesCount<S> {
type MatchesCount = Set<members::matches_count>;
type SyncedAt = S::SyncedAt;
}
pub struct SetSyncedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSyncedAt<S> {}
impl<S: State> State for SetSyncedAt<S> {
type MatchesCount = S::MatchesCount;
type SyncedAt = Set<members::synced_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct matches_count(());
pub struct synced_at(());
}
}
pub struct SyncStatusBuilder<'a, S: sync_status_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SyncStatus<'a> {
pub fn new() -> SyncStatusBuilder<'a, sync_status_state::Empty> {
SyncStatusBuilder::new()
}
}
impl<'a> SyncStatusBuilder<'a, sync_status_state::Empty> {
pub fn new() -> Self {
SyncStatusBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::MatchesCount: sync_status_state::IsUnset,
{
pub fn matches_count(
mut self,
value: impl Into<i64>,
) -> SyncStatusBuilder<'a, sync_status_state::SetMatchesCount<S>> {
self._fields.0 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::SyncedAt: sync_status_state::IsUnset,
{
pub fn synced_at(
mut self,
value: impl Into<Datetime>,
) -> SyncStatusBuilder<'a, sync_status_state::SetSyncedAt<S>> {
self._fields.1 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::MatchesCount: sync_status_state::IsSet,
S::SyncedAt: sync_status_state::IsSet,
{
pub fn build(self) -> SyncStatus<'a> {
SyncStatus {
matches_count: self._fields.0.unwrap(),
synced_at: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SyncStatus<'a> {
SyncStatus {
matches_count: self._fields.0.unwrap(),
synced_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}