1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.knot.listKeys
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 ListKeys<'a> {
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 #[builder(into)]
24 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
25 ///(default: 100, min: 1, max: 1000)
26 #[serde(skip_serializing_if = "std::option::Option::is_none")]
27 pub limit: std::option::Option<i64>,
28}
29
30#[jacquard_derive::lexicon]
31#[derive(
32 serde::Serialize,
33 serde::Deserialize,
34 Debug,
35 Clone,
36 PartialEq,
37 Eq,
38 jacquard_derive::IntoStatic
39)]
40#[serde(rename_all = "camelCase")]
41pub struct ListKeysOutput<'a> {
42 /// Pagination cursor for next page
43 #[serde(skip_serializing_if = "std::option::Option::is_none")]
44 #[serde(borrow)]
45 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
46 #[serde(borrow)]
47 pub keys: Vec<jacquard_common::types::value::Data<'a>>,
48}
49
50#[jacquard_derive::open_union]
51#[derive(
52 serde::Serialize,
53 serde::Deserialize,
54 Debug,
55 Clone,
56 PartialEq,
57 Eq,
58 thiserror::Error,
59 miette::Diagnostic,
60 jacquard_derive::IntoStatic
61)]
62#[serde(tag = "error", content = "message")]
63#[serde(bound(deserialize = "'de: 'a"))]
64pub enum ListKeysError<'a> {
65 /// Failed to retrieve public keys
66 #[serde(rename = "InternalServerError")]
67 InternalServerError(std::option::Option<String>),
68}
69
70impl std::fmt::Display for ListKeysError<'_> {
71 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
72 match self {
73 Self::InternalServerError(msg) => {
74 write!(f, "InternalServerError")?;
75 if let Some(msg) = msg {
76 write!(f, ": {}", msg)?;
77 }
78 Ok(())
79 }
80 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
81 }
82 }
83}
84
85///Response type for
86///sh.tangled.knot.listKeys
87pub struct ListKeysResponse;
88impl jacquard_common::xrpc::XrpcResp for ListKeysResponse {
89 const NSID: &'static str = "sh.tangled.knot.listKeys";
90 const ENCODING: &'static str = "application/json";
91 type Output<'de> = ListKeysOutput<'de>;
92 type Err<'de> = ListKeysError<'de>;
93}
94
95impl<'a> jacquard_common::xrpc::XrpcRequest for ListKeys<'a> {
96 const NSID: &'static str = "sh.tangled.knot.listKeys";
97 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
98 type Response = ListKeysResponse;
99}
100
101///Endpoint type for
102///sh.tangled.knot.listKeys
103pub struct ListKeysRequest;
104impl jacquard_common::xrpc::XrpcEndpoint for ListKeysRequest {
105 const PATH: &'static str = "/xrpc/sh.tangled.knot.listKeys";
106 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
107 type Request<'de> = ListKeys<'de>;
108 type Response = ListKeysResponse;
109}
110
111#[jacquard_derive::lexicon]
112#[derive(
113 serde::Serialize,
114 serde::Deserialize,
115 Debug,
116 Clone,
117 PartialEq,
118 Eq,
119 jacquard_derive::IntoStatic,
120 bon::Builder
121)]
122#[serde(rename_all = "camelCase")]
123pub struct PublicKey<'a> {
124 /// Key upload timestamp
125 pub created_at: jacquard_common::types::string::Datetime,
126 /// DID associated with the public key
127 #[serde(borrow)]
128 pub did: jacquard_common::types::string::Did<'a>,
129 /// Public key contents
130 #[serde(borrow)]
131 #[builder(into)]
132 pub key: jacquard_common::CowStr<'a>,
133}