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    jacquard_derive::IntoStatic
46)]
47#[serde(tag = "error", content = "message")]
48#[serde(bound(deserialize = "'de: 'a"))]
49pub enum RequestCrawlError<'a> {
50    #[serde(rename = "HostBanned")]
51    HostBanned(std::option::Option<String>),
52}
53
54impl std::fmt::Display for RequestCrawlError<'_> {
55    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56        match self {
57            Self::HostBanned(msg) => {
58                write!(f, "HostBanned")?;
59                if let Some(msg) = msg {
60                    write!(f, ": {}", msg)?;
61                }
62                Ok(())
63            }
64            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
65        }
66    }
67}
68
69///Response type for
70///com.atproto.sync.requestCrawl
71pub struct RequestCrawlResponse;
72impl jacquard_common::xrpc::XrpcResp for RequestCrawlResponse {
73    const NSID: &'static str = "com.atproto.sync.requestCrawl";
74    const ENCODING: &'static str = "application/json";
75    type Output<'de> = ();
76    type Err<'de> = RequestCrawlError<'de>;
77}
78
79impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for RequestCrawl<'de> {
80    const NSID: &'static str = "com.atproto.sync.requestCrawl";
81    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
82        "application/json",
83    );
84    type Response = RequestCrawlResponse;
85}
86
87///Endpoint type for
88///com.atproto.sync.requestCrawl
89pub struct RequestCrawlRequest;
90impl jacquard_common::xrpc::XrpcEndpoint for RequestCrawlRequest {
91    const PATH: &'static str = "/xrpc/com.atproto.sync.requestCrawl";
92    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
93        "application/json",
94    );
95    type Request<'de> = RequestCrawl<'de>;
96    type Response = RequestCrawlResponse;
97}