atproto blogging
at main 172 lines 5.6 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.weaver.edit.getContributors 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 jacquard_derive::IntoStatic 16)] 17#[serde(rename_all = "camelCase")] 18pub struct GetContributors<'a> { 19 /// (default: true) 20 #[serde(skip_serializing_if = "std::option::Option::is_none")] 21 pub include_cascaded: std::option::Option<bool>, 22 #[serde(borrow)] 23 pub resource: jacquard_common::types::string::AtUri<'a>, 24} 25 26pub mod get_contributors_state { 27 28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 29 #[allow(unused)] 30 use ::core::marker::PhantomData; 31 mod sealed { 32 pub trait Sealed {} 33 } 34 /// State trait tracking which required fields have been set 35 pub trait State: sealed::Sealed { 36 type Resource; 37 } 38 /// Empty state - all required fields are unset 39 pub struct Empty(()); 40 impl sealed::Sealed for Empty {} 41 impl State for Empty { 42 type Resource = Unset; 43 } 44 ///State transition - sets the `resource` field to Set 45 pub struct SetResource<S: State = Empty>(PhantomData<fn() -> S>); 46 impl<S: State> sealed::Sealed for SetResource<S> {} 47 impl<S: State> State for SetResource<S> { 48 type Resource = Set<members::resource>; 49 } 50 /// Marker types for field names 51 #[allow(non_camel_case_types)] 52 pub mod members { 53 ///Marker type for the `resource` field 54 pub struct resource(()); 55 } 56} 57 58/// Builder for constructing an instance of this type 59pub struct GetContributorsBuilder<'a, S: get_contributors_state::State> { 60 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 61 __unsafe_private_named: ( 62 ::core::option::Option<bool>, 63 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 64 ), 65 _phantom: ::core::marker::PhantomData<&'a ()>, 66} 67 68impl<'a> GetContributors<'a> { 69 /// Create a new builder for this type 70 pub fn new() -> GetContributorsBuilder<'a, get_contributors_state::Empty> { 71 GetContributorsBuilder::new() 72 } 73} 74 75impl<'a> GetContributorsBuilder<'a, get_contributors_state::Empty> { 76 /// Create a new builder with all fields unset 77 pub fn new() -> Self { 78 GetContributorsBuilder { 79 _phantom_state: ::core::marker::PhantomData, 80 __unsafe_private_named: (None, None), 81 _phantom: ::core::marker::PhantomData, 82 } 83 } 84} 85 86impl<'a, S: get_contributors_state::State> GetContributorsBuilder<'a, S> { 87 /// Set the `includeCascaded` field (optional) 88 pub fn include_cascaded(mut self, value: impl Into<Option<bool>>) -> Self { 89 self.__unsafe_private_named.0 = value.into(); 90 self 91 } 92 /// Set the `includeCascaded` field to an Option value (optional) 93 pub fn maybe_include_cascaded(mut self, value: Option<bool>) -> Self { 94 self.__unsafe_private_named.0 = value; 95 self 96 } 97} 98 99impl<'a, S> GetContributorsBuilder<'a, S> 100where 101 S: get_contributors_state::State, 102 S::Resource: get_contributors_state::IsUnset, 103{ 104 /// Set the `resource` field (required) 105 pub fn resource( 106 mut self, 107 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 108 ) -> GetContributorsBuilder<'a, get_contributors_state::SetResource<S>> { 109 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 110 GetContributorsBuilder { 111 _phantom_state: ::core::marker::PhantomData, 112 __unsafe_private_named: self.__unsafe_private_named, 113 _phantom: ::core::marker::PhantomData, 114 } 115 } 116} 117 118impl<'a, S> GetContributorsBuilder<'a, S> 119where 120 S: get_contributors_state::State, 121 S::Resource: get_contributors_state::IsSet, 122{ 123 /// Build the final struct 124 pub fn build(self) -> GetContributors<'a> { 125 GetContributors { 126 include_cascaded: self.__unsafe_private_named.0, 127 resource: self.__unsafe_private_named.1.unwrap(), 128 } 129 } 130} 131 132#[jacquard_derive::lexicon] 133#[derive( 134 serde::Serialize, 135 serde::Deserialize, 136 Debug, 137 Clone, 138 PartialEq, 139 Eq, 140 jacquard_derive::IntoStatic 141)] 142#[serde(rename_all = "camelCase")] 143pub struct GetContributorsOutput<'a> { 144 #[serde(borrow)] 145 pub contributors: Vec<crate::sh_weaver::actor::ProfileViewBasic<'a>>, 146} 147 148/// Response type for 149///sh.weaver.edit.getContributors 150pub struct GetContributorsResponse; 151impl jacquard_common::xrpc::XrpcResp for GetContributorsResponse { 152 const NSID: &'static str = "sh.weaver.edit.getContributors"; 153 const ENCODING: &'static str = "application/json"; 154 type Output<'de> = GetContributorsOutput<'de>; 155 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 156} 157 158impl<'a> jacquard_common::xrpc::XrpcRequest for GetContributors<'a> { 159 const NSID: &'static str = "sh.weaver.edit.getContributors"; 160 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 161 type Response = GetContributorsResponse; 162} 163 164/// Endpoint type for 165///sh.weaver.edit.getContributors 166pub struct GetContributorsRequest; 167impl jacquard_common::xrpc::XrpcEndpoint for GetContributorsRequest { 168 const PATH: &'static str = "/xrpc/sh.weaver.edit.getContributors"; 169 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 170 type Request<'de> = GetContributors<'de>; 171 type Response = GetContributorsResponse; 172}