Skip to main content

atrium_api/tools/ozone/report/
create_activity.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `tools.ozone.report.createActivity` namespace.
3pub const NSID: &str = "tools.ozone.report.createActivity";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct InputData {
7    ///The type of activity to record.
8    pub activity: crate::types::Union<InputActivityRefs>,
9    ///ID of the report moderation event. Resolves to the report created from that event. Exactly one of reportId or eventId must be provided.
10    #[serde(skip_serializing_if = "core::option::Option::is_none")]
11    pub event_id: core::option::Option<i64>,
12    ///Optional moderator-only note. Not visible to reporters.
13    #[serde(skip_serializing_if = "core::option::Option::is_none")]
14    pub internal_note: core::option::Option<String>,
15    ///Set true when this activity is triggered by an automated process. Defaults to false.
16    #[serde(skip_serializing_if = "core::option::Option::is_none")]
17    pub is_automated: core::option::Option<bool>,
18    ///Optional public-facing note, potentially visible to the reporter.
19    #[serde(skip_serializing_if = "core::option::Option::is_none")]
20    pub public_note: core::option::Option<String>,
21    ///ID of the report to record activity on. Exactly one of reportId or eventId must be provided.
22    #[serde(skip_serializing_if = "core::option::Option::is_none")]
23    pub report_id: core::option::Option<i64>,
24}
25pub type Input = crate::types::Object<InputData>;
26#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
27#[serde(rename_all = "camelCase")]
28pub struct OutputData {
29    pub activity: crate::tools::ozone::report::defs::ReportActivityView,
30}
31pub type Output = crate::types::Object<OutputData>;
32#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
33#[serde(tag = "error", content = "message")]
34pub enum Error {
35    ///No report exists with the given reportId or eventId
36    ReportNotFound(Option<String>),
37    ///The requested state transition is not permitted from the report's current status
38    InvalidStateTransition(Option<String>),
39    ///The report is already in the status implied by this activity type
40    AlreadyInTargetState(Option<String>),
41}
42impl std::fmt::Display for Error {
43    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
44        match self {
45            Error::ReportNotFound(msg) => {
46                write!(_f, "ReportNotFound")?;
47                if let Some(msg) = msg {
48                    write!(_f, ": {msg}")?;
49                }
50            }
51            Error::InvalidStateTransition(msg) => {
52                write!(_f, "InvalidStateTransition")?;
53                if let Some(msg) = msg {
54                    write!(_f, ": {msg}")?;
55                }
56            }
57            Error::AlreadyInTargetState(msg) => {
58                write!(_f, "AlreadyInTargetState")?;
59                if let Some(msg) = msg {
60                    write!(_f, ": {msg}")?;
61                }
62            }
63        }
64        Ok(())
65    }
66}
67#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
68#[serde(tag = "$type")]
69pub enum InputActivityRefs {
70    #[serde(rename = "tools.ozone.report.defs#queueActivity")]
71    ToolsOzoneReportDefsQueueActivity(
72        Box<crate::tools::ozone::report::defs::QueueActivity>,
73    ),
74    #[serde(rename = "tools.ozone.report.defs#assignmentActivity")]
75    ToolsOzoneReportDefsAssignmentActivity(
76        Box<crate::tools::ozone::report::defs::AssignmentActivity>,
77    ),
78    #[serde(rename = "tools.ozone.report.defs#escalationActivity")]
79    ToolsOzoneReportDefsEscalationActivity(
80        Box<crate::tools::ozone::report::defs::EscalationActivity>,
81    ),
82    #[serde(rename = "tools.ozone.report.defs#closeActivity")]
83    ToolsOzoneReportDefsCloseActivity(
84        Box<crate::tools::ozone::report::defs::CloseActivity>,
85    ),
86    #[serde(rename = "tools.ozone.report.defs#reopenActivity")]
87    ToolsOzoneReportDefsReopenActivity(
88        Box<crate::tools::ozone::report::defs::ReopenActivity>,
89    ),
90    #[serde(rename = "tools.ozone.report.defs#noteActivity")]
91    ToolsOzoneReportDefsNoteActivity(
92        Box<crate::tools::ozone::report::defs::NoteActivity>,
93    ),
94}