#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_common::types::string::Did;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SwapLaunchToken<'a> {
#[serde(borrow)]
pub launch_token: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct SwapLaunchTokenOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub did: Option<Did<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub handle: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub name: Option<CowStr<'a>>,
#[serde(borrow)]
pub token: CowStr<'a>,
}
pub struct SwapLaunchTokenResponse;
impl jacquard_common::xrpc::XrpcResp for SwapLaunchTokenResponse {
const NSID: &'static str = "app.ocho.server.swapLaunchToken";
const ENCODING: &'static str = "application/json";
type Output<'de> = SwapLaunchTokenOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for SwapLaunchToken<'a> {
const NSID: &'static str = "app.ocho.server.swapLaunchToken";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = SwapLaunchTokenResponse;
}
pub struct SwapLaunchTokenRequest;
impl jacquard_common::xrpc::XrpcEndpoint for SwapLaunchTokenRequest {
const PATH: &'static str = "/xrpc/app.ocho.server.swapLaunchToken";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = SwapLaunchToken<'de>;
type Response = SwapLaunchTokenResponse;
}
pub mod swap_launch_token_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 {
type LaunchToken;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type LaunchToken = Unset;
}
pub struct SetLaunchToken<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLaunchToken<S> {}
impl<S: State> State for SetLaunchToken<S> {
type LaunchToken = Set<members::launch_token>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct launch_token(());
}
}
pub struct SwapLaunchTokenBuilder<'a, S: swap_launch_token_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SwapLaunchToken<'a> {
pub fn new() -> SwapLaunchTokenBuilder<'a, swap_launch_token_state::Empty> {
SwapLaunchTokenBuilder::new()
}
}
impl<'a> SwapLaunchTokenBuilder<'a, swap_launch_token_state::Empty> {
pub fn new() -> Self {
SwapLaunchTokenBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SwapLaunchTokenBuilder<'a, S>
where
S: swap_launch_token_state::State,
S::LaunchToken: swap_launch_token_state::IsUnset,
{
pub fn launch_token(
mut self,
value: impl Into<CowStr<'a>>,
) -> SwapLaunchTokenBuilder<'a, swap_launch_token_state::SetLaunchToken<S>> {
self._fields.0 = Option::Some(value.into());
SwapLaunchTokenBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SwapLaunchTokenBuilder<'a, S>
where
S: swap_launch_token_state::State,
S::LaunchToken: swap_launch_token_state::IsSet,
{
pub fn build(self) -> SwapLaunchToken<'a> {
SwapLaunchToken {
launch_token: self._fields.0.unwrap(),
}
}
}