jacquard_api/com_atproto/sync/
request_crawl.rs

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    jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20#[builder(start_fn = new)]
21pub struct RequestCrawl<'a> {
22    ///Hostname of the current service (eg, PDS) that is requesting to be crawled.
23    #[serde(borrow)]
24    #[builder(into)]
25    pub hostname: jacquard_common::CowStr<'a>,
26    #[serde(flatten)]
27    #[serde(borrow)]
28    #[builder(default)]
29    pub extra_data: ::std::collections::BTreeMap<
30        ::jacquard_common::smol_str::SmolStr,
31        ::jacquard_common::types::value::Data<'a>,
32    >,
33}
34
35#[jacquard_derive::open_union]
36#[derive(
37    serde::Serialize,
38    serde::Deserialize,
39    Debug,
40    Clone,
41    PartialEq,
42    Eq,
43    thiserror::Error,
44    miette::Diagnostic
45)]
46#[serde(tag = "error", content = "message")]
47#[serde(bound(deserialize = "'de: 'a"))]
48pub enum RequestCrawlError<'a> {
49    #[serde(rename = "HostBanned")]
50    HostBanned(std::option::Option<String>),
51}
52
53impl std::fmt::Display for RequestCrawlError<'_> {
54    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55        match self {
56            Self::HostBanned(msg) => {
57                write!(f, "HostBanned")?;
58                if let Some(msg) = msg {
59                    write!(f, ": {}", msg)?;
60                }
61                Ok(())
62            }
63            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
64        }
65    }
66}
67
68impl jacquard_common::IntoStatic for RequestCrawlError<'_> {
69    type Output = RequestCrawlError<'static>;
70    fn into_static(self) -> Self::Output {
71        match self {
72            RequestCrawlError::HostBanned(v) => {
73                RequestCrawlError::HostBanned(v.into_static())
74            }
75            RequestCrawlError::Unknown(v) => RequestCrawlError::Unknown(v.into_static()),
76        }
77    }
78}
79
80///Response type for
81///com.atproto.sync.requestCrawl
82pub struct RequestCrawlResponse;
83impl jacquard_common::xrpc::XrpcResp for RequestCrawlResponse {
84    const NSID: &'static str = "com.atproto.sync.requestCrawl";
85    const ENCODING: &'static str = "application/json";
86    type Output<'de> = ();
87    type Err<'de> = RequestCrawlError<'de>;
88}
89
90impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for RequestCrawl<'de> {
91    const NSID: &'static str = "com.atproto.sync.requestCrawl";
92    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
93        "application/json",
94    );
95    type Response = RequestCrawlResponse;
96}
97
98///Endpoint type for
99///com.atproto.sync.requestCrawl
100pub struct RequestCrawlRequest;
101impl jacquard_common::xrpc::XrpcEndpoint for RequestCrawlRequest {
102    const PATH: &'static str = "/xrpc/com.atproto.sync.requestCrawl";
103    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
104        "application/json",
105    );
106    type Request<'de> = RequestCrawl<'de>;
107    type Response = RequestCrawlResponse;
108}