fn _default_limit() -> std::option::Option<i64> {
Some(500i64)
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ListRepos<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub limit: std::option::Option<i64>,
}
pub mod list_repos_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 ListReposBuilder<'a, S: list_repos_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ListRepos<'a> {
pub fn new() -> ListReposBuilder<'a, list_repos_state::Empty> {
ListReposBuilder::new()
}
}
impl<'a> ListReposBuilder<'a, list_repos_state::Empty> {
pub fn new() -> Self {
ListReposBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: list_repos_state::State> ListReposBuilder<'a, S> {
pub fn cursor(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: list_repos_state::State> ListReposBuilder<'a, S> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> ListReposBuilder<'a, S>
where
S: list_repos_state::State,
{
pub fn build(self) -> ListRepos<'a> {
ListRepos {
cursor: self.__unsafe_private_named.0,
limit: self.__unsafe_private_named.1,
}
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ListReposOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub repos: Vec<crate::com_atproto::sync::list_repos::Repo<'a>>,
}
pub struct ListReposResponse;
impl jacquard_common::xrpc::XrpcResp for ListReposResponse {
const NSID: &'static str = "com.atproto.sync.listRepos";
const ENCODING: &'static str = "application/json";
type Output<'de> = ListReposOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for ListRepos<'a> {
const NSID: &'static str = "com.atproto.sync.listRepos";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = ListReposResponse;
}
pub struct ListReposRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListReposRequest {
const PATH: &'static str = "/xrpc/com.atproto.sync.listRepos";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = ListRepos<'de>;
type Response = ListReposResponse;
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Repo<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub active: std::option::Option<bool>,
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub head: jacquard_common::types::string::Cid<'a>,
pub rev: jacquard_common::types::string::Tid,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub status: std::option::Option<RepoStatus<'a>>,
}
pub mod repo_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 {
type Rev;
type Did;
type Head;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Rev = Unset;
type Did = Unset;
type Head = Unset;
}
pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRev<S> {}
impl<S: State> State for SetRev<S> {
type Rev = Set<members::rev>;
type Did = S::Did;
type Head = S::Head;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Rev = S::Rev;
type Did = Set<members::did>;
type Head = S::Head;
}
pub struct SetHead<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHead<S> {}
impl<S: State> State for SetHead<S> {
type Rev = S::Rev;
type Did = S::Did;
type Head = Set<members::head>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct rev(());
pub struct did(());
pub struct head(());
}
}
pub struct RepoBuilder<'a, S: repo_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<bool>,
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::types::string::Cid<'a>>,
::core::option::Option<jacquard_common::types::string::Tid>,
::core::option::Option<RepoStatus<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Repo<'a> {
pub fn new() -> RepoBuilder<'a, repo_state::Empty> {
RepoBuilder::new()
}
}
impl<'a> RepoBuilder<'a, repo_state::Empty> {
pub fn new() -> Self {
RepoBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn active(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_active(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Did: repo_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> RepoBuilder<'a, repo_state::SetDid<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
RepoBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Head: repo_state::IsUnset,
{
pub fn head(
mut self,
value: impl Into<jacquard_common::types::string::Cid<'a>>,
) -> RepoBuilder<'a, repo_state::SetHead<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
RepoBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Rev: repo_state::IsUnset,
{
pub fn rev(
mut self,
value: impl Into<jacquard_common::types::string::Tid>,
) -> RepoBuilder<'a, repo_state::SetRev<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
RepoBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: repo_state::State> RepoBuilder<'a, S> {
pub fn status(mut self, value: impl Into<Option<RepoStatus<'a>>>) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_status(mut self, value: Option<RepoStatus<'a>>) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> RepoBuilder<'a, S>
where
S: repo_state::State,
S::Rev: repo_state::IsSet,
S::Did: repo_state::IsSet,
S::Head: repo_state::IsSet,
{
pub fn build(self) -> Repo<'a> {
Repo {
active: self.__unsafe_private_named.0,
did: self.__unsafe_private_named.1.unwrap(),
head: self.__unsafe_private_named.2.unwrap(),
rev: self.__unsafe_private_named.3.unwrap(),
status: self.__unsafe_private_named.4,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Repo<'a> {
Repo {
active: self.__unsafe_private_named.0,
did: self.__unsafe_private_named.1.unwrap(),
head: self.__unsafe_private_named.2.unwrap(),
rev: self.__unsafe_private_named.3.unwrap(),
status: self.__unsafe_private_named.4,
extra_data: Some(extra_data),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RepoStatus<'a> {
Takendown,
Suspended,
Deleted,
Deactivated,
Desynchronized,
Throttled,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> RepoStatus<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Takendown => "takendown",
Self::Suspended => "suspended",
Self::Deleted => "deleted",
Self::Deactivated => "deactivated",
Self::Desynchronized => "desynchronized",
Self::Throttled => "throttled",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for RepoStatus<'a> {
fn from(s: &'a str) -> Self {
match s {
"takendown" => Self::Takendown,
"suspended" => Self::Suspended,
"deleted" => Self::Deleted,
"deactivated" => Self::Deactivated,
"desynchronized" => Self::Desynchronized,
"throttled" => Self::Throttled,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for RepoStatus<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"takendown" => Self::Takendown,
"suspended" => Self::Suspended,
"deleted" => Self::Deleted,
"deactivated" => Self::Deactivated,
"desynchronized" => Self::Desynchronized,
"throttled" => Self::Throttled,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for RepoStatus<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for RepoStatus<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for RepoStatus<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for RepoStatus<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for RepoStatus<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for RepoStatus<'_> {
type Output = RepoStatus<'static>;
fn into_static(self) -> Self::Output {
match self {
RepoStatus::Takendown => RepoStatus::Takendown,
RepoStatus::Suspended => RepoStatus::Suspended,
RepoStatus::Deleted => RepoStatus::Deleted,
RepoStatus::Deactivated => RepoStatus::Deactivated,
RepoStatus::Desynchronized => RepoStatus::Desynchronized,
RepoStatus::Throttled => RepoStatus::Throttled,
RepoStatus::Other(v) => RepoStatus::Other(v.into_static()),
}
}
}
fn lexicon_doc_com_atproto_sync_listRepos() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("com.atproto.sync.listRepos"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
description: None,
parameters: Some(
::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
description: None,
required: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cursor",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"limit",
),
::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
),
output: None,
errors: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("repo"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("did"),
::jacquard_common::deps::smol_str::SmolStr::new_static("head"),
::jacquard_common::deps::smol_str::SmolStr::new_static("rev")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"active",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"did",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Did,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"head",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Current repo commit CID",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Cid,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"rev",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Tid,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"status",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Repo<'a> {
fn nsid() -> &'static str {
"com.atproto.sync.listRepos"
}
fn def_name() -> &'static str {
"repo"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_com_atproto_sync_listRepos()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}