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 jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20#[builder(start_fn = new)]
21pub struct ResetPassword<'a> {
22 #[serde(borrow)]
23 #[builder(into)]
24 pub password: jacquard_common::CowStr<'a>,
25 #[serde(borrow)]
26 #[builder(into)]
27 pub token: jacquard_common::CowStr<'a>,
28 #[serde(flatten)]
29 #[serde(borrow)]
30 #[builder(default)]
31 pub extra_data: ::std::collections::BTreeMap<
32 ::jacquard_common::smol_str::SmolStr,
33 ::jacquard_common::types::value::Data<'a>,
34 >,
35}
36
37#[jacquard_derive::open_union]
38#[derive(
39 serde::Serialize,
40 serde::Deserialize,
41 Debug,
42 Clone,
43 PartialEq,
44 Eq,
45 thiserror::Error,
46 miette::Diagnostic,
47 jacquard_derive::IntoStatic
48)]
49#[serde(tag = "error", content = "message")]
50#[serde(bound(deserialize = "'de: 'a"))]
51pub enum ResetPasswordError<'a> {
52 #[serde(rename = "ExpiredToken")]
53 ExpiredToken(std::option::Option<String>),
54 #[serde(rename = "InvalidToken")]
55 InvalidToken(std::option::Option<String>),
56}
57
58impl std::fmt::Display for ResetPasswordError<'_> {
59 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60 match self {
61 Self::ExpiredToken(msg) => {
62 write!(f, "ExpiredToken")?;
63 if let Some(msg) = msg {
64 write!(f, ": {}", msg)?;
65 }
66 Ok(())
67 }
68 Self::InvalidToken(msg) => {
69 write!(f, "InvalidToken")?;
70 if let Some(msg) = msg {
71 write!(f, ": {}", msg)?;
72 }
73 Ok(())
74 }
75 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
76 }
77 }
78}
79
80///Response type for
81///com.atproto.server.resetPassword
82pub struct ResetPasswordResponse;
83impl jacquard_common::xrpc::XrpcResp for ResetPasswordResponse {
84 const NSID: &'static str = "com.atproto.server.resetPassword";
85 const ENCODING: &'static str = "application/json";
86 type Output<'de> = ();
87 type Err<'de> = ResetPasswordError<'de>;
88}
89
90impl<'a> jacquard_common::xrpc::XrpcRequest for ResetPassword<'a> {
91 const NSID: &'static str = "com.atproto.server.resetPassword";
92 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
93 "application/json",
94 );
95 type Response = ResetPasswordResponse;
96}
97
98///Endpoint type for
99///com.atproto.server.resetPassword
100pub struct ResetPasswordRequest;
101impl jacquard_common::xrpc::XrpcEndpoint for ResetPasswordRequest {
102 const PATH: &'static str = "/xrpc/com.atproto.server.resetPassword";
103 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
104 "application/json",
105 );
106 type Request<'de> = ResetPassword<'de>;
107 type Response = ResetPasswordResponse;
108}