pub mod accept;
pub mod get_collaboration_state;
pub mod get_invites;
pub mod get_resource_participants;
pub mod get_resource_sessions;
pub mod invite;
pub mod session;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, 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::{AtUri, Cid, Datetime, UriValue};
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::com_atproto::repo::strong_ref::StrongRef;
use crate::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::notebook::PublishedVersionView;
use crate::sh_weaver::collab;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Chapter;
impl core::fmt::Display for Chapter {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "chapter")
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CollaborationStateView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub canonical_uri: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_collaborator_added_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub former_participants: Option<Vec<collab::FormerCollaboratorView<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_divergence: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_former_collaborators: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_orphaned_versions: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_synced_at: Option<Datetime>,
pub participants: Vec<collab::ParticipantStateView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub published_versions: Option<Vec<PublishedVersionView<S>>>,
pub resource: StrongRef<S>,
pub status: CollaborationStateViewStatus<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CollaborationStateViewStatus<S: BosStr = DefaultStr> {
Active,
Broken,
Diverged,
Reconciled,
Other(S),
}
impl<S: BosStr> CollaborationStateViewStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Active => "active",
Self::Broken => "broken",
Self::Diverged => "diverged",
Self::Reconciled => "reconciled",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"active" => Self::Active,
"broken" => Self::Broken,
"diverged" => Self::Diverged,
"reconciled" => Self::Reconciled,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for CollaborationStateViewStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for CollaborationStateViewStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for CollaborationStateViewStatus<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for CollaborationStateViewStatus<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for CollaborationStateViewStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for CollaborationStateViewStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = CollaborationStateViewStatus<S::Output>;
fn into_static(self) -> Self::Output {
match self {
CollaborationStateViewStatus::Active => CollaborationStateViewStatus::Active,
CollaborationStateViewStatus::Broken => CollaborationStateViewStatus::Broken,
CollaborationStateViewStatus::Diverged => {
CollaborationStateViewStatus::Diverged
}
CollaborationStateViewStatus::Reconciled => {
CollaborationStateViewStatus::Reconciled
}
CollaborationStateViewStatus::Other(v) => {
CollaborationStateViewStatus::Other(v.into_static())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Entry;
impl core::fmt::Display for Entry {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "entry")
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct FormerCollaboratorView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub contribution_count: Option<i64>,
pub end_reason: FormerCollaboratorViewEndReason<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_published_version: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub published_version_uri: Option<AtUri<S>>,
pub user: ProfileViewBasic<S>,
pub was_active_from: Datetime,
pub was_active_until: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FormerCollaboratorViewEndReason<S: BosStr = DefaultStr> {
VoluntaryLeave,
InviteRevoked,
InviteExpired,
OwnerDeletedResource,
Other(S),
}
impl<S: BosStr> FormerCollaboratorViewEndReason<S> {
pub fn as_str(&self) -> &str {
match self {
Self::VoluntaryLeave => "voluntary_leave",
Self::InviteRevoked => "invite_revoked",
Self::InviteExpired => "invite_expired",
Self::OwnerDeletedResource => "owner_deleted_resource",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"voluntary_leave" => Self::VoluntaryLeave,
"invite_revoked" => Self::InviteRevoked,
"invite_expired" => Self::InviteExpired,
"owner_deleted_resource" => Self::OwnerDeletedResource,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for FormerCollaboratorViewEndReason<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for FormerCollaboratorViewEndReason<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for FormerCollaboratorViewEndReason<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for FormerCollaboratorViewEndReason<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for FormerCollaboratorViewEndReason<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for FormerCollaboratorViewEndReason<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = FormerCollaboratorViewEndReason<S::Output>;
fn into_static(self) -> Self::Output {
match self {
FormerCollaboratorViewEndReason::VoluntaryLeave => {
FormerCollaboratorViewEndReason::VoluntaryLeave
}
FormerCollaboratorViewEndReason::InviteRevoked => {
FormerCollaboratorViewEndReason::InviteRevoked
}
FormerCollaboratorViewEndReason::InviteExpired => {
FormerCollaboratorViewEndReason::InviteExpired
}
FormerCollaboratorViewEndReason::OwnerDeletedResource => {
FormerCollaboratorViewEndReason::OwnerDeletedResource
}
FormerCollaboratorViewEndReason::Other(v) => {
FormerCollaboratorViewEndReason::Other(v.into_static())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct InviteView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub accept_uri: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub accepted_at: Option<Datetime>,
pub cid: Cid<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<Datetime>,
pub invitee: ProfileViewBasic<S>,
pub inviter: ProfileViewBasic<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<S>,
pub resource: StrongRef<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub resource_title: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scope: Option<InviteViewScope<S>>,
pub status: InviteViewStatus<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InviteViewScope<S: BosStr = DefaultStr> {
Notebook,
Entry,
Chapter,
Other(S),
}
impl<S: BosStr> InviteViewScope<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Notebook => "notebook",
Self::Entry => "entry",
Self::Chapter => "chapter",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"notebook" => Self::Notebook,
"entry" => Self::Entry,
"chapter" => Self::Chapter,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for InviteViewScope<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for InviteViewScope<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for InviteViewScope<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for InviteViewScope<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for InviteViewScope<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for InviteViewScope<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = InviteViewScope<S::Output>;
fn into_static(self) -> Self::Output {
match self {
InviteViewScope::Notebook => InviteViewScope::Notebook,
InviteViewScope::Entry => InviteViewScope::Entry,
InviteViewScope::Chapter => InviteViewScope::Chapter,
InviteViewScope::Other(v) => InviteViewScope::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InviteViewStatus<S: BosStr = DefaultStr> {
Pending,
Accepted,
Expired,
Revoked,
Other(S),
}
impl<S: BosStr> InviteViewStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Pending => "pending",
Self::Accepted => "accepted",
Self::Expired => "expired",
Self::Revoked => "revoked",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"pending" => Self::Pending,
"accepted" => Self::Accepted,
"expired" => Self::Expired,
"revoked" => Self::Revoked,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for InviteViewStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for InviteViewStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for InviteViewStatus<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for InviteViewStatus<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for InviteViewStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for InviteViewStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = InviteViewStatus<S::Output>;
fn into_static(self) -> Self::Output {
match self {
InviteViewStatus::Pending => InviteViewStatus::Pending,
InviteViewStatus::Accepted => InviteViewStatus::Accepted,
InviteViewStatus::Expired => InviteViewStatus::Expired,
InviteViewStatus::Revoked => InviteViewStatus::Revoked,
InviteViewStatus::Other(v) => InviteViewStatus::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Notebook;
impl core::fmt::Display for Notebook {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "notebook")
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ParticipantStateView<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub accept_uri: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub end_reason: Option<ParticipantStateViewEndReason<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_edit_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invite_uri: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_edit_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub published_version: Option<StrongRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub relationship_ended_at: Option<Datetime>,
pub role: ParticipantStateViewRole<S>,
pub status: ParticipantStateViewStatus<S>,
pub user: ProfileViewBasic<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub was_collaborator: Option<bool>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ParticipantStateViewEndReason<S: BosStr = DefaultStr> {
VoluntaryLeave,
InviteRevoked,
InviteExpired,
OwnerDeletedResource,
Other(S),
}
impl<S: BosStr> ParticipantStateViewEndReason<S> {
pub fn as_str(&self) -> &str {
match self {
Self::VoluntaryLeave => "voluntary_leave",
Self::InviteRevoked => "invite_revoked",
Self::InviteExpired => "invite_expired",
Self::OwnerDeletedResource => "owner_deleted_resource",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"voluntary_leave" => Self::VoluntaryLeave,
"invite_revoked" => Self::InviteRevoked,
"invite_expired" => Self::InviteExpired,
"owner_deleted_resource" => Self::OwnerDeletedResource,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ParticipantStateViewEndReason<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ParticipantStateViewEndReason<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ParticipantStateViewEndReason<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for ParticipantStateViewEndReason<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for ParticipantStateViewEndReason<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ParticipantStateViewEndReason<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ParticipantStateViewEndReason<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ParticipantStateViewEndReason::VoluntaryLeave => {
ParticipantStateViewEndReason::VoluntaryLeave
}
ParticipantStateViewEndReason::InviteRevoked => {
ParticipantStateViewEndReason::InviteRevoked
}
ParticipantStateViewEndReason::InviteExpired => {
ParticipantStateViewEndReason::InviteExpired
}
ParticipantStateViewEndReason::OwnerDeletedResource => {
ParticipantStateViewEndReason::OwnerDeletedResource
}
ParticipantStateViewEndReason::Other(v) => {
ParticipantStateViewEndReason::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ParticipantStateViewRole<S: BosStr = DefaultStr> {
Owner,
Collaborator,
FormerCollaborator,
Other(S),
}
impl<S: BosStr> ParticipantStateViewRole<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Owner => "owner",
Self::Collaborator => "collaborator",
Self::FormerCollaborator => "former_collaborator",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"owner" => Self::Owner,
"collaborator" => Self::Collaborator,
"former_collaborator" => Self::FormerCollaborator,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ParticipantStateViewRole<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ParticipantStateViewRole<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ParticipantStateViewRole<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for ParticipantStateViewRole<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for ParticipantStateViewRole<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ParticipantStateViewRole<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ParticipantStateViewRole<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ParticipantStateViewRole::Owner => ParticipantStateViewRole::Owner,
ParticipantStateViewRole::Collaborator => {
ParticipantStateViewRole::Collaborator
}
ParticipantStateViewRole::FormerCollaborator => {
ParticipantStateViewRole::FormerCollaborator
}
ParticipantStateViewRole::Other(v) => {
ParticipantStateViewRole::Other(v.into_static())
}
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ParticipantStateViewStatus<S: BosStr = DefaultStr> {
Active,
Invited,
Left,
Removed,
Expired,
Other(S),
}
impl<S: BosStr> ParticipantStateViewStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Active => "active",
Self::Invited => "invited",
Self::Left => "left",
Self::Removed => "removed",
Self::Expired => "expired",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"active" => Self::Active,
"invited" => Self::Invited,
"left" => Self::Left,
"removed" => Self::Removed,
"expired" => Self::Expired,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ParticipantStateViewStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ParticipantStateViewStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ParticipantStateViewStatus<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>
for ParticipantStateViewStatus<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for ParticipantStateViewStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ParticipantStateViewStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ParticipantStateViewStatus<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ParticipantStateViewStatus::Active => ParticipantStateViewStatus::Active,
ParticipantStateViewStatus::Invited => ParticipantStateViewStatus::Invited,
ParticipantStateViewStatus::Left => ParticipantStateViewStatus::Left,
ParticipantStateViewStatus::Removed => ParticipantStateViewStatus::Removed,
ParticipantStateViewStatus::Expired => ParticipantStateViewStatus::Expired,
ParticipantStateViewStatus::Other(v) => {
ParticipantStateViewStatus::Other(v.into_static())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SessionView<S: BosStr = DefaultStr> {
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<Datetime>,
pub node_id: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub relay_url: Option<UriValue<S>>,
pub resource: StrongRef<S>,
pub uri: AtUri<S>,
pub user: ProfileViewBasic<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for CollaborationStateView<S> {
fn nsid() -> &'static str {
"sh.weaver.collab.defs"
}
fn def_name() -> &'static str {
"collaborationStateView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_collab_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for FormerCollaboratorView<S> {
fn nsid() -> &'static str {
"sh.weaver.collab.defs"
}
fn def_name() -> &'static str {
"formerCollaboratorView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_collab_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for InviteView<S> {
fn nsid() -> &'static str {
"sh.weaver.collab.defs"
}
fn def_name() -> &'static str {
"inviteView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_collab_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ParticipantStateView<S> {
fn nsid() -> &'static str {
"sh.weaver.collab.defs"
}
fn def_name() -> &'static str {
"participantStateView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_collab_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SessionView<S> {
fn nsid() -> &'static str {
"sh.weaver.collab.defs"
}
fn def_name() -> &'static str {
"sessionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_collab_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod collaboration_state_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 Resource;
type Participants;
type Status;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Resource = Unset;
type Participants = Unset;
type Status = Unset;
}
pub struct SetResource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetResource<St> {}
impl<St: State> State for SetResource<St> {
type Resource = Set<members::resource>;
type Participants = St::Participants;
type Status = St::Status;
}
pub struct SetParticipants<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetParticipants<St> {}
impl<St: State> State for SetParticipants<St> {
type Resource = St::Resource;
type Participants = Set<members::participants>;
type Status = St::Status;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Resource = St::Resource;
type Participants = St::Participants;
type Status = Set<members::status>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct resource(());
pub struct participants(());
pub struct status(());
}
}
pub struct CollaborationStateViewBuilder<
S: BosStr,
St: collaboration_state_view_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<AtUri<S>>,
Option<Datetime>,
Option<Datetime>,
Option<Vec<collab::FormerCollaboratorView<S>>>,
Option<bool>,
Option<bool>,
Option<bool>,
Option<Datetime>,
Option<Vec<collab::ParticipantStateView<S>>>,
Option<Vec<PublishedVersionView<S>>>,
Option<StrongRef<S>>,
Option<CollaborationStateViewStatus<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> CollaborationStateView<S> {
pub fn new() -> CollaborationStateViewBuilder<
S,
collaboration_state_view_state::Empty,
> {
CollaborationStateViewBuilder::new()
}
}
impl<S: BosStr> CollaborationStateViewBuilder<S, collaboration_state_view_state::Empty> {
pub fn new() -> Self {
CollaborationStateViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn canonical_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_canonical_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
self._fields.1 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn first_collaborator_added_at(
mut self,
value: impl Into<Option<Datetime>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_first_collaborator_added_at(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn former_participants(
mut self,
value: impl Into<Option<Vec<collab::FormerCollaboratorView<S>>>>,
) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_former_participants(
mut self,
value: Option<Vec<collab::FormerCollaboratorView<S>>>,
) -> Self {
self._fields.3 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn has_divergence(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_has_divergence(mut self, value: Option<bool>) -> Self {
self._fields.4 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn has_former_collaborators(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_has_former_collaborators(mut self, value: Option<bool>) -> Self {
self._fields.5 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn has_orphaned_versions(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_has_orphaned_versions(mut self, value: Option<bool>) -> Self {
self._fields.6 = value;
self
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn last_synced_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_last_synced_at(mut self, value: Option<Datetime>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St> CollaborationStateViewBuilder<S, St>
where
St: collaboration_state_view_state::State,
St::Participants: collaboration_state_view_state::IsUnset,
{
pub fn participants(
mut self,
value: impl Into<Vec<collab::ParticipantStateView<S>>>,
) -> CollaborationStateViewBuilder<
S,
collaboration_state_view_state::SetParticipants<St>,
> {
self._fields.8 = Option::Some(value.into());
CollaborationStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: collaboration_state_view_state::State,
> CollaborationStateViewBuilder<S, St> {
pub fn published_versions(
mut self,
value: impl Into<Option<Vec<PublishedVersionView<S>>>>,
) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_published_versions(
mut self,
value: Option<Vec<PublishedVersionView<S>>>,
) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St> CollaborationStateViewBuilder<S, St>
where
St: collaboration_state_view_state::State,
St::Resource: collaboration_state_view_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<StrongRef<S>>,
) -> CollaborationStateViewBuilder<
S,
collaboration_state_view_state::SetResource<St>,
> {
self._fields.10 = Option::Some(value.into());
CollaborationStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollaborationStateViewBuilder<S, St>
where
St: collaboration_state_view_state::State,
St::Status: collaboration_state_view_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<CollaborationStateViewStatus<S>>,
) -> CollaborationStateViewBuilder<
S,
collaboration_state_view_state::SetStatus<St>,
> {
self._fields.11 = Option::Some(value.into());
CollaborationStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CollaborationStateViewBuilder<S, St>
where
St: collaboration_state_view_state::State,
St::Resource: collaboration_state_view_state::IsSet,
St::Participants: collaboration_state_view_state::IsSet,
St::Status: collaboration_state_view_state::IsSet,
{
pub fn build(self) -> CollaborationStateView<S> {
CollaborationStateView {
canonical_uri: self._fields.0,
created_at: self._fields.1,
first_collaborator_added_at: self._fields.2,
former_participants: self._fields.3,
has_divergence: self._fields.4,
has_former_collaborators: self._fields.5,
has_orphaned_versions: self._fields.6,
last_synced_at: self._fields.7,
participants: self._fields.8.unwrap(),
published_versions: self._fields.9,
resource: self._fields.10.unwrap(),
status: self._fields.11.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> CollaborationStateView<S> {
CollaborationStateView {
canonical_uri: self._fields.0,
created_at: self._fields.1,
first_collaborator_added_at: self._fields.2,
former_participants: self._fields.3,
has_divergence: self._fields.4,
has_former_collaborators: self._fields.5,
has_orphaned_versions: self._fields.6,
last_synced_at: self._fields.7,
participants: self._fields.8.unwrap(),
published_versions: self._fields.9,
resource: self._fields.10.unwrap(),
status: self._fields.11.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_collab_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("sh.weaver.collab.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("chapter"),
LexUserType::Token(LexToken { ..Default::default() }),
);
map.insert(
SmolStr::new_static("collaborationStateView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Full state of a collaboration relationship including version reconciliation. Tracks both current and former collaborators.",
),
),
required: Some(
vec![
SmolStr::new_static("resource"),
SmolStr::new_static("status"),
SmolStr::new_static("participants")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("canonicalUri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The 'canonical' version URI (usually owner's)",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("firstCollaboratorAddedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("formerParticipants"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"People who used to collaborate but relationship ended",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#formerCollaboratorView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hasDivergence"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hasFormerCollaborators"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hasOrphanedVersions"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastSyncedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("participants"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Current active + invited participants"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#participantStateView"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedVersions"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.notebook.defs#publishedVersionView",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("resource"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"active=normal, broken=all invites revoked/expired, diverged=versions differ, reconciled=was diverged but resolved",
),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entry"),
LexUserType::Token(LexToken { ..Default::default() }),
);
map.insert(
SmolStr::new_static("formerCollaboratorView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Lightweight view for 'this person used to collaborate but doesn't anymore'.",
),
),
required: Some(
vec![
SmolStr::new_static("user"),
SmolStr::new_static("wasActiveFrom"),
SmolStr::new_static("wasActiveUntil"),
SmolStr::new_static("endReason")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("contributionCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("endReason"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("hasPublishedVersion"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedVersionUri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("user"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("wasActiveFrom"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("wasActiveUntil"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("inviteView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Hydrated view of a collaboration invite with status.",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("inviter"),
SmolStr::new_static("invitee"),
SmolStr::new_static("resource"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("status")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("acceptUri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("acceptedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
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("expiresAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("invitee"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("inviter"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("message"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("resource"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("resourceTitle"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("scope"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebook"),
LexUserType::Token(LexToken { ..Default::default() }),
);
map.insert(
SmolStr::new_static("participantStateView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Individual participant's state in a collaboration. Distinguishes 'was collaborator' vs 'never was'.",
),
),
required: Some(
vec![
SmolStr::new_static("user"), SmolStr::new_static("role"),
SmolStr::new_static("status")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("acceptUri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"If they accepted (even if later broken)",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("endReason"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Why the relationship ended, if applicable",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("firstEditAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When they first contributed"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("inviteUri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastEditAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("publishedVersion"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("relationshipEndedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When left/removed/expired"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("role"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"active=can edit, invited=pending, left=voluntarily departed, removed=invite revoked, expired=invite timed out",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("user"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("wasCollaborator"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sessionView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Active real-time collaboration session."),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("user"),
SmolStr::new_static("resource"),
SmolStr::new_static("nodeId"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expiresAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("nodeId"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("relayUrl"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("resource"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("user"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod former_collaborator_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 User;
type WasActiveUntil;
type EndReason;
type WasActiveFrom;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type User = Unset;
type WasActiveUntil = Unset;
type EndReason = Unset;
type WasActiveFrom = Unset;
}
pub struct SetUser<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUser<St> {}
impl<St: State> State for SetUser<St> {
type User = Set<members::user>;
type WasActiveUntil = St::WasActiveUntil;
type EndReason = St::EndReason;
type WasActiveFrom = St::WasActiveFrom;
}
pub struct SetWasActiveUntil<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetWasActiveUntil<St> {}
impl<St: State> State for SetWasActiveUntil<St> {
type User = St::User;
type WasActiveUntil = Set<members::was_active_until>;
type EndReason = St::EndReason;
type WasActiveFrom = St::WasActiveFrom;
}
pub struct SetEndReason<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEndReason<St> {}
impl<St: State> State for SetEndReason<St> {
type User = St::User;
type WasActiveUntil = St::WasActiveUntil;
type EndReason = Set<members::end_reason>;
type WasActiveFrom = St::WasActiveFrom;
}
pub struct SetWasActiveFrom<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetWasActiveFrom<St> {}
impl<St: State> State for SetWasActiveFrom<St> {
type User = St::User;
type WasActiveUntil = St::WasActiveUntil;
type EndReason = St::EndReason;
type WasActiveFrom = Set<members::was_active_from>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct user(());
pub struct was_active_until(());
pub struct end_reason(());
pub struct was_active_from(());
}
}
pub struct FormerCollaboratorViewBuilder<
S: BosStr,
St: former_collaborator_view_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<FormerCollaboratorViewEndReason<S>>,
Option<bool>,
Option<AtUri<S>>,
Option<ProfileViewBasic<S>>,
Option<Datetime>,
Option<Datetime>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> FormerCollaboratorView<S> {
pub fn new() -> FormerCollaboratorViewBuilder<
S,
former_collaborator_view_state::Empty,
> {
FormerCollaboratorViewBuilder::new()
}
}
impl<S: BosStr> FormerCollaboratorViewBuilder<S, former_collaborator_view_state::Empty> {
pub fn new() -> Self {
FormerCollaboratorViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: former_collaborator_view_state::State,
> FormerCollaboratorViewBuilder<S, St> {
pub fn contribution_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_contribution_count(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> FormerCollaboratorViewBuilder<S, St>
where
St: former_collaborator_view_state::State,
St::EndReason: former_collaborator_view_state::IsUnset,
{
pub fn end_reason(
mut self,
value: impl Into<FormerCollaboratorViewEndReason<S>>,
) -> FormerCollaboratorViewBuilder<
S,
former_collaborator_view_state::SetEndReason<St>,
> {
self._fields.1 = Option::Some(value.into());
FormerCollaboratorViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: former_collaborator_view_state::State,
> FormerCollaboratorViewBuilder<S, St> {
pub fn has_published_version(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_has_published_version(mut self, value: Option<bool>) -> Self {
self._fields.2 = value;
self
}
}
impl<
S: BosStr,
St: former_collaborator_view_state::State,
> FormerCollaboratorViewBuilder<S, St> {
pub fn published_version_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_published_version_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> FormerCollaboratorViewBuilder<S, St>
where
St: former_collaborator_view_state::State,
St::User: former_collaborator_view_state::IsUnset,
{
pub fn user(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> FormerCollaboratorViewBuilder<S, former_collaborator_view_state::SetUser<St>> {
self._fields.4 = Option::Some(value.into());
FormerCollaboratorViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FormerCollaboratorViewBuilder<S, St>
where
St: former_collaborator_view_state::State,
St::WasActiveFrom: former_collaborator_view_state::IsUnset,
{
pub fn was_active_from(
mut self,
value: impl Into<Datetime>,
) -> FormerCollaboratorViewBuilder<
S,
former_collaborator_view_state::SetWasActiveFrom<St>,
> {
self._fields.5 = Option::Some(value.into());
FormerCollaboratorViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FormerCollaboratorViewBuilder<S, St>
where
St: former_collaborator_view_state::State,
St::WasActiveUntil: former_collaborator_view_state::IsUnset,
{
pub fn was_active_until(
mut self,
value: impl Into<Datetime>,
) -> FormerCollaboratorViewBuilder<
S,
former_collaborator_view_state::SetWasActiveUntil<St>,
> {
self._fields.6 = Option::Some(value.into());
FormerCollaboratorViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FormerCollaboratorViewBuilder<S, St>
where
St: former_collaborator_view_state::State,
St::User: former_collaborator_view_state::IsSet,
St::WasActiveUntil: former_collaborator_view_state::IsSet,
St::EndReason: former_collaborator_view_state::IsSet,
St::WasActiveFrom: former_collaborator_view_state::IsSet,
{
pub fn build(self) -> FormerCollaboratorView<S> {
FormerCollaboratorView {
contribution_count: self._fields.0,
end_reason: self._fields.1.unwrap(),
has_published_version: self._fields.2,
published_version_uri: self._fields.3,
user: self._fields.4.unwrap(),
was_active_from: self._fields.5.unwrap(),
was_active_until: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> FormerCollaboratorView<S> {
FormerCollaboratorView {
contribution_count: self._fields.0,
end_reason: self._fields.1.unwrap(),
has_published_version: self._fields.2,
published_version_uri: self._fields.3,
user: self._fields.4.unwrap(),
was_active_from: self._fields.5.unwrap(),
was_active_until: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod invite_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 Status;
type Inviter;
type Invitee;
type Uri;
type Resource;
type CreatedAt;
type Cid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Status = Unset;
type Inviter = Unset;
type Invitee = Unset;
type Uri = Unset;
type Resource = Unset;
type CreatedAt = Unset;
type Cid = Unset;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Status = Set<members::status>;
type Inviter = St::Inviter;
type Invitee = St::Invitee;
type Uri = St::Uri;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
type Cid = St::Cid;
}
pub struct SetInviter<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetInviter<St> {}
impl<St: State> State for SetInviter<St> {
type Status = St::Status;
type Inviter = Set<members::inviter>;
type Invitee = St::Invitee;
type Uri = St::Uri;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
type Cid = St::Cid;
}
pub struct SetInvitee<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetInvitee<St> {}
impl<St: State> State for SetInvitee<St> {
type Status = St::Status;
type Inviter = St::Inviter;
type Invitee = Set<members::invitee>;
type Uri = St::Uri;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
type Cid = St::Cid;
}
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 Status = St::Status;
type Inviter = St::Inviter;
type Invitee = St::Invitee;
type Uri = Set<members::uri>;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
type Cid = St::Cid;
}
pub struct SetResource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetResource<St> {}
impl<St: State> State for SetResource<St> {
type Status = St::Status;
type Inviter = St::Inviter;
type Invitee = St::Invitee;
type Uri = St::Uri;
type Resource = Set<members::resource>;
type CreatedAt = St::CreatedAt;
type Cid = St::Cid;
}
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 Status = St::Status;
type Inviter = St::Inviter;
type Invitee = St::Invitee;
type Uri = St::Uri;
type Resource = St::Resource;
type CreatedAt = Set<members::created_at>;
type Cid = St::Cid;
}
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 Status = St::Status;
type Inviter = St::Inviter;
type Invitee = St::Invitee;
type Uri = St::Uri;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
type Cid = Set<members::cid>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct status(());
pub struct inviter(());
pub struct invitee(());
pub struct uri(());
pub struct resource(());
pub struct created_at(());
pub struct cid(());
}
}
pub struct InviteViewBuilder<S: BosStr, St: invite_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<AtUri<S>>,
Option<Datetime>,
Option<Cid<S>>,
Option<Datetime>,
Option<Datetime>,
Option<ProfileViewBasic<S>>,
Option<ProfileViewBasic<S>>,
Option<S>,
Option<StrongRef<S>>,
Option<S>,
Option<InviteViewScope<S>>,
Option<InviteViewStatus<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> InviteView<S> {
pub fn new() -> InviteViewBuilder<S, invite_view_state::Empty> {
InviteViewBuilder::new()
}
}
impl<S: BosStr> InviteViewBuilder<S, invite_view_state::Empty> {
pub fn new() -> Self {
InviteViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn accept_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_accept_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn accepted_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_accepted_at(mut self, value: Option<Datetime>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Cid: invite_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetCid<St>> {
self._fields.2 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::CreatedAt: invite_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> InviteViewBuilder<S, invite_view_state::SetCreatedAt<St>> {
self._fields.3 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn expires_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_expires_at(mut self, value: Option<Datetime>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Invitee: invite_view_state::IsUnset,
{
pub fn invitee(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetInvitee<St>> {
self._fields.5 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Inviter: invite_view_state::IsUnset,
{
pub fn inviter(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetInviter<St>> {
self._fields.6 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn message(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_message(mut self, value: Option<S>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Resource: invite_view_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<StrongRef<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetResource<St>> {
self._fields.8 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn resource_title(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_resource_title(mut self, value: Option<S>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: invite_view_state::State> InviteViewBuilder<S, St> {
pub fn scope(mut self, value: impl Into<Option<InviteViewScope<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_scope(mut self, value: Option<InviteViewScope<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Status: invite_view_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<InviteViewStatus<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetStatus<St>> {
self._fields.11 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Uri: invite_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> InviteViewBuilder<S, invite_view_state::SetUri<St>> {
self._fields.12 = Option::Some(value.into());
InviteViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> InviteViewBuilder<S, St>
where
St: invite_view_state::State,
St::Status: invite_view_state::IsSet,
St::Inviter: invite_view_state::IsSet,
St::Invitee: invite_view_state::IsSet,
St::Uri: invite_view_state::IsSet,
St::Resource: invite_view_state::IsSet,
St::CreatedAt: invite_view_state::IsSet,
St::Cid: invite_view_state::IsSet,
{
pub fn build(self) -> InviteView<S> {
InviteView {
accept_uri: self._fields.0,
accepted_at: self._fields.1,
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
expires_at: self._fields.4,
invitee: self._fields.5.unwrap(),
inviter: self._fields.6.unwrap(),
message: self._fields.7,
resource: self._fields.8.unwrap(),
resource_title: self._fields.9,
scope: self._fields.10,
status: self._fields.11.unwrap(),
uri: self._fields.12.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> InviteView<S> {
InviteView {
accept_uri: self._fields.0,
accepted_at: self._fields.1,
cid: self._fields.2.unwrap(),
created_at: self._fields.3.unwrap(),
expires_at: self._fields.4,
invitee: self._fields.5.unwrap(),
inviter: self._fields.6.unwrap(),
message: self._fields.7,
resource: self._fields.8.unwrap(),
resource_title: self._fields.9,
scope: self._fields.10,
status: self._fields.11.unwrap(),
uri: self._fields.12.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod participant_state_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 Status;
type User;
type Role;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Status = Unset;
type User = Unset;
type Role = Unset;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Status = Set<members::status>;
type User = St::User;
type Role = St::Role;
}
pub struct SetUser<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUser<St> {}
impl<St: State> State for SetUser<St> {
type Status = St::Status;
type User = Set<members::user>;
type Role = St::Role;
}
pub struct SetRole<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRole<St> {}
impl<St: State> State for SetRole<St> {
type Status = St::Status;
type User = St::User;
type Role = Set<members::role>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct status(());
pub struct user(());
pub struct role(());
}
}
pub struct ParticipantStateViewBuilder<
S: BosStr,
St: participant_state_view_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<AtUri<S>>,
Option<ParticipantStateViewEndReason<S>>,
Option<Datetime>,
Option<AtUri<S>>,
Option<Datetime>,
Option<StrongRef<S>>,
Option<Datetime>,
Option<ParticipantStateViewRole<S>>,
Option<ParticipantStateViewStatus<S>>,
Option<ProfileViewBasic<S>>,
Option<bool>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ParticipantStateView<S> {
pub fn new() -> ParticipantStateViewBuilder<S, participant_state_view_state::Empty> {
ParticipantStateViewBuilder::new()
}
}
impl<S: BosStr> ParticipantStateViewBuilder<S, participant_state_view_state::Empty> {
pub fn new() -> Self {
ParticipantStateViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn accept_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_accept_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn end_reason(
mut self,
value: impl Into<Option<ParticipantStateViewEndReason<S>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_end_reason(
mut self,
value: Option<ParticipantStateViewEndReason<S>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn first_edit_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_first_edit_at(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn invite_uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_invite_uri(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn last_edit_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_last_edit_at(mut self, value: Option<Datetime>) -> Self {
self._fields.4 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn published_version(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_published_version(mut self, value: Option<StrongRef<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn relationship_ended_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_relationship_ended_at(mut self, value: Option<Datetime>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> ParticipantStateViewBuilder<S, St>
where
St: participant_state_view_state::State,
St::Role: participant_state_view_state::IsUnset,
{
pub fn role(
mut self,
value: impl Into<ParticipantStateViewRole<S>>,
) -> ParticipantStateViewBuilder<S, participant_state_view_state::SetRole<St>> {
self._fields.7 = Option::Some(value.into());
ParticipantStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ParticipantStateViewBuilder<S, St>
where
St: participant_state_view_state::State,
St::Status: participant_state_view_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<ParticipantStateViewStatus<S>>,
) -> ParticipantStateViewBuilder<S, participant_state_view_state::SetStatus<St>> {
self._fields.8 = Option::Some(value.into());
ParticipantStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ParticipantStateViewBuilder<S, St>
where
St: participant_state_view_state::State,
St::User: participant_state_view_state::IsUnset,
{
pub fn user(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> ParticipantStateViewBuilder<S, participant_state_view_state::SetUser<St>> {
self._fields.9 = Option::Some(value.into());
ParticipantStateViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: participant_state_view_state::State,
> ParticipantStateViewBuilder<S, St> {
pub fn was_collaborator(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_was_collaborator(mut self, value: Option<bool>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St> ParticipantStateViewBuilder<S, St>
where
St: participant_state_view_state::State,
St::Status: participant_state_view_state::IsSet,
St::User: participant_state_view_state::IsSet,
St::Role: participant_state_view_state::IsSet,
{
pub fn build(self) -> ParticipantStateView<S> {
ParticipantStateView {
accept_uri: self._fields.0,
end_reason: self._fields.1,
first_edit_at: self._fields.2,
invite_uri: self._fields.3,
last_edit_at: self._fields.4,
published_version: self._fields.5,
relationship_ended_at: self._fields.6,
role: self._fields.7.unwrap(),
status: self._fields.8.unwrap(),
user: self._fields.9.unwrap(),
was_collaborator: self._fields.10,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ParticipantStateView<S> {
ParticipantStateView {
accept_uri: self._fields.0,
end_reason: self._fields.1,
first_edit_at: self._fields.2,
invite_uri: self._fields.3,
last_edit_at: self._fields.4,
published_version: self._fields.5,
relationship_ended_at: self._fields.6,
role: self._fields.7.unwrap(),
status: self._fields.8.unwrap(),
user: self._fields.9.unwrap(),
was_collaborator: self._fields.10,
extra_data: Some(extra_data),
}
}
}
pub mod session_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 NodeId;
type Uri;
type User;
type Resource;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type NodeId = Unset;
type Uri = Unset;
type User = Unset;
type Resource = Unset;
type CreatedAt = Unset;
}
pub struct SetNodeId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNodeId<St> {}
impl<St: State> State for SetNodeId<St> {
type NodeId = Set<members::node_id>;
type Uri = St::Uri;
type User = St::User;
type Resource = St::Resource;
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 NodeId = St::NodeId;
type Uri = Set<members::uri>;
type User = St::User;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
}
pub struct SetUser<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUser<St> {}
impl<St: State> State for SetUser<St> {
type NodeId = St::NodeId;
type Uri = St::Uri;
type User = Set<members::user>;
type Resource = St::Resource;
type CreatedAt = St::CreatedAt;
}
pub struct SetResource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetResource<St> {}
impl<St: State> State for SetResource<St> {
type NodeId = St::NodeId;
type Uri = St::Uri;
type User = St::User;
type Resource = Set<members::resource>;
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 NodeId = St::NodeId;
type Uri = St::Uri;
type User = St::User;
type Resource = St::Resource;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct node_id(());
pub struct uri(());
pub struct user(());
pub struct resource(());
pub struct created_at(());
}
}
pub struct SessionViewBuilder<S: BosStr, St: session_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Datetime>,
Option<Datetime>,
Option<S>,
Option<UriValue<S>>,
Option<StrongRef<S>>,
Option<AtUri<S>>,
Option<ProfileViewBasic<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SessionView<S> {
pub fn new() -> SessionViewBuilder<S, session_view_state::Empty> {
SessionViewBuilder::new()
}
}
impl<S: BosStr> SessionViewBuilder<S, session_view_state::Empty> {
pub fn new() -> Self {
SessionViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::CreatedAt: session_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> SessionViewBuilder<S, session_view_state::SetCreatedAt<St>> {
self._fields.0 = Option::Some(value.into());
SessionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: session_view_state::State> SessionViewBuilder<S, St> {
pub fn expires_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_expires_at(mut self, value: Option<Datetime>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::NodeId: session_view_state::IsUnset,
{
pub fn node_id(
mut self,
value: impl Into<S>,
) -> SessionViewBuilder<S, session_view_state::SetNodeId<St>> {
self._fields.2 = Option::Some(value.into());
SessionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: session_view_state::State> SessionViewBuilder<S, St> {
pub fn relay_url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_relay_url(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::Resource: session_view_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<StrongRef<S>>,
) -> SessionViewBuilder<S, session_view_state::SetResource<St>> {
self._fields.4 = Option::Some(value.into());
SessionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::Uri: session_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> SessionViewBuilder<S, session_view_state::SetUri<St>> {
self._fields.5 = Option::Some(value.into());
SessionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::User: session_view_state::IsUnset,
{
pub fn user(
mut self,
value: impl Into<ProfileViewBasic<S>>,
) -> SessionViewBuilder<S, session_view_state::SetUser<St>> {
self._fields.6 = Option::Some(value.into());
SessionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SessionViewBuilder<S, St>
where
St: session_view_state::State,
St::NodeId: session_view_state::IsSet,
St::Uri: session_view_state::IsSet,
St::User: session_view_state::IsSet,
St::Resource: session_view_state::IsSet,
St::CreatedAt: session_view_state::IsSet,
{
pub fn build(self) -> SessionView<S> {
SessionView {
created_at: self._fields.0.unwrap(),
expires_at: self._fields.1,
node_id: self._fields.2.unwrap(),
relay_url: self._fields.3,
resource: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
user: self._fields.6.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> SessionView<S> {
SessionView {
created_at: self._fields.0.unwrap(),
expires_at: self._fields.1,
node_id: self._fields.2.unwrap(),
relay_url: self._fields.3,
resource: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
user: self._fields.6.unwrap(),
extra_data: Some(extra_data),
}
}
}