#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::games_gamesgamesgamesgames::GameSummaryView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListGames<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub age_ratings: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub application_types: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub did: Option<Did<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub genres: Option<Vec<S>>,
#[serde(default = "_default_include_cancelled")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_cancelled: Option<bool>,
#[serde(default = "_default_include_unrated")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_unrated: Option<bool>,
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub modes: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub player_perspectives: Option<Vec<S>>,
#[serde(default = "_default_sort")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort: Option<S>,
#[serde(default = "_default_sort_direction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_direction: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub themes: Option<Vec<S>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListGamesOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
pub games: Vec<GameSummaryView<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct ListGamesResponse;
impl jacquard_common::xrpc::XrpcResp for ListGamesResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.listGames";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ListGamesOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for ListGames<S> {
const NSID: &'static str = "games.gamesgamesgamesgames.listGames";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = ListGamesResponse;
}
pub struct ListGamesRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListGamesRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.listGames";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = ListGames<S>;
type Response = ListGamesResponse;
}
fn _default_include_cancelled() -> Option<bool> {
Some(false)
}
fn _default_include_unrated() -> Option<bool> {
Some(false)
}
fn _default_limit() -> Option<i64> {
Some(20i64)
}
fn _default_sort<S: jacquard_common::FromStaticStr>() -> Option<S> {
Some(S::from_static("indexed_at"))
}
fn _default_sort_direction<S: jacquard_common::FromStaticStr>() -> Option<S> {
Some(S::from_static("desc"))
}
pub mod list_games_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 {}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {}
#[allow(non_camel_case_types)]
pub mod members {}
}
pub struct ListGamesBuilder<St: list_games_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<S>>,
Option<Vec<S>>,
Option<S>,
Option<Did<S>>,
Option<Vec<S>>,
Option<bool>,
Option<bool>,
Option<i64>,
Option<Vec<S>>,
Option<Vec<S>>,
Option<S>,
Option<S>,
Option<Vec<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl ListGames<DefaultStr> {
pub fn new() -> ListGamesBuilder<list_games_state::Empty, DefaultStr> {
ListGamesBuilder::new()
}
}
impl<S: BosStr> ListGames<S> {
pub fn builder() -> ListGamesBuilder<list_games_state::Empty, S> {
ListGamesBuilder::builder()
}
}
impl ListGamesBuilder<list_games_state::Empty, DefaultStr> {
pub fn new() -> Self {
ListGamesBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> ListGamesBuilder<list_games_state::Empty, S> {
pub fn builder() -> Self {
ListGamesBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn age_ratings(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_age_ratings(mut self, value: Option<Vec<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn application_types(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_application_types(mut self, value: Option<Vec<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn did(mut self, value: impl Into<Option<Did<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_did(mut self, value: Option<Did<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn genres(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_genres(mut self, value: Option<Vec<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn include_cancelled(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_include_cancelled(mut self, value: Option<bool>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn include_unrated(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_include_unrated(mut self, value: Option<bool>) -> Self {
self._fields.6 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.7 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn modes(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_modes(mut self, value: Option<Vec<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn player_perspectives(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_player_perspectives(mut self, value: Option<Vec<S>>) -> Self {
self._fields.9 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn sort(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_sort(mut self, value: Option<S>) -> Self {
self._fields.10 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn sort_direction(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_sort_direction(mut self, value: Option<S>) -> Self {
self._fields.11 = value;
self
}
}
impl<St: list_games_state::State, S: BosStr> ListGamesBuilder<St, S> {
pub fn themes(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_themes(mut self, value: Option<Vec<S>>) -> Self {
self._fields.12 = value;
self
}
}
impl<St, S: BosStr> ListGamesBuilder<St, S>
where
St: list_games_state::State,
{
pub fn build(self) -> ListGames<S> {
ListGames {
age_ratings: self._fields.0,
application_types: self._fields.1,
cursor: self._fields.2,
did: self._fields.3,
genres: self._fields.4,
include_cancelled: self._fields.5,
include_unrated: self._fields.6,
limit: self._fields.7,
modes: self._fields.8,
player_perspectives: self._fields.9,
sort: self._fields.10,
sort_direction: self._fields.11,
themes: self._fields.12,
}
}
}