#[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::string::Did;
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::tools_ozone::moderation::cancel_scheduled_actions;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CancellationResults<S: BosStr = DefaultStr> {
pub failed: Vec<cancel_scheduled_actions::FailedCancellation<S>>,
pub succeeded: Vec<Did<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 FailedCancellation<S: BosStr = DefaultStr> {
pub did: Did<S>,
pub error: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<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 CancelScheduledActions<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<S>,
pub subjects: Vec<Did<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 CancelScheduledActionsOutput<S: BosStr = DefaultStr> {
#[serde(flatten)]
pub value: Data<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for CancellationResults<S> {
fn nsid() -> &'static str {
"tools.ozone.moderation.cancelScheduledActions"
}
fn def_name() -> &'static str {
"cancellationResults"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tools_ozone_moderation_cancelScheduledActions()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for FailedCancellation<S> {
fn nsid() -> &'static str {
"tools.ozone.moderation.cancelScheduledActions"
}
fn def_name() -> &'static str {
"failedCancellation"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_tools_ozone_moderation_cancelScheduledActions()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct CancelScheduledActionsResponse;
impl jacquard_common::xrpc::XrpcResp for CancelScheduledActionsResponse {
const NSID: &'static str = "tools.ozone.moderation.cancelScheduledActions";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = CancelScheduledActionsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for CancelScheduledActions<S> {
const NSID: &'static str = "tools.ozone.moderation.cancelScheduledActions";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = CancelScheduledActionsResponse;
}
pub struct CancelScheduledActionsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for CancelScheduledActionsRequest {
const PATH: &'static str = "/xrpc/tools.ozone.moderation.cancelScheduledActions";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = CancelScheduledActions<S>;
type Response = CancelScheduledActionsResponse;
}
pub mod cancellation_results_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 Succeeded;
type Failed;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Succeeded = Unset;
type Failed = Unset;
}
pub struct SetSucceeded<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSucceeded<St> {}
impl<St: State> State for SetSucceeded<St> {
type Succeeded = Set<members::succeeded>;
type Failed = St::Failed;
}
pub struct SetFailed<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFailed<St> {}
impl<St: State> State for SetFailed<St> {
type Succeeded = St::Succeeded;
type Failed = Set<members::failed>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct succeeded(());
pub struct failed(());
}
}
pub struct CancellationResultsBuilder<S: BosStr, St: cancellation_results_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<cancel_scheduled_actions::FailedCancellation<S>>>,
Option<Vec<Did<S>>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> CancellationResults<S> {
pub fn new() -> CancellationResultsBuilder<S, cancellation_results_state::Empty> {
CancellationResultsBuilder::new()
}
}
impl<S: BosStr> CancellationResultsBuilder<S, cancellation_results_state::Empty> {
pub fn new() -> Self {
CancellationResultsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CancellationResultsBuilder<S, St>
where
St: cancellation_results_state::State,
St::Failed: cancellation_results_state::IsUnset,
{
pub fn failed(
mut self,
value: impl Into<Vec<cancel_scheduled_actions::FailedCancellation<S>>>,
) -> CancellationResultsBuilder<S, cancellation_results_state::SetFailed<St>> {
self._fields.0 = Option::Some(value.into());
CancellationResultsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CancellationResultsBuilder<S, St>
where
St: cancellation_results_state::State,
St::Succeeded: cancellation_results_state::IsUnset,
{
pub fn succeeded(
mut self,
value: impl Into<Vec<Did<S>>>,
) -> CancellationResultsBuilder<S, cancellation_results_state::SetSucceeded<St>> {
self._fields.1 = Option::Some(value.into());
CancellationResultsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CancellationResultsBuilder<S, St>
where
St: cancellation_results_state::State,
St::Succeeded: cancellation_results_state::IsSet,
St::Failed: cancellation_results_state::IsSet,
{
pub fn build(self) -> CancellationResults<S> {
CancellationResults {
failed: self._fields.0.unwrap(),
succeeded: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> CancellationResults<S> {
CancellationResults {
failed: self._fields.0.unwrap(),
succeeded: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> 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.moderation.cancelScheduledActions"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cancellationResults"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("succeeded"),
SmolStr::new_static("failed")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("failed"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"DIDs for which cancellation failed with error details",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#failedCancellation"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("succeeded"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"DIDs for which all pending scheduled actions were successfully cancelled",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("failedCancellation"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("did"), SmolStr::new_static("error")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("error"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("errorCode"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map
},
..Default::default()
}),
);
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("subjects")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("comment"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Optional comment describing the reason for cancellation",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subjects"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Array of DID subjects to cancel scheduled actions for",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
max_length: Some(100usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod failed_cancellation_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 Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Error = Unset;
type Did = Unset;
}
pub struct SetError<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetError<St> {}
impl<St: State> State for SetError<St> {
type Error = Set<members::error>;
type Did = St::Did;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Error = St::Error;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct error(());
pub struct did(());
}
}
pub struct FailedCancellationBuilder<S: BosStr, St: failed_cancellation_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>, Option<S>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> FailedCancellation<S> {
pub fn new() -> FailedCancellationBuilder<S, failed_cancellation_state::Empty> {
FailedCancellationBuilder::new()
}
}
impl<S: BosStr> FailedCancellationBuilder<S, failed_cancellation_state::Empty> {
pub fn new() -> Self {
FailedCancellationBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FailedCancellationBuilder<S, St>
where
St: failed_cancellation_state::State,
St::Did: failed_cancellation_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<Did<S>>,
) -> FailedCancellationBuilder<S, failed_cancellation_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
FailedCancellationBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FailedCancellationBuilder<S, St>
where
St: failed_cancellation_state::State,
St::Error: failed_cancellation_state::IsUnset,
{
pub fn error(
mut self,
value: impl Into<S>,
) -> FailedCancellationBuilder<S, failed_cancellation_state::SetError<St>> {
self._fields.1 = Option::Some(value.into());
FailedCancellationBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: failed_cancellation_state::State> FailedCancellationBuilder<S, St> {
pub fn error_code(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_error_code(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> FailedCancellationBuilder<S, St>
where
St: failed_cancellation_state::State,
St::Error: failed_cancellation_state::IsSet,
St::Did: failed_cancellation_state::IsSet,
{
pub fn build(self) -> FailedCancellation<S> {
FailedCancellation {
did: self._fields.0.unwrap(),
error: self._fields.1.unwrap(),
error_code: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> FailedCancellation<S> {
FailedCancellation {
did: self._fields.0.unwrap(),
error: self._fields.1.unwrap(),
error_code: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod cancel_scheduled_actions_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 Subjects;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Subjects = Unset;
}
pub struct SetSubjects<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubjects<St> {}
impl<St: State> State for SetSubjects<St> {
type Subjects = Set<members::subjects>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct subjects(());
}
}
pub struct CancelScheduledActionsBuilder<
S: BosStr,
St: cancel_scheduled_actions_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<Vec<Did<S>>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> CancelScheduledActions<S> {
pub fn new() -> CancelScheduledActionsBuilder<
S,
cancel_scheduled_actions_state::Empty,
> {
CancelScheduledActionsBuilder::new()
}
}
impl<S: BosStr> CancelScheduledActionsBuilder<S, cancel_scheduled_actions_state::Empty> {
pub fn new() -> Self {
CancelScheduledActionsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<
S: BosStr,
St: cancel_scheduled_actions_state::State,
> CancelScheduledActionsBuilder<S, St> {
pub fn comment(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_comment(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> CancelScheduledActionsBuilder<S, St>
where
St: cancel_scheduled_actions_state::State,
St::Subjects: cancel_scheduled_actions_state::IsUnset,
{
pub fn subjects(
mut self,
value: impl Into<Vec<Did<S>>>,
) -> CancelScheduledActionsBuilder<
S,
cancel_scheduled_actions_state::SetSubjects<St>,
> {
self._fields.1 = Option::Some(value.into());
CancelScheduledActionsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CancelScheduledActionsBuilder<S, St>
where
St: cancel_scheduled_actions_state::State,
St::Subjects: cancel_scheduled_actions_state::IsSet,
{
pub fn build(self) -> CancelScheduledActions<S> {
CancelScheduledActions {
comment: self._fields.0,
subjects: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> CancelScheduledActions<S> {
CancelScheduledActions {
comment: self._fields.0,
subjects: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}