1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: tools.ozone.moderation.scheduleAction
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic,
17 bon::Builder
18)]
19#[serde(rename_all = "camelCase")]
20pub struct FailedScheduling<'a> {
21 #[serde(borrow)]
22 #[builder(into)]
23 pub error: jacquard_common::CowStr<'a>,
24 #[serde(skip_serializing_if = "std::option::Option::is_none")]
25 #[builder(into)]
26 #[serde(borrow)]
27 pub error_code: Option<jacquard_common::CowStr<'a>>,
28 #[serde(borrow)]
29 pub subject: jacquard_common::types::string::Did<'a>,
30}
31
32#[jacquard_derive::lexicon]
33#[derive(
34 serde::Serialize,
35 serde::Deserialize,
36 Debug,
37 Clone,
38 PartialEq,
39 Eq,
40 bon::Builder,
41 jacquard_derive::IntoStatic
42)]
43#[serde(rename_all = "camelCase")]
44#[builder(start_fn = new)]
45pub struct ScheduleAction<'a> {
46 #[serde(borrow)]
47 pub action: jacquard_common::types::value::Data<'a>,
48 #[serde(borrow)]
49 pub created_by: jacquard_common::types::string::Did<'a>,
50 /// This will be propagated to the moderation event when it is applied
51 #[serde(skip_serializing_if = "std::option::Option::is_none")]
52 #[builder(into)]
53 #[serde(borrow)]
54 pub mod_tool: Option<crate::tools_ozone::moderation::ModTool<'a>>,
55 #[serde(borrow)]
56 pub scheduling: jacquard_common::types::value::Data<'a>,
57 /// Array of DID subjects to schedule the action for
58 #[serde(borrow)]
59 pub subjects: Vec<jacquard_common::types::string::Did<'a>>,
60 #[serde(flatten)]
61 #[serde(borrow)]
62 #[builder(default)]
63 pub extra_data: ::std::collections::BTreeMap<
64 ::jacquard_common::smol_str::SmolStr,
65 ::jacquard_common::types::value::Data<'a>,
66 >,
67}
68
69#[jacquard_derive::lexicon]
70#[derive(
71 serde::Serialize,
72 serde::Deserialize,
73 Debug,
74 Clone,
75 PartialEq,
76 Eq,
77 jacquard_derive::IntoStatic
78)]
79#[serde(rename_all = "camelCase")]
80pub struct ScheduleActionOutput<'a> {
81 #[serde(flatten)]
82 #[serde(borrow)]
83 pub value: jacquard_common::types::value::Data<'a>,
84}
85
86///Response type for
87///tools.ozone.moderation.scheduleAction
88pub struct ScheduleActionResponse;
89impl jacquard_common::xrpc::XrpcResp for ScheduleActionResponse {
90 const NSID: &'static str = "tools.ozone.moderation.scheduleAction";
91 const ENCODING: &'static str = "application/json";
92 type Output<'de> = ScheduleActionOutput<'de>;
93 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
94}
95
96impl<'a> jacquard_common::xrpc::XrpcRequest for ScheduleAction<'a> {
97 const NSID: &'static str = "tools.ozone.moderation.scheduleAction";
98 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
99 "application/json",
100 );
101 type Response = ScheduleActionResponse;
102}
103
104///Endpoint type for
105///tools.ozone.moderation.scheduleAction
106pub struct ScheduleActionRequest;
107impl jacquard_common::xrpc::XrpcEndpoint for ScheduleActionRequest {
108 const PATH: &'static str = "/xrpc/tools.ozone.moderation.scheduleAction";
109 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
110 "application/json",
111 );
112 type Request<'de> = ScheduleAction<'de>;
113 type Response = ScheduleActionResponse;
114}
115
116#[jacquard_derive::lexicon]
117#[derive(
118 serde::Serialize,
119 serde::Deserialize,
120 Debug,
121 Clone,
122 PartialEq,
123 Eq,
124 jacquard_derive::IntoStatic,
125 bon::Builder
126)]
127#[serde(rename_all = "camelCase")]
128pub struct ScheduledActionResults<'a> {
129 #[serde(borrow)]
130 pub failed: Vec<
131 crate::tools_ozone::moderation::schedule_action::FailedScheduling<'a>,
132 >,
133 #[serde(borrow)]
134 pub succeeded: Vec<jacquard_common::types::string::Did<'a>>,
135}
136
137/// Configuration for when the action should be executed
138#[jacquard_derive::lexicon]
139#[derive(
140 serde::Serialize,
141 serde::Deserialize,
142 Debug,
143 Clone,
144 PartialEq,
145 Eq,
146 jacquard_derive::IntoStatic,
147 Default
148)]
149#[serde(rename_all = "camelCase")]
150pub struct SchedulingConfig<'a> {
151 /// Earliest time to execute the action (for randomized scheduling)
152 #[serde(skip_serializing_if = "std::option::Option::is_none")]
153 pub execute_after: std::option::Option<jacquard_common::types::string::Datetime>,
154 /// Exact time to execute the action
155 #[serde(skip_serializing_if = "std::option::Option::is_none")]
156 pub execute_at: std::option::Option<jacquard_common::types::string::Datetime>,
157 /// Latest time to execute the action (for randomized scheduling)
158 #[serde(skip_serializing_if = "std::option::Option::is_none")]
159 pub execute_until: std::option::Option<jacquard_common::types::string::Datetime>,
160}
161
162/// Schedule a takedown action
163#[jacquard_derive::lexicon]
164#[derive(
165 serde::Serialize,
166 serde::Deserialize,
167 Debug,
168 Clone,
169 PartialEq,
170 Eq,
171 jacquard_derive::IntoStatic,
172 Default
173)]
174#[serde(rename_all = "camelCase")]
175pub struct Takedown<'a> {
176 /// If true, all other reports on content authored by this account will be resolved (acknowledged).
177 #[serde(skip_serializing_if = "std::option::Option::is_none")]
178 pub acknowledge_account_subjects: std::option::Option<bool>,
179 #[serde(skip_serializing_if = "std::option::Option::is_none")]
180 #[serde(borrow)]
181 pub comment: std::option::Option<jacquard_common::CowStr<'a>>,
182 /// Indicates how long the takedown should be in effect before automatically expiring.
183 #[serde(skip_serializing_if = "std::option::Option::is_none")]
184 pub duration_in_hours: std::option::Option<i64>,
185 /// Names/Keywords of the policies that drove the decision.
186 #[serde(skip_serializing_if = "std::option::Option::is_none")]
187 #[serde(borrow)]
188 pub policies: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
189}