#[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::{Did, AtUri, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::games_gamesgamesgamesgames::get_contribution;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ContributionView<S: BosStr = DefaultStr> {
pub changes: Data<S>,
pub cid: S,
pub contribution_type: ContributionViewContributionType<S>,
pub contributor_did: Did<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub patch: Option<get_contribution::PatchView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub review: Option<get_contribution::ReviewView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_name: Option<S>,
pub uri: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub verification: Option<get_contribution::VerificationView<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 ContributionViewContributionType<S: BosStr = DefaultStr> {
Correction,
Addition,
NewGame,
Other(S),
}
impl<S: BosStr> ContributionViewContributionType<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Correction => "correction",
Self::Addition => "addition",
Self::NewGame => "newGame",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"correction" => Self::Correction,
"addition" => Self::Addition,
"newGame" => Self::NewGame,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ContributionViewContributionType<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ContributionViewContributionType<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ContributionViewContributionType<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 ContributionViewContributionType<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 ContributionViewContributionType<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ContributionViewContributionType<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ContributionViewContributionType<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ContributionViewContributionType::Correction => {
ContributionViewContributionType::Correction
}
ContributionViewContributionType::Addition => {
ContributionViewContributionType::Addition
}
ContributionViewContributionType::NewGame => {
ContributionViewContributionType::NewGame
}
ContributionViewContributionType::Other(v) => {
ContributionViewContributionType::Other(v.into_static())
}
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetContribution<S: BosStr = DefaultStr> {
pub uri: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetContributionOutput<S: BosStr = DefaultStr> {
pub contribution: get_contribution::ContributionView<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PatchView<S: BosStr = DefaultStr> {
pub changes: Data<S>,
pub created_at: Datetime,
pub subject: AtUri<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReviewView<S: BosStr = DefaultStr> {
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<S>,
pub reviewed_by: Did<S>,
pub status: ReviewViewStatus<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 ReviewViewStatus<S: BosStr = DefaultStr> {
Approved,
Denied,
NeedsRevision,
Other(S),
}
impl<S: BosStr> ReviewViewStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Approved => "approved",
Self::Denied => "denied",
Self::NeedsRevision => "needsRevision",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"approved" => Self::Approved,
"denied" => Self::Denied,
"needsRevision" => Self::NeedsRevision,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ReviewViewStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ReviewViewStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ReviewViewStatus<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 ReviewViewStatus<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 ReviewViewStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ReviewViewStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ReviewViewStatus<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ReviewViewStatus::Approved => ReviewViewStatus::Approved,
ReviewViewStatus::Denied => ReviewViewStatus::Denied,
ReviewViewStatus::NeedsRevision => ReviewViewStatus::NeedsRevision,
ReviewViewStatus::Other(v) => ReviewViewStatus::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct VerificationView<S: BosStr = DefaultStr> {
pub accepted_by: VerificationViewAcceptedBy<S>,
pub contributor: Did<S>,
pub created_at: Datetime,
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 VerificationViewAcceptedBy<S: BosStr = DefaultStr> {
Mod,
Owner,
Both,
Other(S),
}
impl<S: BosStr> VerificationViewAcceptedBy<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Mod => "mod",
Self::Owner => "owner",
Self::Both => "both",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"mod" => Self::Mod,
"owner" => Self::Owner,
"both" => Self::Both,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for VerificationViewAcceptedBy<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for VerificationViewAcceptedBy<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for VerificationViewAcceptedBy<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 VerificationViewAcceptedBy<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 VerificationViewAcceptedBy<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for VerificationViewAcceptedBy<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = VerificationViewAcceptedBy<S::Output>;
fn into_static(self) -> Self::Output {
match self {
VerificationViewAcceptedBy::Mod => VerificationViewAcceptedBy::Mod,
VerificationViewAcceptedBy::Owner => VerificationViewAcceptedBy::Owner,
VerificationViewAcceptedBy::Both => VerificationViewAcceptedBy::Both,
VerificationViewAcceptedBy::Other(v) => {
VerificationViewAcceptedBy::Other(v.into_static())
}
}
}
}
impl<S: BosStr> LexiconSchema for ContributionView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getContribution"
}
fn def_name() -> &'static str {
"contributionView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getContribution()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct GetContributionResponse;
impl jacquard_common::xrpc::XrpcResp for GetContributionResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.getContribution";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetContributionOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetContribution<S> {
const NSID: &'static str = "games.gamesgamesgamesgames.getContribution";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetContributionResponse;
}
pub struct GetContributionRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetContributionRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getContribution";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetContribution<S>;
type Response = GetContributionResponse;
}
impl<S: BosStr> LexiconSchema for PatchView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getContribution"
}
fn def_name() -> &'static str {
"patchView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getContribution()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ReviewView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getContribution"
}
fn def_name() -> &'static str {
"reviewView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getContribution()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for VerificationView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getContribution"
}
fn def_name() -> &'static str {
"verificationView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getContribution()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod contribution_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 Changes;
type Cid;
type ContributionType;
type ContributorDid;
type CreatedAt;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Changes = Unset;
type Cid = Unset;
type ContributionType = Unset;
type ContributorDid = Unset;
type CreatedAt = Unset;
type Uri = Unset;
}
pub struct SetChanges<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetChanges<St> {}
impl<St: State> State for SetChanges<St> {
type Changes = Set<members::changes>;
type Cid = St::Cid;
type ContributionType = St::ContributionType;
type ContributorDid = St::ContributorDid;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
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 Changes = St::Changes;
type Cid = Set<members::cid>;
type ContributionType = St::ContributionType;
type ContributorDid = St::ContributorDid;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
pub struct SetContributionType<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetContributionType<St> {}
impl<St: State> State for SetContributionType<St> {
type Changes = St::Changes;
type Cid = St::Cid;
type ContributionType = Set<members::contribution_type>;
type ContributorDid = St::ContributorDid;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
pub struct SetContributorDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetContributorDid<St> {}
impl<St: State> State for SetContributorDid<St> {
type Changes = St::Changes;
type Cid = St::Cid;
type ContributionType = St::ContributionType;
type ContributorDid = Set<members::contributor_did>;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
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 Changes = St::Changes;
type Cid = St::Cid;
type ContributionType = St::ContributionType;
type ContributorDid = St::ContributorDid;
type CreatedAt = Set<members::created_at>;
type Uri = St::Uri;
}
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 Changes = St::Changes;
type Cid = St::Cid;
type ContributionType = St::ContributionType;
type ContributorDid = St::ContributorDid;
type CreatedAt = St::CreatedAt;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct changes(());
pub struct cid(());
pub struct contribution_type(());
pub struct contributor_did(());
pub struct created_at(());
pub struct uri(());
}
}
pub struct ContributionViewBuilder<
St: contribution_view_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Data<S>>,
Option<S>,
Option<ContributionViewContributionType<S>>,
Option<Did<S>>,
Option<Datetime>,
Option<S>,
Option<get_contribution::PatchView<S>>,
Option<get_contribution::ReviewView<S>>,
Option<AtUri<S>>,
Option<S>,
Option<AtUri<S>>,
Option<get_contribution::VerificationView<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl ContributionView<DefaultStr> {
pub fn new() -> ContributionViewBuilder<contribution_view_state::Empty, DefaultStr> {
ContributionViewBuilder::new()
}
}
impl<S: BosStr> ContributionView<S> {
pub fn builder() -> ContributionViewBuilder<contribution_view_state::Empty, S> {
ContributionViewBuilder::builder()
}
}
impl ContributionViewBuilder<contribution_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
ContributionViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> ContributionViewBuilder<contribution_view_state::Empty, S> {
pub fn builder() -> Self {
ContributionViewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::Changes: contribution_view_state::IsUnset,
{
pub fn changes(
mut self,
value: impl Into<Data<S>>,
) -> ContributionViewBuilder<contribution_view_state::SetChanges<St>, S> {
self._fields.0 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::Cid: contribution_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<S>,
) -> ContributionViewBuilder<contribution_view_state::SetCid<St>, S> {
self._fields.1 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::ContributionType: contribution_view_state::IsUnset,
{
pub fn contribution_type(
mut self,
value: impl Into<ContributionViewContributionType<S>>,
) -> ContributionViewBuilder<contribution_view_state::SetContributionType<St>, S> {
self._fields.2 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::ContributorDid: contribution_view_state::IsUnset,
{
pub fn contributor_did(
mut self,
value: impl Into<Did<S>>,
) -> ContributionViewBuilder<contribution_view_state::SetContributorDid<St>, S> {
self._fields.3 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::CreatedAt: contribution_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ContributionViewBuilder<contribution_view_state::SetCreatedAt<St>, S> {
self._fields.4 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn message(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_message(mut self, value: Option<S>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn patch(
mut self,
value: impl Into<Option<get_contribution::PatchView<S>>>,
) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_patch(mut self, value: Option<get_contribution::PatchView<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn review(
mut self,
value: impl Into<Option<get_contribution::ReviewView<S>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_review(
mut self,
value: Option<get_contribution::ReviewView<S>>,
) -> Self {
self._fields.7 = value;
self
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn subject(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_subject(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn subject_name(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_subject_name(mut self, value: Option<S>) -> Self {
self._fields.9 = value;
self
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::Uri: contribution_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ContributionViewBuilder<contribution_view_state::SetUri<St>, S> {
self._fields.10 = Option::Some(value.into());
ContributionViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: contribution_view_state::State, S: BosStr> ContributionViewBuilder<St, S> {
pub fn verification(
mut self,
value: impl Into<Option<get_contribution::VerificationView<S>>>,
) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_verification(
mut self,
value: Option<get_contribution::VerificationView<S>>,
) -> Self {
self._fields.11 = value;
self
}
}
impl<St, S: BosStr> ContributionViewBuilder<St, S>
where
St: contribution_view_state::State,
St::Changes: contribution_view_state::IsSet,
St::Cid: contribution_view_state::IsSet,
St::ContributionType: contribution_view_state::IsSet,
St::ContributorDid: contribution_view_state::IsSet,
St::CreatedAt: contribution_view_state::IsSet,
St::Uri: contribution_view_state::IsSet,
{
pub fn build(self) -> ContributionView<S> {
ContributionView {
changes: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
contribution_type: self._fields.2.unwrap(),
contributor_did: self._fields.3.unwrap(),
created_at: self._fields.4.unwrap(),
message: self._fields.5,
patch: self._fields.6,
review: self._fields.7,
subject: self._fields.8,
subject_name: self._fields.9,
uri: self._fields.10.unwrap(),
verification: self._fields.11,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ContributionView<S> {
ContributionView {
changes: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
contribution_type: self._fields.2.unwrap(),
contributor_did: self._fields.3.unwrap(),
created_at: self._fields.4.unwrap(),
message: self._fields.5,
patch: self._fields.6,
review: self._fields.7,
subject: self._fields.8,
subject_name: self._fields.9,
uri: self._fields.10.unwrap(),
verification: self._fields.11,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_games_gamesgamesgamesgames_getContribution() -> 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("games.gamesgamesgamesgames.getContribution"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("contributionView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("contributorDid"),
SmolStr::new_static("contributionType"),
SmolStr::new_static("changes"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("changes"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("contributionType"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("contributorDid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("message"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("patch"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#patchView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("review"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#reviewView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subject"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subjectName"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Resolved name of the subject entity for display.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("verification"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#verificationView"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("uri")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("uri"),
LexXrpcParametersProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("patchView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("subject"),
SmolStr::new_static("changes"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("changes"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subject"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..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("reviewView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("status"),
SmolStr::new_static("reviewedBy"),
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("reason"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("reviewedBy"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..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("verificationView"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("uri"),
SmolStr::new_static("contributor"),
SmolStr::new_static("acceptedBy"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("acceptedBy"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("contributor"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod get_contribution_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 Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
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 Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct GetContributionBuilder<
St: get_contribution_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl GetContribution<DefaultStr> {
pub fn new() -> GetContributionBuilder<get_contribution_state::Empty, DefaultStr> {
GetContributionBuilder::new()
}
}
impl<S: BosStr> GetContribution<S> {
pub fn builder() -> GetContributionBuilder<get_contribution_state::Empty, S> {
GetContributionBuilder::builder()
}
}
impl GetContributionBuilder<get_contribution_state::Empty, DefaultStr> {
pub fn new() -> Self {
GetContributionBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr> GetContributionBuilder<get_contribution_state::Empty, S> {
pub fn builder() -> Self {
GetContributionBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> GetContributionBuilder<St, S>
where
St: get_contribution_state::State,
St::Uri: get_contribution_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> GetContributionBuilder<get_contribution_state::SetUri<St>, S> {
self._fields.0 = Option::Some(value.into());
GetContributionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> GetContributionBuilder<St, S>
where
St: get_contribution_state::State,
St::Uri: get_contribution_state::IsSet,
{
pub fn build(self) -> GetContribution<S> {
GetContribution {
uri: self._fields.0.unwrap(),
}
}
}
pub mod patch_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 Changes;
type CreatedAt;
type Subject;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Changes = Unset;
type CreatedAt = Unset;
type Subject = Unset;
type Uri = Unset;
}
pub struct SetChanges<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetChanges<St> {}
impl<St: State> State for SetChanges<St> {
type Changes = Set<members::changes>;
type CreatedAt = St::CreatedAt;
type Subject = St::Subject;
type Uri = St::Uri;
}
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 Changes = St::Changes;
type CreatedAt = Set<members::created_at>;
type Subject = St::Subject;
type Uri = St::Uri;
}
pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubject<St> {}
impl<St: State> State for SetSubject<St> {
type Changes = St::Changes;
type CreatedAt = St::CreatedAt;
type Subject = Set<members::subject>;
type Uri = St::Uri;
}
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 Changes = St::Changes;
type CreatedAt = St::CreatedAt;
type Subject = St::Subject;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct changes(());
pub struct created_at(());
pub struct subject(());
pub struct uri(());
}
}
pub struct PatchViewBuilder<St: patch_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Data<S>>, Option<Datetime>, Option<AtUri<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl PatchView<DefaultStr> {
pub fn new() -> PatchViewBuilder<patch_view_state::Empty, DefaultStr> {
PatchViewBuilder::new()
}
}
impl<S: BosStr> PatchView<S> {
pub fn builder() -> PatchViewBuilder<patch_view_state::Empty, S> {
PatchViewBuilder::builder()
}
}
impl PatchViewBuilder<patch_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
PatchViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> PatchViewBuilder<patch_view_state::Empty, S> {
pub fn builder() -> Self {
PatchViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PatchViewBuilder<St, S>
where
St: patch_view_state::State,
St::Changes: patch_view_state::IsUnset,
{
pub fn changes(
mut self,
value: impl Into<Data<S>>,
) -> PatchViewBuilder<patch_view_state::SetChanges<St>, S> {
self._fields.0 = Option::Some(value.into());
PatchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PatchViewBuilder<St, S>
where
St: patch_view_state::State,
St::CreatedAt: patch_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> PatchViewBuilder<patch_view_state::SetCreatedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
PatchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PatchViewBuilder<St, S>
where
St: patch_view_state::State,
St::Subject: patch_view_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<AtUri<S>>,
) -> PatchViewBuilder<patch_view_state::SetSubject<St>, S> {
self._fields.2 = Option::Some(value.into());
PatchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PatchViewBuilder<St, S>
where
St: patch_view_state::State,
St::Uri: patch_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> PatchViewBuilder<patch_view_state::SetUri<St>, S> {
self._fields.3 = Option::Some(value.into());
PatchViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PatchViewBuilder<St, S>
where
St: patch_view_state::State,
St::Changes: patch_view_state::IsSet,
St::CreatedAt: patch_view_state::IsSet,
St::Subject: patch_view_state::IsSet,
St::Uri: patch_view_state::IsSet,
{
pub fn build(self) -> PatchView<S> {
PatchView {
changes: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
subject: self._fields.2.unwrap(),
uri: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> PatchView<S> {
PatchView {
changes: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
subject: self._fields.2.unwrap(),
uri: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod review_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 CreatedAt;
type ReviewedBy;
type Status;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type ReviewedBy = Unset;
type Status = Unset;
type Uri = Unset;
}
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 CreatedAt = Set<members::created_at>;
type ReviewedBy = St::ReviewedBy;
type Status = St::Status;
type Uri = St::Uri;
}
pub struct SetReviewedBy<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetReviewedBy<St> {}
impl<St: State> State for SetReviewedBy<St> {
type CreatedAt = St::CreatedAt;
type ReviewedBy = Set<members::reviewed_by>;
type Status = St::Status;
type Uri = St::Uri;
}
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 CreatedAt = St::CreatedAt;
type ReviewedBy = St::ReviewedBy;
type Status = Set<members::status>;
type Uri = St::Uri;
}
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 CreatedAt = St::CreatedAt;
type ReviewedBy = St::ReviewedBy;
type Status = St::Status;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct reviewed_by(());
pub struct status(());
pub struct uri(());
}
}
pub struct ReviewViewBuilder<St: review_view_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Datetime>,
Option<S>,
Option<Did<S>>,
Option<ReviewViewStatus<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl ReviewView<DefaultStr> {
pub fn new() -> ReviewViewBuilder<review_view_state::Empty, DefaultStr> {
ReviewViewBuilder::new()
}
}
impl<S: BosStr> ReviewView<S> {
pub fn builder() -> ReviewViewBuilder<review_view_state::Empty, S> {
ReviewViewBuilder::builder()
}
}
impl ReviewViewBuilder<review_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
ReviewViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ReviewViewBuilder<review_view_state::Empty, S> {
pub fn builder() -> Self {
ReviewViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
St: review_view_state::State,
St::CreatedAt: review_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ReviewViewBuilder<review_view_state::SetCreatedAt<St>, S> {
self._fields.0 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: review_view_state::State, S: BosStr> ReviewViewBuilder<St, S> {
pub fn reason(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_reason(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
St: review_view_state::State,
St::ReviewedBy: review_view_state::IsUnset,
{
pub fn reviewed_by(
mut self,
value: impl Into<Did<S>>,
) -> ReviewViewBuilder<review_view_state::SetReviewedBy<St>, S> {
self._fields.2 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
St: review_view_state::State,
St::Status: review_view_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<ReviewViewStatus<S>>,
) -> ReviewViewBuilder<review_view_state::SetStatus<St>, S> {
self._fields.3 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
St: review_view_state::State,
St::Uri: review_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ReviewViewBuilder<review_view_state::SetUri<St>, S> {
self._fields.4 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
St: review_view_state::State,
St::CreatedAt: review_view_state::IsSet,
St::ReviewedBy: review_view_state::IsSet,
St::Status: review_view_state::IsSet,
St::Uri: review_view_state::IsSet,
{
pub fn build(self) -> ReviewView<S> {
ReviewView {
created_at: self._fields.0.unwrap(),
reason: self._fields.1,
reviewed_by: self._fields.2.unwrap(),
status: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ReviewView<S> {
ReviewView {
created_at: self._fields.0.unwrap(),
reason: self._fields.1,
reviewed_by: self._fields.2.unwrap(),
status: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod verification_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 AcceptedBy;
type Contributor;
type CreatedAt;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type AcceptedBy = Unset;
type Contributor = Unset;
type CreatedAt = Unset;
type Uri = Unset;
}
pub struct SetAcceptedBy<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAcceptedBy<St> {}
impl<St: State> State for SetAcceptedBy<St> {
type AcceptedBy = Set<members::accepted_by>;
type Contributor = St::Contributor;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
pub struct SetContributor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetContributor<St> {}
impl<St: State> State for SetContributor<St> {
type AcceptedBy = St::AcceptedBy;
type Contributor = Set<members::contributor>;
type CreatedAt = St::CreatedAt;
type Uri = St::Uri;
}
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 AcceptedBy = St::AcceptedBy;
type Contributor = St::Contributor;
type CreatedAt = Set<members::created_at>;
type Uri = St::Uri;
}
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 AcceptedBy = St::AcceptedBy;
type Contributor = St::Contributor;
type CreatedAt = St::CreatedAt;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct accepted_by(());
pub struct contributor(());
pub struct created_at(());
pub struct uri(());
}
}
pub struct VerificationViewBuilder<
St: verification_view_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<VerificationViewAcceptedBy<S>>,
Option<Did<S>>,
Option<Datetime>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl VerificationView<DefaultStr> {
pub fn new() -> VerificationViewBuilder<verification_view_state::Empty, DefaultStr> {
VerificationViewBuilder::new()
}
}
impl<S: BosStr> VerificationView<S> {
pub fn builder() -> VerificationViewBuilder<verification_view_state::Empty, S> {
VerificationViewBuilder::builder()
}
}
impl VerificationViewBuilder<verification_view_state::Empty, DefaultStr> {
pub fn new() -> Self {
VerificationViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> VerificationViewBuilder<verification_view_state::Empty, S> {
pub fn builder() -> Self {
VerificationViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VerificationViewBuilder<St, S>
where
St: verification_view_state::State,
St::AcceptedBy: verification_view_state::IsUnset,
{
pub fn accepted_by(
mut self,
value: impl Into<VerificationViewAcceptedBy<S>>,
) -> VerificationViewBuilder<verification_view_state::SetAcceptedBy<St>, S> {
self._fields.0 = Option::Some(value.into());
VerificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VerificationViewBuilder<St, S>
where
St: verification_view_state::State,
St::Contributor: verification_view_state::IsUnset,
{
pub fn contributor(
mut self,
value: impl Into<Did<S>>,
) -> VerificationViewBuilder<verification_view_state::SetContributor<St>, S> {
self._fields.1 = Option::Some(value.into());
VerificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VerificationViewBuilder<St, S>
where
St: verification_view_state::State,
St::CreatedAt: verification_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> VerificationViewBuilder<verification_view_state::SetCreatedAt<St>, S> {
self._fields.2 = Option::Some(value.into());
VerificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VerificationViewBuilder<St, S>
where
St: verification_view_state::State,
St::Uri: verification_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> VerificationViewBuilder<verification_view_state::SetUri<St>, S> {
self._fields.3 = Option::Some(value.into());
VerificationViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> VerificationViewBuilder<St, S>
where
St: verification_view_state::State,
St::AcceptedBy: verification_view_state::IsSet,
St::Contributor: verification_view_state::IsSet,
St::CreatedAt: verification_view_state::IsSet,
St::Uri: verification_view_state::IsSet,
{
pub fn build(self) -> VerificationView<S> {
VerificationView {
accepted_by: self._fields.0.unwrap(),
contributor: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
uri: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> VerificationView<S> {
VerificationView {
accepted_by: self._fields.0.unwrap(),
contributor: self._fields.1.unwrap(),
created_at: self._fields.2.unwrap(),
uri: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}