#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::AtUri;
use jacquard_derive::{IntoStatic, lexicon};
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::tools_ozone::verification::revoke_verifications;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RevokeVerifications<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub revoke_reason: Option<CowStr<'a>>,
#[serde(borrow)]
pub uris: Vec<AtUri<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RevokeVerificationsOutput<'a> {
#[serde(borrow)]
pub failed_revocations: Vec<revoke_verifications::RevokeError<'a>>,
#[serde(borrow)]
pub revoked_verifications: Vec<AtUri<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RevokeError<'a> {
#[serde(borrow)]
pub error: CowStr<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
pub struct RevokeVerificationsResponse;
impl jacquard_common::xrpc::XrpcResp for RevokeVerificationsResponse {
const NSID: &'static str = "tools.ozone.verification.revokeVerifications";
const ENCODING: &'static str = "application/json";
type Output<'de> = RevokeVerificationsOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for RevokeVerifications<'a> {
const NSID: &'static str = "tools.ozone.verification.revokeVerifications";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = RevokeVerificationsResponse;
}
pub struct RevokeVerificationsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for RevokeVerificationsRequest {
const PATH: &'static str = "/xrpc/tools.ozone.verification.revokeVerifications";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<'de> = RevokeVerifications<'de>;
type Response = RevokeVerificationsResponse;
}
impl<'a> LexiconSchema for RevokeError<'a> {
fn nsid() -> &'static str {
"tools.ozone.verification.revokeVerifications"
}
fn def_name() -> &'static str {
"revokeError"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tools_ozone_verification_revokeVerifications()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod revoke_verifications_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 Uris;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uris = Unset;
}
pub struct SetUris<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUris<S> {}
impl<S: State> State for SetUris<S> {
type Uris = Set<members::uris>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uris(());
}
}
pub struct RevokeVerificationsBuilder<'a, S: revoke_verifications_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<Vec<AtUri<'a>>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RevokeVerifications<'a> {
pub fn new() -> RevokeVerificationsBuilder<'a, revoke_verifications_state::Empty> {
RevokeVerificationsBuilder::new()
}
}
impl<'a> RevokeVerificationsBuilder<'a, revoke_verifications_state::Empty> {
pub fn new() -> Self {
RevokeVerificationsBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: revoke_verifications_state::State> RevokeVerificationsBuilder<'a, S> {
pub fn revoke_reason(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_revoke_reason(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> RevokeVerificationsBuilder<'a, S>
where
S: revoke_verifications_state::State,
S::Uris: revoke_verifications_state::IsUnset,
{
pub fn uris(
mut self,
value: impl Into<Vec<AtUri<'a>>>,
) -> RevokeVerificationsBuilder<'a, revoke_verifications_state::SetUris<S>> {
self._fields.1 = Option::Some(value.into());
RevokeVerificationsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RevokeVerificationsBuilder<'a, S>
where
S: revoke_verifications_state::State,
S::Uris: revoke_verifications_state::IsSet,
{
pub fn build(self) -> RevokeVerifications<'a> {
RevokeVerifications {
revoke_reason: self._fields.0,
uris: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RevokeVerifications<'a> {
RevokeVerifications {
revoke_reason: self._fields.0,
uris: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod revoke_error_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 Error;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Error = Unset;
type Uri = Unset;
}
pub struct SetError<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetError<S> {}
impl<S: State> State for SetError<S> {
type Error = Set<members::error>;
type Uri = S::Uri;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Error = S::Error;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct error(());
pub struct uri(());
}
}
pub struct RevokeErrorBuilder<'a, S: revoke_error_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RevokeError<'a> {
pub fn new() -> RevokeErrorBuilder<'a, revoke_error_state::Empty> {
RevokeErrorBuilder::new()
}
}
impl<'a> RevokeErrorBuilder<'a, revoke_error_state::Empty> {
pub fn new() -> Self {
RevokeErrorBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RevokeErrorBuilder<'a, S>
where
S: revoke_error_state::State,
S::Error: revoke_error_state::IsUnset,
{
pub fn error(
mut self,
value: impl Into<CowStr<'a>>,
) -> RevokeErrorBuilder<'a, revoke_error_state::SetError<S>> {
self._fields.0 = Option::Some(value.into());
RevokeErrorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RevokeErrorBuilder<'a, S>
where
S: revoke_error_state::State,
S::Uri: revoke_error_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> RevokeErrorBuilder<'a, revoke_error_state::SetUri<S>> {
self._fields.1 = Option::Some(value.into());
RevokeErrorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RevokeErrorBuilder<'a, S>
where
S: revoke_error_state::State,
S::Error: revoke_error_state::IsSet,
S::Uri: revoke_error_state::IsSet,
{
pub fn build(self) -> RevokeError<'a> {
RevokeError {
error: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RevokeError<'a> {
RevokeError {
error: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_tools_ozone_verification_revokeVerifications() -> 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("tools.ozone.verification.revokeVerifications"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcProcedure(LexXrpcProcedure {
input: Some(LexXrpcBody {
encoding: CowStr::new_static("application/json"),
schema: Some(
LexXrpcBodySchema::Object(LexObject {
required: Some(vec![SmolStr::new_static("uris")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("revokeReason"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Reason for revoking the verification. This is optional and can be omitted if not needed.",
),
),
max_length: Some(1000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uris"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Array of verification record uris to revoke",
),
),
items: LexArrayItem::String(LexString {
description: Some(
CowStr::new_static(
"The AT-URI of the verification record to revoke.",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
max_length: Some(100usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("revokeError"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Error object for failed revocations"),
),
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("error")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("error"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Description of the error that occurred during revocation.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The AT-URI of the verification record that failed to revoke.",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}