#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Profile<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub allow_tags: std::option::Option<ProfileAllowTags<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub created_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub default_delayed_reveal: std::option::Option<ProfileDefaultDelayedReveal<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub default_visibility: std::option::Option<ProfileDefaultVisibility<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub distance_unit: std::option::Option<ProfileDistanceUnit<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_profile_hide_past_beacons")]
pub hide_past_beacons: std::option::Option<bool>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub language: std::option::Option<ProfileLanguage<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub marker_color: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_profile_post_beacon_links")]
pub post_beacon_links: std::option::Option<bool>,
pub updated_at: jacquard_common::types::string::Datetime,
}
fn _default_profile_hide_past_beacons() -> std::option::Option<bool> {
Some(false)
}
fn _default_profile_post_beacon_links() -> std::option::Option<bool> {
Some(true)
}
pub mod profile_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 UpdatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type UpdatedAt = Unset;
}
pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
impl<S: State> State for SetUpdatedAt<S> {
type UpdatedAt = Set<members::updated_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct updated_at(());
}
}
pub struct ProfileBuilder<'a, S: profile_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<ProfileAllowTags<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<ProfileDefaultDelayedReveal<'a>>,
::core::option::Option<ProfileDefaultVisibility<'a>>,
::core::option::Option<ProfileDistanceUnit<'a>>,
::core::option::Option<bool>,
::core::option::Option<ProfileLanguage<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<bool>,
::core::option::Option<jacquard_common::types::string::Datetime>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Profile<'a> {
pub fn new() -> ProfileBuilder<'a, profile_state::Empty> {
ProfileBuilder::new()
}
}
impl<'a> ProfileBuilder<'a, profile_state::Empty> {
pub fn new() -> Self {
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn allow_tags(mut self, value: impl Into<Option<ProfileAllowTags<'a>>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_allow_tags(mut self, value: Option<ProfileAllowTags<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn created_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_created_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn default_delayed_reveal(
mut self,
value: impl Into<Option<ProfileDefaultDelayedReveal<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_default_delayed_reveal(
mut self,
value: Option<ProfileDefaultDelayedReveal<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn default_visibility(
mut self,
value: impl Into<Option<ProfileDefaultVisibility<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_default_visibility(
mut self,
value: Option<ProfileDefaultVisibility<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn distance_unit(
mut self,
value: impl Into<Option<ProfileDistanceUnit<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_distance_unit(
mut self,
value: Option<ProfileDistanceUnit<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn hide_past_beacons(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_hide_past_beacons(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn language(mut self, value: impl Into<Option<ProfileLanguage<'a>>>) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_language(mut self, value: Option<ProfileLanguage<'a>>) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn marker_color(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_marker_color(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
pub fn post_beacon_links(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.8 = value.into();
self
}
pub fn maybe_post_beacon_links(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.8 = value;
self
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::UpdatedAt: profile_state::IsUnset,
{
pub fn updated_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> ProfileBuilder<'a, profile_state::SetUpdatedAt<S>> {
self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into());
ProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileBuilder<'a, S>
where
S: profile_state::State,
S::UpdatedAt: profile_state::IsSet,
{
pub fn build(self) -> Profile<'a> {
Profile {
allow_tags: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1,
default_delayed_reveal: self.__unsafe_private_named.2,
default_visibility: self.__unsafe_private_named.3,
distance_unit: self.__unsafe_private_named.4,
hide_past_beacons: self.__unsafe_private_named.5.or_else(|| Some(false)),
language: self.__unsafe_private_named.6,
marker_color: self.__unsafe_private_named.7,
post_beacon_links: self.__unsafe_private_named.8.or_else(|| Some(true)),
updated_at: self.__unsafe_private_named.9.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>,
>,
) -> Profile<'a> {
Profile {
allow_tags: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1,
default_delayed_reveal: self.__unsafe_private_named.2,
default_visibility: self.__unsafe_private_named.3,
distance_unit: self.__unsafe_private_named.4,
hide_past_beacons: self.__unsafe_private_named.5.or_else(|| Some(false)),
language: self.__unsafe_private_named.6,
marker_color: self.__unsafe_private_named.7,
post_beacon_links: self.__unsafe_private_named.8.or_else(|| Some(true)),
updated_at: self.__unsafe_private_named.9.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Profile<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, ProfileRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProfileAllowTags<'a> {
All,
Followers,
Mutuals,
None,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ProfileAllowTags<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::All => "all",
Self::Followers => "followers",
Self::Mutuals => "mutuals",
Self::None => "none",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ProfileAllowTags<'a> {
fn from(s: &'a str) -> Self {
match s {
"all" => Self::All,
"followers" => Self::Followers,
"mutuals" => Self::Mutuals,
"none" => Self::None,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ProfileAllowTags<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"all" => Self::All,
"followers" => Self::Followers,
"mutuals" => Self::Mutuals,
"none" => Self::None,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ProfileAllowTags<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ProfileAllowTags<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ProfileAllowTags<'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 ProfileAllowTags<'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 ProfileAllowTags<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ProfileAllowTags<'_> {
type Output = ProfileAllowTags<'static>;
fn into_static(self) -> Self::Output {
match self {
ProfileAllowTags::All => ProfileAllowTags::All,
ProfileAllowTags::Followers => ProfileAllowTags::Followers,
ProfileAllowTags::Mutuals => ProfileAllowTags::Mutuals,
ProfileAllowTags::None => ProfileAllowTags::None,
ProfileAllowTags::Other(v) => ProfileAllowTags::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProfileDefaultDelayedReveal<'a> {
None,
_1h,
_1d,
Custom,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ProfileDefaultDelayedReveal<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::None => "none",
Self::_1h => "1h",
Self::_1d => "1d",
Self::Custom => "custom",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ProfileDefaultDelayedReveal<'a> {
fn from(s: &'a str) -> Self {
match s {
"none" => Self::None,
"1h" => Self::_1h,
"1d" => Self::_1d,
"custom" => Self::Custom,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ProfileDefaultDelayedReveal<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"none" => Self::None,
"1h" => Self::_1h,
"1d" => Self::_1d,
"custom" => Self::Custom,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ProfileDefaultDelayedReveal<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ProfileDefaultDelayedReveal<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ProfileDefaultDelayedReveal<'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 ProfileDefaultDelayedReveal<'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 ProfileDefaultDelayedReveal<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ProfileDefaultDelayedReveal<'_> {
type Output = ProfileDefaultDelayedReveal<'static>;
fn into_static(self) -> Self::Output {
match self {
ProfileDefaultDelayedReveal::None => ProfileDefaultDelayedReveal::None,
ProfileDefaultDelayedReveal::_1h => ProfileDefaultDelayedReveal::_1h,
ProfileDefaultDelayedReveal::_1d => ProfileDefaultDelayedReveal::_1d,
ProfileDefaultDelayedReveal::Custom => ProfileDefaultDelayedReveal::Custom,
ProfileDefaultDelayedReveal::Other(v) => {
ProfileDefaultDelayedReveal::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProfileDefaultVisibility<'a> {
Public,
Followers,
Mutuals,
Hidden,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ProfileDefaultVisibility<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Followers => "followers",
Self::Mutuals => "mutuals",
Self::Hidden => "hidden",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ProfileDefaultVisibility<'a> {
fn from(s: &'a str) -> Self {
match s {
"public" => Self::Public,
"followers" => Self::Followers,
"mutuals" => Self::Mutuals,
"hidden" => Self::Hidden,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ProfileDefaultVisibility<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"public" => Self::Public,
"followers" => Self::Followers,
"mutuals" => Self::Mutuals,
"hidden" => Self::Hidden,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ProfileDefaultVisibility<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ProfileDefaultVisibility<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ProfileDefaultVisibility<'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 ProfileDefaultVisibility<'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 ProfileDefaultVisibility<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ProfileDefaultVisibility<'_> {
type Output = ProfileDefaultVisibility<'static>;
fn into_static(self) -> Self::Output {
match self {
ProfileDefaultVisibility::Public => ProfileDefaultVisibility::Public,
ProfileDefaultVisibility::Followers => ProfileDefaultVisibility::Followers,
ProfileDefaultVisibility::Mutuals => ProfileDefaultVisibility::Mutuals,
ProfileDefaultVisibility::Hidden => ProfileDefaultVisibility::Hidden,
ProfileDefaultVisibility::Other(v) => {
ProfileDefaultVisibility::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProfileDistanceUnit<'a> {
Km,
Miles,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ProfileDistanceUnit<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Km => "km",
Self::Miles => "miles",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ProfileDistanceUnit<'a> {
fn from(s: &'a str) -> Self {
match s {
"km" => Self::Km,
"miles" => Self::Miles,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ProfileDistanceUnit<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"km" => Self::Km,
"miles" => Self::Miles,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ProfileDistanceUnit<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ProfileDistanceUnit<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ProfileDistanceUnit<'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 ProfileDistanceUnit<'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 ProfileDistanceUnit<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ProfileDistanceUnit<'_> {
type Output = ProfileDistanceUnit<'static>;
fn into_static(self) -> Self::Output {
match self {
ProfileDistanceUnit::Km => ProfileDistanceUnit::Km,
ProfileDistanceUnit::Miles => ProfileDistanceUnit::Miles,
ProfileDistanceUnit::Other(v) => ProfileDistanceUnit::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProfileLanguage<'a> {
Auto,
En,
Es,
Fr,
De,
PtBr,
Ja,
ZhHans,
Ko,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> ProfileLanguage<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Auto => "auto",
Self::En => "en",
Self::Es => "es",
Self::Fr => "fr",
Self::De => "de",
Self::PtBr => "pt-BR",
Self::Ja => "ja",
Self::ZhHans => "zh-Hans",
Self::Ko => "ko",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for ProfileLanguage<'a> {
fn from(s: &'a str) -> Self {
match s {
"auto" => Self::Auto,
"en" => Self::En,
"es" => Self::Es,
"fr" => Self::Fr,
"de" => Self::De,
"pt-BR" => Self::PtBr,
"ja" => Self::Ja,
"zh-Hans" => Self::ZhHans,
"ko" => Self::Ko,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for ProfileLanguage<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"auto" => Self::Auto,
"en" => Self::En,
"es" => Self::Es,
"fr" => Self::Fr,
"de" => Self::De,
"pt-BR" => Self::PtBr,
"ja" => Self::Ja,
"zh-Hans" => Self::ZhHans,
"ko" => Self::Ko,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for ProfileLanguage<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for ProfileLanguage<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for ProfileLanguage<'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 ProfileLanguage<'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 ProfileLanguage<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for ProfileLanguage<'_> {
type Output = ProfileLanguage<'static>;
fn into_static(self) -> Self::Output {
match self {
ProfileLanguage::Auto => ProfileLanguage::Auto,
ProfileLanguage::En => ProfileLanguage::En,
ProfileLanguage::Es => ProfileLanguage::Es,
ProfileLanguage::Fr => ProfileLanguage::Fr,
ProfileLanguage::De => ProfileLanguage::De,
ProfileLanguage::PtBr => ProfileLanguage::PtBr,
ProfileLanguage::Ja => ProfileLanguage::Ja,
ProfileLanguage::ZhHans => ProfileLanguage::ZhHans,
ProfileLanguage::Ko => ProfileLanguage::Ko,
ProfileLanguage::Other(v) => ProfileLanguage::Other(v.into_static()),
}
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ProfileGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Profile<'a>,
}
impl From<ProfileGetRecordOutput<'_>> for Profile<'_> {
fn from(output: ProfileGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Profile<'_> {
const NSID: &'static str = "app.beaconbits.profile";
type Record = ProfileRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct ProfileRecord;
impl jacquard_common::xrpc::XrpcResp for ProfileRecord {
const NSID: &'static str = "app.beaconbits.profile";
const ENCODING: &'static str = "application/json";
type Output<'de> = ProfileGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for ProfileRecord {
const NSID: &'static str = "app.beaconbits.profile";
type Record = ProfileRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Profile<'a> {
fn nsid() -> &'static str {
"app.beaconbits.profile"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_beaconbits_profile()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.allow_tags {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 32usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"allow_tags",
),
max: 32usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.default_delayed_reveal {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 16usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"default_delayed_reveal",
),
max: 16usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.default_visibility {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 32usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"default_visibility",
),
max: 32usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.distance_unit {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 16usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"distance_unit",
),
max: 16usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.language {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 16usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"language",
),
max: 16usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.marker_color {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 7usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"marker_color",
),
max: 7usize,
actual: count,
});
}
}
}
Ok(())
}
}
fn lexicon_doc_app_beaconbits_profile() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("app.beaconbits.profile"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static(
"User preferences and settings for BeaconBits",
),
),
key: Some(::jacquard_common::CowStr::new_static("literal:self")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("updatedAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"allowTags",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Who can tag this user in beacons",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(32usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Timestamp when settings were first created",
),
),
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(
"defaultDelayedReveal",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Default delayed reveal setting for new beacons",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(16usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"defaultVisibility",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Default visibility for new beacons",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(32usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"distanceUnit",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Preferred distance unit",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(16usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"hidePastBeacons",
),
::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(
"language",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Preferred language setting",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(16usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"markerColor",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Hex color code for map marker (e.g., #e24630)",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: Some(7usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"postBeaconLinks",
),
::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(
"updatedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Timestamp when settings were last updated",
),
),
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
},
}
}