#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_common::types::string::{Did, Nsid, Datetime, UriValue};
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::tools_ozone::moderation::ModEventView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct QueryEvents<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub added_labels: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub added_tags: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub age_assurance_state: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub batch_id: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub collections: Option<Vec<Nsid<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub comment: Option<CowStr<'a>>,
#[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")]
#[serde(borrow)]
pub created_by: Option<Did<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cursor: Option<CowStr<'a>>,
#[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")]
#[serde(borrow)]
pub mod_tool: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub policies: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub removed_labels: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub removed_tags: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub report_types: Option<Vec<CowStr<'a>>>,
#[serde(default = "_default_sort_direction")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub sort_direction: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub subject: Option<UriValue<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub subject_type: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub types: Option<Vec<CowStr<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub with_strike: Option<bool>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct QueryEventsOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cursor: Option<CowStr<'a>>,
#[serde(borrow)]
pub events: Vec<ModEventView<'a>>,
}
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<'de> = QueryEventsOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for QueryEvents<'a> {
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<'de> = QueryEvents<'de>;
type Response = QueryEventsResponse;
}
fn _default_include_all_user_records() -> Option<bool> {
Some(false)
}
fn _default_limit() -> Option<i64> {
Some(50i64)
}
fn _default_sort_direction() -> Option<CowStr<'static>> {
Some(CowStr::from("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<'a, S: query_events_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Vec<CowStr<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Vec<Nsid<'a>>>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<Datetime>,
Option<Did<'a>>,
Option<CowStr<'a>>,
Option<bool>,
Option<bool>,
Option<i64>,
Option<Vec<CowStr<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<Vec<CowStr<'a>>>,
Option<CowStr<'a>>,
Option<UriValue<'a>>,
Option<CowStr<'a>>,
Option<Vec<CowStr<'a>>>,
Option<bool>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> QueryEvents<'a> {
pub fn new() -> QueryEventsBuilder<'a, query_events_state::Empty> {
QueryEventsBuilder::new()
}
}
impl<'a> QueryEventsBuilder<'a, 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,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn added_labels(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_added_labels(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn added_tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_added_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn age_assurance_state(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_age_assurance_state(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn batch_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_batch_id(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn collections(mut self, value: impl Into<Option<Vec<Nsid<'a>>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_collections(mut self, value: Option<Vec<Nsid<'a>>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn comment(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_comment(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn created_by(mut self, value: impl Into<Option<Did<'a>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_created_by(mut self, value: Option<Did<'a>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn cursor(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_cursor(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn mod_tool(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_mod_tool(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.13 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn policies(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_policies(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.14 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn removed_labels(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_removed_labels(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.15 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn removed_tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_removed_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.16 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn report_types(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_report_types(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.17 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn sort_direction(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.18 = value.into();
self
}
pub fn maybe_sort_direction(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.18 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn subject(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.19 = value.into();
self
}
pub fn maybe_subject(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.19 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn subject_type(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.20 = value.into();
self
}
pub fn maybe_subject_type(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.20 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
pub fn types(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
self._fields.21 = value.into();
self
}
pub fn maybe_types(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
self._fields.21 = value;
self
}
}
impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
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<'a, S> QueryEventsBuilder<'a, S>
where
S: query_events_state::State,
{
pub fn build(self) -> QueryEvents<'a> {
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,
}
}
}