#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::sync::HostStatus;
use crate::com_atproto::sync::list_hosts;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Host<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub account_count: Option<i64>,
pub hostname: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub seq: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<HostStatus<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListHosts<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ListHostsOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
pub hosts: Vec<list_hosts::Host<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for Host<S> {
fn nsid() -> &'static str {
"com.atproto.sync.listHosts"
}
fn def_name() -> &'static str {
"host"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_listHosts()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct ListHostsResponse;
impl jacquard_common::xrpc::XrpcResp for ListHostsResponse {
const NSID: &'static str = "com.atproto.sync.listHosts";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ListHostsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for ListHosts<S> {
const NSID: &'static str = "com.atproto.sync.listHosts";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = ListHostsResponse;
}
pub struct ListHostsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListHostsRequest {
const PATH: &'static str = "/xrpc/com.atproto.sync.listHosts";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = ListHosts<S>;
type Response = ListHostsResponse;
}
fn lexicon_doc_com_atproto_sync_listHosts() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("com.atproto.sync.listHosts"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("host"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("hostname")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("accountCount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hostname"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"hostname of server; not a URL (no scheme)",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("seq"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"com.atproto.sync.defs#hostStatus",
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cursor"),
LexXrpcParametersProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("limit"),
LexXrpcParametersProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map
},
..Default::default()
}
}
fn _default_limit() -> Option<i64> {
Some(200i64)
}
pub mod list_hosts_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {}
#[allow(non_camel_case_types)]
pub mod members {}
}
pub struct ListHostsBuilder<S: BosStr, St: list_hosts_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ListHosts<S> {
pub fn new() -> ListHostsBuilder<S, list_hosts_state::Empty> {
ListHostsBuilder::new()
}
}
impl<S: BosStr> ListHostsBuilder<S, list_hosts_state::Empty> {
pub fn new() -> Self {
ListHostsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: list_hosts_state::State> ListHostsBuilder<S, St> {
pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: list_hosts_state::State> ListHostsBuilder<S, St> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> ListHostsBuilder<S, St>
where
St: list_hosts_state::State,
{
pub fn build(self) -> ListHosts<S> {
ListHosts {
cursor: self._fields.0,
limit: self._fields.1,
}
}
}