pub mod clear_slice_records;
pub mod create_o_auth_client;
pub mod delete_o_auth_client;
pub mod get_actors;
pub mod get_jetstream_logs;
pub mod get_jetstream_status;
pub mod get_job_logs;
pub mod get_job_status;
pub mod get_o_auth_clients;
pub mod get_slice_records;
pub mod get_sparklines;
pub mod get_sync_summary;
pub mod start_sync;
pub mod stats;
pub mod sync_user_collections;
pub mod update_o_auth_client;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::network_slices::actor::ProfileViewBasic;
use crate::network_slices::slice;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
rename = "network.slices.slice",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Slice<S: BosStr = DefaultStr> {
pub created_at: Datetime,
pub domain: S,
pub name: 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")]
pub struct SliceGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Slice<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct SliceView<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
pub created_at: Datetime,
pub creator: ProfileViewBasic<S>,
pub domain: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_actor_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_collection_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_record_count: Option<i64>,
pub name: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub sparkline: Option<Vec<slice::SparklinePoint<S>>>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub waitlist_invite_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub waitlist_request_count: Option<i64>,
#[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 SparklinePoint<S: BosStr = DefaultStr> {
pub count: i64,
pub timestamp: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Slice<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, SliceRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct SliceRecord;
impl XrpcResp for SliceRecord {
const NSID: &'static str = "network.slices.slice";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = SliceGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<SliceGetRecordOutput<S>> for Slice<S> {
fn from(output: SliceGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Slice<S> {
const NSID: &'static str = "network.slices.slice";
type Record = SliceRecord;
}
impl Collection for SliceRecord {
const NSID: &'static str = "network.slices.slice";
type Record = SliceRecord;
}
impl<S: BosStr> LexiconSchema for Slice<S> {
fn nsid() -> &'static str {
"network.slices.slice"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_slice()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.domain;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("domain"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.name;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SliceView<S> {
fn nsid() -> &'static str {
"network.slices.slice.defs"
}
fn def_name() -> &'static str {
"sliceView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_slice_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SparklinePoint<S> {
fn nsid() -> &'static str {
"network.slices.slice.defs"
}
fn def_name() -> &'static str {
"sparklinePoint"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_network_slices_slice_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.count;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("count"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
pub mod slice_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Domain;
type CreatedAt;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Domain = Unset;
type CreatedAt = Unset;
type Name = Unset;
}
pub struct SetDomain<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDomain<St> {}
impl<St: State> State for SetDomain<St> {
type Domain = Set<members::domain>;
type CreatedAt = St::CreatedAt;
type Name = St::Name;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Domain = St::Domain;
type CreatedAt = Set<members::created_at>;
type Name = St::Name;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Domain = St::Domain;
type CreatedAt = St::CreatedAt;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct domain(());
pub struct created_at(());
pub struct name(());
}
}
pub struct SliceBuilder<S: BosStr, St: slice_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>, Option<S>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Slice<S> {
pub fn new() -> SliceBuilder<S, slice_state::Empty> {
SliceBuilder::new()
}
}
impl<S: BosStr> SliceBuilder<S, slice_state::Empty> {
pub fn new() -> Self {
SliceBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceBuilder<S, St>
where
St: slice_state::State,
St::CreatedAt: slice_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> SliceBuilder<S, slice_state::SetCreatedAt<St>> {
self._fields.0 = Option::Some(value.into());
SliceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceBuilder<S, St>
where
St: slice_state::State,
St::Domain: slice_state::IsUnset,
{
pub fn domain(mut self, value: impl Into<S>) -> SliceBuilder<S, slice_state::SetDomain<St>> {
self._fields.1 = Option::Some(value.into());
SliceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceBuilder<S, St>
where
St: slice_state::State,
St::Name: slice_state::IsUnset,
{
pub fn name(mut self, value: impl Into<S>) -> SliceBuilder<S, slice_state::SetName<St>> {
self._fields.2 = Option::Some(value.into());
SliceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceBuilder<S, St>
where
St: slice_state::State,
St::Domain: slice_state::IsSet,
St::CreatedAt: slice_state::IsSet,
St::Name: slice_state::IsSet,
{
pub fn build(self) -> Slice<S> {
Slice {
created_at: self._fields.0.unwrap(),
domain: self._fields.1.unwrap(),
name: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Slice<S> {
Slice {
created_at: self._fields.0.unwrap(),
domain: self._fields.1.unwrap(),
name: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_network_slices_slice() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("network.slices.slice"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("name"), SmolStr::new_static("domain"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the slice was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("domain"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Primary domain namespace for this slice (e.g. social.grain)",
),
),
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Name of the slice")),
max_length: Some(256usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod slice_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Name;
type Uri;
type Domain;
type Cid;
type Creator;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type Uri = Unset;
type Domain = Unset;
type Cid = Unset;
type Creator = Unset;
type CreatedAt = Unset;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type Name = Set<members::name>;
type Uri = St::Uri;
type Domain = St::Domain;
type Cid = St::Cid;
type Creator = St::Creator;
type CreatedAt = St::CreatedAt;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Name = St::Name;
type Uri = Set<members::uri>;
type Domain = St::Domain;
type Cid = St::Cid;
type Creator = St::Creator;
type CreatedAt = St::CreatedAt;
}
pub struct SetDomain<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDomain<St> {}
impl<St: State> State for SetDomain<St> {
type Name = St::Name;
type Uri = St::Uri;
type Domain = Set<members::domain>;
type Cid = St::Cid;
type Creator = St::Creator;
type CreatedAt = St::CreatedAt;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Name = St::Name;
type Uri = St::Uri;
type Domain = St::Domain;
type Cid = Set<members::cid>;
type Creator = St::Creator;
type CreatedAt = St::CreatedAt;
}
pub struct SetCreator<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreator<St> {}
impl<St: State> State for SetCreator<St> {
type Name = St::Name;
type Uri = St::Uri;
type Domain = St::Domain;
type Cid = St::Cid;
type Creator = Set<members::creator>;
type CreatedAt = St::CreatedAt;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Name = St::Name;
type Uri = St::Uri;
type Domain = St::Domain;
type Cid = St::Cid;
type Creator = St::Creator;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct uri(());
pub struct domain(());
pub struct cid(());
pub struct creator(());
pub struct created_at(());
}
}
pub struct SliceViewBuilder<S: BosStr, St: slice_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Cid<S>>,
Option<Datetime>,
Option<ProfileViewBasic<S>>,
Option<S>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<S>,
Option<Vec<slice::SparklinePoint<S>>>,
Option<AtUri<S>>,
Option<i64>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SliceView<S> {
pub fn new() -> SliceViewBuilder<S, slice_view_state::Empty> {
SliceViewBuilder::new()
}
}
impl<S: BosStr> SliceViewBuilder<S, slice_view_state::Empty> {
pub fn new() -> Self {
SliceViewBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Cid: slice_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> SliceViewBuilder<S, slice_view_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::CreatedAt: slice_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> SliceViewBuilder<S, slice_view_state::SetCreatedAt<St>> {
self._fields.1 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Creator: slice_view_state::IsUnset,
{
pub fn creator(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> SliceViewBuilder<S, slice_view_state::SetCreator<St>> {
self._fields.2 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Domain: slice_view_state::IsUnset,
{
pub fn domain(
mut self,
value: impl Into<S>,
) -> SliceViewBuilder<S, slice_view_state::SetDomain<St>> {
self._fields.3 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn indexed_actor_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_indexed_actor_count(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn indexed_collection_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_indexed_collection_count(mut self, value: Option<i64>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn indexed_record_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_indexed_record_count(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Name: slice_view_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<S>,
) -> SliceViewBuilder<S, slice_view_state::SetName<St>> {
self._fields.7 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn sparkline(mut self, value: impl Into<Option<Vec<slice::SparklinePoint<S>>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_sparkline(mut self, value: Option<Vec<slice::SparklinePoint<S>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Uri: slice_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> SliceViewBuilder<S, slice_view_state::SetUri<St>> {
self._fields.9 = Option::Some(value.into());
SliceViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn waitlist_invite_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_waitlist_invite_count(mut self, value: Option<i64>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St: slice_view_state::State> SliceViewBuilder<S, St> {
pub fn waitlist_request_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_waitlist_request_count(mut self, value: Option<i64>) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St> SliceViewBuilder<S, St>
where
St: slice_view_state::State,
St::Name: slice_view_state::IsSet,
St::Uri: slice_view_state::IsSet,
St::Domain: slice_view_state::IsSet,
St::Cid: slice_view_state::IsSet,
St::Creator: slice_view_state::IsSet,
St::CreatedAt: slice_view_state::IsSet,
{
pub fn build(self) -> SliceView<S> {
SliceView {
cid: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
creator: self._fields.2.unwrap(),
domain: self._fields.3.unwrap(),
indexed_actor_count: self._fields.4,
indexed_collection_count: self._fields.5,
indexed_record_count: self._fields.6,
name: self._fields.7.unwrap(),
sparkline: self._fields.8,
uri: self._fields.9.unwrap(),
waitlist_invite_count: self._fields.10,
waitlist_request_count: self._fields.11,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SliceView<S> {
SliceView {
cid: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
creator: self._fields.2.unwrap(),
domain: self._fields.3.unwrap(),
indexed_actor_count: self._fields.4,
indexed_collection_count: self._fields.5,
indexed_record_count: self._fields.6,
name: self._fields.7.unwrap(),
sparkline: self._fields.8,
uri: self._fields.9.unwrap(),
waitlist_invite_count: self._fields.10,
waitlist_request_count: self._fields.11,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_network_slices_slice_defs() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("network.slices.slice.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("sliceView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("name"),
SmolStr::new_static("domain"),
SmolStr::new_static("creator"),
SmolStr::new_static("createdAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("creator"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"network.slices.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("domain"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Primary domain namespace for this slice (e.g. social.grain)",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedActorCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedCollectionCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedRecordCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Display name of the slice")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sparkline"),
LexObjectProperty::Array(LexArray {
description: Some(CowStr::new_static(
"Recent activity sparkline data points for the last 24 hours",
)),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#sparklinePoint"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("waitlistInviteCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("waitlistRequestCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sparklinePoint"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("timestamp"),
SmolStr::new_static("count"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("count"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("timestamp"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod sparkline_point_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Timestamp;
type Count;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Timestamp = Unset;
type Count = Unset;
}
pub struct SetTimestamp<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTimestamp<St> {}
impl<St: State> State for SetTimestamp<St> {
type Timestamp = Set<members::timestamp>;
type Count = St::Count;
}
pub struct SetCount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCount<St> {}
impl<St: State> State for SetCount<St> {
type Timestamp = St::Timestamp;
type Count = Set<members::count>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct timestamp(());
pub struct count(());
}
}
pub struct SparklinePointBuilder<S: BosStr, St: sparkline_point_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SparklinePoint<S> {
pub fn new() -> SparklinePointBuilder<S, sparkline_point_state::Empty> {
SparklinePointBuilder::new()
}
}
impl<S: BosStr> SparklinePointBuilder<S, sparkline_point_state::Empty> {
pub fn new() -> Self {
SparklinePointBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SparklinePointBuilder<S, St>
where
St: sparkline_point_state::State,
St::Count: sparkline_point_state::IsUnset,
{
pub fn count(
mut self,
value: impl Into<i64>,
) -> SparklinePointBuilder<S, sparkline_point_state::SetCount<St>> {
self._fields.0 = Option::Some(value.into());
SparklinePointBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SparklinePointBuilder<S, St>
where
St: sparkline_point_state::State,
St::Timestamp: sparkline_point_state::IsUnset,
{
pub fn timestamp(
mut self,
value: impl Into<Datetime>,
) -> SparklinePointBuilder<S, sparkline_point_state::SetTimestamp<St>> {
self._fields.1 = Option::Some(value.into());
SparklinePointBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SparklinePointBuilder<S, St>
where
St: sparkline_point_state::State,
St::Timestamp: sparkline_point_state::IsSet,
St::Count: sparkline_point_state::IsSet,
{
pub fn build(self) -> SparklinePoint<S> {
SparklinePoint {
count: self._fields.0.unwrap(),
timestamp: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SparklinePoint<S> {
SparklinePoint {
count: self._fields.0.unwrap(),
timestamp: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}