#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Did, Nsid, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::tools_ozone::moderation::ModEventView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct QueryEvents<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub added_labels: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub added_tags: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub age_assurance_state: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_id: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub collections: Option<Vec<Nsid<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub comment: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_after: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_before: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_by: Option<Did<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub has_comment: Option<bool>,
#[serde(default = "_default_include_all_user_records")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include_all_user_records: Option<bool>,
#[serde(default = "_default_limit")]
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mod_tool: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub removed_labels: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub removed_tags: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub report_types: Option<Vec<S>>,
#[serde(default = "_default_sort_direction")]
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_direction: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<UriValue<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject_type: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub types: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub with_strike: Option<bool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct QueryEventsOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<S>,
pub events: Vec<ModEventView<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct QueryEventsResponse;
impl jacquard_common::xrpc::XrpcResp for QueryEventsResponse {
const NSID: &'static str = "tools.ozone.moderation.queryEvents";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = QueryEventsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for QueryEvents<S> {
const NSID: &'static str = "tools.ozone.moderation.queryEvents";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = QueryEventsResponse;
}
pub struct QueryEventsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for QueryEventsRequest {
const PATH: &'static str = "/xrpc/tools.ozone.moderation.queryEvents";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = QueryEvents<S>;
type Response = QueryEventsResponse;
}
fn _default_include_all_user_records() -> Option<bool> {
Some(false)
}
fn _default_limit() -> Option<i64> {
Some(50i64)
}
fn _default_sort_direction<S: jacquard_common::FromStaticStr>() -> Option<S> {
Some(S::from_static("desc"))
}
pub mod query_events_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 QueryEventsBuilder<S: BosStr, St: query_events_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<S>>,
Option<Vec<S>>,
Option<S>,
Option<S>,
Option<Vec<Nsid<S>>>,
Option<S>,
Option<Datetime>,
Option<Datetime>,
Option<Did<S>>,
Option<S>,
Option<bool>,
Option<bool>,
Option<i64>,
Option<Vec<S>>,
Option<Vec<S>>,
Option<Vec<S>>,
Option<Vec<S>>,
Option<Vec<S>>,
Option<S>,
Option<UriValue<S>>,
Option<S>,
Option<Vec<S>>,
Option<bool>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> QueryEvents<S> {
pub fn new() -> QueryEventsBuilder<S, query_events_state::Empty> {
QueryEventsBuilder::new()
}
}
impl<S: BosStr> QueryEventsBuilder<S, query_events_state::Empty> {
pub fn new() -> Self {
QueryEventsBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn added_labels(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_added_labels(mut self, value: Option<Vec<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn added_tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_added_tags(mut self, value: Option<Vec<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn age_assurance_state(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_age_assurance_state(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn batch_id(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_batch_id(mut self, value: Option<S>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn collections(mut self, value: impl Into<Option<Vec<Nsid<S>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_collections(mut self, value: Option<Vec<Nsid<S>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn comment(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_comment(mut self, value: Option<S>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn created_after(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_created_after(mut self, value: Option<Datetime>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn created_before(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_created_before(mut self, value: Option<Datetime>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn created_by(mut self, value: impl Into<Option<Did<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_created_by(mut self, value: Option<Did<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn has_comment(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_has_comment(mut self, value: Option<bool>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn include_all_user_records(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_include_all_user_records(mut self, value: Option<bool>) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
self._fields.12 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn mod_tool(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_mod_tool(mut self, value: Option<Vec<S>>) -> Self {
self._fields.13 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn policies(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_policies(mut self, value: Option<Vec<S>>) -> Self {
self._fields.14 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn removed_labels(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_removed_labels(mut self, value: Option<Vec<S>>) -> Self {
self._fields.15 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn removed_tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_removed_tags(mut self, value: Option<Vec<S>>) -> Self {
self._fields.16 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn report_types(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_report_types(mut self, value: Option<Vec<S>>) -> Self {
self._fields.17 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn sort_direction(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.18 = value.into();
self
}
pub fn maybe_sort_direction(mut self, value: Option<S>) -> Self {
self._fields.18 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn subject(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.19 = value.into();
self
}
pub fn maybe_subject(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.19 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn subject_type(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.20 = value.into();
self
}
pub fn maybe_subject_type(mut self, value: Option<S>) -> Self {
self._fields.20 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn types(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.21 = value.into();
self
}
pub fn maybe_types(mut self, value: Option<Vec<S>>) -> Self {
self._fields.21 = value;
self
}
}
impl<S: BosStr, St: query_events_state::State> QueryEventsBuilder<S, St> {
pub fn with_strike(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.22 = value.into();
self
}
pub fn maybe_with_strike(mut self, value: Option<bool>) -> Self {
self._fields.22 = value;
self
}
}
impl<S: BosStr, St> QueryEventsBuilder<S, St>
where
St: query_events_state::State,
{
pub fn build(self) -> QueryEvents<S> {
QueryEvents {
added_labels: self._fields.0,
added_tags: self._fields.1,
age_assurance_state: self._fields.2,
batch_id: self._fields.3,
collections: self._fields.4,
comment: self._fields.5,
created_after: self._fields.6,
created_before: self._fields.7,
created_by: self._fields.8,
cursor: self._fields.9,
has_comment: self._fields.10,
include_all_user_records: self._fields.11,
limit: self._fields.12,
mod_tool: self._fields.13,
policies: self._fields.14,
removed_labels: self._fields.15,
removed_tags: self._fields.16,
report_types: self._fields.17,
sort_direction: self._fields.18,
subject: self._fields.19,
subject_type: self._fields.20,
types: self._fields.21,
with_strike: self._fields.22,
}
}
}