#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{AtUri, Datetime, Did};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::games_gamesgamesgamesgames::GameSummaryView;
use crate::games_gamesgamesgamesgames::get_claim;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ClaimView<S: BosStr = DefaultStr> {
pub cid: S,
pub claimant_did: Did<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub contact: Option<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub games: Option<Vec<GameSummaryView<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub org: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub review: Option<get_claim::ReviewView<S>>,
pub r#type: ClaimViewType<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 ClaimViewType<S: BosStr = DefaultStr> {
Game,
Org,
Other(S),
}
impl<S: BosStr> ClaimViewType<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Game => "game",
Self::Org => "org",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"game" => Self::Game,
"org" => Self::Org,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for ClaimViewType<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for ClaimViewType<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for ClaimViewType<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 ClaimViewType<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 ClaimViewType<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for ClaimViewType<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = ClaimViewType<S::Output>;
fn into_static(self) -> Self::Output {
match self {
ClaimViewType::Game => ClaimViewType::Game,
ClaimViewType::Org => ClaimViewType::Org,
ClaimViewType::Other(v) => ClaimViewType::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetClaim<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 GetClaimOutput<S: BosStr = DefaultStr> {
pub claim: get_claim::ClaimView<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> {
#[serde(skip_serializing_if = "Option::is_none")]
pub approved_games: Option<Vec<AtUri<S>>>,
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,
Other(S),
}
impl<S: BosStr> ReviewViewStatus<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Approved => "approved",
Self::Denied => "denied",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"approved" => Self::Approved,
"denied" => Self::Denied,
_ => 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::Other(v) => ReviewViewStatus::Other(v.into_static()),
}
}
}
impl<S: BosStr> LexiconSchema for ClaimView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getClaim"
}
fn def_name() -> &'static str {
"claimView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getClaim()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct GetClaimResponse;
impl jacquard_common::xrpc::XrpcResp for GetClaimResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.getClaim";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetClaimOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetClaim<S> {
const NSID: &'static str = "games.gamesgamesgamesgames.getClaim";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetClaimResponse;
}
pub struct GetClaimRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetClaimRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getClaim";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetClaim<S>;
type Response = GetClaimResponse;
}
impl<S: BosStr> LexiconSchema for ReviewView<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.getClaim"
}
fn def_name() -> &'static str {
"reviewView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_getClaim()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod claim_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type ClaimantDid;
type Cid;
type Uri;
type CreatedAt;
type Type;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ClaimantDid = Unset;
type Cid = Unset;
type Uri = Unset;
type CreatedAt = Unset;
type Type = Unset;
}
pub struct SetClaimantDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetClaimantDid<St> {}
impl<St: State> State for SetClaimantDid<St> {
type ClaimantDid = Set<members::claimant_did>;
type Cid = St::Cid;
type Uri = St::Uri;
type CreatedAt = St::CreatedAt;
type Type = St::Type;
}
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 ClaimantDid = St::ClaimantDid;
type Cid = Set<members::cid>;
type Uri = St::Uri;
type CreatedAt = St::CreatedAt;
type Type = St::Type;
}
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 ClaimantDid = St::ClaimantDid;
type Cid = St::Cid;
type Uri = Set<members::uri>;
type CreatedAt = St::CreatedAt;
type Type = St::Type;
}
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 ClaimantDid = St::ClaimantDid;
type Cid = St::Cid;
type Uri = St::Uri;
type CreatedAt = Set<members::created_at>;
type Type = St::Type;
}
pub struct SetType<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetType<St> {}
impl<St: State> State for SetType<St> {
type ClaimantDid = St::ClaimantDid;
type Cid = St::Cid;
type Uri = St::Uri;
type CreatedAt = St::CreatedAt;
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct claimant_did(());
pub struct cid(());
pub struct uri(());
pub struct created_at(());
pub struct r#type(());
}
}
pub struct ClaimViewBuilder<S: BosStr, St: claim_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<Did<S>>,
Option<S>,
Option<Datetime>,
Option<Vec<GameSummaryView<S>>>,
Option<S>,
Option<AtUri<S>>,
Option<get_claim::ReviewView<S>>,
Option<ClaimViewType<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ClaimView<S> {
pub fn new() -> ClaimViewBuilder<S, claim_view_state::Empty> {
ClaimViewBuilder::new()
}
}
impl<S: BosStr> ClaimViewBuilder<S, claim_view_state::Empty> {
pub fn new() -> Self {
ClaimViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::Cid: claim_view_state::IsUnset,
{
pub fn cid(mut self, value: impl Into<S>) -> ClaimViewBuilder<S, claim_view_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
ClaimViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::ClaimantDid: claim_view_state::IsUnset,
{
pub fn claimant_did(
mut self,
value: impl Into<Did<S>>,
) -> ClaimViewBuilder<S, claim_view_state::SetClaimantDid<St>> {
self._fields.1 = Option::Some(value.into());
ClaimViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: claim_view_state::State> ClaimViewBuilder<S, St> {
pub fn contact(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_contact(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::CreatedAt: claim_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ClaimViewBuilder<S, claim_view_state::SetCreatedAt<St>> {
self._fields.3 = Option::Some(value.into());
ClaimViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: claim_view_state::State> ClaimViewBuilder<S, St> {
pub fn games(mut self, value: impl Into<Option<Vec<GameSummaryView<S>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_games(mut self, value: Option<Vec<GameSummaryView<S>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: claim_view_state::State> ClaimViewBuilder<S, St> {
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<S: BosStr, St: claim_view_state::State> ClaimViewBuilder<S, St> {
pub fn org(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_org(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: claim_view_state::State> ClaimViewBuilder<S, St> {
pub fn review(mut self, value: impl Into<Option<get_claim::ReviewView<S>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_review(mut self, value: Option<get_claim::ReviewView<S>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::Type: claim_view_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<ClaimViewType<S>>,
) -> ClaimViewBuilder<S, claim_view_state::SetType<St>> {
self._fields.8 = Option::Some(value.into());
ClaimViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::Uri: claim_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ClaimViewBuilder<S, claim_view_state::SetUri<St>> {
self._fields.9 = Option::Some(value.into());
ClaimViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ClaimViewBuilder<S, St>
where
St: claim_view_state::State,
St::ClaimantDid: claim_view_state::IsSet,
St::Cid: claim_view_state::IsSet,
St::Uri: claim_view_state::IsSet,
St::CreatedAt: claim_view_state::IsSet,
St::Type: claim_view_state::IsSet,
{
pub fn build(self) -> ClaimView<S> {
ClaimView {
cid: self._fields.0.unwrap(),
claimant_did: self._fields.1.unwrap(),
contact: self._fields.2,
created_at: self._fields.3.unwrap(),
games: self._fields.4,
message: self._fields.5,
org: self._fields.6,
review: self._fields.7,
r#type: self._fields.8.unwrap(),
uri: self._fields.9.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ClaimView<S> {
ClaimView {
cid: self._fields.0.unwrap(),
claimant_did: self._fields.1.unwrap(),
contact: self._fields.2,
created_at: self._fields.3.unwrap(),
games: self._fields.4,
message: self._fields.5,
org: self._fields.6,
review: self._fields.7,
r#type: self._fields.8.unwrap(),
uri: self._fields.9.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_games_gamesgamesgamesgames_getClaim() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("games.gamesgamesgamesgames.getClaim"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("claimView"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("uri"),
SmolStr::new_static("cid"),
SmolStr::new_static("type"),
SmolStr::new_static("claimantDid"),
SmolStr::new_static("createdAt"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("claimantDid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("contact"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("games"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"games.gamesgamesgamesgames.defs#gameSummaryView",
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("message"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("org"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("review"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#reviewView"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
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("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("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("approvedGames"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
..Default::default()
}),
);
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
},
..Default::default()
}
}
pub mod get_claim_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type 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 GetClaimBuilder<S: BosStr, St: get_claim_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetClaim<S> {
pub fn new() -> GetClaimBuilder<S, get_claim_state::Empty> {
GetClaimBuilder::new()
}
}
impl<S: BosStr> GetClaimBuilder<S, get_claim_state::Empty> {
pub fn new() -> Self {
GetClaimBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetClaimBuilder<S, St>
where
St: get_claim_state::State,
St::Uri: get_claim_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> GetClaimBuilder<S, get_claim_state::SetUri<St>> {
self._fields.0 = Option::Some(value.into());
GetClaimBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetClaimBuilder<S, St>
where
St: get_claim_state::State,
St::Uri: get_claim_state::IsSet,
{
pub fn build(self) -> GetClaim<S> {
GetClaim {
uri: self._fields.0.unwrap(),
}
}
}
pub mod review_view_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type ReviewedBy;
type CreatedAt;
type Status;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ReviewedBy = Unset;
type CreatedAt = Unset;
type Status = Unset;
type Uri = Unset;
}
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 ReviewedBy = Set<members::reviewed_by>;
type CreatedAt = St::CreatedAt;
type Status = St::Status;
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 ReviewedBy = St::ReviewedBy;
type CreatedAt = Set<members::created_at>;
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 ReviewedBy = St::ReviewedBy;
type CreatedAt = St::CreatedAt;
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 ReviewedBy = St::ReviewedBy;
type CreatedAt = St::CreatedAt;
type Status = St::Status;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct reviewed_by(());
pub struct created_at(());
pub struct status(());
pub struct uri(());
}
}
pub struct ReviewViewBuilder<S: BosStr, St: review_view_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<AtUri<S>>>,
Option<Datetime>,
Option<S>,
Option<Did<S>>,
Option<ReviewViewStatus<S>>,
Option<AtUri<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ReviewView<S> {
pub fn new() -> ReviewViewBuilder<S, review_view_state::Empty> {
ReviewViewBuilder::new()
}
}
impl<S: BosStr> ReviewViewBuilder<S, review_view_state::Empty> {
pub fn new() -> Self {
ReviewViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: review_view_state::State> ReviewViewBuilder<S, St> {
pub fn approved_games(mut self, value: impl Into<Option<Vec<AtUri<S>>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_approved_games(mut self, value: Option<Vec<AtUri<S>>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> ReviewViewBuilder<S, St>
where
St: review_view_state::State,
St::CreatedAt: review_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ReviewViewBuilder<S, review_view_state::SetCreatedAt<St>> {
self._fields.1 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: review_view_state::State> ReviewViewBuilder<S, St> {
pub fn reason(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_reason(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> ReviewViewBuilder<S, St>
where
St: review_view_state::State,
St::ReviewedBy: review_view_state::IsUnset,
{
pub fn reviewed_by(
mut self,
value: impl Into<Did<S>>,
) -> ReviewViewBuilder<S, review_view_state::SetReviewedBy<St>> {
self._fields.3 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReviewViewBuilder<S, St>
where
St: review_view_state::State,
St::Status: review_view_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<ReviewViewStatus<S>>,
) -> ReviewViewBuilder<S, review_view_state::SetStatus<St>> {
self._fields.4 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReviewViewBuilder<S, St>
where
St: review_view_state::State,
St::Uri: review_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> ReviewViewBuilder<S, review_view_state::SetUri<St>> {
self._fields.5 = Option::Some(value.into());
ReviewViewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ReviewViewBuilder<S, St>
where
St: review_view_state::State,
St::ReviewedBy: review_view_state::IsSet,
St::CreatedAt: review_view_state::IsSet,
St::Status: review_view_state::IsSet,
St::Uri: review_view_state::IsSet,
{
pub fn build(self) -> ReviewView<S> {
ReviewView {
approved_games: self._fields.0,
created_at: self._fields.1.unwrap(),
reason: self._fields.2,
reviewed_by: self._fields.3.unwrap(),
status: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReviewView<S> {
ReviewView {
approved_games: self._fields.0,
created_at: self._fields.1.unwrap(),
reason: self._fields.2,
reviewed_by: self._fields.3.unwrap(),
status: self._fields.4.unwrap(),
uri: self._fields.5.unwrap(),
extra_data: Some(extra_data),
}
}
}