#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_common::types::string::Did;
use jacquard_derive::{IntoStatic, lexicon, open_union};
use serde::{Serialize, Deserialize};
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct OwnerOutput<'a> {
#[serde(borrow)]
pub owner: Did<'a>,
}
#[open_union]
#[derive(
Serialize,
Deserialize,
Debug,
Clone,
PartialEq,
Eq,
thiserror::Error,
miette::Diagnostic,
IntoStatic
)]
#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum OwnerError<'a> {
#[serde(rename = "OwnerNotFound")]
OwnerNotFound(Option<CowStr<'a>>),
}
impl core::fmt::Display for OwnerError<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::OwnerNotFound(msg) => {
write!(f, "OwnerNotFound")?;
if let Some(msg) = msg {
write!(f, ": {}", msg)?;
}
Ok(())
}
Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct Owner;
pub struct OwnerResponse;
impl jacquard_common::xrpc::XrpcResp for OwnerResponse {
const NSID: &'static str = "sh.tangled.owner";
const ENCODING: &'static str = "application/json";
type Output<'de> = OwnerOutput<'de>;
type Err<'de> = OwnerError<'de>;
}
impl jacquard_common::xrpc::XrpcRequest for Owner {
const NSID: &'static str = "sh.tangled.owner";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = OwnerResponse;
}
pub struct OwnerRequest;
impl jacquard_common::xrpc::XrpcEndpoint for OwnerRequest {
const PATH: &'static str = "/xrpc/sh.tangled.owner";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = Owner;
type Response = OwnerResponse;
}