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<GetRelationshipsOutputRelationshipsItem<'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 jacquard_derive::IntoStatic
58)]
59#[serde(tag = "$type")]
60#[serde(bound(deserialize = "'de: 'a"))]
61pub enum GetRelationshipsOutputRelationshipsItem<'a> {
62 #[serde(rename = "app.bsky.graph.defs#relationship")]
63 Relationship(Box<crate::app_bsky::graph::Relationship<'a>>),
64 #[serde(rename = "app.bsky.graph.defs#notFoundActor")]
65 NotFoundActor(Box<crate::app_bsky::graph::NotFoundActor<'a>>),
66}
67
68#[jacquard_derive::open_union]
69#[derive(
70 serde::Serialize,
71 serde::Deserialize,
72 Debug,
73 Clone,
74 PartialEq,
75 Eq,
76 thiserror::Error,
77 miette::Diagnostic,
78 jacquard_derive::IntoStatic
79)]
80#[serde(tag = "error", content = "message")]
81#[serde(bound(deserialize = "'de: 'a"))]
82pub enum GetRelationshipsError<'a> {
83 /// the primary actor at-identifier could not be resolved
84 #[serde(rename = "ActorNotFound")]
85 ActorNotFound(std::option::Option<String>),
86}
87
88impl std::fmt::Display for GetRelationshipsError<'_> {
89 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
90 match self {
91 Self::ActorNotFound(msg) => {
92 write!(f, "ActorNotFound")?;
93 if let Some(msg) = msg {
94 write!(f, ": {}", msg)?;
95 }
96 Ok(())
97 }
98 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
99 }
100 }
101}
102
103///Response type for
104///app.bsky.graph.getRelationships
105pub struct GetRelationshipsResponse;
106impl jacquard_common::xrpc::XrpcResp for GetRelationshipsResponse {
107 const NSID: &'static str = "app.bsky.graph.getRelationships";
108 const ENCODING: &'static str = "application/json";
109 type Output<'de> = GetRelationshipsOutput<'de>;
110 type Err<'de> = GetRelationshipsError<'de>;
111}
112
113impl<'a> jacquard_common::xrpc::XrpcRequest for GetRelationships<'a> {
114 const NSID: &'static str = "app.bsky.graph.getRelationships";
115 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
116 type Response = GetRelationshipsResponse;
117}
118
119///Endpoint type for
120///app.bsky.graph.getRelationships
121pub struct GetRelationshipsRequest;
122impl jacquard_common::xrpc::XrpcEndpoint for GetRelationshipsRequest {
123 const PATH: &'static str = "/xrpc/app.bsky.graph.getRelationships";
124 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
125 type Request<'de> = GetRelationships<'de>;
126 type Response = GetRelationshipsResponse;
127}