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)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct DereferenceScope<'a> {
20 #[serde(borrow)]
21 #[builder(into)]
22 pub scope: jacquard_common::CowStr<'a>,
23}
24
25impl jacquard_common::IntoStatic for DereferenceScope<'_> {
26 type Output = DereferenceScope<'static>;
27 fn into_static(self) -> Self::Output {
28 DereferenceScope {
29 scope: self.scope.into_static(),
30 }
31 }
32}
33
34#[jacquard_derive::lexicon]
35#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
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
43impl jacquard_common::IntoStatic for DereferenceScopeOutput<'_> {
44 type Output = DereferenceScopeOutput<'static>;
45 fn into_static(self) -> Self::Output {
46 DereferenceScopeOutput {
47 scope: self.scope.into_static(),
48 extra_data: self.extra_data.into_static(),
49 }
50 }
51}
52
53#[jacquard_derive::open_union]
54#[derive(
55 serde::Serialize,
56 serde::Deserialize,
57 Debug,
58 Clone,
59 PartialEq,
60 Eq,
61 thiserror::Error,
62 miette::Diagnostic
63)]
64#[serde(tag = "error", content = "message")]
65#[serde(bound(deserialize = "'de: 'a"))]
66pub enum DereferenceScopeError<'a> {
67 ///An invalid scope reference was provided.
68 #[serde(rename = "InvalidScopeReference")]
69 InvalidScopeReference(std::option::Option<String>),
70}
71
72impl std::fmt::Display for DereferenceScopeError<'_> {
73 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
74 match self {
75 Self::InvalidScopeReference(msg) => {
76 write!(f, "InvalidScopeReference")?;
77 if let Some(msg) = msg {
78 write!(f, ": {}", msg)?;
79 }
80 Ok(())
81 }
82 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
83 }
84 }
85}
86
87impl jacquard_common::IntoStatic for DereferenceScopeError<'_> {
88 type Output = DereferenceScopeError<'static>;
89 fn into_static(self) -> Self::Output {
90 match self {
91 DereferenceScopeError::InvalidScopeReference(v) => {
92 DereferenceScopeError::InvalidScopeReference(v.into_static())
93 }
94 DereferenceScopeError::Unknown(v) => {
95 DereferenceScopeError::Unknown(v.into_static())
96 }
97 }
98 }
99}
100
101impl jacquard_common::types::xrpc::XrpcRequest for DereferenceScope<'_> {
102 const NSID: &'static str = "com.atproto.temp.dereferenceScope";
103 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
104 const OUTPUT_ENCODING: &'static str = "application/json";
105 type Output<'de> = DereferenceScopeOutput<'de>;
106 type Err<'de> = DereferenceScopeError<'de>;
107}