#[allow(unused_imports)]
use alloc::collections::BTreeMap;
use crate::tools_ozone::moderation::ScheduledActionView;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Datetime, Did};
use jacquard_common::types::value::Data;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
use jacquard_derive::IntoStatic;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ListScheduledActions<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ends_before: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_list_scheduled_actions_limit")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub starts_after: Option<Datetime>,
pub statuses: Vec<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subjects: Option<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 ListScheduledActionsOutput<S: BosStr = DefaultStr> {
pub actions: Vec<ScheduledActionView<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct ListScheduledActionsResponse;
impl jacquard_common::xrpc::XrpcResp for ListScheduledActionsResponse {
const NSID: &'static str = "tools.ozone.moderation.listScheduledActions";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ListScheduledActionsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for ListScheduledActions<S> {
const NSID: &'static str = "tools.ozone.moderation.listScheduledActions";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Response = ListScheduledActionsResponse;
}
pub struct ListScheduledActionsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ListScheduledActionsRequest {
const PATH: &'static str = "/xrpc/tools.ozone.moderation.listScheduledActions";
const METHOD: jacquard_common::xrpc::XrpcMethod =
jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
type Request<S: BosStr> = ListScheduledActions<S>;
type Response = ListScheduledActionsResponse;
}
fn _default_list_scheduled_actions_limit() -> Option<i64> {
Some(50i64)
}
pub mod list_scheduled_actions_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Statuses;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Statuses = Unset;
}
pub struct SetStatuses<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatuses<St> {}
impl<St: State> State for SetStatuses<St> {
type Statuses = Set<members::statuses>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct statuses(());
}
}
pub struct ListScheduledActionsBuilder<S: BosStr, St: list_scheduled_actions_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<Datetime>,
Option<i64>,
Option<Datetime>,
Option<Vec<S>>,
Option<Vec<Did<S>>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ListScheduledActions<S> {
pub fn new() -> ListScheduledActionsBuilder<S, list_scheduled_actions_state::Empty> {
ListScheduledActionsBuilder::new()
}
}
impl<S: BosStr> ListScheduledActionsBuilder<S, list_scheduled_actions_state::Empty> {
pub fn new() -> Self {
ListScheduledActionsBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: list_scheduled_actions_state::State> ListScheduledActionsBuilder<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_scheduled_actions_state::State> ListScheduledActionsBuilder<S, St> {
pub fn ends_before(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_ends_before(mut self, value: Option<Datetime>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: list_scheduled_actions_state::State> ListScheduledActionsBuilder<S, St> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: list_scheduled_actions_state::State> ListScheduledActionsBuilder<S, St> {
pub fn starts_after(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_starts_after(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> ListScheduledActionsBuilder<S, St>
where
St: list_scheduled_actions_state::State,
St::Statuses: list_scheduled_actions_state::IsUnset,
{
pub fn statuses(
mut self,
value: impl Into<Vec<S>>,
) -> ListScheduledActionsBuilder<S, list_scheduled_actions_state::SetStatuses<St>> {
self._fields.4 = Option::Some(value.into());
ListScheduledActionsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: list_scheduled_actions_state::State> ListScheduledActionsBuilder<S, St> {
pub fn subjects(mut self, value: impl Into<Option<Vec<Did<S>>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_subjects(mut self, value: Option<Vec<Did<S>>>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St> ListScheduledActionsBuilder<S, St>
where
St: list_scheduled_actions_state::State,
St::Statuses: list_scheduled_actions_state::IsSet,
{
pub fn build(self) -> ListScheduledActions<S> {
ListScheduledActions {
cursor: self._fields.0,
ends_before: self._fields.1,
limit: self._fields.2.or_else(|| Some(50i64)),
starts_after: self._fields.3,
statuses: self._fields.4.unwrap(),
subjects: self._fields.5,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ListScheduledActions<S> {
ListScheduledActions {
cursor: self._fields.0,
ends_before: self._fields.1,
limit: self._fields.2.or_else(|| Some(50i64)),
starts_after: self._fields.3,
statuses: self._fields.4.unwrap(),
subjects: self._fields.5,
extra_data: Some(extra_data),
}
}
}