#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct GetProfile<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub handle: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod get_profile_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 GetProfileBuilder<'a, S: get_profile_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<jacquard_common::CowStr<'a>>,),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> GetProfile<'a> {
pub fn new() -> GetProfileBuilder<'a, get_profile_state::Empty> {
GetProfileBuilder::new()
}
}
impl<'a> GetProfileBuilder<'a, get_profile_state::Empty> {
pub fn new() -> Self {
GetProfileBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None,),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: get_profile_state::State> GetProfileBuilder<'a, S> {
pub fn handle(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_handle(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> GetProfileBuilder<'a, S>
where
S: get_profile_state::State,
{
pub fn build(self) -> GetProfile<'a> {
GetProfile {
handle: self.__unsafe_private_named.0,
}
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct GetProfileOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub handle: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub profile: std::option::Option<GetProfileOutputProfile<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub profile_type: std::option::Option<GetProfileOutputProfileType<'a>>,
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum GetProfileOutputProfile<'a> {
#[serde(rename = "games.gamesgamesgamesgames.defs#actorProfileDetailView")]
ActorProfileDetailView(
Box<crate::games_gamesgamesgamesgames::ActorProfileDetailView<'a>>,
),
#[serde(rename = "games.gamesgamesgamesgames.defs#orgProfileDetailView")]
OrgProfileDetailView(
Box<crate::games_gamesgamesgamesgames::OrgProfileDetailView<'a>>,
),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum GetProfileOutputProfileType<'a> {
Actor,
Org,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> GetProfileOutputProfileType<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Actor => "actor",
Self::Org => "org",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for GetProfileOutputProfileType<'a> {
fn from(s: &'a str) -> Self {
match s {
"actor" => Self::Actor,
"org" => Self::Org,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for GetProfileOutputProfileType<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"actor" => Self::Actor,
"org" => Self::Org,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for GetProfileOutputProfileType<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for GetProfileOutputProfileType<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for GetProfileOutputProfileType<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for GetProfileOutputProfileType<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for GetProfileOutputProfileType<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for GetProfileOutputProfileType<'_> {
type Output = GetProfileOutputProfileType<'static>;
fn into_static(self) -> Self::Output {
match self {
GetProfileOutputProfileType::Actor => GetProfileOutputProfileType::Actor,
GetProfileOutputProfileType::Org => GetProfileOutputProfileType::Org,
GetProfileOutputProfileType::Other(v) => {
GetProfileOutputProfileType::Other(v.into_static())
}
}
}
}
pub struct GetProfileResponse;
impl jacquard_common::xrpc::XrpcResp for GetProfileResponse {
const NSID: &'static str = "games.gamesgamesgamesgames.getProfile";
const ENCODING: &'static str = "application/json";
type Output<'de> = GetProfileOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for GetProfile<'a> {
const NSID: &'static str = "games.gamesgamesgamesgames.getProfile";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetProfileResponse;
}
pub struct GetProfileRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetProfileRequest {
const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getProfile";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = GetProfile<'de>;
type Response = GetProfileResponse;
}