jacquard_api/sh_tangled/
owner.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.owner
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10    serde::Serialize,
11    serde::Deserialize,
12    Debug,
13    Clone,
14    PartialEq,
15    Eq,
16    jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct OwnerOutput<'a> {
20    #[serde(borrow)]
21    pub owner: jacquard_common::types::string::Did<'a>,
22}
23
24#[jacquard_derive::open_union]
25#[derive(
26    serde::Serialize,
27    serde::Deserialize,
28    Debug,
29    Clone,
30    PartialEq,
31    Eq,
32    thiserror::Error,
33    miette::Diagnostic
34)]
35#[serde(tag = "error", content = "message")]
36#[serde(bound(deserialize = "'de: 'a"))]
37pub enum OwnerError<'a> {
38    ///Owner is not set for this service
39    #[serde(rename = "OwnerNotFound")]
40    OwnerNotFound(std::option::Option<String>),
41}
42
43impl std::fmt::Display for OwnerError<'_> {
44    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45        match self {
46            Self::OwnerNotFound(msg) => {
47                write!(f, "OwnerNotFound")?;
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
58impl jacquard_common::IntoStatic for OwnerError<'_> {
59    type Output = OwnerError<'static>;
60    fn into_static(self) -> Self::Output {
61        match self {
62            OwnerError::OwnerNotFound(v) => OwnerError::OwnerNotFound(v.into_static()),
63            OwnerError::Unknown(v) => OwnerError::Unknown(v.into_static()),
64        }
65    }
66}
67
68/// XRPC request marker type
69#[derive(
70    Debug,
71    Clone,
72    Copy,
73    PartialEq,
74    Eq,
75    serde::Serialize,
76    serde::Deserialize,
77    jacquard_derive::IntoStatic
78)]
79pub struct Owner;
80///Response type for
81///sh.tangled.owner
82pub struct OwnerResponse;
83impl jacquard_common::xrpc::XrpcResp for OwnerResponse {
84    const NSID: &'static str = "sh.tangled.owner";
85    const ENCODING: &'static str = "application/json";
86    type Output<'de> = OwnerOutput<'de>;
87    type Err<'de> = OwnerError<'de>;
88}
89
90impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for Owner {
91    const NSID: &'static str = "sh.tangled.owner";
92    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
93    type Response = OwnerResponse;
94}
95
96///Endpoint type for
97///sh.tangled.owner
98pub struct OwnerRequest;
99impl jacquard_common::xrpc::XrpcEndpoint for OwnerRequest {
100    const PATH: &'static str = "/xrpc/sh.tangled.owner";
101    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
102    type Request<'de> = Owner;
103    type Response = OwnerResponse;
104}