1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.sync.requestCrawl
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 bon::Builder
17)]
18#[serde(rename_all = "camelCase")]
19#[builder(start_fn = new)]
20pub struct RequestCrawl<'a> {
21 ///Hostname of the current service (eg, PDS) that is requesting to be crawled.
22 #[serde(borrow)]
23 #[builder(into)]
24 pub hostname: jacquard_common::CowStr<'a>,
25 #[serde(flatten)]
26 #[serde(borrow)]
27 #[builder(default)]
28 pub extra_data: ::std::collections::BTreeMap<
29 ::jacquard_common::smol_str::SmolStr,
30 ::jacquard_common::types::value::Data<'a>,
31 >,
32}
33
34impl jacquard_common::IntoStatic for RequestCrawl<'_> {
35 type Output = RequestCrawl<'static>;
36 fn into_static(self) -> Self::Output {
37 RequestCrawl {
38 hostname: self.hostname.into_static(),
39 extra_data: self.extra_data.into_static(),
40 }
41 }
42}
43
44#[jacquard_derive::open_union]
45#[derive(
46 serde::Serialize,
47 serde::Deserialize,
48 Debug,
49 Clone,
50 PartialEq,
51 Eq,
52 thiserror::Error,
53 miette::Diagnostic
54)]
55#[serde(tag = "error", content = "message")]
56#[serde(bound(deserialize = "'de: 'a"))]
57pub enum RequestCrawlError<'a> {
58 #[serde(rename = "HostBanned")]
59 HostBanned(std::option::Option<String>),
60}
61
62impl std::fmt::Display for RequestCrawlError<'_> {
63 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
64 match self {
65 Self::HostBanned(msg) => {
66 write!(f, "HostBanned")?;
67 if let Some(msg) = msg {
68 write!(f, ": {}", msg)?;
69 }
70 Ok(())
71 }
72 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
73 }
74 }
75}
76
77impl jacquard_common::IntoStatic for RequestCrawlError<'_> {
78 type Output = RequestCrawlError<'static>;
79 fn into_static(self) -> Self::Output {
80 match self {
81 RequestCrawlError::HostBanned(v) => {
82 RequestCrawlError::HostBanned(v.into_static())
83 }
84 RequestCrawlError::Unknown(v) => RequestCrawlError::Unknown(v.into_static()),
85 }
86 }
87}
88
89impl jacquard_common::types::xrpc::XrpcRequest for RequestCrawl<'_> {
90 const NSID: &'static str = "com.atproto.sync.requestCrawl";
91 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure(
92 "application/json",
93 );
94 const OUTPUT_ENCODING: &'static str = "application/json";
95 type Output<'de> = ();
96 type Err<'de> = RequestCrawlError<'de>;
97}