#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct UpdateAccountSigningKey<S: BosStr = DefaultStr> {
pub did: Did<S>,
pub signing_key: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct UpdateAccountSigningKeyResponse;
impl jacquard_common::xrpc::XrpcResp for UpdateAccountSigningKeyResponse {
const NSID: &'static str = "com.atproto.admin.updateAccountSigningKey";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ();
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for UpdateAccountSigningKey<S> {
const NSID: &'static str = "com.atproto.admin.updateAccountSigningKey";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = UpdateAccountSigningKeyResponse;
}
pub struct UpdateAccountSigningKeyRequest;
impl jacquard_common::xrpc::XrpcEndpoint for UpdateAccountSigningKeyRequest {
const PATH: &'static str = "/xrpc/com.atproto.admin.updateAccountSigningKey";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = UpdateAccountSigningKey<S>;
type Response = UpdateAccountSigningKeyResponse;
}
pub mod update_account_signing_key_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 SigningKey;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type SigningKey = Unset;
type Did = Unset;
}
pub struct SetSigningKey<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSigningKey<St> {}
impl<St: State> State for SetSigningKey<St> {
type SigningKey = Set<members::signing_key>;
type Did = St::Did;
}
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 SigningKey = St::SigningKey;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct signing_key(());
pub struct did(());
}
}
pub struct UpdateAccountSigningKeyBuilder<
S: BosStr,
St: update_account_signing_key_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>, Option<Did<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> UpdateAccountSigningKey<S> {
pub fn new() -> UpdateAccountSigningKeyBuilder<
S,
update_account_signing_key_state::Empty,
> {
UpdateAccountSigningKeyBuilder::new()
}
}
impl<
S: BosStr,
> UpdateAccountSigningKeyBuilder<S, update_account_signing_key_state::Empty> {
pub fn new() -> Self {
UpdateAccountSigningKeyBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountSigningKeyBuilder<S, St>
where
St: update_account_signing_key_state::State,
St::Did: update_account_signing_key_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> UpdateAccountSigningKeyBuilder<
S,
update_account_signing_key_state::SetDid<St>,
> {
self._fields.0 = Option::Some(value.into());
UpdateAccountSigningKeyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountSigningKeyBuilder<S, St>
where
St: update_account_signing_key_state::State,
St::SigningKey: update_account_signing_key_state::IsUnset,
{
pub fn signing_key(
mut self,
value: impl Into<Did<S>>,
) -> UpdateAccountSigningKeyBuilder<
S,
update_account_signing_key_state::SetSigningKey<St>,
> {
self._fields.1 = Option::Some(value.into());
UpdateAccountSigningKeyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UpdateAccountSigningKeyBuilder<S, St>
where
St: update_account_signing_key_state::State,
St::SigningKey: update_account_signing_key_state::IsSet,
St::Did: update_account_signing_key_state::IsSet,
{
pub fn build(self) -> UpdateAccountSigningKey<S> {
UpdateAccountSigningKey {
did: self._fields.0.unwrap(),
signing_key: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> UpdateAccountSigningKey<S> {
UpdateAccountSigningKey {
did: self._fields.0.unwrap(),
signing_key: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}