jacquard_api/com_atproto/server/
delete_session.rs1#[allow(unused_imports)]
9use core::marker::PhantomData;
10use jacquard_common::CowStr;
11use jacquard_derive::{IntoStatic, open_union};
12use serde::{Serialize, Deserialize};
13
14#[open_union]
15#[derive(
16 Serialize,
17 Deserialize,
18 Debug,
19 Clone,
20 PartialEq,
21 Eq,
22 thiserror::Error,
23 miette::Diagnostic,
24 IntoStatic
25)]
26
27#[serde(tag = "error", content = "message")]
28#[serde(bound(deserialize = "'de: 'a"))]
29pub enum DeleteSessionError<'a> {
30 #[serde(rename = "InvalidToken")]
31 InvalidToken(Option<CowStr<'a>>),
32 #[serde(rename = "ExpiredToken")]
33 ExpiredToken(Option<CowStr<'a>>),
34}
35
36impl core::fmt::Display for DeleteSessionError<'_> {
37 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
38 match self {
39 Self::InvalidToken(msg) => {
40 write!(f, "InvalidToken")?;
41 if let Some(msg) = msg {
42 write!(f, ": {}", msg)?;
43 }
44 Ok(())
45 }
46 Self::ExpiredToken(msg) => {
47 write!(f, "ExpiredToken")?;
48 if let Some(msg) = msg {
49 write!(f, ": {}", msg)?;
50 }
51 Ok(())
52 }
53 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
54 }
55 }
56}
57
58#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
61pub struct DeleteSession;
62pub struct DeleteSessionResponse;
64impl jacquard_common::xrpc::XrpcResp for DeleteSessionResponse {
65 const NSID: &'static str = "com.atproto.server.deleteSession";
66 const ENCODING: &'static str = "application/json";
67 type Output<'de> = ();
68 type Err<'de> = DeleteSessionError<'de>;
69}
70
71impl jacquard_common::xrpc::XrpcRequest for DeleteSession {
72 const NSID: &'static str = "com.atproto.server.deleteSession";
73 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
74 "application/json",
75 );
76 type Response = DeleteSessionResponse;
77}
78
79pub struct DeleteSessionRequest;
81impl jacquard_common::xrpc::XrpcEndpoint for DeleteSessionRequest {
82 const PATH: &'static str = "/xrpc/com.atproto.server.deleteSession";
83 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
84 "application/json",
85 );
86 type Request<'de> = DeleteSession;
87 type Response = DeleteSessionResponse;
88}