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    Default
36)]
37#[serde(rename_all = "camelCase")]
38pub struct DereferenceScopeOutput<'a> {
39    /// The full oauth permission scope
40    #[serde(borrow)]
41    pub scope: jacquard_common::CowStr<'a>,
42}
43
44#[jacquard_derive::open_union]
45#[derive(
46    serde::Serialize,
47    serde::Deserialize,
48    Debug,
49    Clone,
50    PartialEq,
51    Eq,
52    thiserror::Error,
53    miette::Diagnostic,
54    jacquard_derive::IntoStatic
55)]
56#[serde(tag = "error", content = "message")]
57#[serde(bound(deserialize = "'de: 'a"))]
58pub enum DereferenceScopeError<'a> {
59    /// An invalid scope reference was provided.
60    #[serde(rename = "InvalidScopeReference")]
61    InvalidScopeReference(std::option::Option<String>),
62}
63
64impl std::fmt::Display for DereferenceScopeError<'_> {
65    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66        match self {
67            Self::InvalidScopeReference(msg) => {
68                write!(f, "InvalidScopeReference")?;
69                if let Some(msg) = msg {
70                    write!(f, ": {}", msg)?;
71                }
72                Ok(())
73            }
74            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
75        }
76    }
77}
78
79/// Response type for
80///com.atproto.temp.dereferenceScope
81pub struct DereferenceScopeResponse;
82impl jacquard_common::xrpc::XrpcResp for DereferenceScopeResponse {
83    const NSID: &'static str = "com.atproto.temp.dereferenceScope";
84    const ENCODING: &'static str = "application/json";
85    type Output<'de> = DereferenceScopeOutput<'de>;
86    type Err<'de> = DereferenceScopeError<'de>;
87}
88
89impl<'a> jacquard_common::xrpc::XrpcRequest for DereferenceScope<'a> {
90    const NSID: &'static str = "com.atproto.temp.dereferenceScope";
91    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
92    type Response = DereferenceScopeResponse;
93}
94
95/// Endpoint type for
96///com.atproto.temp.dereferenceScope
97pub struct DereferenceScopeRequest;
98impl jacquard_common::xrpc::XrpcEndpoint for DereferenceScopeRequest {
99    const PATH: &'static str = "/xrpc/com.atproto.temp.dereferenceScope";
100    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
101    type Request<'de> = DereferenceScope<'de>;
102    type Response = DereferenceScopeResponse;
103}