#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_common::types::string::{AtUri, Datetime};
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::games_gamesgamesgamesgames::AgeRating;
use crate::games_gamesgamesgamesgames::AlternativeName;
use crate::games_gamesgamesgamesgames::ApplicationType;
use crate::games_gamesgamesgamesgames::ExternalVideo;
use crate::games_gamesgamesgamesgames::Genre;
use crate::games_gamesgamesgamesgames::LanguageSupport;
use crate::games_gamesgamesgamesgames::MediaItem;
use crate::games_gamesgamesgamesgames::Mode;
use crate::games_gamesgamesgamesgames::MultiplayerMode;
use crate::games_gamesgamesgamesgames::PlayerPerspective;
use crate::games_gamesgamesgamesgames::Release;
use crate::games_gamesgamesgamesgames::Theme;
use crate::games_gamesgamesgamesgames::TimeToBeat;
use crate::games_gamesgamesgamesgames::Website;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PutGame<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub age_ratings: Option<Vec<AgeRating<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub alternative_names: Option<Vec<AlternativeName<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub application_type: Option<ApplicationType<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub engines: Option<Vec<AtUri<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub genres: Option<Vec<Genre<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub keywords: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub language_supports: Option<Vec<LanguageSupport<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub media: Option<Vec<MediaItem<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub modes: Option<Vec<Mode<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub multiplayer_modes: Option<Vec<MultiplayerMode<'a>>>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub parent: Option<AtUri<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub player_perspectives: Option<Vec<PlayerPerspective<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub releases: Option<Vec<Release<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub should_publish: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub storyline: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub summary: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub themes: Option<Vec<Theme<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub time_to_beat: Option<TimeToBeat<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub videos: Option<Vec<ExternalVideo<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub websites: Option<Vec<Website<'a>>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PutGameOutput<'a> {
#[serde(borrow)]
pub cid: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
pub struct PutGameResponse;
impl jacquard_common::xrpc::XrpcResp for PutGameResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.putGame";
const ENCODING: &'static str = "application/json";
type Output<'de> = PutGameOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for PutGame<'a> {
const NSID: &'static str = "games.gamesgamesgamesgames.putGame";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = PutGameResponse;
}
pub struct PutGameRequest;
impl jacquard_common::xrpc::XrpcEndpoint for PutGameRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.putGame";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<'de> = PutGame<'de>;
type Response = PutGameResponse;
}
pub mod put_game_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;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Name = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type Name = S::Name;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Uri = S::Uri;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct name(());
}
}
pub struct PutGameBuilder<'a, S: put_game_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<AgeRating<'a>>>,
Option<Vec<AlternativeName<'a>>>,
Option<ApplicationType<'a>>,
Option<Datetime>,
Option<Vec<AtUri<'a>>>,
Option<Vec<Genre<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<Vec<LanguageSupport<'a>>>,
Option<Vec<MediaItem<'a>>>,
Option<Vec<Mode<'a>>>,
Option<Vec<MultiplayerMode<'a>>>,
Option<CowStr<'a>>,
Option<AtUri<'a>>,
Option<Vec<PlayerPerspective<'a>>>,
Option<Vec<Release<'a>>>,
Option<bool>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Vec<Theme<'a>>>,
Option<TimeToBeat<'a>>,
Option<AtUri<'a>>,
Option<Vec<ExternalVideo<'a>>>,
Option<Vec<Website<'a>>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PutGame<'a> {
pub fn new() -> PutGameBuilder<'a, put_game_state::Empty> {
PutGameBuilder::new()
}
}
impl<'a> PutGameBuilder<'a, put_game_state::Empty> {
pub fn new() -> Self {
PutGameBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn age_ratings(mut self, value: impl Into<Option<Vec<AgeRating<'a>>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_age_ratings(mut self, value: Option<Vec<AgeRating<'a>>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn alternative_names(
mut self,
value: impl Into<Option<Vec<AlternativeName<'a>>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_alternative_names(
mut self,
value: Option<Vec<AlternativeName<'a>>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn application_type(
mut self,
value: impl Into<Option<ApplicationType<'a>>>,
) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_application_type(mut self, value: Option<ApplicationType<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn engines(mut self, value: impl Into<Option<Vec<AtUri<'a>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_engines(mut self, value: Option<Vec<AtUri<'a>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn genres(mut self, value: impl Into<Option<Vec<Genre<'a>>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_genres(mut self, value: Option<Vec<Genre<'a>>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn keywords(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_keywords(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn language_supports(
mut self,
value: impl Into<Option<Vec<LanguageSupport<'a>>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_language_supports(
mut self,
value: Option<Vec<LanguageSupport<'a>>>,
) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn media(mut self, value: impl Into<Option<Vec<MediaItem<'a>>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_media(mut self, value: Option<Vec<MediaItem<'a>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn modes(mut self, value: impl Into<Option<Vec<Mode<'a>>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_modes(mut self, value: Option<Vec<Mode<'a>>>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn multiplayer_modes(
mut self,
value: impl Into<Option<Vec<MultiplayerMode<'a>>>>,
) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_multiplayer_modes(
mut self,
value: Option<Vec<MultiplayerMode<'a>>>,
) -> Self {
self._fields.10 = value;
self
}
}
impl<'a, S> PutGameBuilder<'a, S>
where
S: put_game_state::State,
S::Name: put_game_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> PutGameBuilder<'a, put_game_state::SetName<S>> {
self._fields.11 = Option::Some(value.into());
PutGameBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn parent(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_parent(mut self, value: Option<AtUri<'a>>) -> Self {
self._fields.12 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn player_perspectives(
mut self,
value: impl Into<Option<Vec<PlayerPerspective<'a>>>>,
) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_player_perspectives(
mut self,
value: Option<Vec<PlayerPerspective<'a>>>,
) -> Self {
self._fields.13 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn releases(mut self, value: impl Into<Option<Vec<Release<'a>>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_releases(mut self, value: Option<Vec<Release<'a>>>) -> Self {
self._fields.14 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn should_publish(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_should_publish(mut self, value: Option<bool>) -> Self {
self._fields.15 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn storyline(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_storyline(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.16 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn summary(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_summary(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.17 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn themes(mut self, value: impl Into<Option<Vec<Theme<'a>>>>) -> Self {
self._fields.18 = value.into();
self
}
pub fn maybe_themes(mut self, value: Option<Vec<Theme<'a>>>) -> Self {
self._fields.18 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn time_to_beat(mut self, value: impl Into<Option<TimeToBeat<'a>>>) -> Self {
self._fields.19 = value.into();
self
}
pub fn maybe_time_to_beat(mut self, value: Option<TimeToBeat<'a>>) -> Self {
self._fields.19 = value;
self
}
}
impl<'a, S> PutGameBuilder<'a, S>
where
S: put_game_state::State,
S::Uri: put_game_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> PutGameBuilder<'a, put_game_state::SetUri<S>> {
self._fields.20 = Option::Some(value.into());
PutGameBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn videos(mut self, value: impl Into<Option<Vec<ExternalVideo<'a>>>>) -> Self {
self._fields.21 = value.into();
self
}
pub fn maybe_videos(mut self, value: Option<Vec<ExternalVideo<'a>>>) -> Self {
self._fields.21 = value;
self
}
}
impl<'a, S: put_game_state::State> PutGameBuilder<'a, S> {
pub fn websites(mut self, value: impl Into<Option<Vec<Website<'a>>>>) -> Self {
self._fields.22 = value.into();
self
}
pub fn maybe_websites(mut self, value: Option<Vec<Website<'a>>>) -> Self {
self._fields.22 = value;
self
}
}
impl<'a, S> PutGameBuilder<'a, S>
where
S: put_game_state::State,
S::Uri: put_game_state::IsSet,
S::Name: put_game_state::IsSet,
{
pub fn build(self) -> PutGame<'a> {
PutGame {
age_ratings: self._fields.0,
alternative_names: self._fields.1,
application_type: self._fields.2,
created_at: self._fields.3,
engines: self._fields.4,
genres: self._fields.5,
keywords: self._fields.6,
language_supports: self._fields.7,
media: self._fields.8,
modes: self._fields.9,
multiplayer_modes: self._fields.10,
name: self._fields.11.unwrap(),
parent: self._fields.12,
player_perspectives: self._fields.13,
releases: self._fields.14,
should_publish: self._fields.15,
storyline: self._fields.16,
summary: self._fields.17,
themes: self._fields.18,
time_to_beat: self._fields.19,
uri: self._fields.20.unwrap(),
videos: self._fields.21,
websites: self._fields.22,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> PutGame<'a> {
PutGame {
age_ratings: self._fields.0,
alternative_names: self._fields.1,
application_type: self._fields.2,
created_at: self._fields.3,
engines: self._fields.4,
genres: self._fields.5,
keywords: self._fields.6,
language_supports: self._fields.7,
media: self._fields.8,
modes: self._fields.9,
multiplayer_modes: self._fields.10,
name: self._fields.11.unwrap(),
parent: self._fields.12,
player_perspectives: self._fields.13,
releases: self._fields.14,
should_publish: self._fields.15,
storyline: self._fields.16,
summary: self._fields.17,
themes: self._fields.18,
time_to_beat: self._fields.19,
uri: self._fields.20.unwrap(),
videos: self._fields.21,
websites: self._fields.22,
extra_data: Some(extra_data),
}
}
}