1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.server.resetPassword
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 bon::Builder
17)]
18#[serde(rename_all = "camelCase")]
19#[builder(start_fn = new)]
20pub struct ResetPassword<'a> {
21 #[serde(borrow)]
22 #[builder(into)]
23 pub password: jacquard_common::CowStr<'a>,
24 #[serde(borrow)]
25 #[builder(into)]
26 pub token: jacquard_common::CowStr<'a>,
27 #[serde(flatten)]
28 #[serde(borrow)]
29 #[builder(default)]
30 pub extra_data: ::std::collections::BTreeMap<
31 ::jacquard_common::smol_str::SmolStr,
32 ::jacquard_common::types::value::Data<'a>,
33 >,
34}
35
36impl jacquard_common::IntoStatic for ResetPassword<'_> {
37 type Output = ResetPassword<'static>;
38 fn into_static(self) -> Self::Output {
39 ResetPassword {
40 password: self.password.into_static(),
41 token: self.token.into_static(),
42 extra_data: self.extra_data.into_static(),
43 }
44 }
45}
46
47#[jacquard_derive::open_union]
48#[derive(
49 serde::Serialize,
50 serde::Deserialize,
51 Debug,
52 Clone,
53 PartialEq,
54 Eq,
55 thiserror::Error,
56 miette::Diagnostic
57)]
58#[serde(tag = "error", content = "message")]
59#[serde(bound(deserialize = "'de: 'a"))]
60pub enum ResetPasswordError<'a> {
61 #[serde(rename = "ExpiredToken")]
62 ExpiredToken(std::option::Option<String>),
63 #[serde(rename = "InvalidToken")]
64 InvalidToken(std::option::Option<String>),
65}
66
67impl std::fmt::Display for ResetPasswordError<'_> {
68 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
69 match self {
70 Self::ExpiredToken(msg) => {
71 write!(f, "ExpiredToken")?;
72 if let Some(msg) = msg {
73 write!(f, ": {}", msg)?;
74 }
75 Ok(())
76 }
77 Self::InvalidToken(msg) => {
78 write!(f, "InvalidToken")?;
79 if let Some(msg) = msg {
80 write!(f, ": {}", msg)?;
81 }
82 Ok(())
83 }
84 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
85 }
86 }
87}
88
89impl jacquard_common::IntoStatic for ResetPasswordError<'_> {
90 type Output = ResetPasswordError<'static>;
91 fn into_static(self) -> Self::Output {
92 match self {
93 ResetPasswordError::ExpiredToken(v) => {
94 ResetPasswordError::ExpiredToken(v.into_static())
95 }
96 ResetPasswordError::InvalidToken(v) => {
97 ResetPasswordError::InvalidToken(v.into_static())
98 }
99 ResetPasswordError::Unknown(v) => {
100 ResetPasswordError::Unknown(v.into_static())
101 }
102 }
103 }
104}
105
106impl jacquard_common::types::xrpc::XrpcRequest for ResetPassword<'_> {
107 const NSID: &'static str = "com.atproto.server.resetPassword";
108 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure(
109 "application/json",
110 );
111 const OUTPUT_ENCODING: &'static str = "application/json";
112 type Output<'de> = ();
113 type Err<'de> = ResetPasswordError<'de>;
114}