Skip to main content

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#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14use jacquard_derive::{IntoStatic, lexicon, open_union};
15use serde::{Serialize, Deserialize};
16
17#[lexicon]
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
19#[serde(rename_all = "camelCase")]
20pub struct RequestCrawl<'a> {
21    ///Hostname of the current service (eg, PDS) that is requesting to be crawled.
22    #[serde(borrow)]
23    pub hostname: CowStr<'a>,
24}
25
26
27#[open_union]
28#[derive(
29    Serialize,
30    Deserialize,
31    Debug,
32    Clone,
33    PartialEq,
34    Eq,
35    thiserror::Error,
36    miette::Diagnostic,
37    IntoStatic
38)]
39
40#[serde(tag = "error", content = "message")]
41#[serde(bound(deserialize = "'de: 'a"))]
42pub enum RequestCrawlError<'a> {
43    #[serde(rename = "HostBanned")]
44    HostBanned(Option<CowStr<'a>>),
45}
46
47impl core::fmt::Display for RequestCrawlError<'_> {
48    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
49        match self {
50            Self::HostBanned(msg) => {
51                write!(f, "HostBanned")?;
52                if let Some(msg) = msg {
53                    write!(f, ": {}", msg)?;
54                }
55                Ok(())
56            }
57            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
58        }
59    }
60}
61
62/// Response type for com.atproto.sync.requestCrawl
63pub struct RequestCrawlResponse;
64impl jacquard_common::xrpc::XrpcResp for RequestCrawlResponse {
65    const NSID: &'static str = "com.atproto.sync.requestCrawl";
66    const ENCODING: &'static str = "application/json";
67    type Output<'de> = ();
68    type Err<'de> = RequestCrawlError<'de>;
69}
70
71impl<'a> jacquard_common::xrpc::XrpcRequest for RequestCrawl<'a> {
72    const NSID: &'static str = "com.atproto.sync.requestCrawl";
73    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
74        "application/json",
75    );
76    type Response = RequestCrawlResponse;
77}
78
79/// Endpoint type for com.atproto.sync.requestCrawl
80pub struct RequestCrawlRequest;
81impl jacquard_common::xrpc::XrpcEndpoint for RequestCrawlRequest {
82    const PATH: &'static str = "/xrpc/com.atproto.sync.requestCrawl";
83    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
84        "application/json",
85    );
86    type Request<'de> = RequestCrawl<'de>;
87    type Response = RequestCrawlResponse;
88}