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;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Did, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct MatchAndContactIndex<S: BosStr = DefaultStr> {
pub contact_index: i64,
pub r#match: ProfileView<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Notification<S: BosStr = DefaultStr> {
pub from: Did<S>,
pub to: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SyncStatus<S: BosStr = DefaultStr> {
pub matches_count: i64,
pub synced_at: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for MatchAndContactIndex<S> {
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<S: BosStr> LexiconSchema for Notification<S> {
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<S: BosStr> LexiconSchema for SyncStatus<S> {
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 ContactIndex;
type Match;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ContactIndex = Unset;
type Match = Unset;
}
pub struct SetContactIndex<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetContactIndex<St> {}
impl<St: State> State for SetContactIndex<St> {
type ContactIndex = Set<members::contact_index>;
type Match = St::Match;
}
pub struct SetMatch<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMatch<St> {}
impl<St: State> State for SetMatch<St> {
type ContactIndex = St::ContactIndex;
type Match = Set<members::r#match>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct contact_index(());
pub struct r#match(());
}
}
pub struct MatchAndContactIndexBuilder<
S: BosStr,
St: match_and_contact_index_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<ProfileView<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> MatchAndContactIndex<S> {
pub fn new() -> MatchAndContactIndexBuilder<
S,
match_and_contact_index_state::Empty,
> {
MatchAndContactIndexBuilder::new()
}
}
impl<S: BosStr> MatchAndContactIndexBuilder<S, match_and_contact_index_state::Empty> {
pub fn new() -> Self {
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MatchAndContactIndexBuilder<S, St>
where
St: match_and_contact_index_state::State,
St::ContactIndex: match_and_contact_index_state::IsUnset,
{
pub fn contact_index(
mut self,
value: impl Into<i64>,
) -> MatchAndContactIndexBuilder<
S,
match_and_contact_index_state::SetContactIndex<St>,
> {
self._fields.0 = Option::Some(value.into());
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MatchAndContactIndexBuilder<S, St>
where
St: match_and_contact_index_state::State,
St::Match: match_and_contact_index_state::IsUnset,
{
pub fn r#match(
mut self,
value: impl Into<ProfileView<S>>,
) -> MatchAndContactIndexBuilder<S, match_and_contact_index_state::SetMatch<St>> {
self._fields.1 = Option::Some(value.into());
MatchAndContactIndexBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MatchAndContactIndexBuilder<S, St>
where
St: match_and_contact_index_state::State,
St::ContactIndex: match_and_contact_index_state::IsSet,
St::Match: match_and_contact_index_state::IsSet,
{
pub fn build(self) -> MatchAndContactIndex<S> {
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<SmolStr, Data<S>>,
) -> MatchAndContactIndex<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFrom<St> {}
impl<St: State> State for SetFrom<St> {
type From = Set<members::from>;
type To = St::To;
}
pub struct SetTo<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTo<St> {}
impl<St: State> State for SetTo<St> {
type From = St::From;
type To = Set<members::to>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct from(());
pub struct to(());
}
}
pub struct NotificationBuilder<S: BosStr, St: notification_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>, Option<Did<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Notification<S> {
pub fn new() -> NotificationBuilder<S, notification_state::Empty> {
NotificationBuilder::new()
}
}
impl<S: BosStr> NotificationBuilder<S, notification_state::Empty> {
pub fn new() -> Self {
NotificationBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationBuilder<S, St>
where
St: notification_state::State,
St::From: notification_state::IsUnset,
{
pub fn from(
mut self,
value: impl Into<Did<S>>,
) -> NotificationBuilder<S, notification_state::SetFrom<St>> {
self._fields.0 = Option::Some(value.into());
NotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationBuilder<S, St>
where
St: notification_state::State,
St::To: notification_state::IsUnset,
{
pub fn to(
mut self,
value: impl Into<Did<S>>,
) -> NotificationBuilder<S, notification_state::SetTo<St>> {
self._fields.1 = Option::Some(value.into());
NotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotificationBuilder<S, St>
where
St: notification_state::State,
St::From: notification_state::IsSet,
St::To: notification_state::IsSet,
{
pub fn build(self) -> Notification<S> {
Notification {
from: self._fields.0.unwrap(),
to: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Notification<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMatchesCount<St> {}
impl<St: State> State for SetMatchesCount<St> {
type MatchesCount = Set<members::matches_count>;
type SyncedAt = St::SyncedAt;
}
pub struct SetSyncedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSyncedAt<St> {}
impl<St: State> State for SetSyncedAt<St> {
type MatchesCount = St::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<S: BosStr, St: sync_status_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SyncStatus<S> {
pub fn new() -> SyncStatusBuilder<S, sync_status_state::Empty> {
SyncStatusBuilder::new()
}
}
impl<S: BosStr> SyncStatusBuilder<S, sync_status_state::Empty> {
pub fn new() -> Self {
SyncStatusBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncStatusBuilder<S, St>
where
St: sync_status_state::State,
St::MatchesCount: sync_status_state::IsUnset,
{
pub fn matches_count(
mut self,
value: impl Into<i64>,
) -> SyncStatusBuilder<S, sync_status_state::SetMatchesCount<St>> {
self._fields.0 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncStatusBuilder<S, St>
where
St: sync_status_state::State,
St::SyncedAt: sync_status_state::IsUnset,
{
pub fn synced_at(
mut self,
value: impl Into<Datetime>,
) -> SyncStatusBuilder<S, sync_status_state::SetSyncedAt<St>> {
self._fields.1 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SyncStatusBuilder<S, St>
where
St: sync_status_state::State,
St::MatchesCount: sync_status_state::IsSet,
St::SyncedAt: sync_status_state::IsSet,
{
pub fn build(self) -> SyncStatus<S> {
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<SmolStr, Data<S>>,
) -> SyncStatus<S> {
SyncStatus {
matches_count: self._fields.0.unwrap(),
synced_at: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}