Skip to main content

jacquard_api/com_atproto/server/
delete_session.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.server.deleteSession
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::value::Data;
16use jacquard_derive::{IntoStatic, open_union};
17use serde::{Serialize, Deserialize};
18
19#[derive(
20    Serialize,
21    Deserialize,
22    Debug,
23    Clone,
24    PartialEq,
25    Eq,
26    thiserror::Error,
27    miette::Diagnostic
28)]
29
30#[serde(tag = "error", content = "message")]
31pub enum DeleteSessionError {
32    #[serde(rename = "InvalidToken")]
33    InvalidToken(Option<SmolStr>),
34    #[serde(rename = "ExpiredToken")]
35    ExpiredToken(Option<SmolStr>),
36    /// Catch-all for unknown error codes.
37    #[serde(untagged)]
38    Other { error: SmolStr, message: Option<SmolStr> },
39}
40
41impl core::fmt::Display for DeleteSessionError {
42    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
43        match self {
44            Self::InvalidToken(msg) => {
45                write!(f, "InvalidToken")?;
46                if let Some(msg) = msg {
47                    write!(f, ": {}", msg)?;
48                }
49                Ok(())
50            }
51            Self::ExpiredToken(msg) => {
52                write!(f, "ExpiredToken")?;
53                if let Some(msg) = msg {
54                    write!(f, ": {}", msg)?;
55                }
56                Ok(())
57            }
58            Self::Other { error, message } => {
59                write!(f, "{}", error)?;
60                if let Some(msg) = message {
61                    write!(f, ": {}", msg)?;
62                }
63                Ok(())
64            }
65        }
66    }
67}
68
69/** Request marker for the `com.atproto.server.deleteSession` procedure.
70
71This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/
72
73#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
74pub struct DeleteSession;
75/** Response marker for the `com.atproto.server.deleteSession` procedure.
76
77Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `()` for this endpoint.*/
78pub struct DeleteSessionResponse;
79impl jacquard_common::xrpc::XrpcResp for DeleteSessionResponse {
80    const NSID: &'static str = "com.atproto.server.deleteSession";
81    const ENCODING: &'static str = "application/json";
82    type Output<S: BosStr> = ();
83    type Err = DeleteSessionError;
84}
85
86impl jacquard_common::xrpc::XrpcRequest for DeleteSession {
87    const NSID: &'static str = "com.atproto.server.deleteSession";
88    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
89        "application/json",
90    );
91    type Response = DeleteSessionResponse;
92}
93
94/** Endpoint marker for the `com.atproto.server.deleteSession` procedure.
95
96Path: `/xrpc/com.atproto.server.deleteSession`. The request payload type is `DeleteSession`; use this marker with lower-level `XrpcEndpoint` APIs when you need endpoint metadata.*/
97pub struct DeleteSessionRequest;
98impl jacquard_common::xrpc::XrpcEndpoint for DeleteSessionRequest {
99    const PATH: &'static str = "/xrpc/com.atproto.server.deleteSession";
100    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
101        "application/json",
102    );
103    type Request<S: BosStr> = DeleteSession;
104    type Response = DeleteSessionResponse;
105}