#[allow(unused_imports)]
use alloc::collections::BTreeMap;
use crate::tools_ozone::moderation::ModEventViewDetail;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_derive::IntoStatic;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetEvent {
pub id: i64,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetEventOutput<S: BosStr = DefaultStr> {
#[serde(flatten)]
pub value: ModEventViewDetail<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetEventResponse;
impl jacquard_common::xrpc::XrpcResp for GetEventResponse {
const NSID: &'static str = "tools.ozone.moderation.getEvent";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetEventOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl jacquard_common::xrpc::XrpcRequest for GetEvent {
const NSID: &'static str = "tools.ozone.moderation.getEvent";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetEventResponse;
}
pub struct GetEventRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetEventRequest {
const PATH: &'static str = "/xrpc/tools.ozone.moderation.getEvent";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetEvent;
type Response = GetEventResponse;
}
pub mod get_event_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 Id;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Id = Unset;
}
pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetId<St> {}
impl<St: State> State for SetId<St> {
type Id = Set<members::id>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct id(());
}
}
pub struct GetEventBuilder<St: get_event_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>,),
}
impl GetEvent {
pub fn new() -> GetEventBuilder<get_event_state::Empty> {
GetEventBuilder::new()
}
}
impl GetEventBuilder<get_event_state::Empty> {
pub fn new() -> Self {
GetEventBuilder {
_state: PhantomData,
_fields: (None,),
}
}
}
impl<St> GetEventBuilder<St>
where
St: get_event_state::State,
St::Id: get_event_state::IsUnset,
{
pub fn id(mut self, value: impl Into<i64>) -> GetEventBuilder<get_event_state::SetId<St>> {
self._fields.0 = Option::Some(value.into());
GetEventBuilder {
_state: PhantomData,
_fields: self._fields,
}
}
}
impl<St> GetEventBuilder<St>
where
St: get_event_state::State,
St::Id: get_event_state::IsSet,
{
pub fn build(self) -> GetEvent {
GetEvent {
id: self._fields.0.unwrap(),
}
}
}