jacquard-api 0.12.0-beta.1

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: games.gamesgamesgamesgames.createGame
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[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::AtUri;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CreateGame<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_ratings: Option<Vec<AgeRating<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alternative_names: Option<Vec<AlternativeName<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub application_type: Option<ApplicationType<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub engines: Option<Vec<AtUri<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub genres: Option<Vec<Genre<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub keywords: Option<Vec<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub language_supports: Option<Vec<LanguageSupport<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub media: Option<Vec<MediaItem<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub modes: Option<Vec<Mode<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub multiplayer_modes: Option<Vec<MultiplayerMode<S>>>,
    pub name: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub parent: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub player_perspectives: Option<Vec<PlayerPerspective<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub releases: Option<Vec<Release<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub should_publish: Option<bool>,
    ///URL-friendly identifier for the game.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slug: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub storyline: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub summary: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub themes: Option<Vec<Theme<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub time_to_beat: Option<TimeToBeat<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub videos: Option<Vec<ExternalVideo<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub websites: Option<Vec<Website<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 CreateGameOutput<S: BosStr = DefaultStr> {
    pub cid: S,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Response type for games.gamesgamesgamesgames.createGame
pub struct CreateGameResponse;
impl jacquard_common::xrpc::XrpcResp for CreateGameResponse {
    const NSID: &'static str = "games.gamesgamesgamesgames.createGame";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = CreateGameOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for CreateGame<S> {
    const NSID: &'static str = "games.gamesgamesgamesgames.createGame";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = CreateGameResponse;
}

/// Endpoint type for games.gamesgamesgamesgames.createGame
pub struct CreateGameRequest;
impl jacquard_common::xrpc::XrpcEndpoint for CreateGameRequest {
    const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.createGame";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<S: BosStr> = CreateGame<S>;
    type Response = CreateGameResponse;
}