jacquard_api/com_atproto/temp/
dereference_scope.rs

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