A better Rust ATProto crate
at main 3.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.labeler.service 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// A declaration of the existence of labeler service. 9#[jacquard_derive::lexicon] 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic, 18 bon::Builder 19)] 20#[serde(rename_all = "camelCase")] 21pub struct Service<'a> { 22 pub created_at: jacquard_common::types::string::Datetime, 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[builder(into)] 25 #[serde(borrow)] 26 pub labels: Option<crate::com_atproto::label::SelfLabels<'a>>, 27 #[serde(borrow)] 28 pub policies: crate::app_bsky::labeler::LabelerPolicies<'a>, 29 /// The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. 30 #[serde(skip_serializing_if = "std::option::Option::is_none")] 31 #[builder(into)] 32 #[serde(borrow)] 33 pub reason_types: Option<Vec<crate::com_atproto::moderation::ReasonType<'a>>>, 34 /// Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. 35 #[serde(skip_serializing_if = "std::option::Option::is_none")] 36 #[builder(into)] 37 #[serde(borrow)] 38 pub subject_collections: Option<Vec<jacquard_common::types::string::Nsid<'a>>>, 39 /// The set of subject types (account, record, etc) this service accepts reports on. 40 #[serde(skip_serializing_if = "std::option::Option::is_none")] 41 #[builder(into)] 42 #[serde(borrow)] 43 pub subject_types: Option<Vec<crate::com_atproto::moderation::SubjectType<'a>>>, 44} 45 46/// Typed wrapper for GetRecord response with this collection's record type. 47#[derive( 48 serde::Serialize, 49 serde::Deserialize, 50 Debug, 51 Clone, 52 PartialEq, 53 Eq, 54 jacquard_derive::IntoStatic 55)] 56#[serde(rename_all = "camelCase")] 57pub struct ServiceGetRecordOutput<'a> { 58 #[serde(skip_serializing_if = "std::option::Option::is_none")] 59 #[serde(borrow)] 60 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 61 #[serde(borrow)] 62 pub uri: jacquard_common::types::string::AtUri<'a>, 63 #[serde(borrow)] 64 pub value: Service<'a>, 65} 66 67/// Marker type for deserializing records from this collection. 68pub struct ServiceRecord; 69impl jacquard_common::xrpc::XrpcResp for ServiceRecord { 70 const NSID: &'static str = "app.bsky.labeler.service"; 71 const ENCODING: &'static str = "application/json"; 72 type Output<'de> = ServiceGetRecordOutput<'de>; 73 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 74} 75 76impl jacquard_common::types::collection::Collection for Service<'_> { 77 const NSID: &'static str = "app.bsky.labeler.service"; 78 type Record = ServiceRecord; 79} 80 81impl From<ServiceGetRecordOutput<'_>> for Service<'_> { 82 fn from(output: ServiceGetRecordOutput<'_>) -> Self { 83 use jacquard_common::IntoStatic; 84 output.value.into_static() 85 } 86}