jacquard-api 0.12.0-beta.2

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: games.gamesgamesgamesgames.getGame
//
// 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;

use crate::games_gamesgamesgamesgames::GameDetailView;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::AtUri;
use jacquard_common::types::value::Data;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
use jacquard_derive::IntoStatic;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetGame<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub apple_app_store_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub epic_games_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gog_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub google_play_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub humble_bundle_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub igdb_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub include_actor_credits: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub include_org_credits: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nintendo_eshop_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_station_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slug: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub steam_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub xbox_id: Option<S>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetGameOutput<S: BosStr = DefaultStr> {
    pub game: GameDetailView<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

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

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetGame<S> {
    const NSID: &'static str = "games.gamesgamesgamesgames.getGame";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetGameResponse;
}

/// Endpoint type for games.gamesgamesgamesgames.getGame
pub struct GetGameRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetGameRequest {
    const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getGame";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<S: BosStr> = GetGame<S>;
    type Response = GetGameResponse;
}

pub mod get_game_state {

    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type.
pub struct GetGameBuilder<S: BosStr, St: get_game_state::State> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<bool>,
        Option<bool>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<AtUri<S>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl<S: BosStr> GetGame<S> {
    /// Create a new builder for this type.
    pub fn new() -> GetGameBuilder<S, get_game_state::Empty> {
        GetGameBuilder::new()
    }
}

impl<S: BosStr> GetGameBuilder<S, get_game_state::Empty> {
    /// Create a new builder with all fields unset.
    pub fn new() -> Self {
        GetGameBuilder {
            _state: PhantomData,
            _fields: (
                None, None, None, None, None, None, None, None, None, None, None, None, None, None,
            ),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `appleAppStoreId` field (optional)
    pub fn apple_app_store_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `appleAppStoreId` field to an Option value (optional)
    pub fn maybe_apple_app_store_id(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `epicGamesId` field (optional)
    pub fn epic_games_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `epicGamesId` field to an Option value (optional)
    pub fn maybe_epic_games_id(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `gogId` field (optional)
    pub fn gog_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `gogId` field to an Option value (optional)
    pub fn maybe_gog_id(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `googlePlayId` field (optional)
    pub fn google_play_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `googlePlayId` field to an Option value (optional)
    pub fn maybe_google_play_id(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `humbleBundleId` field (optional)
    pub fn humble_bundle_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `humbleBundleId` field to an Option value (optional)
    pub fn maybe_humble_bundle_id(mut self, value: Option<S>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `igdbId` field (optional)
    pub fn igdb_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `igdbId` field to an Option value (optional)
    pub fn maybe_igdb_id(mut self, value: Option<S>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `includeActorCredits` field (optional)
    pub fn include_actor_credits(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `includeActorCredits` field to an Option value (optional)
    pub fn maybe_include_actor_credits(mut self, value: Option<bool>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `includeOrgCredits` field (optional)
    pub fn include_org_credits(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `includeOrgCredits` field to an Option value (optional)
    pub fn maybe_include_org_credits(mut self, value: Option<bool>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `nintendoEshopId` field (optional)
    pub fn nintendo_eshop_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `nintendoEshopId` field to an Option value (optional)
    pub fn maybe_nintendo_eshop_id(mut self, value: Option<S>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `playStationId` field (optional)
    pub fn play_station_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `playStationId` field to an Option value (optional)
    pub fn maybe_play_station_id(mut self, value: Option<S>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `slug` field (optional)
    pub fn slug(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `slug` field to an Option value (optional)
    pub fn maybe_slug(mut self, value: Option<S>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `steamId` field (optional)
    pub fn steam_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `steamId` field to an Option value (optional)
    pub fn maybe_steam_id(mut self, value: Option<S>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `uri` field (optional)
    pub fn uri(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `uri` field to an Option value (optional)
    pub fn maybe_uri(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<S: BosStr, St: get_game_state::State> GetGameBuilder<S, St> {
    /// Set the `xboxId` field (optional)
    pub fn xbox_id(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `xboxId` field to an Option value (optional)
    pub fn maybe_xbox_id(mut self, value: Option<S>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<S: BosStr, St> GetGameBuilder<S, St>
where
    St: get_game_state::State,
{
    /// Build the final struct.
    pub fn build(self) -> GetGame<S> {
        GetGame {
            apple_app_store_id: self._fields.0,
            epic_games_id: self._fields.1,
            gog_id: self._fields.2,
            google_play_id: self._fields.3,
            humble_bundle_id: self._fields.4,
            igdb_id: self._fields.5,
            include_actor_credits: self._fields.6,
            include_org_credits: self._fields.7,
            nintendo_eshop_id: self._fields.8,
            play_station_id: self._fields.9,
            slug: self._fields.10,
            steam_id: self._fields.11,
            uri: self._fields.12,
            xbox_id: self._fields.13,
        }
    }
}