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 jacquard_derive::IntoStatic,
17 Default
18)]
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: jacquard_common::CowStr<'a>,
24}
25
26#[jacquard_derive::open_union]
27#[derive(
28 serde::Serialize,
29 serde::Deserialize,
30 Debug,
31 Clone,
32 PartialEq,
33 Eq,
34 thiserror::Error,
35 miette::Diagnostic,
36 jacquard_derive::IntoStatic
37)]
38#[serde(tag = "error", content = "message")]
39#[serde(bound(deserialize = "'de: 'a"))]
40pub enum RequestCrawlError<'a> {
41 #[serde(rename = "HostBanned")]
42 HostBanned(std::option::Option<String>),
43}
44
45impl std::fmt::Display for RequestCrawlError<'_> {
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 match self {
48 Self::HostBanned(msg) => {
49 write!(f, "HostBanned")?;
50 if let Some(msg) = msg {
51 write!(f, ": {}", msg)?;
52 }
53 Ok(())
54 }
55 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
56 }
57 }
58}
59
60///Response type for
61///com.atproto.sync.requestCrawl
62pub struct RequestCrawlResponse;
63impl jacquard_common::xrpc::XrpcResp for RequestCrawlResponse {
64 const NSID: &'static str = "com.atproto.sync.requestCrawl";
65 const ENCODING: &'static str = "application/json";
66 type Output<'de> = ();
67 type Err<'de> = RequestCrawlError<'de>;
68}
69
70impl<'a> jacquard_common::xrpc::XrpcRequest for RequestCrawl<'a> {
71 const NSID: &'static str = "com.atproto.sync.requestCrawl";
72 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
73 "application/json",
74 );
75 type Response = RequestCrawlResponse;
76}
77
78///Endpoint type for
79///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}