A better Rust ATProto crate
at oauth 3.3 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(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 11#[serde(rename_all = "camelCase")] 12pub struct Service<'a> { 13 pub created_at: jacquard_common::types::string::Datetime, 14 #[serde(skip_serializing_if = "std::option::Option::is_none")] 15 #[serde(borrow)] 16 pub labels: std::option::Option<ServiceRecordLabels<'a>>, 17 #[serde(borrow)] 18 pub policies: crate::app_bsky::labeler::LabelerPolicies<'a>, 19 ///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. 20 #[serde(skip_serializing_if = "std::option::Option::is_none")] 21 #[serde(borrow)] 22 pub reason_types: std::option::Option< 23 Vec<crate::com_atproto::moderation::ReasonType<'a>>, 24 >, 25 ///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. 26 #[serde(skip_serializing_if = "std::option::Option::is_none")] 27 #[serde(borrow)] 28 pub subject_collections: std::option::Option< 29 Vec<jacquard_common::types::string::Nsid<'a>>, 30 >, 31 ///The set of subject types (account, record, etc) this service accepts reports on. 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 #[serde(borrow)] 34 pub subject_types: std::option::Option< 35 Vec<crate::com_atproto::moderation::SubjectType<'a>>, 36 >, 37} 38 39#[jacquard_derive::open_union] 40#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 41#[serde(tag = "$type")] 42#[serde(bound(deserialize = "'de: 'a"))] 43pub enum ServiceRecordLabels<'a> { 44 #[serde(rename = "com.atproto.label.defs#selfLabels")] 45 DefsSelfLabels(Box<crate::com_atproto::label::SelfLabels<'a>>), 46} 47 48impl jacquard_common::IntoStatic for ServiceRecordLabels<'_> { 49 type Output = ServiceRecordLabels<'static>; 50 fn into_static(self) -> Self::Output { 51 match self { 52 ServiceRecordLabels::DefsSelfLabels(v) => { 53 ServiceRecordLabels::DefsSelfLabels(v.into_static()) 54 } 55 ServiceRecordLabels::Unknown(v) => { 56 ServiceRecordLabels::Unknown(v.into_static()) 57 } 58 } 59 } 60} 61 62impl jacquard_common::types::collection::Collection for Service<'_> { 63 const NSID: &'static str = "app.bsky.labeler.service"; 64} 65 66impl jacquard_common::IntoStatic for Service<'_> { 67 type Output = Service<'static>; 68 fn into_static(self) -> Self::Output { 69 Service { 70 created_at: self.created_at.into_static(), 71 labels: self.labels.into_static(), 72 policies: self.policies.into_static(), 73 reason_types: self.reason_types.into_static(), 74 subject_collections: self.subject_collections.into_static(), 75 subject_types: self.subject_types.into_static(), 76 extra_data: self.extra_data.into_static(), 77 } 78 } 79}