A better Rust ATProto crate
at oauth 3.6 kB view raw
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)] 17#[builder(start_fn = new)] 18#[serde(rename_all = "camelCase")] 19pub struct GetRelationships<'a> { 20 #[serde(borrow)] 21 pub actor: jacquard_common::types::ident::AtIdentifier<'a>, 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[serde(borrow)] 24 pub others: std::option::Option< 25 Vec<jacquard_common::types::ident::AtIdentifier<'a>>, 26 >, 27} 28 29impl jacquard_common::IntoStatic for GetRelationships<'_> { 30 type Output = GetRelationships<'static>; 31 fn into_static(self) -> Self::Output { 32 GetRelationships { 33 actor: self.actor.into_static(), 34 others: self.others.into_static(), 35 } 36 } 37} 38 39#[jacquard_derive::lexicon] 40#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 41#[serde(rename_all = "camelCase")] 42pub struct GetRelationshipsOutput<'a> { 43 #[serde(skip_serializing_if = "std::option::Option::is_none")] 44 #[serde(borrow)] 45 pub actor: std::option::Option<jacquard_common::types::string::Did<'a>>, 46 #[serde(borrow)] 47 pub relationships: Vec<jacquard_common::types::value::Data<'a>>, 48} 49 50impl jacquard_common::IntoStatic for GetRelationshipsOutput<'_> { 51 type Output = GetRelationshipsOutput<'static>; 52 fn into_static(self) -> Self::Output { 53 GetRelationshipsOutput { 54 actor: self.actor.into_static(), 55 relationships: self.relationships.into_static(), 56 extra_data: self.extra_data.into_static(), 57 } 58 } 59} 60 61#[jacquard_derive::open_union] 62#[derive( 63 serde::Serialize, 64 serde::Deserialize, 65 Debug, 66 Clone, 67 PartialEq, 68 Eq, 69 thiserror::Error, 70 miette::Diagnostic 71)] 72#[serde(tag = "error", content = "message")] 73#[serde(bound(deserialize = "'de: 'a"))] 74pub enum GetRelationshipsError<'a> { 75 ///the primary actor at-identifier could not be resolved 76 #[serde(rename = "ActorNotFound")] 77 ActorNotFound(std::option::Option<String>), 78} 79 80impl std::fmt::Display for GetRelationshipsError<'_> { 81 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 82 match self { 83 Self::ActorNotFound(msg) => { 84 write!(f, "ActorNotFound")?; 85 if let Some(msg) = msg { 86 write!(f, ": {}", msg)?; 87 } 88 Ok(()) 89 } 90 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 91 } 92 } 93} 94 95impl jacquard_common::IntoStatic for GetRelationshipsError<'_> { 96 type Output = GetRelationshipsError<'static>; 97 fn into_static(self) -> Self::Output { 98 match self { 99 GetRelationshipsError::ActorNotFound(v) => { 100 GetRelationshipsError::ActorNotFound(v.into_static()) 101 } 102 GetRelationshipsError::Unknown(v) => { 103 GetRelationshipsError::Unknown(v.into_static()) 104 } 105 } 106 } 107} 108 109impl jacquard_common::types::xrpc::XrpcRequest for GetRelationships<'_> { 110 const NSID: &'static str = "app.bsky.graph.getRelationships"; 111 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; 112 const OUTPUT_ENCODING: &'static str = "application/json"; 113 type Output<'de> = GetRelationshipsOutput<'de>; 114 type Err<'de> = GetRelationshipsError<'de>; 115}