#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Did, Handle};
use jacquard_common::types::value::Data;
use jacquard_common::{BosStr, 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 UpdateAccountHandle<S: BosStr = DefaultStr> {
pub did: Did<S>,
pub handle: Handle<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct UpdateAccountHandleResponse;
impl jacquard_common::xrpc::XrpcResp for UpdateAccountHandleResponse {
const NSID: &'static str = "com.atproto.admin.updateAccountHandle";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ();
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for UpdateAccountHandle<S> {
const NSID: &'static str = "com.atproto.admin.updateAccountHandle";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Response = UpdateAccountHandleResponse;
}
pub struct UpdateAccountHandleRequest;
impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountHandleRequest {
const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountHandle";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Request<S: BosStr> = UpdateAccountHandle<S>;
type Response = UpdateAccountHandleResponse;
}
pub mod update_account_handle_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 Did;
type Handle;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
type Handle = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
type Handle = St::Handle;
}
pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetHandle<St> {}
impl<St: State> State for SetHandle<St> {
type Did = St::Did;
type Handle = Set<members::handle>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
pub struct handle(());
}
}
pub struct UpdateAccountHandleBuilder<S: BosStr, St: update_account_handle_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>, Option<Handle<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> UpdateAccountHandle<S> {
pub fn new() -> UpdateAccountHandleBuilder<S, update_account_handle_state::Empty> {
UpdateAccountHandleBuilder::new()
}
}
impl<S: BosStr> UpdateAccountHandleBuilder<S, update_account_handle_state::Empty> {
pub fn new() -> Self {
UpdateAccountHandleBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountHandleBuilder<S, St>
where
St: update_account_handle_state::State,
St::Did: update_account_handle_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> UpdateAccountHandleBuilder<S, update_account_handle_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
UpdateAccountHandleBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountHandleBuilder<S, St>
where
St: update_account_handle_state::State,
St::Handle: update_account_handle_state::IsUnset,
{
pub fn handle(
mut self,
value: impl Into<Handle<S>>,
) -> UpdateAccountHandleBuilder<S, update_account_handle_state::SetHandle<St>> {
self._fields.1 = Option::Some(value.into());
UpdateAccountHandleBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountHandleBuilder<S, St>
where
St: update_account_handle_state::State,
St::Did: update_account_handle_state::IsSet,
St::Handle: update_account_handle_state::IsSet,
{
pub fn build(self) -> UpdateAccountHandle<S> {
UpdateAccountHandle {
did: self._fields.0.unwrap(),
handle: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> UpdateAccountHandle<S> {
UpdateAccountHandle {
did: self._fields.0.unwrap(),
handle: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}