pub mod get_preferences;
pub mod get_profile;
pub mod profile;
pub mod put_preferences;
pub mod search_clips;
pub mod search_profiles;
pub mod search_tags;
#[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 PreferencesItem<'a> {
#[serde(rename = "social.clippr.actor.defs#publishingScopesPref")]
PublishingScopesPref(Box<crate::social_clippr::actor::PublishingScopesPref<'a>>),
}
pub type Preferences<'a> = Vec<PreferencesItem<'a>>;
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ProfileView<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub avatar: std::option::Option<jacquard_common::types::string::UriValue<'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 description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub display_name: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub handle: jacquard_common::types::string::Handle<'a>,
}
pub mod profile_view_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 Handle;
type DisplayName;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Handle = Unset;
type DisplayName = Unset;
type Did = Unset;
}
pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHandle<S> {}
impl<S: State> State for SetHandle<S> {
type Handle = Set<members::handle>;
type DisplayName = S::DisplayName;
type Did = S::Did;
}
pub struct SetDisplayName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDisplayName<S> {}
impl<S: State> State for SetDisplayName<S> {
type Handle = S::Handle;
type DisplayName = Set<members::display_name>;
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 Handle = S::Handle;
type DisplayName = S::DisplayName;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct handle(());
pub struct display_name(());
pub struct did(());
}
}
pub struct ProfileViewBuilder<'a, S: profile_view_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Handle<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ProfileView<'a> {
pub fn new() -> ProfileViewBuilder<'a, profile_view_state::Empty> {
ProfileViewBuilder::new()
}
}
impl<'a> ProfileViewBuilder<'a, profile_view_state::Empty> {
pub fn new() -> Self {
ProfileViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
pub fn avatar(
mut self,
value: impl Into<Option<jacquard_common::types::string::UriValue<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_avatar(
mut self,
value: Option<jacquard_common::types::string::UriValue<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: profile_view_state::State> ProfileViewBuilder<'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_view_state::State> ProfileViewBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> ProfileViewBuilder<'a, S>
where
S: profile_view_state::State,
S::Did: profile_view_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> ProfileViewBuilder<'a, profile_view_state::SetDid<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
ProfileViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileViewBuilder<'a, S>
where
S: profile_view_state::State,
S::DisplayName: profile_view_state::IsUnset,
{
pub fn display_name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> ProfileViewBuilder<'a, profile_view_state::SetDisplayName<S>> {
self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
ProfileViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileViewBuilder<'a, S>
where
S: profile_view_state::State,
S::Handle: profile_view_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<jacquard_common::types::string::Handle<'a>>,
) -> ProfileViewBuilder<'a, profile_view_state::SetHandle<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
ProfileViewBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ProfileViewBuilder<'a, S>
where
S: profile_view_state::State,
S::Handle: profile_view_state::IsSet,
S::DisplayName: profile_view_state::IsSet,
S::Did: profile_view_state::IsSet,
{
pub fn build(self) -> ProfileView<'a> {
ProfileView {
avatar: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1,
description: self.__unsafe_private_named.2,
did: self.__unsafe_private_named.3.unwrap(),
display_name: self.__unsafe_private_named.4.unwrap(),
handle: self.__unsafe_private_named.5.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>,
>,
) -> ProfileView<'a> {
ProfileView {
avatar: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1,
description: self.__unsafe_private_named.2,
did: self.__unsafe_private_named.3.unwrap(),
display_name: self.__unsafe_private_named.4.unwrap(),
handle: self.__unsafe_private_named.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_social_clippr_actor_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("social.clippr.actor.defs"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("preferences"),
::jacquard_lexicon::lexicon::LexUserType::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: None,
refs: vec![
::jacquard_common::CowStr::new_static("#publishingScopesPref")
],
closed: None,
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("profileView"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"A view of an actor's profile.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("handle"),
::jacquard_common::deps::smol_str::SmolStr::new_static("displayName")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"avatar",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"A link to the profile's avatar",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
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(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"When the profile record was 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(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The biography associated to the profile",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(5000usize),
min_graphemes: None,
max_graphemes: Some(500usize),
r#enum: None,
r#const: None,
known_values: 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 DID of the profile",
),
),
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(
"displayName",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The display name associated to the profile",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(640usize),
min_graphemes: None,
max_graphemes: Some(64usize),
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 handle of the profile",
),
),
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
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"publishingScopesPref",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Preferences for an user's publishing scopes.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("defaultScope")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"defaultScope",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"What publishing scope to mark a clip as by default",
),
),
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
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ProfileView<'a> {
fn nsid() -> &'static str {
"social.clippr.actor.defs"
}
fn def_name() -> &'static str {
"profileView"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_social_clippr_actor_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 5000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"description",
),
max: 5000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.description {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 500usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"description",
),
max: 500usize,
actual: count,
});
}
}
}
{
let value = &self.display_name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 640usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"display_name",
),
max: 640usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.display_name;
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"display_name",
),
max: 64usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct PublishingScopesPref<'a> {
#[serde(borrow)]
pub default_scope: PublishingScopesPrefDefaultScope<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PublishingScopesPrefDefaultScope<'a> {
Public,
Unlisted,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> PublishingScopesPrefDefaultScope<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Public => "public",
Self::Unlisted => "unlisted",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for PublishingScopesPrefDefaultScope<'a> {
fn from(s: &'a str) -> Self {
match s {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for PublishingScopesPrefDefaultScope<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"public" => Self::Public,
"unlisted" => Self::Unlisted,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for PublishingScopesPrefDefaultScope<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for PublishingScopesPrefDefaultScope<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for PublishingScopesPrefDefaultScope<'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 PublishingScopesPrefDefaultScope<'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 PublishingScopesPrefDefaultScope<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for PublishingScopesPrefDefaultScope<'_> {
type Output = PublishingScopesPrefDefaultScope<'static>;
fn into_static(self) -> Self::Output {
match self {
PublishingScopesPrefDefaultScope::Public => {
PublishingScopesPrefDefaultScope::Public
}
PublishingScopesPrefDefaultScope::Unlisted => {
PublishingScopesPrefDefaultScope::Unlisted
}
PublishingScopesPrefDefaultScope::Other(v) => {
PublishingScopesPrefDefaultScope::Other(v.into_static())
}
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PublishingScopesPref<'a> {
fn nsid() -> &'static str {
"social.clippr.actor.defs"
}
fn def_name() -> &'static str {
"publishingScopesPref"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_social_clippr_actor_defs()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}