atproto blogging
at main 1434 lines 59 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.labeler.defs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8pub mod get_services; 9pub mod service; 10 11#[jacquard_derive::lexicon] 12#[derive( 13 serde::Serialize, 14 serde::Deserialize, 15 Debug, 16 Clone, 17 PartialEq, 18 Eq, 19 jacquard_derive::IntoStatic 20)] 21#[serde(rename_all = "camelCase")] 22pub struct LabelerPolicies<'a> { 23 /// Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler. 24 #[serde(skip_serializing_if = "std::option::Option::is_none")] 25 #[serde(borrow)] 26 pub label_value_definitions: std::option::Option< 27 Vec<crate::com_atproto::label::LabelValueDefinition<'a>>, 28 >, 29 /// The label values which this labeler publishes. May include global or custom labels. 30 #[serde(borrow)] 31 pub label_values: Vec<crate::com_atproto::label::LabelValue<'a>>, 32} 33 34pub mod labeler_policies_state { 35 36 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 37 #[allow(unused)] 38 use ::core::marker::PhantomData; 39 mod sealed { 40 pub trait Sealed {} 41 } 42 /// State trait tracking which required fields have been set 43 pub trait State: sealed::Sealed { 44 type LabelValues; 45 } 46 /// Empty state - all required fields are unset 47 pub struct Empty(()); 48 impl sealed::Sealed for Empty {} 49 impl State for Empty { 50 type LabelValues = Unset; 51 } 52 ///State transition - sets the `label_values` field to Set 53 pub struct SetLabelValues<S: State = Empty>(PhantomData<fn() -> S>); 54 impl<S: State> sealed::Sealed for SetLabelValues<S> {} 55 impl<S: State> State for SetLabelValues<S> { 56 type LabelValues = Set<members::label_values>; 57 } 58 /// Marker types for field names 59 #[allow(non_camel_case_types)] 60 pub mod members { 61 ///Marker type for the `label_values` field 62 pub struct label_values(()); 63 } 64} 65 66/// Builder for constructing an instance of this type 67pub struct LabelerPoliciesBuilder<'a, S: labeler_policies_state::State> { 68 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 69 __unsafe_private_named: ( 70 ::core::option::Option<Vec<crate::com_atproto::label::LabelValueDefinition<'a>>>, 71 ::core::option::Option<Vec<crate::com_atproto::label::LabelValue<'a>>>, 72 ), 73 _phantom: ::core::marker::PhantomData<&'a ()>, 74} 75 76impl<'a> LabelerPolicies<'a> { 77 /// Create a new builder for this type 78 pub fn new() -> LabelerPoliciesBuilder<'a, labeler_policies_state::Empty> { 79 LabelerPoliciesBuilder::new() 80 } 81} 82 83impl<'a> LabelerPoliciesBuilder<'a, labeler_policies_state::Empty> { 84 /// Create a new builder with all fields unset 85 pub fn new() -> Self { 86 LabelerPoliciesBuilder { 87 _phantom_state: ::core::marker::PhantomData, 88 __unsafe_private_named: (None, None), 89 _phantom: ::core::marker::PhantomData, 90 } 91 } 92} 93 94impl<'a, S: labeler_policies_state::State> LabelerPoliciesBuilder<'a, S> { 95 /// Set the `labelValueDefinitions` field (optional) 96 pub fn label_value_definitions( 97 mut self, 98 value: impl Into< 99 Option<Vec<crate::com_atproto::label::LabelValueDefinition<'a>>>, 100 >, 101 ) -> Self { 102 self.__unsafe_private_named.0 = value.into(); 103 self 104 } 105 /// Set the `labelValueDefinitions` field to an Option value (optional) 106 pub fn maybe_label_value_definitions( 107 mut self, 108 value: Option<Vec<crate::com_atproto::label::LabelValueDefinition<'a>>>, 109 ) -> Self { 110 self.__unsafe_private_named.0 = value; 111 self 112 } 113} 114 115impl<'a, S> LabelerPoliciesBuilder<'a, S> 116where 117 S: labeler_policies_state::State, 118 S::LabelValues: labeler_policies_state::IsUnset, 119{ 120 /// Set the `labelValues` field (required) 121 pub fn label_values( 122 mut self, 123 value: impl Into<Vec<crate::com_atproto::label::LabelValue<'a>>>, 124 ) -> LabelerPoliciesBuilder<'a, labeler_policies_state::SetLabelValues<S>> { 125 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 126 LabelerPoliciesBuilder { 127 _phantom_state: ::core::marker::PhantomData, 128 __unsafe_private_named: self.__unsafe_private_named, 129 _phantom: ::core::marker::PhantomData, 130 } 131 } 132} 133 134impl<'a, S> LabelerPoliciesBuilder<'a, S> 135where 136 S: labeler_policies_state::State, 137 S::LabelValues: labeler_policies_state::IsSet, 138{ 139 /// Build the final struct 140 pub fn build(self) -> LabelerPolicies<'a> { 141 LabelerPolicies { 142 label_value_definitions: self.__unsafe_private_named.0, 143 label_values: self.__unsafe_private_named.1.unwrap(), 144 extra_data: Default::default(), 145 } 146 } 147 /// Build the final struct with custom extra_data 148 pub fn build_with_data( 149 self, 150 extra_data: std::collections::BTreeMap< 151 jacquard_common::smol_str::SmolStr, 152 jacquard_common::types::value::Data<'a>, 153 >, 154 ) -> LabelerPolicies<'a> { 155 LabelerPolicies { 156 label_value_definitions: self.__unsafe_private_named.0, 157 label_values: self.__unsafe_private_named.1.unwrap(), 158 extra_data: Some(extra_data), 159 } 160 } 161} 162 163fn lexicon_doc_app_bsky_labeler_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 164 'static, 165> { 166 ::jacquard_lexicon::lexicon::LexiconDoc { 167 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 168 id: ::jacquard_common::CowStr::new_static("app.bsky.labeler.defs"), 169 revision: None, 170 description: None, 171 defs: { 172 let mut map = ::alloc::collections::BTreeMap::new(); 173 map.insert( 174 ::jacquard_common::smol_str::SmolStr::new_static("labelerPolicies"), 175 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 176 description: None, 177 required: Some( 178 vec![ 179 ::jacquard_common::smol_str::SmolStr::new_static("labelValues") 180 ], 181 ), 182 nullable: None, 183 properties: { 184 #[allow(unused_mut)] 185 let mut map = ::alloc::collections::BTreeMap::new(); 186 map.insert( 187 ::jacquard_common::smol_str::SmolStr::new_static( 188 "labelValueDefinitions", 189 ), 190 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 191 description: Some( 192 ::jacquard_common::CowStr::new_static( 193 "Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler.", 194 ), 195 ), 196 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 197 description: None, 198 r#ref: ::jacquard_common::CowStr::new_static( 199 "com.atproto.label.defs#labelValueDefinition", 200 ), 201 }), 202 min_length: None, 203 max_length: None, 204 }), 205 ); 206 map.insert( 207 ::jacquard_common::smol_str::SmolStr::new_static( 208 "labelValues", 209 ), 210 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 211 description: Some( 212 ::jacquard_common::CowStr::new_static( 213 "The label values which this labeler publishes. May include global or custom labels.", 214 ), 215 ), 216 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 217 description: None, 218 r#ref: ::jacquard_common::CowStr::new_static( 219 "com.atproto.label.defs#labelValue", 220 ), 221 }), 222 min_length: None, 223 max_length: None, 224 }), 225 ); 226 map 227 }, 228 }), 229 ); 230 map.insert( 231 ::jacquard_common::smol_str::SmolStr::new_static("labelerView"), 232 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 233 description: None, 234 required: Some( 235 vec![ 236 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 237 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 238 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 239 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") 240 ], 241 ), 242 nullable: None, 243 properties: { 244 #[allow(unused_mut)] 245 let mut map = ::alloc::collections::BTreeMap::new(); 246 map.insert( 247 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 248 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 249 description: None, 250 format: Some( 251 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 252 ), 253 default: None, 254 min_length: None, 255 max_length: None, 256 min_graphemes: None, 257 max_graphemes: None, 258 r#enum: None, 259 r#const: None, 260 known_values: None, 261 }), 262 ); 263 map.insert( 264 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 265 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 266 description: None, 267 r#ref: ::jacquard_common::CowStr::new_static( 268 "app.bsky.actor.defs#profileView", 269 ), 270 }), 271 ); 272 map.insert( 273 ::jacquard_common::smol_str::SmolStr::new_static( 274 "indexedAt", 275 ), 276 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 277 description: None, 278 format: Some( 279 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 280 ), 281 default: None, 282 min_length: None, 283 max_length: None, 284 min_graphemes: None, 285 max_graphemes: None, 286 r#enum: None, 287 r#const: None, 288 known_values: None, 289 }), 290 ); 291 map.insert( 292 ::jacquard_common::smol_str::SmolStr::new_static("labels"), 293 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 294 description: None, 295 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 296 description: None, 297 r#ref: ::jacquard_common::CowStr::new_static( 298 "com.atproto.label.defs#label", 299 ), 300 }), 301 min_length: None, 302 max_length: None, 303 }), 304 ); 305 map.insert( 306 ::jacquard_common::smol_str::SmolStr::new_static( 307 "likeCount", 308 ), 309 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 310 description: None, 311 default: None, 312 minimum: Some(0i64), 313 maximum: None, 314 r#enum: None, 315 r#const: None, 316 }), 317 ); 318 map.insert( 319 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 320 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 321 description: None, 322 format: Some( 323 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 324 ), 325 default: None, 326 min_length: None, 327 max_length: None, 328 min_graphemes: None, 329 max_graphemes: None, 330 r#enum: None, 331 r#const: None, 332 known_values: None, 333 }), 334 ); 335 map.insert( 336 ::jacquard_common::smol_str::SmolStr::new_static("viewer"), 337 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 338 description: None, 339 r#ref: ::jacquard_common::CowStr::new_static( 340 "#labelerViewerState", 341 ), 342 }), 343 ); 344 map 345 }, 346 }), 347 ); 348 map.insert( 349 ::jacquard_common::smol_str::SmolStr::new_static("labelerViewDetailed"), 350 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 351 description: None, 352 required: Some( 353 vec![ 354 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 355 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 356 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 357 ::jacquard_common::smol_str::SmolStr::new_static("policies"), 358 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") 359 ], 360 ), 361 nullable: None, 362 properties: { 363 #[allow(unused_mut)] 364 let mut map = ::alloc::collections::BTreeMap::new(); 365 map.insert( 366 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 367 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 368 description: None, 369 format: Some( 370 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 371 ), 372 default: None, 373 min_length: None, 374 max_length: None, 375 min_graphemes: None, 376 max_graphemes: None, 377 r#enum: None, 378 r#const: None, 379 known_values: None, 380 }), 381 ); 382 map.insert( 383 ::jacquard_common::smol_str::SmolStr::new_static("creator"), 384 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 385 description: None, 386 r#ref: ::jacquard_common::CowStr::new_static( 387 "app.bsky.actor.defs#profileView", 388 ), 389 }), 390 ); 391 map.insert( 392 ::jacquard_common::smol_str::SmolStr::new_static( 393 "indexedAt", 394 ), 395 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 396 description: None, 397 format: Some( 398 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 399 ), 400 default: None, 401 min_length: None, 402 max_length: None, 403 min_graphemes: None, 404 max_graphemes: None, 405 r#enum: None, 406 r#const: None, 407 known_values: None, 408 }), 409 ); 410 map.insert( 411 ::jacquard_common::smol_str::SmolStr::new_static("labels"), 412 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 413 description: None, 414 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 415 description: None, 416 r#ref: ::jacquard_common::CowStr::new_static( 417 "com.atproto.label.defs#label", 418 ), 419 }), 420 min_length: None, 421 max_length: None, 422 }), 423 ); 424 map.insert( 425 ::jacquard_common::smol_str::SmolStr::new_static( 426 "likeCount", 427 ), 428 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 429 description: None, 430 default: None, 431 minimum: Some(0i64), 432 maximum: None, 433 r#enum: None, 434 r#const: None, 435 }), 436 ); 437 map.insert( 438 ::jacquard_common::smol_str::SmolStr::new_static("policies"), 439 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 440 description: None, 441 r#ref: ::jacquard_common::CowStr::new_static( 442 "app.bsky.labeler.defs#labelerPolicies", 443 ), 444 }), 445 ); 446 map.insert( 447 ::jacquard_common::smol_str::SmolStr::new_static( 448 "reasonTypes", 449 ), 450 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 451 description: Some( 452 ::jacquard_common::CowStr::new_static( 453 "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.", 454 ), 455 ), 456 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 457 description: None, 458 r#ref: ::jacquard_common::CowStr::new_static( 459 "com.atproto.moderation.defs#reasonType", 460 ), 461 }), 462 min_length: None, 463 max_length: None, 464 }), 465 ); 466 map.insert( 467 ::jacquard_common::smol_str::SmolStr::new_static( 468 "subjectCollections", 469 ), 470 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 471 description: Some( 472 ::jacquard_common::CowStr::new_static( 473 "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.", 474 ), 475 ), 476 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 477 description: None, 478 format: Some( 479 ::jacquard_lexicon::lexicon::LexStringFormat::Nsid, 480 ), 481 default: None, 482 min_length: None, 483 max_length: None, 484 min_graphemes: None, 485 max_graphemes: None, 486 r#enum: None, 487 r#const: None, 488 known_values: None, 489 }), 490 min_length: None, 491 max_length: None, 492 }), 493 ); 494 map.insert( 495 ::jacquard_common::smol_str::SmolStr::new_static( 496 "subjectTypes", 497 ), 498 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 499 description: Some( 500 ::jacquard_common::CowStr::new_static( 501 "The set of subject types (account, record, etc) this service accepts reports on.", 502 ), 503 ), 504 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 505 description: None, 506 r#ref: ::jacquard_common::CowStr::new_static( 507 "com.atproto.moderation.defs#subjectType", 508 ), 509 }), 510 min_length: None, 511 max_length: None, 512 }), 513 ); 514 map.insert( 515 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 516 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 517 description: None, 518 format: Some( 519 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 520 ), 521 default: None, 522 min_length: None, 523 max_length: None, 524 min_graphemes: None, 525 max_graphemes: None, 526 r#enum: None, 527 r#const: None, 528 known_values: None, 529 }), 530 ); 531 map.insert( 532 ::jacquard_common::smol_str::SmolStr::new_static("viewer"), 533 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 534 description: None, 535 r#ref: ::jacquard_common::CowStr::new_static( 536 "#labelerViewerState", 537 ), 538 }), 539 ); 540 map 541 }, 542 }), 543 ); 544 map.insert( 545 ::jacquard_common::smol_str::SmolStr::new_static("labelerViewerState"), 546 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 547 description: None, 548 required: None, 549 nullable: None, 550 properties: { 551 #[allow(unused_mut)] 552 let mut map = ::alloc::collections::BTreeMap::new(); 553 map.insert( 554 ::jacquard_common::smol_str::SmolStr::new_static("like"), 555 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 556 description: None, 557 format: Some( 558 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 559 ), 560 default: None, 561 min_length: None, 562 max_length: None, 563 min_graphemes: None, 564 max_graphemes: None, 565 r#enum: None, 566 r#const: None, 567 known_values: None, 568 }), 569 ); 570 map 571 }, 572 }), 573 ); 574 map 575 }, 576 } 577} 578 579impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerPolicies<'a> { 580 fn nsid() -> &'static str { 581 "app.bsky.labeler.defs" 582 } 583 fn def_name() -> &'static str { 584 "labelerPolicies" 585 } 586 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 587 lexicon_doc_app_bsky_labeler_defs() 588 } 589 fn validate( 590 &self, 591 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 592 Ok(()) 593 } 594} 595 596#[jacquard_derive::lexicon] 597#[derive( 598 serde::Serialize, 599 serde::Deserialize, 600 Debug, 601 Clone, 602 PartialEq, 603 Eq, 604 jacquard_derive::IntoStatic 605)] 606#[serde(rename_all = "camelCase")] 607pub struct LabelerView<'a> { 608 #[serde(borrow)] 609 pub cid: jacquard_common::types::string::Cid<'a>, 610 #[serde(borrow)] 611 pub creator: crate::app_bsky::actor::ProfileView<'a>, 612 pub indexed_at: jacquard_common::types::string::Datetime, 613 #[serde(skip_serializing_if = "std::option::Option::is_none")] 614 #[serde(borrow)] 615 pub labels: std::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 616 #[serde(skip_serializing_if = "std::option::Option::is_none")] 617 pub like_count: std::option::Option<i64>, 618 #[serde(borrow)] 619 pub uri: jacquard_common::types::string::AtUri<'a>, 620 #[serde(skip_serializing_if = "std::option::Option::is_none")] 621 #[serde(borrow)] 622 pub viewer: std::option::Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 623} 624 625pub mod labeler_view_state { 626 627 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 628 #[allow(unused)] 629 use ::core::marker::PhantomData; 630 mod sealed { 631 pub trait Sealed {} 632 } 633 /// State trait tracking which required fields have been set 634 pub trait State: sealed::Sealed { 635 type IndexedAt; 636 type Cid; 637 type Creator; 638 type Uri; 639 } 640 /// Empty state - all required fields are unset 641 pub struct Empty(()); 642 impl sealed::Sealed for Empty {} 643 impl State for Empty { 644 type IndexedAt = Unset; 645 type Cid = Unset; 646 type Creator = Unset; 647 type Uri = Unset; 648 } 649 ///State transition - sets the `indexed_at` field to Set 650 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); 651 impl<S: State> sealed::Sealed for SetIndexedAt<S> {} 652 impl<S: State> State for SetIndexedAt<S> { 653 type IndexedAt = Set<members::indexed_at>; 654 type Cid = S::Cid; 655 type Creator = S::Creator; 656 type Uri = S::Uri; 657 } 658 ///State transition - sets the `cid` field to Set 659 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 660 impl<S: State> sealed::Sealed for SetCid<S> {} 661 impl<S: State> State for SetCid<S> { 662 type IndexedAt = S::IndexedAt; 663 type Cid = Set<members::cid>; 664 type Creator = S::Creator; 665 type Uri = S::Uri; 666 } 667 ///State transition - sets the `creator` field to Set 668 pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); 669 impl<S: State> sealed::Sealed for SetCreator<S> {} 670 impl<S: State> State for SetCreator<S> { 671 type IndexedAt = S::IndexedAt; 672 type Cid = S::Cid; 673 type Creator = Set<members::creator>; 674 type Uri = S::Uri; 675 } 676 ///State transition - sets the `uri` field to Set 677 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 678 impl<S: State> sealed::Sealed for SetUri<S> {} 679 impl<S: State> State for SetUri<S> { 680 type IndexedAt = S::IndexedAt; 681 type Cid = S::Cid; 682 type Creator = S::Creator; 683 type Uri = Set<members::uri>; 684 } 685 /// Marker types for field names 686 #[allow(non_camel_case_types)] 687 pub mod members { 688 ///Marker type for the `indexed_at` field 689 pub struct indexed_at(()); 690 ///Marker type for the `cid` field 691 pub struct cid(()); 692 ///Marker type for the `creator` field 693 pub struct creator(()); 694 ///Marker type for the `uri` field 695 pub struct uri(()); 696 } 697} 698 699/// Builder for constructing an instance of this type 700pub struct LabelerViewBuilder<'a, S: labeler_view_state::State> { 701 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 702 __unsafe_private_named: ( 703 ::core::option::Option<jacquard_common::types::string::Cid<'a>>, 704 ::core::option::Option<crate::app_bsky::actor::ProfileView<'a>>, 705 ::core::option::Option<jacquard_common::types::string::Datetime>, 706 ::core::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 707 ::core::option::Option<i64>, 708 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 709 ::core::option::Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 710 ), 711 _phantom: ::core::marker::PhantomData<&'a ()>, 712} 713 714impl<'a> LabelerView<'a> { 715 /// Create a new builder for this type 716 pub fn new() -> LabelerViewBuilder<'a, labeler_view_state::Empty> { 717 LabelerViewBuilder::new() 718 } 719} 720 721impl<'a> LabelerViewBuilder<'a, labeler_view_state::Empty> { 722 /// Create a new builder with all fields unset 723 pub fn new() -> Self { 724 LabelerViewBuilder { 725 _phantom_state: ::core::marker::PhantomData, 726 __unsafe_private_named: (None, None, None, None, None, None, None), 727 _phantom: ::core::marker::PhantomData, 728 } 729 } 730} 731 732impl<'a, S> LabelerViewBuilder<'a, S> 733where 734 S: labeler_view_state::State, 735 S::Cid: labeler_view_state::IsUnset, 736{ 737 /// Set the `cid` field (required) 738 pub fn cid( 739 mut self, 740 value: impl Into<jacquard_common::types::string::Cid<'a>>, 741 ) -> LabelerViewBuilder<'a, labeler_view_state::SetCid<S>> { 742 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 743 LabelerViewBuilder { 744 _phantom_state: ::core::marker::PhantomData, 745 __unsafe_private_named: self.__unsafe_private_named, 746 _phantom: ::core::marker::PhantomData, 747 } 748 } 749} 750 751impl<'a, S> LabelerViewBuilder<'a, S> 752where 753 S: labeler_view_state::State, 754 S::Creator: labeler_view_state::IsUnset, 755{ 756 /// Set the `creator` field (required) 757 pub fn creator( 758 mut self, 759 value: impl Into<crate::app_bsky::actor::ProfileView<'a>>, 760 ) -> LabelerViewBuilder<'a, labeler_view_state::SetCreator<S>> { 761 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 762 LabelerViewBuilder { 763 _phantom_state: ::core::marker::PhantomData, 764 __unsafe_private_named: self.__unsafe_private_named, 765 _phantom: ::core::marker::PhantomData, 766 } 767 } 768} 769 770impl<'a, S> LabelerViewBuilder<'a, S> 771where 772 S: labeler_view_state::State, 773 S::IndexedAt: labeler_view_state::IsUnset, 774{ 775 /// Set the `indexedAt` field (required) 776 pub fn indexed_at( 777 mut self, 778 value: impl Into<jacquard_common::types::string::Datetime>, 779 ) -> LabelerViewBuilder<'a, labeler_view_state::SetIndexedAt<S>> { 780 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 781 LabelerViewBuilder { 782 _phantom_state: ::core::marker::PhantomData, 783 __unsafe_private_named: self.__unsafe_private_named, 784 _phantom: ::core::marker::PhantomData, 785 } 786 } 787} 788 789impl<'a, S: labeler_view_state::State> LabelerViewBuilder<'a, S> { 790 /// Set the `labels` field (optional) 791 pub fn labels( 792 mut self, 793 value: impl Into<Option<Vec<crate::com_atproto::label::Label<'a>>>>, 794 ) -> Self { 795 self.__unsafe_private_named.3 = value.into(); 796 self 797 } 798 /// Set the `labels` field to an Option value (optional) 799 pub fn maybe_labels( 800 mut self, 801 value: Option<Vec<crate::com_atproto::label::Label<'a>>>, 802 ) -> Self { 803 self.__unsafe_private_named.3 = value; 804 self 805 } 806} 807 808impl<'a, S: labeler_view_state::State> LabelerViewBuilder<'a, S> { 809 /// Set the `likeCount` field (optional) 810 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self { 811 self.__unsafe_private_named.4 = value.into(); 812 self 813 } 814 /// Set the `likeCount` field to an Option value (optional) 815 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self { 816 self.__unsafe_private_named.4 = value; 817 self 818 } 819} 820 821impl<'a, S> LabelerViewBuilder<'a, S> 822where 823 S: labeler_view_state::State, 824 S::Uri: labeler_view_state::IsUnset, 825{ 826 /// Set the `uri` field (required) 827 pub fn uri( 828 mut self, 829 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 830 ) -> LabelerViewBuilder<'a, labeler_view_state::SetUri<S>> { 831 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 832 LabelerViewBuilder { 833 _phantom_state: ::core::marker::PhantomData, 834 __unsafe_private_named: self.__unsafe_private_named, 835 _phantom: ::core::marker::PhantomData, 836 } 837 } 838} 839 840impl<'a, S: labeler_view_state::State> LabelerViewBuilder<'a, S> { 841 /// Set the `viewer` field (optional) 842 pub fn viewer( 843 mut self, 844 value: impl Into<Option<crate::app_bsky::labeler::LabelerViewerState<'a>>>, 845 ) -> Self { 846 self.__unsafe_private_named.6 = value.into(); 847 self 848 } 849 /// Set the `viewer` field to an Option value (optional) 850 pub fn maybe_viewer( 851 mut self, 852 value: Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 853 ) -> Self { 854 self.__unsafe_private_named.6 = value; 855 self 856 } 857} 858 859impl<'a, S> LabelerViewBuilder<'a, S> 860where 861 S: labeler_view_state::State, 862 S::IndexedAt: labeler_view_state::IsSet, 863 S::Cid: labeler_view_state::IsSet, 864 S::Creator: labeler_view_state::IsSet, 865 S::Uri: labeler_view_state::IsSet, 866{ 867 /// Build the final struct 868 pub fn build(self) -> LabelerView<'a> { 869 LabelerView { 870 cid: self.__unsafe_private_named.0.unwrap(), 871 creator: self.__unsafe_private_named.1.unwrap(), 872 indexed_at: self.__unsafe_private_named.2.unwrap(), 873 labels: self.__unsafe_private_named.3, 874 like_count: self.__unsafe_private_named.4, 875 uri: self.__unsafe_private_named.5.unwrap(), 876 viewer: self.__unsafe_private_named.6, 877 extra_data: Default::default(), 878 } 879 } 880 /// Build the final struct with custom extra_data 881 pub fn build_with_data( 882 self, 883 extra_data: std::collections::BTreeMap< 884 jacquard_common::smol_str::SmolStr, 885 jacquard_common::types::value::Data<'a>, 886 >, 887 ) -> LabelerView<'a> { 888 LabelerView { 889 cid: self.__unsafe_private_named.0.unwrap(), 890 creator: self.__unsafe_private_named.1.unwrap(), 891 indexed_at: self.__unsafe_private_named.2.unwrap(), 892 labels: self.__unsafe_private_named.3, 893 like_count: self.__unsafe_private_named.4, 894 uri: self.__unsafe_private_named.5.unwrap(), 895 viewer: self.__unsafe_private_named.6, 896 extra_data: Some(extra_data), 897 } 898 } 899} 900 901impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerView<'a> { 902 fn nsid() -> &'static str { 903 "app.bsky.labeler.defs" 904 } 905 fn def_name() -> &'static str { 906 "labelerView" 907 } 908 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 909 lexicon_doc_app_bsky_labeler_defs() 910 } 911 fn validate( 912 &self, 913 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 914 if let Some(ref value) = self.like_count { 915 if *value < 0i64 { 916 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 917 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 918 "like_count", 919 ), 920 min: 0i64, 921 actual: *value, 922 }); 923 } 924 } 925 Ok(()) 926 } 927} 928 929#[jacquard_derive::lexicon] 930#[derive( 931 serde::Serialize, 932 serde::Deserialize, 933 Debug, 934 Clone, 935 PartialEq, 936 Eq, 937 jacquard_derive::IntoStatic 938)] 939#[serde(rename_all = "camelCase")] 940pub struct LabelerViewDetailed<'a> { 941 #[serde(borrow)] 942 pub cid: jacquard_common::types::string::Cid<'a>, 943 #[serde(borrow)] 944 pub creator: crate::app_bsky::actor::ProfileView<'a>, 945 pub indexed_at: jacquard_common::types::string::Datetime, 946 #[serde(skip_serializing_if = "std::option::Option::is_none")] 947 #[serde(borrow)] 948 pub labels: std::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 949 #[serde(skip_serializing_if = "std::option::Option::is_none")] 950 pub like_count: std::option::Option<i64>, 951 #[serde(borrow)] 952 pub policies: crate::app_bsky::labeler::LabelerPolicies<'a>, 953 /// 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. 954 #[serde(skip_serializing_if = "std::option::Option::is_none")] 955 #[serde(borrow)] 956 pub reason_types: std::option::Option< 957 Vec<crate::com_atproto::moderation::ReasonType<'a>>, 958 >, 959 /// 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. 960 #[serde(skip_serializing_if = "std::option::Option::is_none")] 961 #[serde(borrow)] 962 pub subject_collections: std::option::Option< 963 Vec<jacquard_common::types::string::Nsid<'a>>, 964 >, 965 /// The set of subject types (account, record, etc) this service accepts reports on. 966 #[serde(skip_serializing_if = "std::option::Option::is_none")] 967 #[serde(borrow)] 968 pub subject_types: std::option::Option< 969 Vec<crate::com_atproto::moderation::SubjectType<'a>>, 970 >, 971 #[serde(borrow)] 972 pub uri: jacquard_common::types::string::AtUri<'a>, 973 #[serde(skip_serializing_if = "std::option::Option::is_none")] 974 #[serde(borrow)] 975 pub viewer: std::option::Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 976} 977 978pub mod labeler_view_detailed_state { 979 980 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 981 #[allow(unused)] 982 use ::core::marker::PhantomData; 983 mod sealed { 984 pub trait Sealed {} 985 } 986 /// State trait tracking which required fields have been set 987 pub trait State: sealed::Sealed { 988 type Cid; 989 type Policies; 990 type Uri; 991 type Creator; 992 type IndexedAt; 993 } 994 /// Empty state - all required fields are unset 995 pub struct Empty(()); 996 impl sealed::Sealed for Empty {} 997 impl State for Empty { 998 type Cid = Unset; 999 type Policies = Unset; 1000 type Uri = Unset; 1001 type Creator = Unset; 1002 type IndexedAt = Unset; 1003 } 1004 ///State transition - sets the `cid` field to Set 1005 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 1006 impl<S: State> sealed::Sealed for SetCid<S> {} 1007 impl<S: State> State for SetCid<S> { 1008 type Cid = Set<members::cid>; 1009 type Policies = S::Policies; 1010 type Uri = S::Uri; 1011 type Creator = S::Creator; 1012 type IndexedAt = S::IndexedAt; 1013 } 1014 ///State transition - sets the `policies` field to Set 1015 pub struct SetPolicies<S: State = Empty>(PhantomData<fn() -> S>); 1016 impl<S: State> sealed::Sealed for SetPolicies<S> {} 1017 impl<S: State> State for SetPolicies<S> { 1018 type Cid = S::Cid; 1019 type Policies = Set<members::policies>; 1020 type Uri = S::Uri; 1021 type Creator = S::Creator; 1022 type IndexedAt = S::IndexedAt; 1023 } 1024 ///State transition - sets the `uri` field to Set 1025 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 1026 impl<S: State> sealed::Sealed for SetUri<S> {} 1027 impl<S: State> State for SetUri<S> { 1028 type Cid = S::Cid; 1029 type Policies = S::Policies; 1030 type Uri = Set<members::uri>; 1031 type Creator = S::Creator; 1032 type IndexedAt = S::IndexedAt; 1033 } 1034 ///State transition - sets the `creator` field to Set 1035 pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); 1036 impl<S: State> sealed::Sealed for SetCreator<S> {} 1037 impl<S: State> State for SetCreator<S> { 1038 type Cid = S::Cid; 1039 type Policies = S::Policies; 1040 type Uri = S::Uri; 1041 type Creator = Set<members::creator>; 1042 type IndexedAt = S::IndexedAt; 1043 } 1044 ///State transition - sets the `indexed_at` field to Set 1045 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>); 1046 impl<S: State> sealed::Sealed for SetIndexedAt<S> {} 1047 impl<S: State> State for SetIndexedAt<S> { 1048 type Cid = S::Cid; 1049 type Policies = S::Policies; 1050 type Uri = S::Uri; 1051 type Creator = S::Creator; 1052 type IndexedAt = Set<members::indexed_at>; 1053 } 1054 /// Marker types for field names 1055 #[allow(non_camel_case_types)] 1056 pub mod members { 1057 ///Marker type for the `cid` field 1058 pub struct cid(()); 1059 ///Marker type for the `policies` field 1060 pub struct policies(()); 1061 ///Marker type for the `uri` field 1062 pub struct uri(()); 1063 ///Marker type for the `creator` field 1064 pub struct creator(()); 1065 ///Marker type for the `indexed_at` field 1066 pub struct indexed_at(()); 1067 } 1068} 1069 1070/// Builder for constructing an instance of this type 1071pub struct LabelerViewDetailedBuilder<'a, S: labeler_view_detailed_state::State> { 1072 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1073 __unsafe_private_named: ( 1074 ::core::option::Option<jacquard_common::types::string::Cid<'a>>, 1075 ::core::option::Option<crate::app_bsky::actor::ProfileView<'a>>, 1076 ::core::option::Option<jacquard_common::types::string::Datetime>, 1077 ::core::option::Option<Vec<crate::com_atproto::label::Label<'a>>>, 1078 ::core::option::Option<i64>, 1079 ::core::option::Option<crate::app_bsky::labeler::LabelerPolicies<'a>>, 1080 ::core::option::Option<Vec<crate::com_atproto::moderation::ReasonType<'a>>>, 1081 ::core::option::Option<Vec<jacquard_common::types::string::Nsid<'a>>>, 1082 ::core::option::Option<Vec<crate::com_atproto::moderation::SubjectType<'a>>>, 1083 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1084 ::core::option::Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 1085 ), 1086 _phantom: ::core::marker::PhantomData<&'a ()>, 1087} 1088 1089impl<'a> LabelerViewDetailed<'a> { 1090 /// Create a new builder for this type 1091 pub fn new() -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::Empty> { 1092 LabelerViewDetailedBuilder::new() 1093 } 1094} 1095 1096impl<'a> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::Empty> { 1097 /// Create a new builder with all fields unset 1098 pub fn new() -> Self { 1099 LabelerViewDetailedBuilder { 1100 _phantom_state: ::core::marker::PhantomData, 1101 __unsafe_private_named: ( 1102 None, 1103 None, 1104 None, 1105 None, 1106 None, 1107 None, 1108 None, 1109 None, 1110 None, 1111 None, 1112 None, 1113 ), 1114 _phantom: ::core::marker::PhantomData, 1115 } 1116 } 1117} 1118 1119impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1120where 1121 S: labeler_view_detailed_state::State, 1122 S::Cid: labeler_view_detailed_state::IsUnset, 1123{ 1124 /// Set the `cid` field (required) 1125 pub fn cid( 1126 mut self, 1127 value: impl Into<jacquard_common::types::string::Cid<'a>>, 1128 ) -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::SetCid<S>> { 1129 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1130 LabelerViewDetailedBuilder { 1131 _phantom_state: ::core::marker::PhantomData, 1132 __unsafe_private_named: self.__unsafe_private_named, 1133 _phantom: ::core::marker::PhantomData, 1134 } 1135 } 1136} 1137 1138impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1139where 1140 S: labeler_view_detailed_state::State, 1141 S::Creator: labeler_view_detailed_state::IsUnset, 1142{ 1143 /// Set the `creator` field (required) 1144 pub fn creator( 1145 mut self, 1146 value: impl Into<crate::app_bsky::actor::ProfileView<'a>>, 1147 ) -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::SetCreator<S>> { 1148 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1149 LabelerViewDetailedBuilder { 1150 _phantom_state: ::core::marker::PhantomData, 1151 __unsafe_private_named: self.__unsafe_private_named, 1152 _phantom: ::core::marker::PhantomData, 1153 } 1154 } 1155} 1156 1157impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1158where 1159 S: labeler_view_detailed_state::State, 1160 S::IndexedAt: labeler_view_detailed_state::IsUnset, 1161{ 1162 /// Set the `indexedAt` field (required) 1163 pub fn indexed_at( 1164 mut self, 1165 value: impl Into<jacquard_common::types::string::Datetime>, 1166 ) -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::SetIndexedAt<S>> { 1167 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1168 LabelerViewDetailedBuilder { 1169 _phantom_state: ::core::marker::PhantomData, 1170 __unsafe_private_named: self.__unsafe_private_named, 1171 _phantom: ::core::marker::PhantomData, 1172 } 1173 } 1174} 1175 1176impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1177 /// Set the `labels` field (optional) 1178 pub fn labels( 1179 mut self, 1180 value: impl Into<Option<Vec<crate::com_atproto::label::Label<'a>>>>, 1181 ) -> Self { 1182 self.__unsafe_private_named.3 = value.into(); 1183 self 1184 } 1185 /// Set the `labels` field to an Option value (optional) 1186 pub fn maybe_labels( 1187 mut self, 1188 value: Option<Vec<crate::com_atproto::label::Label<'a>>>, 1189 ) -> Self { 1190 self.__unsafe_private_named.3 = value; 1191 self 1192 } 1193} 1194 1195impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1196 /// Set the `likeCount` field (optional) 1197 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self { 1198 self.__unsafe_private_named.4 = value.into(); 1199 self 1200 } 1201 /// Set the `likeCount` field to an Option value (optional) 1202 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self { 1203 self.__unsafe_private_named.4 = value; 1204 self 1205 } 1206} 1207 1208impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1209where 1210 S: labeler_view_detailed_state::State, 1211 S::Policies: labeler_view_detailed_state::IsUnset, 1212{ 1213 /// Set the `policies` field (required) 1214 pub fn policies( 1215 mut self, 1216 value: impl Into<crate::app_bsky::labeler::LabelerPolicies<'a>>, 1217 ) -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::SetPolicies<S>> { 1218 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 1219 LabelerViewDetailedBuilder { 1220 _phantom_state: ::core::marker::PhantomData, 1221 __unsafe_private_named: self.__unsafe_private_named, 1222 _phantom: ::core::marker::PhantomData, 1223 } 1224 } 1225} 1226 1227impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1228 /// Set the `reasonTypes` field (optional) 1229 pub fn reason_types( 1230 mut self, 1231 value: impl Into<Option<Vec<crate::com_atproto::moderation::ReasonType<'a>>>>, 1232 ) -> Self { 1233 self.__unsafe_private_named.6 = value.into(); 1234 self 1235 } 1236 /// Set the `reasonTypes` field to an Option value (optional) 1237 pub fn maybe_reason_types( 1238 mut self, 1239 value: Option<Vec<crate::com_atproto::moderation::ReasonType<'a>>>, 1240 ) -> Self { 1241 self.__unsafe_private_named.6 = value; 1242 self 1243 } 1244} 1245 1246impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1247 /// Set the `subjectCollections` field (optional) 1248 pub fn subject_collections( 1249 mut self, 1250 value: impl Into<Option<Vec<jacquard_common::types::string::Nsid<'a>>>>, 1251 ) -> Self { 1252 self.__unsafe_private_named.7 = value.into(); 1253 self 1254 } 1255 /// Set the `subjectCollections` field to an Option value (optional) 1256 pub fn maybe_subject_collections( 1257 mut self, 1258 value: Option<Vec<jacquard_common::types::string::Nsid<'a>>>, 1259 ) -> Self { 1260 self.__unsafe_private_named.7 = value; 1261 self 1262 } 1263} 1264 1265impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1266 /// Set the `subjectTypes` field (optional) 1267 pub fn subject_types( 1268 mut self, 1269 value: impl Into<Option<Vec<crate::com_atproto::moderation::SubjectType<'a>>>>, 1270 ) -> Self { 1271 self.__unsafe_private_named.8 = value.into(); 1272 self 1273 } 1274 /// Set the `subjectTypes` field to an Option value (optional) 1275 pub fn maybe_subject_types( 1276 mut self, 1277 value: Option<Vec<crate::com_atproto::moderation::SubjectType<'a>>>, 1278 ) -> Self { 1279 self.__unsafe_private_named.8 = value; 1280 self 1281 } 1282} 1283 1284impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1285where 1286 S: labeler_view_detailed_state::State, 1287 S::Uri: labeler_view_detailed_state::IsUnset, 1288{ 1289 /// Set the `uri` field (required) 1290 pub fn uri( 1291 mut self, 1292 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1293 ) -> LabelerViewDetailedBuilder<'a, labeler_view_detailed_state::SetUri<S>> { 1294 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); 1295 LabelerViewDetailedBuilder { 1296 _phantom_state: ::core::marker::PhantomData, 1297 __unsafe_private_named: self.__unsafe_private_named, 1298 _phantom: ::core::marker::PhantomData, 1299 } 1300 } 1301} 1302 1303impl<'a, S: labeler_view_detailed_state::State> LabelerViewDetailedBuilder<'a, S> { 1304 /// Set the `viewer` field (optional) 1305 pub fn viewer( 1306 mut self, 1307 value: impl Into<Option<crate::app_bsky::labeler::LabelerViewerState<'a>>>, 1308 ) -> Self { 1309 self.__unsafe_private_named.10 = value.into(); 1310 self 1311 } 1312 /// Set the `viewer` field to an Option value (optional) 1313 pub fn maybe_viewer( 1314 mut self, 1315 value: Option<crate::app_bsky::labeler::LabelerViewerState<'a>>, 1316 ) -> Self { 1317 self.__unsafe_private_named.10 = value; 1318 self 1319 } 1320} 1321 1322impl<'a, S> LabelerViewDetailedBuilder<'a, S> 1323where 1324 S: labeler_view_detailed_state::State, 1325 S::Cid: labeler_view_detailed_state::IsSet, 1326 S::Policies: labeler_view_detailed_state::IsSet, 1327 S::Uri: labeler_view_detailed_state::IsSet, 1328 S::Creator: labeler_view_detailed_state::IsSet, 1329 S::IndexedAt: labeler_view_detailed_state::IsSet, 1330{ 1331 /// Build the final struct 1332 pub fn build(self) -> LabelerViewDetailed<'a> { 1333 LabelerViewDetailed { 1334 cid: self.__unsafe_private_named.0.unwrap(), 1335 creator: self.__unsafe_private_named.1.unwrap(), 1336 indexed_at: self.__unsafe_private_named.2.unwrap(), 1337 labels: self.__unsafe_private_named.3, 1338 like_count: self.__unsafe_private_named.4, 1339 policies: self.__unsafe_private_named.5.unwrap(), 1340 reason_types: self.__unsafe_private_named.6, 1341 subject_collections: self.__unsafe_private_named.7, 1342 subject_types: self.__unsafe_private_named.8, 1343 uri: self.__unsafe_private_named.9.unwrap(), 1344 viewer: self.__unsafe_private_named.10, 1345 extra_data: Default::default(), 1346 } 1347 } 1348 /// Build the final struct with custom extra_data 1349 pub fn build_with_data( 1350 self, 1351 extra_data: std::collections::BTreeMap< 1352 jacquard_common::smol_str::SmolStr, 1353 jacquard_common::types::value::Data<'a>, 1354 >, 1355 ) -> LabelerViewDetailed<'a> { 1356 LabelerViewDetailed { 1357 cid: self.__unsafe_private_named.0.unwrap(), 1358 creator: self.__unsafe_private_named.1.unwrap(), 1359 indexed_at: self.__unsafe_private_named.2.unwrap(), 1360 labels: self.__unsafe_private_named.3, 1361 like_count: self.__unsafe_private_named.4, 1362 policies: self.__unsafe_private_named.5.unwrap(), 1363 reason_types: self.__unsafe_private_named.6, 1364 subject_collections: self.__unsafe_private_named.7, 1365 subject_types: self.__unsafe_private_named.8, 1366 uri: self.__unsafe_private_named.9.unwrap(), 1367 viewer: self.__unsafe_private_named.10, 1368 extra_data: Some(extra_data), 1369 } 1370 } 1371} 1372 1373impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerViewDetailed<'a> { 1374 fn nsid() -> &'static str { 1375 "app.bsky.labeler.defs" 1376 } 1377 fn def_name() -> &'static str { 1378 "labelerViewDetailed" 1379 } 1380 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1381 lexicon_doc_app_bsky_labeler_defs() 1382 } 1383 fn validate( 1384 &self, 1385 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1386 if let Some(ref value) = self.like_count { 1387 if *value < 0i64 { 1388 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 1389 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 1390 "like_count", 1391 ), 1392 min: 0i64, 1393 actual: *value, 1394 }); 1395 } 1396 } 1397 Ok(()) 1398 } 1399} 1400 1401#[jacquard_derive::lexicon] 1402#[derive( 1403 serde::Serialize, 1404 serde::Deserialize, 1405 Debug, 1406 Clone, 1407 PartialEq, 1408 Eq, 1409 jacquard_derive::IntoStatic, 1410 Default 1411)] 1412#[serde(rename_all = "camelCase")] 1413pub struct LabelerViewerState<'a> { 1414 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1415 #[serde(borrow)] 1416 pub like: std::option::Option<jacquard_common::types::string::AtUri<'a>>, 1417} 1418 1419impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LabelerViewerState<'a> { 1420 fn nsid() -> &'static str { 1421 "app.bsky.labeler.defs" 1422 } 1423 fn def_name() -> &'static str { 1424 "labelerViewerState" 1425 } 1426 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1427 lexicon_doc_app_bsky_labeler_defs() 1428 } 1429 fn validate( 1430 &self, 1431 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1432 Ok(()) 1433 } 1434}