#[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;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::games_gamesgamesgamesgames::search_slugs;
#[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 SearchSlugs<S: BosStr = DefaultStr> {
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
pub slug: S,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct SearchSlugsOutput<S: BosStr = DefaultStr> {
pub slugs: Vec<search_slugs::SlugResult<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 SlugResult<S: BosStr = DefaultStr> {
pub r#ref: AtUri<S>,
pub slug: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct SearchSlugsResponse;
impl jacquard_common::xrpc::XrpcResp for SearchSlugsResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.searchSlugs";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = SearchSlugsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for SearchSlugs<S> {
const NSID: &'static str = "games.gamesgamesgamesgames.searchSlugs";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = SearchSlugsResponse;
}
pub struct SearchSlugsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for SearchSlugsRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.searchSlugs";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = SearchSlugs<S>;
type Response = SearchSlugsResponse;
}
impl<S: BosStr> LexiconSchema for SlugResult<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.searchSlugs"
}
fn def_name() -> &'static str {
"slugResult"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_searchSlugs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn _default_limit() -> Option<i64> {
Some(10i64)
}
pub mod search_slugs_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 Slug;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Slug = Unset;
}
pub struct SetSlug<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSlug<St> {}
impl<St: State> State for SetSlug<St> {
type Slug = Set<members::slug>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct slug(());
}
}
pub struct SearchSlugsBuilder<S: BosStr, St: search_slugs_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SearchSlugs<S> {
pub fn new() -> SearchSlugsBuilder<S, search_slugs_state::Empty> {
SearchSlugsBuilder::new()
}
}
impl<S: BosStr> SearchSlugsBuilder<S, search_slugs_state::Empty> {
pub fn new() -> Self {
SearchSlugsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: search_slugs_state::State> SearchSlugsBuilder<S, St> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> SearchSlugsBuilder<S, St>
where
St: search_slugs_state::State,
St::Slug: search_slugs_state::IsUnset,
{
pub fn slug(
mut self,
value: impl Into<S>,
) -> SearchSlugsBuilder<S, search_slugs_state::SetSlug<St>> {
self._fields.1 = Option::Some(value.into());
SearchSlugsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SearchSlugsBuilder<S, St>
where
St: search_slugs_state::State,
St::Slug: search_slugs_state::IsSet,
{
pub fn build(self) -> SearchSlugs<S> {
SearchSlugs {
limit: self._fields.0,
slug: self._fields.1.unwrap(),
}
}
}
pub mod slug_result_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 Slug;
type Ref;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Slug = Unset;
type Ref = Unset;
}
pub struct SetSlug<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSlug<St> {}
impl<St: State> State for SetSlug<St> {
type Slug = Set<members::slug>;
type Ref = St::Ref;
}
pub struct SetRef<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRef<St> {}
impl<St: State> State for SetRef<St> {
type Slug = St::Slug;
type Ref = Set<members::r#ref>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct slug(());
pub struct r#ref(());
}
}
pub struct SlugResultBuilder<S: BosStr, St: slug_result_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SlugResult<S> {
pub fn new() -> SlugResultBuilder<S, slug_result_state::Empty> {
SlugResultBuilder::new()
}
}
impl<S: BosStr> SlugResultBuilder<S, slug_result_state::Empty> {
pub fn new() -> Self {
SlugResultBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SlugResultBuilder<S, St>
where
St: slug_result_state::State,
St::Ref: slug_result_state::IsUnset,
{
pub fn r#ref(
mut self,
value: impl Into<AtUri<S>>,
) -> SlugResultBuilder<S, slug_result_state::SetRef<St>> {
self._fields.0 = Option::Some(value.into());
SlugResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SlugResultBuilder<S, St>
where
St: slug_result_state::State,
St::Slug: slug_result_state::IsUnset,
{
pub fn slug(
mut self,
value: impl Into<S>,
) -> SlugResultBuilder<S, slug_result_state::SetSlug<St>> {
self._fields.1 = Option::Some(value.into());
SlugResultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SlugResultBuilder<S, St>
where
St: slug_result_state::State,
St::Slug: slug_result_state::IsSet,
St::Ref: slug_result_state::IsSet,
{
pub fn build(self) -> SlugResult<S> {
SlugResult {
r#ref: self._fields.0.unwrap(),
slug: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SlugResult<S> {
SlugResult {
r#ref: self._fields.0.unwrap(),
slug: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_games_gamesgamesgamesgames_searchSlugs() -> 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.searchSlugs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("slug")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("limit"),
LexXrpcParametersProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("slug"),
LexXrpcParametersProperty::String(LexString {
description: Some(CowStr::new_static(
"The slug value to search for.",
)),
min_length: Some(1usize),
max_length: Some(64usize),
..Default::default()
}),
);
map
},
..Default::default()
})),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("slugResult"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("slug"),
SmolStr::new_static("ref"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("ref"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("slug"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}