Skip to main content

atrium_api/tools/ozone/report/
assign_moderator.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `tools.ozone.report.assignModerator` namespace.
3pub const NSID: &str = "tools.ozone.report.assignModerator";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct InputData {
7    ///DID to be assigned. Defaults to the caller's DID. Admins may assign to any moderator.
8    #[serde(skip_serializing_if = "core::option::Option::is_none")]
9    pub did: core::option::Option<crate::types::string::Did>,
10    ///When true, the assignment has no expiry (endAt is null). Throws AlreadyAssigned if another user already has a permanent assignment on this report.
11    #[serde(skip_serializing_if = "core::option::Option::is_none")]
12    pub is_permanent: core::option::Option<bool>,
13    ///Optional queue ID to associate the assignment with. If not provided and the report has been assigned on a queue before, it will stay on that queue.
14    #[serde(skip_serializing_if = "core::option::Option::is_none")]
15    pub queue_id: core::option::Option<i64>,
16    ///The ID of the report to assign.
17    pub report_id: i64,
18}
19pub type Input = crate::types::Object<InputData>;
20pub type Output = crate::tools::ozone::report::defs::AssignmentView;
21#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
22#[serde(tag = "error", content = "message")]
23pub enum Error {
24    ///The report is already assigned to another user.
25    AlreadyAssigned(Option<String>),
26    ///The report ID or queue ID is invalid.
27    InvalidAssignment(Option<String>),
28}
29impl std::fmt::Display for Error {
30    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
31        match self {
32            Error::AlreadyAssigned(msg) => {
33                write!(_f, "AlreadyAssigned")?;
34                if let Some(msg) = msg {
35                    write!(_f, ": {msg}")?;
36                }
37            }
38            Error::InvalidAssignment(msg) => {
39                write!(_f, "InvalidAssignment")?;
40                if let Some(msg) = msg {
41                    write!(_f, ": {msg}")?;
42                }
43            }
44        }
45        Ok(())
46    }
47}