1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.graph.getRelationships
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 GetRelationships<'a> {
21 #[serde(borrow)]
22 pub actor: jacquard_common::types::ident::AtIdentifier<'a>,
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 #[serde(borrow)]
25 pub others: std::option::Option<
26 Vec<jacquard_common::types::ident::AtIdentifier<'a>>,
27 >,
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 GetRelationshipsOutput<'a> {
42 #[serde(skip_serializing_if = "std::option::Option::is_none")]
43 #[serde(borrow)]
44 pub actor: std::option::Option<jacquard_common::types::string::Did<'a>>,
45 #[serde(borrow)]
46 pub relationships: Vec<jacquard_common::types::value::Data<'a>>,
47}
48
49#[jacquard_derive::open_union]
50#[derive(
51 serde::Serialize,
52 serde::Deserialize,
53 Debug,
54 Clone,
55 PartialEq,
56 Eq,
57 thiserror::Error,
58 miette::Diagnostic
59)]
60#[serde(tag = "error", content = "message")]
61#[serde(bound(deserialize = "'de: 'a"))]
62pub enum GetRelationshipsError<'a> {
63 ///the primary actor at-identifier could not be resolved
64 #[serde(rename = "ActorNotFound")]
65 ActorNotFound(std::option::Option<String>),
66}
67
68impl std::fmt::Display for GetRelationshipsError<'_> {
69 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
70 match self {
71 Self::ActorNotFound(msg) => {
72 write!(f, "ActorNotFound")?;
73 if let Some(msg) = msg {
74 write!(f, ": {}", msg)?;
75 }
76 Ok(())
77 }
78 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
79 }
80 }
81}
82
83impl jacquard_common::IntoStatic for GetRelationshipsError<'_> {
84 type Output = GetRelationshipsError<'static>;
85 fn into_static(self) -> Self::Output {
86 match self {
87 GetRelationshipsError::ActorNotFound(v) => {
88 GetRelationshipsError::ActorNotFound(v.into_static())
89 }
90 GetRelationshipsError::Unknown(v) => {
91 GetRelationshipsError::Unknown(v.into_static())
92 }
93 }
94 }
95}
96
97///Response type for
98///app.bsky.graph.getRelationships
99pub struct GetRelationshipsResponse;
100impl jacquard_common::xrpc::XrpcResp for GetRelationshipsResponse {
101 const NSID: &'static str = "app.bsky.graph.getRelationships";
102 const ENCODING: &'static str = "application/json";
103 type Output<'de> = GetRelationshipsOutput<'de>;
104 type Err<'de> = GetRelationshipsError<'de>;
105}
106
107impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetRelationships<'de> {
108 const NSID: &'static str = "app.bsky.graph.getRelationships";
109 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
110 type Response = GetRelationshipsResponse;
111}
112
113///Endpoint type for
114///app.bsky.graph.getRelationships
115pub struct GetRelationshipsRequest;
116impl jacquard_common::xrpc::XrpcEndpoint for GetRelationshipsRequest {
117 const PATH: &'static str = "/xrpc/app.bsky.graph.getRelationships";
118 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
119 type Request<'de> = GetRelationships<'de>;
120 type Response = GetRelationshipsResponse;
121}